/* =============================================================
   adr.mn — Admin Portal Stylesheet
   Dark / Light mode via [data-theme] on <html>
   ============================================================= */

/* ── Google Font ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700;800&display=swap');

/* ── Light theme (default) ───────────────────────────────────── */
:root {
  --bg:           #f0f4f8;
  --surface:      #ffffff;
  --surface-alt:  #f8fafc;
  --primary:      #034EA0;
  --primary-h:    #023d80;
  --accent:       #fd8b00;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --shadow:       0 4px 24px rgba(3,78,160,.08);
  --sidebar-bg:   #ffffff;
  --sidebar-text: #0f172a;
  --sidebar-w:    240px;
  --nav-h:        60px;
  --input-bg:     #f8fafc;
  --badge-new:    #16a34a;
  --danger:       #dc2626;
  --success:      #16a34a;
}

/* ── Dark theme ──────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0f172a;
  --surface:      #1e293b;
  --surface-alt:  #1a2436;
  --primary:      #3b82f6;
  --primary-h:    #2563eb;
  --accent:       #f59e0b;
  --text:         #f1f5f9;
  --text-muted:   #94a3b8;
  --border:       #334155;
  --shadow:       0 4px 24px rgba(0,0,0,.3);
  --sidebar-bg:   #1e293b;
  --sidebar-text: #f1f5f9;
  --input-bg:     #0f172a;
}

/* ── Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  transition: background .25s, color .25s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }

/* ── Admin Layout ────────────────────────────────────────────── */
.admin-wrap {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.admin-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s, background .25s, border-color .25s;
  box-shadow: var(--shadow);
}

.admin-sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .625rem;
}
.admin-sidebar-brand img { height: 36px; }
.admin-sidebar-brand span {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  letter-spacing: -.5px;
}

.admin-sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}
.admin-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.25rem;
  color: var(--text-muted);
  border-radius: 0;
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.admin-sidebar-nav a:hover,
.admin-sidebar-nav a.active {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  border-left: 3px solid var(--primary);
}
.admin-sidebar-nav a .material-symbols-outlined {
  font-size: 1.2rem;
}
.admin-sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: .5rem 1.25rem;
}

/* ── Collapsible nav groups ─────────────────────────────────── */
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.25rem;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.nav-group-toggle:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--text);
}
.nav-group-toggle.open {
  color: var(--text);
}
.nav-group-toggle .nav-group-arrow {
  margin-left: auto;
  font-size: 1.1rem;
  transition: transform .25s ease;
  flex-shrink: 0;
}
.nav-group-toggle.open .nav-group-arrow {
  transform: rotate(180deg);
}
/* collapsed */
.nav-group-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s cubic-bezier(.4,0,.2,1);
}
/* expanded */
.nav-group-items.open {
  max-height: 400px;
}
.nav-group-items a {
  padding-left: 2.8rem !important;
  font-size: .85rem;
  border-left: 3px solid transparent;
}
.admin-sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ── Coming-soon nav badge ──────────────────────────────────── */
.nav-soon {
  margin-left: auto;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: .15rem .45rem;
  border-radius: 20px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .nav-soon {
  background: #78350f;
  color: #fcd34d;
  border-color: #92400e;
}

/* ── Main content ────────────────────────────────────────────── */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s;
}

/* ── Top navbar ──────────────────────────────────────────────── */
.admin-topnav {
  height: var(--nav-h);
  background: var(--surface);
  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: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,.05);
  transition: background .25s, border-color .25s;
}
.admin-topnav-left { display: flex; align-items: center; gap: .75rem; }
.admin-topnav-right { display: flex; align-items: center; gap: .75rem; }

.admin-page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

/* ── Theme toggle ────────────────────────────────────────────── */
.theme-toggle {
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  border: none;
  transition: background .2s;
  flex-shrink: 0;
}
.theme-toggle::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform .2s, background .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
[data-theme="dark"] .theme-toggle { background: var(--primary); }
[data-theme="dark"] .theme-toggle::after { transform: translateX(20px); }

/* ── User avatar pill ────────────────────────────────────────── */
.admin-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  cursor: pointer;
}
.admin-avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.admin-user-pill {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  padding: .35rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  transition: border-color .15s;
  text-decoration: none;
  color: var(--text);
}
.admin-user-pill:hover { border-color: var(--primary); }
.admin-user-pill span { font-size: .85rem; font-weight: 500; }

/* ── Page content ────────────────────────────────────────────── */
.admin-content {
  padding: 1.75rem 1.5rem;
  flex: 1;
}

/* ── Cards ───────────────────────────────────────────────────── */
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: background .25s, border-color .25s;
}
.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.admin-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 1rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow .15s, background .25s;
  box-shadow: var(--shadow);
}
.stat-card:hover { box-shadow: 0 8px 32px rgba(3,78,160,.12); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon-blue  { background: #eff6ff; color: #3b82f6; }
.stat-icon-green { background: #f0fdf4; color: #16a34a; }
.stat-icon-orange{ background: #fff7ed; color: #f97316; }
.stat-icon-purple{ background: #faf5ff; color: #9333ea; }
[data-theme="dark"] .stat-icon-blue  { background: rgba(59,130,246,.15); }
[data-theme="dark"] .stat-icon-green { background: rgba(22,163,74,.15); }
[data-theme="dark"] .stat-icon-orange{ background: rgba(249,115,22,.15); }
[data-theme="dark"] .stat-icon-purple{ background: rgba(147,51,234,.15); }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1.2; }

/* ── Form controls ───────────────────────────────────────────── */
.admin-form-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .4rem;
  display: block;
}
.admin-input {
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .15s, background .25s, color .25s;
  outline: none;
}
.admin-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.admin-input::placeholder { color: var(--text-muted); }

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem 1.5rem;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s, opacity .15s;
}
.admin-btn:active { transform: scale(.98); }
.admin-btn-primary { background: var(--primary); color: #fff; }
.admin-btn-primary:hover { background: var(--primary-h); }
.admin-btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.admin-btn-outline:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.admin-btn-danger { background: var(--danger); color: #fff; }
.admin-btn-sm { padding: .4rem .9rem; font-size: .85rem; }
.admin-btn:disabled { opacity: .6; cursor: not-allowed; }
.admin-btn-full { width: 100%; }

/* ── Alerts ──────────────────────────────────────────────────── */
.admin-alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .9rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.admin-alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.admin-alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.admin-alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
[data-theme="dark"] .admin-alert-danger  { background: rgba(220,38,38,.1);  color: #fca5a5; border-color: rgba(220,38,38,.3); }
[data-theme="dark"] .admin-alert-success { background: rgba(22,163,74,.1);  color: #86efac; border-color: rgba(22,163,74,.3); }
[data-theme="dark"] .admin-alert-info    { background: rgba(59,130,246,.1); color: #93c5fd; border-color: rgba(59,130,246,.3); }

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(3,78,160,.1);
  transition: background .25s, border-color .25s;
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.75rem;
}
.login-logo img { height: 44px; }
.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .35rem;
  text-align: center;
}
.login-subtitle {
  font-size: .9rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2rem;
}

/* ── Step indicator ──────────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 1.75rem;
}
.step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background .2s, transform .2s;
}
.step-dot.active { background: var(--primary); transform: scale(1.4); }
.step-dot.done   { background: var(--success); }

/* ── OTP input row ───────────────────────────────────────────── */
.otp-row {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.otp-box {
  width: 46px; height: 52px;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}
.otp-box:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }

/* ── Phone prefix ────────────────────────────────────────────── */
.phone-group {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--input-bg);
  transition: border-color .15s;
}
.phone-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.phone-prefix {
  padding: .65rem .75rem;
  background: var(--bg);
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 600;
  border-right: 1.5px solid var(--border);
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.phone-group .admin-input {
  border: none;
  border-radius: 0;
  flex: 1;
  background: transparent;
  box-shadow: none;
}
.phone-group .admin-input:focus { box-shadow: none; }

/* ── Terms checkbox ──────────────────────────────────────────── */
.terms-check { display: flex; align-items: flex-start; gap: .6rem; margin: 1rem 0; }
.terms-check input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: .1rem;
  accent-color: var(--primary);
  flex-shrink: 0;
  cursor: pointer;
}
.terms-check label { font-size: .88rem; color: var(--text-muted); cursor: pointer; line-height: 1.5; }
.terms-check a { color: var(--primary); font-weight: 500; }

/* ── Terms modal dark-mode close button ──────────────────────── */
[data-theme="dark"] #termsModal .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}
/* Modal body text inherits --text */
#termsModal .modal-body { color: var(--text); font-size: .92rem; line-height: 1.7; }

/* ── Generated password box ──────────────────────────────────── */
.gen-pass-box {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1.5px dashed var(--primary);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  text-align: center;
  margin: 1rem 0;
}
.gen-pass-box .pass-value {
  font-family: 'Courier New', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .15em;
  color: var(--primary);
  user-select: all;
}
.gen-pass-box small { display: block; color: var(--text-muted); font-size: .8rem; margin-top: .3rem; }

/* ── Dev OTP hint (remove in production) ─────────────────────── */
.otp-dev-hint {
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: .6rem 1rem;
  font-size: .82rem;
  color: #854d0e;
  text-align: center;
  margin-bottom: 1rem;
}
[data-theme="dark"] .otp-dev-hint {
  background: rgba(234,179,8,.1);
  border-color: rgba(234,179,8,.25);
  color: #fde68a;
}

/* ── Login page top-right controls ───────────────────────── */
.login-topbar {
  position: fixed;
  top: 1rem; right: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  z-index: 999;
}
.login-theme-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s, background .25s;
  color: var(--text);
  text-decoration: none;
}
.login-theme-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Logo light / dark switching ──────────────────────────── */
[data-theme="light"] .logo-dark,
[data-theme="dark"]  .logo-light { display: none; }

/* ── Profile avatar upload ───────────────────────────────────── */
.avatar-upload-wrap {
  position: relative;
  width: 96px; height: 96px;
  border-radius: 50%;
  cursor: pointer;
}
.avatar-upload-wrap img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}
.avatar-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  color: #fff;
  font-size: 1.4rem;
}
.avatar-upload-wrap:hover .avatar-upload-overlay { opacity: 1; }

/* ── Sidebar toggle button (mobile) ─────────────────────────── */
.sidebar-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: .35rem;
  border-radius: 6px;
  transition: background .15s;
}
.sidebar-toggle-btn:hover { background: var(--surface-alt); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
    z-index: 300;
  }
  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vw rgba(0,0,0,.4);
  }
  .admin-main { margin-left: 0; }
  .sidebar-toggle-btn { display: flex; }
  .admin-content { padding: 1.25rem 1rem; }
  .login-card { padding: 2rem 1.25rem; }
}

/* ── Divider with text ───────────────────────────────────────── */
.divider-text {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: .8rem;
}
.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Back link ───────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
  transition: color .15s;
}
.back-link:hover { color: var(--primary); }

/* ── Section heading ─────────────────────────────────────────── */
.section-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1.25rem;
}
.section-sub {
  font-size: .88rem;
  color: var(--text-muted);
  margin: -.75rem 0 1.25rem;
}

/* ── Password toggle icon ────────────────────────────────────── */
.input-icon-wrap {
  position: relative;
}
.input-icon-wrap .admin-input { padding-right: 2.75rem; }
.input-icon-btn {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  display: flex;
  align-items: center;
  transition: color .15s;
}
.input-icon-btn:hover { color: var(--primary); }
