/* ══════════════════════════════════════════════════════════════
   Exibe.io Admin Panel — Design System
   ══════════════════════════════════════════════════════════════ */

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

/* ── CSS Variables (Design Tokens) ─────────────────────────── */
:root {
  /* Brand */
  --brand-500: #FF6B35;
  --brand-600: #E85520;
  --brand-400: #FF8C60;
  --brand-glow: rgba(255, 107, 53, 0.25);

  /* Neutrals — dark */
  --bg-base:    #0D0F12;
  --bg-surface: #151820;
  --bg-card:    #1C1F27;
  --bg-hover:   #23273200;
  --border:     rgba(255,255,255,0.07);
  --border-md:  rgba(255,255,255,0.12);

  /* Text */
  --text-primary:   #F0F2F5;
  --text-secondary: #8A8FA8;
  --text-muted:     #555A70;

  /* Status */
  --success:   #22C55E;
  --warning:   #F59E0B;
  --danger:    #EF4444;
  --info:      #3B82F6;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --dur:  200ms;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-500); text-decoration: none; }
a:hover { color: var(--brand-400); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 3px; }

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,107,53,0.12) 0%, transparent 70%),
    var(--bg-base);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: slideUp .4s var(--ease) both;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  background: var(--brand-500);
  border-radius: var(--radius-md);
  font-size: 1.75rem;
  margin-bottom: .75rem;
  box-shadow: 0 8px 32px var(--brand-glow);
}
.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
}
.login-logo p { color: var(--text-secondary); font-size: .875rem; margin-top: .25rem; }

/* ══════════════════════════════════════════════════════════════
   ADMIN LAYOUT
   ══════════════════════════════════════════════════════════════ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--brand-500);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 16px var(--brand-glow);
}
.sidebar-logo span {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -.03em;
}

.sidebar-nav {
  padding: 1rem .75rem;
  flex: 1;
}
.sidebar-section-label {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .5rem .5rem .25rem;
  margin-top: .75rem;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.sidebar-nav a .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.sidebar-nav a.active {
  background: rgba(255,107,53,0.12);
  color: var(--brand-500);
}

.sidebar-footer {
  padding: 1rem .75rem;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem;
  border-radius: var(--radius-sm);
}
.sidebar-user .avatar {
  width: 32px; height: 32px;
  background: var(--brand-500);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8125rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user .user-info { overflow: hidden; }
.sidebar-user .user-name { font-size: .8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: .6875rem; color: var(--text-muted); }

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

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 1.125rem; font-weight: 700; }
.topbar-actions { display: flex; gap: .5rem; align-items: center; }

/* Page body */
.page-body {
  padding: 2rem;
  flex: 1;
}

/* ══════════════════════════════════════════════════════════════
   COMPONENTS
   ══════════════════════════════════════════════════════════════ */

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-title { font-size: 1rem; font-weight: 700; }
.card-body { padding: 1.5rem; }

/* Stats grid */
.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-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.stat-icon.orange { background: rgba(255,107,53,.15); color: var(--brand-500); }
.stat-icon.green  { background: rgba(34,197,94,.15);  color: var(--success); }
.stat-icon.blue   { background: rgba(59,130,246,.15); color: var(--info); }
.stat-icon.yellow { background: rgba(245,158,11,.15); color: var(--warning); }

.stat-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -.04em; }
.stat-label { font-size: .8125rem; color: var(--text-secondary); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .5625rem 1.125rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--dur) var(--ease);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand-500);
  color: #fff;
  box-shadow: 0 4px 16px var(--brand-glow);
}
.btn-primary:hover { background: var(--brand-600); color: #fff; transform: translateY(-1px); }

.btn-secondary {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
  border: 1px solid var(--border-md);
}
.btn-secondary:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); }

.btn-danger {
  background: rgba(239,68,68,.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.25);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }
.btn-icon { padding: .5rem; border-radius: var(--radius-sm); }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .4rem;
}
.form-control {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: .625rem .875rem;
  font-size: .875rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  outline: none;
}
.form-control:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: .75rem; }
.toggle-label { font-size: .875rem; color: var(--text-secondary); }
.toggle {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-md);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--dur) var(--ease);
}
.toggle input:checked + .toggle-slider { background: var(--brand-500); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
tbody td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.02); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.badge-success { background: rgba(34,197,94,.15); color: var(--success); }
.badge-danger  { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-info    { background: rgba(59,130,246,.15); color: var(--info); }

/* Alerts */
.alert {
  padding: .875rem 1.125rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 1.5rem;
  border-left: 3px solid;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.alert-success { background: rgba(34,197,94,.08); border-color: var(--success); color: #86efac; }
.alert-danger  { background: rgba(239,68,68,.08); border-color: var(--danger);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,.08); border-color: var(--warning); color: #fcd34d; }
.alert-info    { background: rgba(59,130,246,.08); border-color: var(--info);    color: #93c5fd; }

/* Token box */
.token-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
}
.token-box code {
  flex: 1;
  font-size: .8125rem;
  color: var(--brand-400);
  word-break: break-all;
  font-family: 'Courier New', monospace;
}

/* Image thumb */
.img-thumb {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.img-thumb-lg {
  width: 100px; height: 100px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

/* Upload area */
.upload-area {
  border: 2px dashed var(--border-md);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--brand-500);
  background: rgba(255,107,53,.04);
}
.upload-area input[type=file] { display: none; }
.upload-icon { font-size: 2rem; margin-bottom: .5rem; }
.upload-text { color: var(--text-secondary); font-size: .875rem; }
.upload-text strong { color: var(--brand-500); }

/* Image preview grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}
.image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.image-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s var(--ease);
}
.image-item:hover img { transform: scale(1.05); }
.image-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.image-item:hover .image-item-overlay { opacity: 1; }

/* Weekday tabs */
.weekday-tabs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.weekday-tab {
  padding: .5rem 1rem;
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-md);
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--dur) var(--ease);
}
.weekday-tab:hover { border-color: var(--brand-500); color: var(--brand-500); }
.weekday-tab.active {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
  box-shadow: 0 4px 12px var(--brand-glow);
}

/* Drag handle */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  padding: 0 .25rem;
  font-size: 1rem;
}
.drag-handle:active { cursor: grabbing; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.modal-overlay.open { opacity: 1 !important; pointer-events: auto !important; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 100px rgba(0,0,0,0.6);
  transform: translateY(20px) scale(.97);
  transition: transform var(--dur) var(--ease);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.25rem; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; gap: .75rem; justify-content: flex-end;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .25rem; }
.empty-desc  { font-size: .875rem; }

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.page-header h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; }
.page-header p  { color: var(--text-secondary); font-size: .875rem; margin-top: .2rem; }

/* Animations */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* .page-body > * { animation: fadeIn .3s var(--ease) both; } */

/* Responsive */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); transition: transform var(--dur) var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}

/* Utility */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.text-sm { font-size: .875rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.font-mono { font-family: 'Courier New', monospace; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
