/* =============================================
   SANSUN ADMIN PANEL — Premium Styling
   ============================================= */

:root {
  --white: #ffffff;
  --off-white: #f8f9fc;
  --light-bg: #f1f3f8;
  --grey-100: #e8eaf0;
  --grey-200: #d1d5e0;
  --grey-300: #a0a8be;
  --grey-400: #6b7394;
  --grey-500: #4a5168;
  --dark: #1a1d2e;
  --accent-start: #4f8cff;
  --accent-end: #7c5cfc;
  --accent-glow: rgba(79, 140, 255, 0.35);
  --accent-glow-strong: rgba(79, 140, 255, 0.55);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.1);
  --orange: #f59e0b;
  --orange-bg: rgba(245, 158, 11, 0.1);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --purple: #8b5cf6;
  --purple-bg: rgba(139, 92, 246, 0.1);
  --blue-bg: rgba(79, 140, 255, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.08);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-full: 999px;
  --font-primary: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --sidebar-width: 260px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-primary);
  background: var(--light-bg);
  color: var(--grey-500);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; transition: var(--transition-smooth); }
button { cursor: pointer; border: none; font-family: inherit; transition: var(--transition-smooth); }
input, select, textarea { font-family: inherit; border: none; outline: none; }

.hidden { display: none !important; }

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
}

/* ========== BUTTONS ========== */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  color: var(--white); border-radius: var(--radius-full);
  font-weight: 600; font-size: 0.9rem;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.glow-btn { box-shadow: 0 4px 20px var(--accent-glow); }

.btn-outline {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  background: var(--white); color: var(--grey-500);
  border-radius: var(--radius-full); font-weight: 600; font-size: 0.85rem;
  border: 1.5px solid var(--grey-200);
}
.btn-outline:hover { border-color: var(--accent-start); color: var(--accent-start); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  background: var(--red); color: var(--white);
  border-radius: var(--radius-full); font-weight: 600; font-size: 0.85rem;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 8px 18px; font-size: 0.82rem; }
.full-width { width: 100%; justify-content: center; }

/* ========== FORM ========== */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label {
  font-size: 0.78rem; font-weight: 600; color: var(--grey-400);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form-input {
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--off-white); border: 1.5px solid var(--grey-100);
  font-size: 0.9rem; color: var(--dark); transition: var(--transition-smooth);
}
.form-input:focus {
  border-color: var(--accent-start);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.1);
  background: var(--white);
}

/* ===================================================
   LOGIN SCREEN
   =================================================== */
.admin-login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 20%, rgba(79, 140, 255, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(124, 92, 252, 0.06) 0%, transparent 50%),
    var(--light-bg);
  padding: 24px;
}

.login-card {
  max-width: 420px; width: 100%;
  padding: 48px 40px; text-align: center;
  background: rgba(255,255,255,0.8);
}

.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 28px;
}
.login-logo .logo-icon { font-size: 2rem; }
.logo-brand { font-size: 1.4rem; font-weight: 900; color: var(--dark); letter-spacing: 2px; display: block; }
.logo-sub { font-size: 0.68rem; color: var(--grey-400); letter-spacing: 1.5px; text-transform: uppercase; display: block; }

.login-card h2 { font-size: 1.5rem; font-weight: 800; color: var(--dark); margin-bottom: 6px; }
.login-desc { font-size: 0.9rem; color: var(--grey-400); margin-bottom: 28px; }
.login-hint { font-size: 0.82rem; color: var(--red); margin-top: 12px; min-height: 20px; }

.login-card .form-group { text-align: left; }

/* ===================================================
   DASHBOARD LAYOUT
   =================================================== */
.admin-dashboard {
  display: flex; min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.admin-sidebar {
  width: var(--sidebar-width); min-height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--grey-100);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 20px; border-bottom: 1px solid var(--grey-100);
}
.sidebar-header .logo-icon { font-size: 1.5rem; }
.sidebar-header .logo-brand { font-size: 1.1rem; }

.sidebar-nav {
  flex: 1; padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500; color: var(--grey-500);
}
.nav-item:hover { background: var(--off-white); color: var(--dark); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.1), rgba(124, 92, 252, 0.08));
  color: var(--accent-start); font-weight: 600;
}
.nav-item span { font-size: 1.1rem; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--grey-100);
  display: flex; flex-direction: column; gap: 4px;
}

/* ---------- MAIN ---------- */
.admin-main {
  flex: 1; margin-left: var(--sidebar-width);
  padding: 0 32px 32px;
  min-height: 100vh;
}

/* ---------- TOPBAR ---------- */
.admin-topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 0; margin-bottom: 8px;
  border-bottom: 1px solid var(--grey-100);
  position: sticky; top: 0;
  background: rgba(241, 243, 248, 0.9);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  z-index: 50;
}

.sidebar-toggle {
  display: none; background: transparent;
  font-size: 1.4rem; color: var(--dark); padding: 4px;
}

.topbar-title {
  flex: 1; font-size: 1.4rem; font-weight: 800; color: var(--dark);
}

.topbar-actions { display: flex; gap: 8px; }

/* ---------- SECTIONS ---------- */
.admin-section { display: none; animation: fadeIn 0.3s ease; }
.admin-section.active { display: block; }

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

/* ===================================================
   STAT CARDS
   =================================================== */
.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 20px; margin-bottom: 28px;
}

.stat-card {
  display: flex; align-items: center; gap: 16px;
  padding: 24px;
}

.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.stat-icon.blue { background: var(--blue-bg); }
.stat-icon.green { background: var(--green-bg); }
.stat-icon.orange { background: var(--orange-bg); }
.stat-icon.purple { background: var(--purple-bg); }

.stat-info { display: flex; flex-direction: column; }
.stat-val { font-size: 1.8rem; font-weight: 900; color: var(--dark); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--grey-400); margin-top: 4px; }

/* ===================================================
   PANELS & TABLES
   =================================================== */
.content-grid {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.panel { padding: 24px; }

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.panel-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--dark); }
.panel-header a { font-size: 0.85rem; font-weight: 600; color: var(--accent-start); }

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table thead th {
  padding: 12px 14px; text-align: left;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--grey-300);
  border-bottom: 1px solid var(--grey-100);
  white-space: nowrap;
}
.data-table tbody tr {
  transition: background 0.2s;
}
.data-table tbody tr:hover { background: var(--off-white); }
.data-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--grey-100);
  color: var(--grey-500); white-space: nowrap;
}
.data-table td:first-child { font-weight: 700; color: var(--dark); font-size: 0.82rem; }

/* Status Badges */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600;
}
.status-pending { background: var(--orange-bg); color: var(--orange); }
.status-confirmed { background: var(--blue-bg); color: var(--accent-start); }
.status-in-progress { background: var(--purple-bg); color: var(--purple); }
.status-completed { background: var(--green-bg); color: var(--green); }
.status-cancelled { background: var(--red-bg); color: var(--red); }

/* Action Buttons */
.action-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--off-white); border: 1px solid var(--grey-100);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: var(--grey-400);
  margin-right: 4px;
}
.action-btn:hover { border-color: var(--accent-start); color: var(--accent-start); }

/* Empty State */
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--grey-300);
}
.empty-state span { font-size: 2.5rem; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ===================================================
   QUICK STATS LIST (Overview Sidebar)
   =================================================== */
.quick-stats-list {
  display: flex; flex-direction: column; gap: 0;
}
.qs-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--grey-100);
}
.qs-item:last-child { border-bottom: none; }
.qs-label { font-size: 0.85rem; color: var(--grey-400); }
.qs-value { font-size: 0.88rem; font-weight: 700; color: var(--dark); }

/* ===================================================
   FILTERS BAR
   =================================================== */
.filters-bar {
  display: flex; align-items: flex-end; gap: 16px;
  padding: 20px 24px; margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 0.7rem; font-weight: 600; color: var(--grey-400); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-group select,
.filter-group input {
  padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--off-white); border: 1px solid var(--grey-100);
  font-size: 0.85rem; color: var(--grey-500); min-width: 150px;
}

/* ===================================================
   TODAY'S VIEW
   =================================================== */
.today-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.today-col h4 {
  font-size: 0.9rem; font-weight: 700; color: var(--dark);
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 2px solid var(--grey-100);
}
.today-slot-list { display: flex; flex-direction: column; gap: 10px; }

.today-booking-card {
  padding: 16px; border-radius: var(--radius-sm);
  background: var(--off-white); border: 1px solid var(--grey-100);
  transition: var(--transition-smooth);
}
.today-booking-card:hover {
  border-color: var(--accent-start);
  box-shadow: 0 4px 16px rgba(79, 140, 255, 0.1);
}
.today-booking-card .tbc-name { font-weight: 700; color: var(--dark); font-size: 0.9rem; }
.today-booking-card .tbc-info { font-size: 0.8rem; color: var(--grey-400); margin-top: 2px; }
.today-booking-card .tbc-status { margin-top: 8px; }
.today-empty { text-align: center; padding: 24px; color: var(--grey-300); font-size: 0.85rem; }

/* ===================================================
   SETTINGS
   =================================================== */
.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.settings-grid .panel:last-child { grid-column: 1 / -1; }
.settings-form { padding-top: 4px; }
.settings-desc { font-size: 0.85rem; color: var(--grey-400); margin-bottom: 12px; }
.danger-text { color: var(--red); }

.settings-form label input[type="checkbox"] {
  margin-right: 8px; accent-color: var(--accent-start);
}

/* ===================================================
   BOOKING DETAIL MODAL
   =================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26, 29, 46, 0.4);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease; padding: 24px;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-content {
  max-width: 540px; width: 100%; padding: 36px;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.active .modal-content { transform: scale(1); }

.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--off-white); color: var(--grey-400);
  font-size: 1rem; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--grey-100); color: var(--dark); }

.booking-detail-modal { position: relative; }
.booking-detail-modal h3 {
  font-size: 1.2rem; font-weight: 800; color: var(--dark); margin-bottom: 24px;
}

.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 24px;
}
.detail-item { display: flex; flex-direction: column; }
.detail-item .d-label { font-size: 0.72rem; font-weight: 600; color: var(--grey-300); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-item .d-value { font-size: 0.9rem; font-weight: 600; color: var(--dark); margin-top: 2px; }
.detail-item.full-span { grid-column: 1 / -1; }

.detail-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 16px; border-top: 1px solid var(--grey-100);
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .today-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open { transform: translateX(0); }

  .admin-main {
    margin-left: 0; padding: 0 16px 24px;
  }

  .sidebar-toggle { display: block; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-val { font-size: 1.4rem; }

  .filters-bar {
    flex-direction: column; align-items: stretch;
  }
  .filter-group select,
  .filter-group input { min-width: auto; width: 100%; }

  .topbar-actions { flex-wrap: wrap; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
}

/* ===================================================
   SCROLLBAR
   =================================================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--off-white); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-start), var(--accent-end));
  border-radius: var(--radius-full);
}
