/* ═══════════════════════════════════════════════════
   InfluX Portal — main.css
   Design System: Light (default) + Dark Mode
   RTL support for Arabic
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap');

/* ── CSS Custom Properties (Light Mode Default) ─── */
:root {
  --primary:        #6C63FF;
  --primary-dark:   #5248cc;
  --primary-light:  #e8e6ff;
  --accent:         #FF6584;
  --accent-light:   #ffe4ea;
  --success:        #22c55e;
  --success-light:  #dcfce7;
  --warning:        #f59e0b;
  --warning-light:  #fef3c7;
  --danger:         #ef4444;
  --danger-light:   #fee2e2;
  --info:           #3b82f6;
  --info-light:     #dbeafe;

  /* Layout */
  --sidebar-w:      260px;
  --sidebar-collapsed-w: 72px;
  --topbar-h:       64px;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      20px;
  --shadow:         0 4px 24px rgba(108,99,255,0.08);
  --shadow-hover:   0 8px 32px rgba(108,99,255,0.18);
  --shadow-card:    0 2px 12px rgba(0,0,0,0.06);
  --transition:     all 0.25s cubic-bezier(0.4,0,0.2,1);

  /* Light Theme Colors */
  --bg:             #f4f6fb;
  --surface:        #ffffff;
  --card:           #ffffff;
  --card-hover:     #f8f9ff;
  --sidebar-bg:     #ffffff;
  --sidebar-text:   #4a4a6a;
  --sidebar-active: #6C63FF;
  --sidebar-active-bg: #eeeeff;
  --topbar-bg:      #ffffff;
  --text:           #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;
  --border:         #e5e7eb;
  --border-focus:   #6C63FF;
  --input-bg:       #ffffff;
  --table-stripe:   #f9fafb;
  --table-hover:    #f0f1ff;
  --badge-bg:       #f3f4f6;
  --badge-text:     #374151;
  --overlay:        rgba(0,0,0,0.5);

  /* Gradients */
  --grad-primary:   linear-gradient(135deg, #6C63FF 0%, #FF6584 100%);
  --grad-success:   linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  --grad-card:      linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
}

/* ── Dark Mode ────────────────────────────────────── */
[data-theme="dark"] {
  --bg:             #0d0d1a;
  --surface:        #13132b;
  --card:           #1a1a35;
  --card-hover:     #20203f;
  --sidebar-bg:     #13132b;
  --sidebar-text:   #b0b0d0;
  --sidebar-active: #a29bfe;
  --sidebar-active-bg: rgba(108,99,255,0.15);
  --topbar-bg:      #13132b;
  --text:           #e8e8f0;
  --text-secondary: #9090b0;
  --text-muted:     #6060a0;
  --border:         #2a2a4a;
  --border-focus:   #a29bfe;
  --input-bg:       #1a1a35;
  --table-stripe:   #16162f;
  --table-hover:    #1e1e38;
  --badge-bg:       #2a2a4a;
  --badge-text:     #c0c0e0;
  --shadow:         0 4px 24px rgba(0,0,0,0.3);
  --shadow-hover:   0 8px 32px rgba(108,99,255,0.25);
  --shadow-card:    0 2px 12px rgba(0,0,0,0.25);
  --grad-card:      linear-gradient(135deg, #1a1a35 0%, #16162e 100%);
}

/* ── Reset & Base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

body.rtl {
  font-family: 'Noto Naskh Arabic', 'Outfit', sans-serif;
  direction: rtl;
  text-align: right;
}

/* ── Typography ─────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { color: var(--text-secondary); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* ── App Layout ─────────────────────────────────── */
#app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
  box-shadow: 2px 0 20px rgba(108,99,255,0.06);
  overflow: hidden;
}
body.rtl .sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid var(--border); }

.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--topbar-h);
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--grad-primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 800;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: 1.2rem; font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.nav-section-label {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 8px 12px 4px;
  margin-top: 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 0.9rem; font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
  text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-active-bg); color: var(--sidebar-active); text-decoration: none; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--sidebar-active); }
.nav-icon { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: #fff;
  font-size: 0.7rem; padding: 2px 7px; border-radius: 20px;
  font-weight: 600;
}
body.rtl .nav-badge { margin-left: 0; margin-right: auto; }

.sidebar-user {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--text-muted); }
.btn-logout {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px;
  border-radius: 6px; transition: var(--transition);
  font-size: 1rem;
}
.btn-logout:hover { color: var(--danger); background: var(--danger-light); }

/* ── Main Content Area ──────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}
body.rtl .main-content { margin-left: 0; margin-right: var(--sidebar-w); }

/* ── Topbar ─────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-card);
}
.topbar-title {
  flex: 1;
  font-size: 1.1rem; font-weight: 700;
  color: var(--text);
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* Theme & Lang toggles */
.toggle-btn {
  background: var(--badge-bg); border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px; border-radius: 20px;
  cursor: pointer; font-size: 0.82rem; font-weight: 600;
  transition: var(--transition); display: flex; align-items: center; gap: 6px;
}
.toggle-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ── Page Content ───────────────────────────────── */
.page-content {
  padding: 28px;
  flex: 1;
  animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 1.4rem; font-weight: 700; }
.page-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 2px; }

/* ── Cards ──────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-body { padding: 24px; }
.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.card-title { font-size: 1rem; font-weight: 700; }
.card-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--table-stripe);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Stat Cards ─────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
  display: flex; align-items: center; gap: 18px;
  transition: var(--transition);
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-card);
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 100%; height: 3px;
}
.stat-card.purple::before  { background: var(--primary); }
.stat-card.coral::before   { background: var(--accent); }
.stat-card.green::before   { background: var(--success); }
.stat-card.amber::before   { background: var(--warning); }
.stat-card.blue::before    { background: var(--info); }
.stat-card.rose::before    { background: #f43f5e; }

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-card.purple .stat-icon  { background: var(--primary-light); color: var(--primary); }
.stat-card.coral .stat-icon   { background: var(--accent-light);  color: var(--accent); }
.stat-card.green .stat-icon   { background: var(--success-light); color: var(--success); }
.stat-card.amber .stat-icon   { background: var(--warning-light); color: var(--warning); }
.stat-card.blue .stat-icon    { background: var(--info-light);    color: var(--info); }
.stat-card.rose .stat-icon    { background: #ffe4e6;              color: #f43f5e; }

.stat-info { flex: 1; }
.stat-value {
  font-size: 1.8rem; font-weight: 800;
  line-height: 1; color: var(--text);
}
.stat-label { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }
.stat-change { font-size: 0.75rem; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Buttons ────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  font-size: 0.9rem; font-weight: 600;
  font-family: inherit;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative; overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.12); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(108,99,255,0.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(108,99,255,0.5); transform: translateY(-1px); }

.btn-secondary {
  background: var(--badge-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.btn-success {
  background: var(--grad-success);
  color: #fff;
  box-shadow: 0 4px 15px rgba(34,197,94,0.3);
}
.btn-danger  { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline-primary {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: 8px; }

/* ── Forms ──────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--text);
}
.form-label span.req { color: var(--danger); margin-left: 3px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control.is-invalid { border-color: var(--danger); }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }
.form-hint  { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.input-group {
  display: flex; gap: 0;
}
.input-group .form-control { border-radius: 0; }
.input-group > *:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > *:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
body.rtl .input-group > *:first-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
body.rtl .input-group > *:last-child  { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

.country-flag-select {
  min-width: 120px;
  border-right: none !important;
  background: var(--table-stripe);
}
body.rtl .country-flag-select { border-right: 1.5px solid var(--border) !important; border-left: none !important; }

/* ── Badges ─────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
  white-space: nowrap;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: #15803d; }
.badge-danger  { background: var(--danger-light);  color: #b91c1c; }
.badge-warning { background: var(--warning-light); color: #b45309; }
.badge-info    { background: var(--info-light);    color: #1d4ed8; }
.badge-muted   { background: var(--badge-bg);      color: var(--text-muted); }
.badge-accent  { background: var(--accent-light);  color: #c73b59; }

/* Platform badges */
.platform-instagram { background: #fce4ec; color: #c2185b; }
.platform-tiktok    { background: #e0f7fa; color: #00838f; }
.platform-youtube   { background: #ffebee; color: #c62828; }
.platform-facebook  { background: #e3f2fd; color: #1565c0; }
.platform-twitter   { background: #e8f5fe; color: #0d6efd; }

/* ── Tables ─────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table.dataTable {
  width: 100% !important;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.dataTable thead th {
  background: var(--table-stripe);
  color: var(--text-secondary);
  font-weight: 600; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
table.dataTable tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
table.dataTable tbody tr:last-child td { border-bottom: none; }
table.dataTable tbody tr:hover td { background: var(--table-hover); }
table.dataTable tbody tr:nth-child(even) td { background: var(--table-stripe); }
table.dataTable tbody tr:nth-child(even):hover td { background: var(--table-hover); }

/* DataTables override */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--primary); }
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label { color: var(--text-secondary); font-size: 0.85rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  background: var(--badge-bg);
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  color: var(--text-secondary) !important;
  padding: 4px 10px !important;
  margin: 0 2px !important;
  font-size: 0.82rem;
  cursor: pointer;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

/* ── Grid Helpers ───────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ── Modals ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  animation: slideUp 0.25s ease;
  border: 1px solid var(--border);
}
.modal-box.modal-lg { max-width: 800px; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.4rem;
  padding: 4px; border-radius: 6px; transition: var(--transition);
  line-height: 1;
}
.modal-close:hover { color: var(--danger); background: var(--danger-light); }
.modal-body    { padding: 24px; }
.modal-footer  { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
body.rtl .modal-footer { justify-content: flex-start; }

/* ── Alerts ─────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-light); color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger  { background: var(--danger-light);  color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: var(--info-light);    color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Loading ────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; color: var(--text-muted);
  flex-direction: column; gap: 14px;
}
.page-loader .spinner { width: 36px; height: 36px; border-width: 4px; }

/* ── Empty State ────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p  { font-size: 0.88rem; }

/* ── Progress Bar ───────────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--grad-primary); border-radius: 99px; transition: width 1s ease; }

/* ── Tabs ───────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 0; }
.tab-btn {
  padding: 10px 20px;
  background: none; border: none; cursor: pointer;
  font-size: 0.9rem; font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  font-family: inherit;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeInUp 0.2s ease; }

/* ── Copy Button ────────────────────────────────── */
.link-display {
  display: flex; align-items: center;
  background: var(--table-stripe);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.link-text {
  flex: 1; padding: 8px 12px;
  font-size: 0.8rem; font-family: monospace;
  color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.copy-btn {
  padding: 8px 14px; background: var(--primary);
  color: #fff; border: none; cursor: pointer;
  font-size: 0.8rem; font-weight: 600; font-family: inherit;
  transition: var(--transition); white-space: nowrap;
}
.copy-btn:hover { background: var(--primary-dark); }

/* ── Live Counter Animation ─────────────────────── */
.counter-anim { transition: all 0.8s ease; }

/* ── Pulse dot ──────────────────────────────────── */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); display: inline-block;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* ── Login Page ─────────────────────────────────── */
#login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #FF6584 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; position: relative; overflow: hidden;
}
#login-page::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  animation: bgMove 30s linear infinite;
}
@keyframes bgMove { from { background-position: 0 0; } to { background-position: 120px 120px; } }

.login-card {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 48px;
  width: 100%; max-width: 440px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
  position: relative; z-index: 1;
  animation: slideUp 0.5s ease;
}
[data-theme="dark"] .login-card {
  background: rgba(26,26,53,0.95);
  border: 1px solid rgba(255,255,255,0.08);
}
.login-logo {
  text-align: center; margin-bottom: 32px;
}
.login-logo-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: var(--grad-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(108,99,255,0.4);
}
.login-title { font-size: 1.8rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.login-subtitle { font-size: 0.9rem; color: var(--text-secondary); }

.login-tabs { display: flex; margin-bottom: 24px; background: var(--badge-bg); border-radius: 10px; padding: 4px; }
.login-tab-btn {
  flex: 1; padding: 8px; border: none; background: none; cursor: pointer;
  border-radius: 7px; font-size: 0.88rem; font-weight: 600;
  color: var(--text-secondary); font-family: inherit; transition: var(--transition);
}
.login-tab-btn.active { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
[data-theme="dark"] .login-tab-btn.active { background: var(--card); }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  body.rtl .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  body.rtl .main-content { margin-right: 0; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .page-content { padding: 20px 16px; }
}
@media (max-width: 576px) {
  .stats-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
  .topbar { padding: 0 16px; }
}

/* ── Sidebar Mobile Toggle ──────────────────────── */
.sidebar-toggle {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 1.3rem; padding: 6px; border-radius: 8px;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--badge-bg); }
@media (max-width: 991px) { .sidebar-toggle { display: flex; align-items: center; } }

/* ── Overlay for mobile sidebar ─────────────────── */
.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 99;
  backdrop-filter: blur(2px);
}
@media (max-width: 991px) {
  .sidebar-backdrop.show { display: block; }
}

/* SweetAlert customization */
.swal2-popup {
  font-family: 'Outfit', sans-serif !important;
  border-radius: 16px !important;
}
.swal2-confirm { background: var(--primary) !important; border-radius: 8px !important; }
.swal2-cancel  { background: var(--badge-bg) !important; color: var(--text) !important; border-radius: 8px !important; }
