/* ==========================================================================
   FREEDOM ONE-TIME WHATSAPP LINK MANAGER - DESIGN SYSTEM
   Brand Colors: Freedom Orange (#FF6B00), White, Dark Charcoal, Light Gray
   Status Colors: Unused (Green), Copied (Yellow), Used (Red)
   ========================================================================== */

:root {
  /* Brand Primary */
  --freedom-orange: #FF6B00;
  --freedom-orange-hover: #E55F00;
  --freedom-orange-light: #FFF5EE;
  --freedom-orange-glow: rgba(255, 107, 0, 0.2);
  --freedom-orange-border: rgba(255, 107, 0, 0.35);

  /* Neutrals */
  --bg-body: #F8FAFC;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: #1E293B;
  --bg-sidebar-active: #334155;
  --bg-card: #FFFFFF;
  --bg-card-alt: #F1F5F9;
  --bg-input: #FFFFFF;
  --bg-input-focus: #FFFFFF;

  /* Typography & Content Colors */
  --text-main: #0F172A;
  --text-body: #334155;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --text-white: #FFFFFF;

  /* Borders & Dividers */
  --border-color: #E2E8F0;
  --border-dark: #CBD5E1;
  --border-subtle: #F1F5F9;

  /* Status Colors */
  /* 🟢 UNUSED (Green) */
  --status-unused: #10B981;
  --status-unused-bg: #ECFDF5;
  --status-unused-border: #A7F3D0;
  --status-unused-text: #047857;

  /* 🟡 COPIED (Yellow/Amber) */
  --status-copied: #F59E0B;
  --status-copied-bg: #FFFBEB;
  --status-copied-border: #FDE68A;
  --status-copied-text: #B45309;

  /* 🔴 USED (Red) */
  --status-used: #EF4444;
  --status-used-bg: #FEF2F2;
  --status-used-border: #FECACA;
  --status-used-text: #B91C1C;

  /* Elevation & Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-dropdown: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.06);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-body);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
}

a {
  color: var(--freedom-orange);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--freedom-orange-hover);
}

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Primary Action Button (Freedom Orange) */
.btn-primary {
  background-color: var(--freedom-orange);
  color: var(--text-white);
  box-shadow: 0 2px 8px var(--freedom-orange-glow);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--freedom-orange-hover);
  box-shadow: 0 4px 14px rgba(255, 107, 0, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-card-alt);
  border-color: var(--border-dark);
  color: var(--text-main);
}

/* Outline Button */
.btn-outline {
  background-color: transparent;
  color: var(--text-body);
  border-color: var(--border-color);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--bg-card-alt);
  border-color: var(--border-dark);
  color: var(--text-main);
}

/* Danger Button */
.btn-danger {
  background-color: #FEE2E2;
  color: #DC2626;
  border-color: #FECACA;
}

.btn-danger:hover:not(:disabled) {
  background-color: #DC2626;
  color: var(--text-white);
}

/* Copy Action Button */
.btn-copy {
  background-color: var(--status-copied-bg);
  color: var(--status-copied-text);
  border: 1px solid var(--status-copied-border);
  font-weight: 700;
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-copy:hover:not(:disabled) {
  background-color: var(--freedom-orange);
  color: var(--text-white);
  border-color: var(--freedom-orange);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

/* Password Input with Embedded Eye Toggle */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  width: 100%;
  padding-right: 44px !important;
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: color 0.2s ease;
}

.password-toggle-btn:hover {
  color: var(--freedom-orange);
}


/* ==========================================================================
   STATUS BADGES (🟢 UNUSED, 🟡 COPIED, 🔴 USED)
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* 🟢 UNUSED */
.badge-unused {
  background-color: var(--status-unused-bg);
  color: var(--status-unused-text);
  border: 1px solid var(--status-unused-border);
}
.badge-unused .badge-dot {
  background-color: var(--status-unused);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

/* 🟡 COPIED */
.badge-copied {
  background-color: var(--status-copied-bg);
  color: var(--status-copied-text);
  border: 1px solid var(--status-copied-border);
}
.badge-copied .badge-dot {
  background-color: var(--status-copied);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

/* 🔴 USED */
.badge-used {
  background-color: var(--status-used-bg);
  color: var(--status-used-text);
  border: 1px solid var(--status-used-border);
}
.badge-used .badge-dot {
  background-color: var(--status-used);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

/* General / Active Badge */
.badge-active {
  background-color: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-group .form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.92rem;
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--freedom-orange);
  box-shadow: 0 0 0 3px var(--freedom-orange-glow);
}

.form-control::placeholder {
  color: var(--text-light);
}

.form-control:disabled {
  background-color: var(--bg-card-alt);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ==========================================================================
   CARDS & PANELS
   ========================================================================== */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  padding: 12px 16px;
  background-color: var(--bg-card-alt);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-body);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #FAFAFC;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.token-badge {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
  background-color: var(--bg-card-alt);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.84rem;
}

.editable-comment {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  width: 100%;
  max-width: 180px;
  background: transparent;
  color: var(--text-main);
  font-size: 0.88rem;
  transition: all var(--transition-fast);
}

.editable-comment:hover {
  border-color: var(--border-color);
  background-color: var(--bg-card-alt);
}

.editable-comment:focus {
  outline: none;
  border-color: var(--freedom-orange);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 2px var(--freedom-orange-glow);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-dropdown);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-card-alt);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background-color: var(--bg-sidebar);
  color: var(--text-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 600;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.toast-success {
  border-left: 4px solid var(--status-unused);
}

.toast.toast-warning {
  border-left: 4px solid var(--status-copied);
}

.toast.toast-error {
  border-left: 4px solid var(--status-used);
}

.toast-icon {
  font-size: 1.1rem;
}

/* ==========================================================================
   EMPTY & LOADING STATES
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  color: var(--text-light);
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: var(--freedom-orange);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Helper Utilities */
.text-orange { color: var(--freedom-orange) !important; }
.text-green { color: var(--status-unused-text) !important; }
.text-yellow { color: var(--status-copied-text) !important; }
.text-red { color: var(--status-used-text) !important; }
.bg-orange { background-color: var(--freedom-orange) !important; }
