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

:root {
  /* Core Base Colors */
  --surface: #ffffff;
  --bg-app: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  /* Text Accents */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  /* Brand/Primary (Deep Royal Indigo for Healthcare SaaS) */
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  
  /* Status Colors */
  --success-bg: #ecfdf5;
  --success-text: #059669;
  --danger-bg: #fef2f2;
  --danger-text: #dc2626;
  --warning-bg: #fffbeb;
  --warning-text: #d97706;
  
  /* Shadows & Geometry */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

body.theme-black {
    /* ✨ Premium AMOLED Midnight (High Contrast) ✨ */
    --bg-app: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --border-light: #475569;
    --brand-50: rgba(99, 102, 241, 0.15);
    --brand-100: rgba(139, 92, 246, 0.25);
    --brand-500: #818cf8;
    --brand-600: #818cf8;
    --brand-700: #6d28d9;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --text-light: #94a3b8;
    --success-bg: rgba(16, 185, 129, 0.15);
    --success-text: #34d399;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --danger-text: #fca5a5;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --warning-text: #fcd34d;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.8);
}

/* Base Reset */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Cairo', sans-serif; }
body { background: var(--bg-app); color: var(--text-main); -webkit-font-smoothing: antialiased; line-height: 1.5; font-size: 14px; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button, input { font-family: inherit; outline: none; }

/* 🖌️ Typography Micro-Classes */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.uppercase-tracking { text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.75rem; font-weight: 700; color: var(--text-light); }

/* 🔘 Bespoke Buttons */
.btn { 
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; 
    border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 600; 
    cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    padding: 0.625rem 1.25rem; border: 1px solid transparent; 
}
.btn-primary { background: var(--brand-600); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-700); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text-main); box-shadow: var(--shadow-sm); }
.btn-outline:hover { background: var(--bg-app); border-color: var(--text-light); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--border-light); color: var(--text-main); }

.btn-danger-ghost { background: transparent; color: var(--danger-text); border: 1px solid transparent; }
.btn-danger-ghost:hover { background: var(--danger-bg); border-color: #fca5a5; }

/* Lucide Icon Sizing */
.lucide { width: 1.125rem; height: 1.125rem; stroke-width: 2.2px; }
.lucide-lg { width: 1.5rem; height: 1.5rem; stroke-width: 2px; }

/* 📝 Forms */
.input-label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--text-main); margin-bottom: 0.5rem; text-align: right; }
.input-field { 
    width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); 
    padding: 0.75rem 1rem; font-size: 0.95rem; color: var(--text-main); 
    background: var(--surface); transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.input-field:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.input-field::placeholder { color: var(--text-light); }

/* 🏗️ Shared Layouts */
.auth-layout { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--bg-app); }
.auth-card { 
    background: var(--surface); width: 100%; max-width: 440px; 
    border-radius: var(--radius-lg); padding: 3rem 2.5rem; 
    box-shadow: var(--shadow-lg); border: 1px solid var(--border-light); text-align: center;
}
.auth-brand { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; background: var(--brand-50); color: var(--brand-600); border-radius: var(--radius-lg); margin-bottom: 1.5rem; }

/* 🎛️ Admin Dashboard Grid System (Precision UI) */
.app-layout { display: flex; min-height: 100vh; }

.app-sidebar { 
    width: 280px; background: var(--surface); border-left: 1px solid var(--border); 
    display: flex; flex-direction: column; z-index: 10;
}
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 0.75rem; color: var(--brand-600); font-size: 1.25rem; font-weight: 800; }
.sidebar-nav { padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.nav-item { 
    display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; 
    border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 600; 
    transition: all 0.2s; cursor: pointer; border: none; background: transparent; width: 100%; text-align: right; font-size: 0.95rem; text-decoration: none;
}
.nav-item:hover { background: var(--border-light); color: var(--text-main); }
.nav-item.active { background: var(--brand-50); color: var(--brand-700); }
.nav-item.active .lucide { color: var(--brand-600); }
.sidebar-footer { padding: 1.5rem; border-top: 1px solid var(--border-light); }

.app-main { flex: 1; display: flex; flex-direction: column; overflow-y: auto; background: var(--bg-app); }
.main-header { 
    padding: 2rem 3rem; background: var(--surface); border-bottom: 1px solid var(--border); 
    display: flex; justify-content: space-between; align-items: flex-end; position: sticky; top: 0; z-index: 5;
}
.header-title h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; letter-spacing: -0.01em; }
.header-title p { font-size: 0.875rem; color: var(--text-muted); }

.dashboard-content { padding: 2.5rem 3rem; display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.5rem; max-width: 1600px; margin: 0 auto; width: 100%; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; overflow: hidden; }
.panel-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; background: var(--surface); }
.panel-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--text-main); font-size: 1rem; }
.panel-title .lucide { color: var(--text-muted); }
.panel-body { padding: 1.5rem; flex: 1; }

.badge { background: var(--brand-100); color: var(--brand-700); padding: 0.25rem 0.75rem; border-radius: 999px; font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums;}

/* Grid Assignments */
.col-span-8 { grid-column: span 8; }
.col-span-4 { grid-column: span 4; }
.col-span-12 { grid-column: span 12; }

/* Specialized Panel: Serving (Hero Widget) */
.serving-hero { text-align: center; padding: 2rem 1.5rem; }
.serving-hero .label { font-size: 0.875rem; color: var(--text-muted); font-weight: 600; margin-bottom: 1rem; }
.serving-hero .number { font-size: 4.5rem; font-weight: 800; color: var(--brand-600); line-height: 1; margin-bottom: 1rem; font-variant-numeric: tabular-nums; letter-spacing: -0.05em; }
.serving-hero .name { font-size: 1.5rem; font-weight: 700; color: var(--text-main); margin-bottom: 2rem; }
.serving-actions { display: flex; gap: 1rem; padding: 1.5rem; border-top: 1px solid var(--border-light); background: var(--bg-app); }

/* Specialized Panel: Lists */
.data-list { display: flex; flex-direction: column; }
.data-row { 
    display: flex; align-items: center; justify-content: space-between; 
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-light); transition: background 0.15s;
}
.data-row:last-child { border-bottom: none; }
.data-row:hover { background: var(--bg-app); }
.row-info { display: flex; align-items: center; gap: 1rem; }
.row-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-50); color: var(--brand-600); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; }
.row-name { font-weight: 600; font-size: 0.95rem; color: var(--text-main); }
.row-meta { font-size: 0.75rem; color: var(--text-muted); }
/* 📺 Display Module (Apple Event Aesthetic / Dashboard Twin) */
.tv-layout { height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-app);}

.tv-header { padding: 2rem 4rem; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); background: var(--surface); z-index: 10;}
.tv-brand { display: flex; align-items: center; gap: 1rem; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text-main); }

.tv-body { flex: 1; display: flex; padding: 2.5rem 3rem; gap: 2.5rem; }
.tv-main { flex: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 4rem; box-shadow: var(--shadow-sm); }
.tv-sidebar { flex: 1; background: var(--surface); padding: 3rem; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

.tv-serving-label { text-transform: uppercase; font-weight: 700; letter-spacing: 0.2em; color: var(--text-muted); margin-bottom: 2rem;}
.tv-massive-num { font-size: 15rem; font-weight: 800; line-height: 0.9; color: var(--brand-600); letter-spacing: -0.06em; margin-bottom: 2rem;}

.tv-massive-name { font-size: 4rem; font-weight: 700; color: var(--text-main); letter-spacing: -0.02em; }

.tv-sidebar-title { font-size: 1.25rem; font-weight: 700; color: var(--text-main); margin-bottom: 2rem; display: flex; align-items: center; gap: 0.75rem;}

.tv-wait-list { display: flex; flex-direction: column; gap: 1.5rem; }
.tv-wait-item { display: flex; align-items: center; gap: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border-light); }
.tv-wait-item:last-child { border-bottom: none; }
.tv-wait-num { font-size: 1.5rem; font-weight: 800; color: var(--brand-600); width: 60px; height: 60px; background: var(--brand-50); border-radius: 50%; display: flex; align-items: center; justify-content: center;}

.tv-wait-name { font-size: 1.5rem; font-weight: 600; color: var(--text-main); }

/* Simple Alerts */
.feedback-toast { margin-top: 1rem; padding: 0.75rem; border-radius: var(--radius-sm); background: var(--success-bg); color: var(--success-text); font-size: 0.875rem; font-weight: 600; display: none; text-align: center;}

/* ===========================================================
   📱 FULL RESPONSIVENESS (Desktops, Tablets, Smartphones) 📱 
   =========================================================== */

/* 💻 Large Tablets (iPad Pro) & Small Laptops [1024px] */
@media (max-width: 1024px) {
    .dashboard-content { padding: 2rem; grid-template-columns: 1fr; }
    .col-span-8, .col-span-4 { grid-column: span 12; }
    
    .tv-body { flex-direction: column; padding: 2rem; gap: 1.5rem; }
    .tv-main { padding: 3rem; }
    .tv-massive-num { font-size: 10rem !important; }
    .tv-massive-name { font-size: 3rem !important; }
}

/* 📱 Standard Tablets & Large Phones [768px] */
@media (max-width: 768px) {
    /* Main App Layout */
    .app-layout { flex-direction: column; }
    .app-sidebar { width: 100%; border-left: none; border-bottom: 1px solid var(--border); }
    .sidebar-header { justify-content: center; padding: 1.25rem; border-bottom: 1px dashed var(--border-light); }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: 1rem; gap: 0.5rem; justify-content: center; }
    .nav-item { width: auto; flex: 1 1 calc(50% - 1rem); justify-content: center; text-align: center; font-size: 0.85rem; padding: 0.85rem;}
    .sidebar-footer { padding: 1rem; display: flex; justify-content: center; }

    /* Main Header */
    .main-header { padding: 1.5rem; flex-direction: column; align-items: stretch; text-align: center; gap: 1.25rem; position: static; }
    .header-actions { flex-direction: column !important; gap: 0.5rem !important; }
    .header-actions .btn { width: 100%; justify-content: center; }

    /* Dashboard Widgets */
    .dashboard-content { padding: 1.5rem 1rem; }
    .serving-hero .number { font-size: 3.5rem; }
    .serving-hero .name { font-size: 1.25rem; }
    
    /* SuperAdmin Fixes */
    #create-clinic-form { grid-template-columns: 1fr !important; }
    
    /* TV Layout */
    .tv-header { padding: 1.5rem; flex-direction: column; align-items: center; gap: 0.75rem; text-align: center; }
    .tv-header > div { text-align: center !important; }
    .tv-body { padding: 1rem; gap: 1rem; }
    .tv-main { padding: 2rem; }
    .tv-massive-num { font-size: 7rem !important; margin-bottom: 1rem; }
    .tv-massive-name { font-size: 2rem !important; }
    .tv-sidebar { padding: 1.5rem; }
    .tv-wait-num { width: 45px; height: 45px; font-size: 1.25rem;}
    .tv-wait-name { font-size: 1.25rem;}
}

/* 📱 Small Smartphones [480px] */
@media (max-width: 480px) {
    body { font-size: 13px; }
    
    .auth-card { padding: 2.5rem 1.5rem !important; margin: 1rem; width: auto;}
    
    .nav-item { flex: 1 1 100%; } /* Stack buttons vertical on very small screens */
    
    .panel-header { padding: 1rem; flex-direction: column; align-items: center; gap: 0.75rem; text-align: center; }
    .badge { margin-top: 0.5rem; }
    
    .tv-massive-num { font-size: 5rem !important; }
    .tv-massive-name { font-size: 1.5rem !important; }
    
    /* Data Lists */
    .data-row { flex-direction: column; text-align: center; gap: 1rem; padding: 1rem; }
    .row-info { flex-direction: column; width: 100%; text-align: center;}
    .row-avatar { margin: 0 auto; }
}
