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

:root {
  --adm-sidebar-w: 260px;
  --adm-nav-h: 64px;
  --adm-primary: #7c3aed;
  --adm-primary-light: #a78bfa;
  --adm-bg: #0f0a1e;
  --adm-bg2: #12082a;
  --adm-bg3: #1a0f36;
  --adm-border: rgba(167,139,250,0.15);
  --adm-text: #f3f4f6;
  --adm-text2: #9ca3af;
  --adm-success: #059669;
  --adm-warning: #d97706;
  --adm-error: #dc2626;
  --adm-info: #2563eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body.admin-body {
  font-family: 'Inter', sans-serif;
  background: var(--adm-bg);
  color: var(--adm-text);
  min-height: 100vh;
  display: flex;
}

/* ── Sidebar ─────────────────────────────────────── */
.adm-sidebar {
  width: var(--adm-sidebar-w);
  background: var(--adm-bg2);
  border-right: 1px solid var(--adm-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform 0.3s ease;
}
.adm-sidebar::-webkit-scrollbar { width: 4px; }
.adm-sidebar::-webkit-scrollbar-thumb { background: var(--adm-primary); border-radius: 999px; }

.adm-sidebar__logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--adm-border);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}
.adm-sidebar__logo-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.1rem; font-weight: 900;
  box-shadow: 0 4px 16px rgba(124,58,237,0.4);
  flex-shrink: 0;
}
.adm-sidebar__logo-text { line-height: 1; }
.adm-sidebar__logo-text strong { display: block; font-size: 0.9rem; color: white; font-weight: 700; }
.adm-sidebar__logo-text span { font-size: 0.7rem; color: var(--adm-text2); }

.adm-sidebar__nav { padding: 16px 12px; flex: 1; }
.adm-sidebar__section-label {
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--adm-text2);
  padding: 16px 8px 8px;
}

.adm-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--adm-text2);
  font-size: 0.875rem; font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  position: relative;
}
.adm-nav-item i { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.adm-nav-item:hover { background: rgba(124,58,237,0.15); color: var(--adm-text); }
.adm-nav-item.active {
  background: rgba(124,58,237,0.2);
  color: var(--adm-primary-light);
  border: 1px solid rgba(124,58,237,0.3);
}
.adm-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--adm-primary);
  border-radius: 0 3px 3px 0;
}
.adm-nav-badge {
  margin-left: auto;
  background: var(--adm-error);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.adm-sidebar__footer {
  padding: 16px;
  border-top: 1px solid var(--adm-border);
  font-size: 0.75rem;
  color: var(--adm-text2);
}
.adm-sidebar__footer strong { color: var(--adm-text); display: block; margin-bottom: 4px; }
.adm-sidebar__footer a { color: var(--adm-error); text-decoration: none; font-weight: 600; }
.adm-sidebar__footer a:hover { text-decoration: underline; }

/* ── Main Content ─────────────────────────────────── */
.adm-main {
  margin-left: var(--adm-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────────────── */
.adm-topbar {
  height: var(--adm-nav-h);
  background: var(--adm-bg2);
  border-bottom: 1px solid var(--adm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.adm-topbar__title { font-size: 1.125rem; font-weight: 700; color: white; }
.adm-topbar__actions { display: flex; align-items: center; gap: 16px; }
.adm-topbar__user {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.875rem; color: var(--adm-text2);
}
.adm-topbar__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.875rem;
}
.adm-btn-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--adm-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--adm-text2);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  font-size: 0.9rem;
}
.adm-btn-icon:hover { background: rgba(124,58,237,0.2); color: var(--adm-primary-light); border-color: var(--adm-primary); }

/* ── Page Content ─────────────────────────────────── */
.adm-content { padding: 32px; flex: 1; }

.adm-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}
.adm-page-header h1 { font-size: 1.5rem; font-weight: 800; color: white; }
.adm-page-header p { font-size: 0.875rem; color: var(--adm-text2); margin-top: 4px; }

/* ── Stats Cards ─────────────────────────────────── */
.adm-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
@media (max-width: 1280px) { .adm-stats-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 768px)  { .adm-stats-grid { grid-template-columns: repeat(2,1fr); } }

.adm-stat-card {
  background: var(--adm-bg2);
  border: 1px solid var(--adm-border);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.adm-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--adm-primary), #a855f7);
}
.adm-stat-card:hover { border-color: var(--adm-primary); transform: translateY(-3px); }
.adm-stat-card__icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 16px;
}
.adm-stat-card__num {
  font-size: 2rem; font-weight: 900;
  color: white; line-height: 1;
  margin-bottom: 6px;
}
.adm-stat-card__label { font-size: 0.8rem; color: var(--adm-text2); font-weight: 500; }

/* ── Cards ─────────────────────────────────────── */
.adm-card {
  background: var(--adm-bg2);
  border: 1px solid var(--adm-border);
  border-radius: 16px;
  overflow: clip; /* clip instead of hidden allows sticky children */
  margin-bottom: 24px;
}
.adm-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--adm-border);
  flex-wrap: wrap;
  gap: 12px;
}
.adm-card__title { font-size: 1rem; font-weight: 700; color: white; }
.adm-card__body { padding: 24px; }

/* ── Table ─────────────────────────────────────── */
.adm-table-wrap { overflow-x: auto; }
.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.adm-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--adm-text2);
  font-weight: 600;
  border-bottom: 1px solid var(--adm-border);
  white-space: nowrap;
  position: sticky;
  top: var(--adm-nav-h);
  background: var(--adm-bg2);
  z-index: 10;
}
.adm-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(167,139,250,0.08);
  color: var(--adm-text);
  vertical-align: middle;
}
.adm-table tr:hover td { background: rgba(124,58,237,0.06); }
.adm-table tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────── */
.adm-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.adm-badge-success { background: rgba(5,150,105,0.15); color: #34d399; border: 1px solid rgba(5,150,105,0.3); }
.adm-badge-warning { background: rgba(217,119,6,0.15);  color: #fbbf24; border: 1px solid rgba(217,119,6,0.3); }
.adm-badge-error   { background: rgba(220,38,38,0.15);  color: #f87171; border: 1px solid rgba(220,38,38,0.3); }
.adm-badge-info    { background: rgba(37,99,235,0.15);  color: #60a5fa; border: 1px solid rgba(37,99,235,0.3); }
.adm-badge-purple  { background: rgba(124,58,237,0.2);  color: #a78bfa; border: 1px solid rgba(124,58,237,0.3); }

/* ── Buttons ─────────────────────────────────────── */
.adm-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
}
.adm-btn-primary { background: linear-gradient(135deg,#7c3aed,#a855f7); color: white; }
.adm-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124,58,237,0.4); }
.adm-btn-ghost { background: rgba(124,58,237,0.1); color: #a78bfa; border: 1px solid rgba(124,58,237,0.3); }
.adm-btn-ghost:hover { background: rgba(124,58,237,0.2); }
.adm-btn-danger { background: rgba(220,38,38,0.15); color: #f87171; border: 1px solid rgba(220,38,38,0.3); }
.adm-btn-danger:hover { background: var(--adm-error); color: white; border-color: var(--adm-error); }
.adm-btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: 6px; }
.adm-btn-lg { padding: 12px 24px; font-size: 0.9rem; border-radius: 10px; }

/* ── Forms ─────────────────────────────────────── */
.adm-form-group { margin-bottom: 20px; }
.adm-form-label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--adm-text2); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.adm-form-control {
  width: 100%;
  background: var(--adm-bg3);
  border: 1.5px solid var(--adm-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--adm-text);
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}
.adm-form-control:focus {
  outline: none;
  border-color: var(--adm-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
  background: var(--adm-bg2);
}
.adm-form-control::placeholder { color: rgba(156,163,175,0.5); }
textarea.adm-form-control { resize: vertical; min-height: 120px; }
select.adm-form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  appearance: none;
}
.adm-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .adm-form-grid { grid-template-columns: 1fr; } }
.adm-form-full { grid-column: 1 / -1; }

.adm-toggle {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}
.adm-toggle input { opacity: 0; width: 0; height: 0; }
.adm-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  transition: all 0.3s;
}
.adm-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  left: 3px; top: 3px;
  transition: transform 0.3s;
}
.adm-toggle input:checked + .adm-toggle-slider { background: var(--adm-primary); }
.adm-toggle input:checked + .adm-toggle-slider::before { transform: translateX(20px); }

/* ── Alert ─────────────────────────────────────── */
.adm-alert {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 0.875rem;
  margin-bottom: 20px;
}
.adm-alert-success { background: rgba(5,150,105,0.1); border: 1px solid rgba(5,150,105,0.3); color: #34d399; }
.adm-alert-error   { background: rgba(220,38,38,0.1);  border: 1px solid rgba(220,38,38,0.3);  color: #f87171; }
.adm-alert-info    { background: rgba(37,99,235,0.1);  border: 1px solid rgba(37,99,235,0.3);  color: #60a5fa; }

/* ── Responsive Sidebar ─────────────────────────── */
@media (max-width: 1024px) {
  .adm-sidebar { transform: translateX(-100%); }
  .adm-sidebar.open { transform: translateX(0); }
  .adm-main { margin-left: 0; }
}

/* ── Login Page ─────────────────────────────────── */
.adm-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--adm-bg);
  position: relative;
  overflow: hidden;
}
.adm-login-card {
  background: var(--adm-bg2);
  border: 1px solid var(--adm-border);
  border-radius: 24px;
  padding: 48px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}
.adm-login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.adm-login-logo h1 { font-size: 1.5rem; color: white; font-weight: 800; margin-top: 16px; }
.adm-login-logo p { font-size: 0.875rem; color: var(--adm-text2); margin-top: 4px; }

/* ── Colour Helpers ─────────────────────────────── */
.adm-color-purple { color: #a78bfa; }
.adm-color-green  { color: #34d399; }
.adm-color-yellow { color: #fbbf24; }
.adm-color-red    { color: #f87171; }
.adm-color-blue   { color: #60a5fa; }
.adm-bg-purple { background: rgba(124,58,237,0.15); }
.adm-bg-green  { background: rgba(5,150,105,0.15);  }
.adm-bg-yellow { background: rgba(217,119,6,0.15);  }
.adm-bg-red    { background: rgba(220,38,38,0.15);  }
.adm-bg-blue   { background: rgba(37,99,235,0.15);  }

/* ── Profile Dropdown ─────────────────────────────── */
.adm-topbar__user {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.adm-profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  background: var(--adm-bg3);
  border: 1px solid var(--adm-border);
  border-radius: 12px;
  width: 250px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 300;
  text-align: left;
}
.adm-profile-dropdown.open {
  display: flex;
}
.adm-profile-dropdown__header {
  padding: 16px;
  border-bottom: 1px solid var(--adm-border);
}
.adm-profile-dropdown__header strong {
  display: block;
  font-size: 0.875rem;
  color: white;
  margin-bottom: 2px;
}
.adm-profile-dropdown__header span {
  font-size: 0.75rem;
  color: var(--adm-text2);
}
.adm-profile-dropdown__divider {
  height: 1px;
  background: var(--adm-border);
}
.adm-profile-dropdown__menu {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}
.adm-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 0.825rem;
  color: var(--adm-text2);
  text-decoration: none;
  transition: all 0.2s ease;
}
.adm-dropdown-item i {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--adm-primary-light);
}
.adm-dropdown-item:hover {
  background: rgba(124,58,237,0.15);
  color: white;
}
.adm-dropdown-item.logout-item {
  color: var(--adm-error);
  border-top: 1px solid var(--adm-border);
}
.adm-dropdown-item.logout-item i {
  color: var(--adm-error);
}
.adm-dropdown-item.logout-item:hover {
  background: rgba(220,38,38,0.12);
  color: #ff8a8a;
}

/* ── Settings Tabs Layout ─────────────────────────── */
.adm-settings-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  align-items: start;
}

@media (max-width: 1024px) {
  .adm-settings-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.adm-settings-nav {
  background: var(--adm-bg2);
  border: 1px solid var(--adm-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 96px;
}

.adm-settings-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--adm-text2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.adm-settings-tab i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.adm-settings-tab:hover {
  background: rgba(124,58,237,0.1);
  color: white;
}

.adm-settings-tab.active {
  background: rgba(124,58,237,0.15);
  color: var(--adm-primary-light);
  border-color: rgba(124,58,237,0.3);
}

.adm-settings-section {
  display: none;
}

.adm-settings-section.active {
  display: block;
  animation: fadeInSettings 0.25s ease-out;
}

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