/* ============================================================
   main.css — Global Design System
   Glassmorphism | Purple/Blue Gradient | Inter Font
   ============================================================ */

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

/* ── CSS VARIABLES ─────────────────────────────────────────── */
:root {
  /* Gradient */
  --grad-start:   #1a0533;
  --grad-mid:     #0d1b4b;
  --grad-end:     #0a2a4a;

  /* Brand */
  --primary:      #7c3aed;
  --primary-light:#9f67f5;
  --secondary:    #2563eb;
  --accent:       #06b6d4;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --success:      #10b981;
  --info:         #3b82f6;

  /* Glass */
  --glass-bg:     rgba(255,255,255,0.08);
  --glass-border: rgba(255,255,255,0.15);
  --glass-hover:  rgba(255,255,255,0.13);
  --glass-strong: rgba(255,255,255,0.18);

  /* Text */
  --text-primary:   #ffffff;
  --text-secondary: rgba(255,255,255,0.70);
  --text-muted:     rgba(255,255,255,0.45);

  /* Layout */
  --radius-sm:    8px;
  --radius-md:    16px;
  --radius-lg:    24px;
  --radius-pill:  50px;
  --nav-height:   72px;
  --shadow:       0 8px 32px rgba(0,0,0,0.35);
  --shadow-sm:    0 2px 12px rgba(0,0,0,0.25);

  /* Transitions */
  --transition:   all 0.28s cubic-bezier(0.4,0,0.2,1);
}

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--grad-start);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(124, 58, 237, 0.15), transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.15), transparent 40%),
    linear-gradient(135deg, var(--grad-start) 0%, var(--grad-mid) 55%, var(--grad-end) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { max-width: 100%; }

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.1rem;  font-weight: 600; }
p  { font-size: 0.9rem; line-height: 1.6; color: var(--text-secondary); }

/* ── GLASS CARD ─────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.card:hover { background: var(--glass-hover); transform: translateY(-2px); }
.card-title { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.4rem; }
.card-value { font-size: 2rem; font-weight: 800; }
.card-sub   { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
  border-radius: inherit;
}
.btn:active::after { background: rgba(255,255,255,0.12); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 4px 20px rgba(124,58,237,0.45);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(124,58,237,0.55); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #0284c7);
  color: #fff;
  box-shadow: 0 4px 20px rgba(6,182,212,0.45);
}
.btn-accent:hover { transform: translateY(-2px); }

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
}
.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
}
.btn-ghost {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover { background: var(--glass-hover); }

.btn-sm { padding: 0.45rem 1rem; font-size: 0.82rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; }
.btn-full { width: 100%; }

.btn:disabled, .btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ── FORM ELEMENTS ───────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
}
.form-control {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.8rem 1rem;
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  border-color: var(--primary-light);
  background: rgba(124,58,237,0.12);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.20);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 0.3rem; }

select.form-control option { background: #1a0533; color: #fff; }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-success  { background: rgba(16,185,129,0.20); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-danger   { background: rgba(239,68,68,0.20);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-warning  { background: rgba(245,158,11,0.20); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-info     { background: rgba(59,130,246,0.20); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.badge-purple   { background: rgba(124,58,237,0.20); color: #c4b5fd; border: 1px solid rgba(124,58,237,0.3); }
.badge-secondary{ background: rgba(255,255,255,0.1); color: var(--text-secondary); }

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.page-header {
  padding: 1.5rem 1rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.page-header h1 { font-size: 1.4rem; }

/* ── PAGE CONTENT ────────────────────────────────────────────── */
.page-content { padding: 0 1rem 1.5rem; }

/* ── STATS GRID ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}
.stats-grid.cols-3 { grid-template-columns: repeat(3,1fr); }
.stats-grid.cols-4 { grid-template-columns: repeat(2,1fr); }

@media (min-width: 640px) {
  .stats-grid.cols-4 { grid-template-columns: repeat(4,1fr); }
}

/* ── TABLE ───────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
}
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}
tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: var(--text-secondary);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.03); }

/* ── BOTTOM NAVIGATION ───────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 1.25rem; left: 1rem; right: 1rem;
  height: auto;
  background: rgba(15,10,35,0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding: 0.5rem 0.5rem;
  border-radius: 2rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}
@media (min-width: 1024px) {
  .bottom-nav.admin-bottom-nav {
    display: none;
  }
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.5rem;
  border-radius: 1.5rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex: 1;
  position: relative;
  overflow: hidden;
}
.nav-item svg { width: 22px; height: 22px; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.nav-item.active { 
  color: #fff; 
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}
.nav-item.active svg { transform: translateY(-2px); filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.nav-item:hover:not(.active) { color: #fff; background: rgba(255, 255, 255, 0.08); transform: translateY(-2px); }

/* ── FLASH ALERTS ────────────────────────────────────────────── */
.flash {
  margin: 0.75rem 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideDown 0.3s ease;
}
.flash-success { background: rgba(16,185,129,0.18); border: 1px solid rgba(16,185,129,0.35); color: #34d399; }
.flash-error   { background: rgba(239,68,68,0.18);  border: 1px solid rgba(239,68,68,0.35);  color: #f87171; }
.flash-warning { background: rgba(245,158,11,0.18); border: 1px solid rgba(245,158,11,0.35); color: #fbbf24; }
.flash-info    { background: rgba(59,130,246,0.18); border: 1px solid rgba(59,130,246,0.35); color: #93c5fd; }

/* ── DIVIDER ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--glass-border); margin: 1.25rem 0; }

/* ── SPINNER ─────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: linear-gradient(160deg, #1e0f42, #0d234f);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem 1.25rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-handle {
  width: 40px; height: 4px;
  background: var(--glass-border);
  border-radius: 2px;
  margin: 0 auto 1.25rem;
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }

/* ── ANIMATIONS ──────────────────────────────────────────────── */
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes slideDown { from { opacity:0; transform: translateY(-10px); } to { opacity:1; transform: translateY(0); } }
@keyframes fadeUp    { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }
@keyframes pulse     { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes shimmer   { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

.animate-in      { animation: fadeUp 0.5s ease both; }
.animate-in-d1   { animation-delay: 0.05s; }
.animate-in-d2   { animation-delay: 0.10s; }
.animate-in-d3   { animation-delay: 0.15s; }
.animate-in-d4   { animation-delay: 0.20s; }

/* ── AVATAR ──────────────────────────────────────────────────── */
.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── UTILITIES ───────────────────────────────────────────────── */
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-sm     { font-size: 0.85rem; }
.text-xs     { font-size: 0.75rem; }
.font-bold   { font-weight: 700; }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.w-full  { width: 100%; }
.hidden  { display: none !important; }
.sr-only { position: absolute; width:1px; height:1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); }

/* ── PROFILE HEADER ──────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem 1rem 0;
}
.profile-header .name { font-size: 1.05rem; font-weight: 700; }
.profile-header .role {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 2px; }

/* ── RESPONSIVE BASE & LAYOUT ─────────────────────────────────── */
.mobile-wrapper {
  /* Used for staff pages to keep them mobile-sized */
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 6rem; /* extra padding for floating nav */
}
.mobile-wrapper .bottom-nav {
  width: calc(100% - 2rem);
  max-width: 440px;
  left: 50%;
  transform: translateX(-50%);
}

.admin-wrapper {
  display: flex;
  min-height: 100vh;
  padding-bottom: var(--nav-height);
}

.admin-sidebar {
  display: none; /* Hidden on mobile */
  width: 260px;
  background: rgba(15,10,35,0.85);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(30px);
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 110;
}

.admin-main {
  flex: 1;
  width: 100%;
}

.admin-container {
  max-width: 1200px;
  margin: 0 auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 2rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 2rem;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
}

.sidebar-link:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(37,99,235,0.2));
  border: 1px solid rgba(124,58,237,0.3);
  color: var(--primary-light);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
}

@media (min-width: 1024px) {
  .admin-wrapper {
    padding-bottom: 0;
    padding-left: 260px;
  }
  .admin-sidebar {
    display: flex;
  }
  .page-header {
    padding: 2.5rem 2rem 1.5rem;
  }
  .page-content {
    padding: 0 2rem 2.5rem;
  }
}

/* ── OVERLAY WARNING ─────────────────────────────────────────── */
.device-warning {
  position: fixed;
  inset: 0;
  background: var(--grad-start);
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.2), transparent 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  text-align: center;
  padding: 2rem;
}
.device-warning svg {
  width: 80px; height: 80px;
  color: var(--primary-light);
  margin-bottom: 1.5rem;
  animation: pulse 2s infinite;
}
.device-warning h1 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: #fff;
}
.device-warning p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin-bottom: 2rem;
}
