/* ════════════════════════════════════════════════════════════
   OTP Admin Dashboard — Premium Dark Theme CSS
   ════════════════════════════════════════════════════════════ */

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

/* ─── Variables ────────────────────────────────────────────── */
:root {
  --bg-primary:   #0a0e1a;
  --bg-secondary: #111827;
  --bg-card:      #1a2236;
  --bg-card-hover:#1e2a42;
  --bg-sidebar:   #0d1526;

  --accent:       #6366f1;
  --accent-light: #818cf8;
  --accent-dark:  #4f46e5;
  --accent-glow:  rgba(99, 102, 241, 0.3);

  --green:   #10b981;
  --yellow:  #f59e0b;
  --red:     #ef4444;
  --blue:    #3b82f6;
  --purple:  #8b5cf6;
  --cyan:    #06b6d4;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --border:       rgba(255,255,255,0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --shadow:     0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 48px rgba(0,0,0,0.6);
  --glow:       0 0 30px var(--accent-glow);

  --sidebar-w:  260px;
  --topbar-h:   64px;
  --transition: 0.2s ease;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ─── Auth Page ─────────────────────────────────────────────── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; position: relative; overflow: hidden; }
.auth-bg { position: fixed; inset: 0; z-index: 0; }
.auth-bg-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.15; animation: float 8s ease-in-out infinite;
}
.orb-1 { width: 400px; height: 400px; background: var(--accent); top: -10%; left: -10%; animation-delay: 0s; }
.orb-2 { width: 300px; height: 300px; background: var(--purple); bottom: -5%; right: 10%; animation-delay: -3s; }
.orb-3 { width: 250px; height: 250px; background: var(--cyan); top: 40%; right: -5%; animation-delay: -6s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

.auth-card {
  position: relative; z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  animation: slideUp 0.5s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-logo { text-align: center; margin-bottom: 2rem; }
.logo-icon { font-size: 3rem; display: block; margin-bottom: 0.5rem; filter: drop-shadow(0 0 20px var(--accent-glow)); }
.auth-logo h1 { font-size: 1.75rem; font-weight: 700; background: linear-gradient(135deg, var(--accent-light), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-logo p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 0.25rem; }

.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.5rem; }

.input-wrapper {
  position: relative; display: flex; align-items: center;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input-icon { padding: 0 0.75rem; color: var(--text-muted); font-size: 1rem; }
.input-wrapper input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 0.9375rem; padding: 0.75rem 0.75rem 0.75rem 0;
}
.input-wrapper input::placeholder { color: var(--text-muted); }
.toggle-password { padding: 0 0.75rem; color: var(--text-muted); font-size: 1rem; transition: color var(--transition); }
.toggle-password:hover { color: var(--text-primary); }

.auth-footer { text-align: center; color: var(--text-muted); font-size: 0.75rem; margin-top: 1.5rem; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.25rem; border-radius: var(--radius); font-size: 0.9375rem;
  font-weight: 600; transition: all var(--transition); white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white; box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 25px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-full { width: 100%; }
.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8125rem; }
.btn-ghost { background: var(--border); color: var(--text-primary); }
.btn-ghost:hover { background: var(--bg-card-hover); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-success { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.25); }

/* ─── Alerts ────────────────────────────────────────────────── */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.875rem; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }

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

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: var(--bg-sidebar);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 1.5rem 1.25rem; display: flex; align-items: center; gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-icon { font-size: 1.75rem; }
.sidebar-logo span { font-size: 1.125rem; font-weight: 700; background: linear-gradient(135deg, var(--accent-light), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-nav { flex: 1; padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; overflow-y: auto; }
.nav-section-label { padding: 0.5rem 0.75rem; font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 0.9rem;
  font-weight: 500; transition: all var(--transition); cursor: pointer;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(99,102,241,0.1)); color: var(--accent-light); border-right: 2px solid var(--accent); }
.nav-item .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar-footer { padding: 1rem 0.75rem; border-top: 1px solid var(--border); }
.admin-info { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.875rem; }
.admin-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--purple)); display: flex; align-items: center; justify-content: center; font-size: 0.875rem; font-weight: 700; }
.admin-details { flex: 1; min-width: 0; }
.admin-name { font-size: 0.875rem; font-weight: 600; truncate: ellipsis; }
.admin-role { font-size: 0.6875rem; color: var(--accent-light); }

/* ─── Main Content ──────────────────────────────────────────── */
.main-content { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: var(--topbar-h); background: var(--bg-secondary);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; padding: 0 1.5rem; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1.125rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.page-content { padding: 1.5rem; flex: 1; }

/* ─── Stats Cards ───────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; transition: all var(--transition); position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; inset: 0; opacity: 0; background: linear-gradient(135deg, var(--accent-glow), transparent); transition: opacity var(--transition); }
.stat-card:hover { border-color: var(--accent); box-shadow: var(--glow); }
.stat-card:hover::before { opacity: 1; }
.stat-icon { font-size: 2rem; margin-bottom: 0.75rem; display: block; }
.stat-value { font-size: 1.625rem; font-weight: 700; line-height: 1; margin-bottom: 0.25rem; }
.stat-label { font-size: 0.8125rem; color: var(--text-secondary); }
.stat-change { font-size: 0.75rem; margin-top: 0.5rem; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ─── Charts ────────────────────────────────────────────────── */
.chart-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.chart-title { font-size: 1rem; font-weight: 600; }
.chart-tabs { display: flex; gap: 0.25rem; }
.chart-tab {
  padding: 0.3rem 0.75rem; border-radius: var(--radius-sm); font-size: 0.8125rem;
  color: var(--text-secondary); background: var(--bg-secondary); transition: all var(--transition); cursor: pointer;
}
.chart-tab.active { background: var(--accent); color: white; }
.chart-wrapper { position: relative; height: 250px; }

/* ─── Grid ──────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ─── Tables ────────────────────────────────────────────────── */
.table-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-header { padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.table-title { font-size: 1rem; font-weight: 600; }
.table-actions { display: flex; gap: 0.5rem; align-items: center; }
.search-input {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.4rem 0.75rem; color: var(--text-primary);
  font-size: 0.875rem; outline: none; width: 200px;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 0.875rem 1rem; font-size: 0.875rem; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Badges ────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-green  { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-red    { background: rgba(239,68,68,0.15);  color: var(--red); }
.badge-yellow { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-blue   { background: rgba(59,130,246,0.15); color: var(--blue); }
.badge-purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.badge-gray   { background: rgba(148,163,184,0.1); color: var(--text-secondary); }

/* ─── Settings ──────────────────────────────────────────────── */
.settings-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1rem; }
.settings-title { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.settings-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; padding: 1rem 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.settings-row:last-child { border-bottom: none; padding-bottom: 0; }
.settings-info { flex: 1; }
.settings-label { font-weight: 500; font-size: 0.9375rem; margin-bottom: 0.25rem; }
.settings-desc { font-size: 0.8125rem; color: var(--text-secondary); }
.settings-control { min-width: 200px; }
.radio-group { display: flex; gap: 0.75rem; }
.radio-item { display: flex; align-items: center; gap: 0.375rem; cursor: pointer; }
.radio-item input { accent-color: var(--accent); }
.number-input {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; color: var(--text-primary);
  font-size: 0.9375rem; outline: none; width: 100%;
  transition: border-color var(--transition);
}
.number-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0; border-radius: 999px;
  background: var(--bg-secondary); border: 1px solid var(--border); transition: var(--transition);
}
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; border-radius: 50%; background: var(--text-muted); transition: var(--transition); }
input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
input:checked + .toggle-slider::before { transform: translateX(20px); background: white; }

/* ─── Pagination ────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 1rem; }
.page-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-secondary);
  font-size: 0.875rem; font-weight: 500; transition: all var(--transition); cursor: pointer;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); animation: fadeIn var(--transition); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); animation: slideUp 0.3s ease; }
.modal-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ─── Loading Skeleton ──────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Toast ─────────────────────────────────────────────────── */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.875rem 1.25rem; box-shadow: var(--shadow); max-width: 360px;
  animation: slideInRight 0.3s ease; display: flex; align-items: center; gap: 0.75rem;
}
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* ─── Misc ──────────────────────────────────────────────────── */
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-blue   { color: var(--blue); }
.text-muted  { color: var(--text-secondary); }
.text-small  { font-size: 0.8125rem; }
.font-mono   { font-family: 'Courier New', monospace; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex        { display: flex; }
.items-center{ align-items: center; }
.gap-2       { gap: 0.5rem; }
.gap-3       { gap: 0.75rem; }
.mb-4        { margin-bottom: 1rem; }
.preview-box { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem 1rem; font-size: 0.875rem; }
.preview-row { display: flex; justify-content: space-between; padding: 0.25rem 0; }
.preview-row.total { border-top: 1px solid var(--border); margin-top: 0.25rem; padding-top: 0.5rem; font-weight: 700; color: var(--accent-light); }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }
.empty-state { text-align: center; padding: 3rem; color: var(--text-secondary); }
.empty-state-icon { font-size: 3rem; margin-bottom: 0.75rem; }

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
