/* ============================================================
   AVANTA — admin.css
   Premium SaaS-style Admin Dashboard
   ============================================================ */

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

:root {
  /* Admin Colors */
  --admin-bg:        #0A0F1E;
  --admin-surface:   #111827;
  --admin-surface2:  #1C2536;
  --admin-border:    rgba(255,255,255,0.07);
  --admin-text:      #E2E8F0;
  --admin-muted:     #64748B;
  --admin-gold:      #D4AF37;
  --admin-blue:      #3B82F6;
  --admin-green:     #10B981;
  --admin-red:       #EF4444;
  --admin-orange:    #F59E0B;
  --admin-purple:    #8B5CF6;
  --sidebar-width:   260px;
  --topbar-height:   64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--admin-bg);
  color: var(--admin-text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ─── Sidebar ─── */
.admin-sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--admin-surface);
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.admin-sidebar::-webkit-scrollbar { width: 3px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.admin-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--admin-border);
  flex-shrink: 0;
}

.admin-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--admin-gold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.admin-logo-text {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  color: #fff;
  line-height: 1.1;
}

.admin-logo-sub {
  font-size: 9px;
  color: var(--admin-gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Nav Groups */
.sidebar-group {
  padding: 20px 12px 8px;
}

.sidebar-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--admin-muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--admin-muted);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 2px;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--admin-text);
}

.sidebar-item.active {
  background: rgba(212,175,55,0.12);
  color: var(--admin-gold);
}

.sidebar-item svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--admin-gold);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.5;
}

.sidebar-badge.red { background: var(--admin-red); color: #fff; }

/* Sidebar Footer */
.admin-sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid var(--admin-border);
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background 0.2s;
  cursor: pointer;
}

.admin-user:hover { background: rgba(255,255,255,.05); }

.admin-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--admin-gold), #a8891f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #000;
  flex-shrink: 0;
}

.admin-user-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--admin-text);
}

.admin-user-role {
  font-size: .75rem;
  color: var(--admin-muted);
}

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

/* Top Bar */
.admin-topbar {
  height: var(--topbar-height);
  background: var(--admin-surface);
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-page-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--admin-text);
}

.admin-breadcrumb {
  font-size: .8125rem;
  color: var(--admin-muted);
}

.admin-breadcrumb span { color: var(--admin-gold); }

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  position: relative;
}

.admin-topbar-btn:hover { background: rgba(255,255,255,.1); }
.admin-topbar-btn svg { width: 17px; height: 17px; stroke: var(--admin-muted); }

.admin-notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--admin-red);
  border-radius: 50%;
  border: 1.5px solid var(--admin-surface);
}

/* Search */
.admin-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 8px 14px;
  min-width: 220px;
}

.admin-search svg { width: 15px; height: 15px; stroke: var(--admin-muted); flex-shrink: 0; }
.admin-search input { background: none; border: none; outline: none; font-size: .875rem; color: var(--admin-text); width: 100%; }
.admin-search input::placeholder { color: var(--admin-muted); }

/* ─── Content ─── */
.admin-content {
  padding: 28px;
  flex: 1;
}

/* ─── Stat Cards ─── */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.admin-stat-card {
  background: var(--admin-surface2);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 22px;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}

.admin-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 12px 12px 0 0;
  transition: opacity .2s;
}

.admin-stat-card.gold::before { background: var(--admin-gold); }
.admin-stat-card.blue::before { background: var(--admin-blue); }
.admin-stat-card.green::before { background: var(--admin-green); }
.admin-stat-card.purple::before { background: var(--admin-purple); }

.admin-stat-card:hover {
  border-color: rgba(255,255,255,.15);
  transform: translateY(-2px);
}

.admin-stat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.admin-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-stat-icon.gold { background: rgba(212,175,55,.15); }
.admin-stat-icon.blue { background: rgba(59,130,246,.15); }
.admin-stat-icon.green { background: rgba(16,185,129,.15); }
.admin-stat-icon.purple { background: rgba(139,92,246,.15); }

.admin-stat-icon svg { width: 20px; height: 20px; }
.admin-stat-icon.gold svg { stroke: var(--admin-gold); }
.admin-stat-icon.blue svg { stroke: var(--admin-blue); }
.admin-stat-icon.green svg { stroke: var(--admin-green); }
.admin-stat-icon.purple svg { stroke: var(--admin-purple); }

.admin-stat-change {
  font-size: .75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}

.admin-stat-change.up { background: rgba(16,185,129,.12); color: var(--admin-green); }
.admin-stat-change.down { background: rgba(239,68,68,.12); color: var(--admin-red); }

.admin-stat-num {
  font-family: 'Rajdhani', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}

.admin-stat-label {
  font-size: .8125rem;
  color: var(--admin-muted);
}

/* Sparkline bar */
.admin-stat-spark {
  margin-top: 14px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 28px;
}

.spark-bar {
  flex: 1;
  border-radius: 2px;
  transition: height .3s;
}

.gold .spark-bar { background: rgba(212,175,55,.3); }
.gold .spark-bar:last-child { background: var(--admin-gold); }
.blue .spark-bar { background: rgba(59,130,246,.3); }
.blue .spark-bar:last-child { background: var(--admin-blue); }
.green .spark-bar { background: rgba(16,185,129,.3); }
.green .spark-bar:last-child { background: var(--admin-green); }
.purple .spark-bar { background: rgba(139,92,246,.3); }
.purple .spark-bar:last-child { background: var(--admin-purple); }

/* ─── Grid Layout ─── */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  margin-bottom: 28px;
}

.admin-grid-full {
  grid-column: 1 / -1;
}

/* ─── Panel ─── */
.admin-panel {
  background: var(--admin-surface2);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  overflow: hidden;
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--admin-border);
}

.admin-panel-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--admin-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-panel-title svg { width: 16px; height: 16px; stroke: var(--admin-gold); }

.admin-panel-action {
  font-size: .8125rem;
  color: var(--admin-gold);
  cursor: pointer;
  transition: color .2s;
  background: none;
  border: none;
  font-family: inherit;
}

.admin-panel-action:hover { color: #f0d060; }

/* ─── Data Table ─── */
.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.admin-table thead th {
  padding: 12px 20px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--admin-muted);
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid var(--admin-border);
  white-space: nowrap;
}

.admin-table tbody tr {
  border-bottom: 1px solid var(--admin-border);
  transition: background .15s;
}

.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table tbody tr:hover { background: rgba(255,255,255,.03); }

.admin-table tbody td {
  padding: 14px 20px;
  color: var(--admin-text);
  vertical-align: middle;
}

.admin-table .td-muted { color: var(--admin-muted); font-size: .8125rem; }

/* Status badges */
.admin-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}

.admin-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.admin-status.new { background: rgba(212,175,55,.1); color: var(--admin-gold); }
.admin-status.new::before { background: var(--admin-gold); }
.admin-status.contacted { background: rgba(59,130,246,.1); color: var(--admin-blue); }
.admin-status.contacted::before { background: var(--admin-blue); }
.admin-status.enrolled { background: rgba(16,185,129,.1); color: var(--admin-green); }
.admin-status.enrolled::before { background: var(--admin-green); }
.admin-status.closed { background: rgba(239,68,68,.1); color: var(--admin-red); }
.admin-status.closed::before { background: var(--admin-red); }

/* Action buttons */
.admin-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--admin-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
}

.admin-action-btn:hover { background: rgba(255,255,255,.1); }
.admin-action-btn svg { width: 13px; height: 13px; stroke: var(--admin-muted); }

/* ─── Quick Stats Sidebar ─── */
.quick-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--admin-border);
  transition: background .15s;
}

.quick-stat:last-child { border-bottom: none; }
.quick-stat:hover { background: rgba(255,255,255,.02); }

.quick-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-stat-num {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.quick-stat-label {
  font-size: .75rem;
  color: var(--admin-muted);
  margin-top: 2px;
}

/* ─── Recent Activity ─── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--admin-border);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.activity-text {
  font-size: .875rem;
  color: var(--admin-text);
  line-height: 1.5;
}

.activity-time {
  margin-left: auto;
  font-size: .75rem;
  color: var(--admin-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Chart Bar (CSS only) ─── */
.chart-bars {
  padding: 20px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 120px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  width: 100%;
}

.chart-bar-inner {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: rgba(212,175,55,.25);
  transition: height .5s ease;
  cursor: pointer;
}

.chart-bar-inner:hover { background: var(--admin-gold); }
.chart-bar-inner.highlight { background: var(--admin-gold); }

.chart-month {
  font-size: .7rem;
  color: var(--admin-muted);
  font-weight: 600;
  text-align: center;
}

/* ─── Module Pages ─── */
.module-page {
  display: none;
}

.module-page.active {
  display: block;
  animation: pageIn .3s ease both;
}

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

/* ─── Form Elements ─── */
.admin-form-group { margin-bottom: 18px; }
.admin-label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--admin-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-input, .admin-select, .admin-textarea {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .9rem;
  font-family: inherit;
  color: var(--admin-text);
  outline: none;
  transition: border-color .2s;
}

.admin-input:focus, .admin-select:focus, .admin-textarea:focus {
  border-color: var(--admin-gold);
  box-shadow: 0 0 0 2px rgba(212,175,55,.1);
}

.admin-textarea { resize: vertical; min-height: 100px; }
.admin-select option { background: var(--admin-surface2); }

/* ─── Toggle Switch ─── */
.admin-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  position: relative;
  transition: background .2s;
}

.toggle-track.on { background: var(--admin-green); }

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform .2s;
}

.toggle-track.on .toggle-thumb { transform: translateX(18px); }

/* ─── Upload Area ─── */
.admin-upload {
  border: 2px dashed var(--admin-border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
}

.admin-upload:hover {
  border-color: var(--admin-gold);
  background: rgba(212,175,55,.04);
}

.admin-upload-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.admin-upload-text {
  font-size: .9rem;
  color: var(--admin-muted);
}

.admin-upload-text strong { color: var(--admin-gold); }

/* ─── Media Grid ─── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 20px;
}

.media-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
  border: 1px solid var(--admin-border);
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}

.media-item:hover img { transform: scale(1.05); }

.media-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity .2s;
}

.media-item:hover .media-item-overlay { opacity: 1; }

/* ─── Responsive ─── */
@media (max-width: 1200px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform .3s; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-stats { grid-template-columns: 1fr; }
}
