/* assets/css/style.css */

/* Import Outfit font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

/* Global Variables & Colors */
:root {
    --font-sans: 'Outfit', sans-serif;
    
    /* Core Harmonies (Sleek Dark Mode by default) */
    --bg-app: #0f172a;       /* Deep Slate/Navy */
    --bg-card: #1e293b;      /* Muted Slate Card */
    --bg-input: #334155;     /* Soft Grey-Blue Input */
    --bg-sidebar: rgba(30, 41, 59, 0.75); /* Dark Glass */
    --border-color: rgba(255, 255, 255, 0.08);
    
    /* Primary Accent: Dynamic HSL Sky/Royal Blue */
    --primary: 14, 165, 233;   /* #0ea5e9 - vibrant celestial blue */
    --primary-rgb: rgb(var(--primary));
    --primary-hover: rgba(var(--primary), 0.85);
    --primary-light: rgba(var(--primary), 0.15);
    
    /* Text Color */
    --text-white: #f8fafc;
    --text-grey: #cbd5e1;
    --text-muted: #64748b;
    
    /* System Alerts */
    --success: 34, 197, 94;     /* #22c55e - Green */
    --danger: 239, 68, 68;      /* #ef4444 - Red */
    --warning: 245, 158, 11;    /* #f59e0b - Amber */
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 15px rgba(var(--primary), 0.45);
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* Light Theme Variables */
body.light-mode {
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --bg-sidebar: rgba(255, 255, 255, 0.95); /* Light Glass */
    --border-color: rgba(15, 23, 42, 0.08);
    --text-white: #0f172a;
    --text-grey: #334155;
    --text-muted: #64748b;
    --primary-light: rgba(var(--primary), 0.08);
}

/* Reset & Base Elements */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

body.light-mode * {
    scrollbar-color: rgba(0,0,0,0.15) transparent;
}

body {
    background-color: var(--bg-app);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
    transition: var(--transition-smooth);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 99px;
}
body.light-mode ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

a {
    text-decoration: none;
    color: inherit;
}

button, input, select, textarea {
    outline: none;
    border: none;
    background: none;
}

/* Dynamic Entrance Splash Page */
.splash-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    padding: 20px;
    text-align: center;
}

.splash-logo {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    color: #fff;
    background: linear-gradient(45deg, #0ea5e9, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    animation: pulseGlow 2.5s infinite alternate;
}

.splash-subtitle {
    color: var(--text-grey);
    font-size: 1.15rem;
    font-weight: 400;
    max-width: 480px;
    margin-bottom: 30px;
    line-height: 1.5;
}

.splash-btn {
    background: var(--primary-rgb);
    color: #fff;
    padding: 16px 36px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.splash-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 25px rgba(var(--primary), 0.7);
}

/* Select Role Options View */
.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    max-width: 900px;
    width: 100%;
    margin-top: 30px;
}

.role-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.role-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 4px;
    background: var(--primary-rgb);
    transform: scaleX(0);
    transition: var(--transition-smooth);
}

.role-card:hover {
    transform: translateY(-5px);
    border-color: rgba(var(--primary), 0.4);
    box-shadow: var(--shadow-lg);
}

.role-card:hover::after {
    transform: scaleX(1);
}

.role-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--primary-light);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    color: var(--primary-rgb);
    font-size: 1.8rem;
}

.role-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 6px;
}

.role-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
}

/* Authentication Views (Login & Register) */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 460px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text-white);
    margin-bottom: 6px;
}

.auth-logo span {
    color: var(--primary-rgb);
}

.auth-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 20px;
    min-width: 0;         /* critical for grid overflow prevention */
    width: 100%;
    box-sizing: border-box;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-grey);
    margin-bottom: 8px;
}

.input-container {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px 16px;
    transition: var(--transition-fast);
    width: 100%;          /* always full width of parent cell */
    box-sizing: border-box;
    min-width: 0;         /* allow flex cell to shrink below content size */
    overflow: hidden;     /* clip long placeholder text */
}

.input-container:focus-within {
    border-color: var(--primary-rgb);
    box-shadow: 0 0 0 3px rgba(var(--primary), 0.2);
}

.input-container i {
    color: var(--text-muted);
    margin-right: 12px;
    font-size: 1.15rem;
}

.input-field {
    flex: 1;
    background: none;
    color: var(--text-white);
    font-size: 0.95rem;
    font-weight: 500;
    min-width: 0;       /* critical: allows flex child to shrink below content */
    width: 100%;
    box-sizing: border-box;
}

.input-field::placeholder {
    color: var(--text-muted);
}

/* Professional Autofill and Input overrides */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text-white) !important;
    caret-color: var(--text-white) !important;
    transition: background-color 5000s ease-in-out 0s;
}

select.input-field option {
    background-color: var(--bg-card);
    color: var(--text-white);
}

/* Password Toggle Eye Icon styling */
.toggle-password {
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-fast);
    margin-left: 8px;
    font-size: 1.15rem;
}

.toggle-password:hover {
    color: var(--primary-rgb) !important;
}

.auth-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    margin-bottom: 24px;
    font-size: 0.85rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-grey);
}

.remember-me input {
    accent-color: var(--primary-rgb);
}

.forgot-link {
    color: var(--primary-rgb);
    font-weight: 600;
}

.forgot-link:hover {
    text-decoration: underline;
}

.auth-btn {
    width: 100%;
    background: var(--primary-rgb);
    color: #fff;
    padding: 14px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.auth-btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-glow);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary-rgb);
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Unified Dynamic Dashboard Portal Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;   /* prevent horizontal bleed-out */
    position: relative;
}

/* Glassmorphic Sidebar styling */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition-smooth);
    box-shadow: 4px 0 24px rgba(0,0,0,0.02);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 10px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-rgb), #2563eb);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 1.4rem;
    box-shadow: 0 4px 12px rgba(var(--primary), 0.3);
}

.sidebar-brand-name {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-white);
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;        /* menu scrolls independently */
    overflow-x: hidden;
    padding-bottom: 4px;     /* small gap before footer */
    -webkit-overflow-scrolling: touch;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-grey);
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.sidebar-link i {
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

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

.sidebar-link:hover i {
    color: var(--primary-rgb);
}

.sidebar-link.active {
    background: var(--primary-rgb);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.sidebar-link.active i {
    color: #fff;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 12px;
    flex-shrink: 0;          /* never shrink — always visible */
    position: sticky;        /* sticks at bottom of its flex parent */
    bottom: 0;
    background: var(--bg-sidebar); /* matches sidebar bg */
    backdrop-filter: blur(10px);
    z-index: 2;
}

/* Logout button: always show icon, show text when space allows */
.sidebar-footer .sidebar-link {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-icon {
    flex-shrink: 0; /* icon never collapses */
}

/* ============================================================
   SIDEBAR HOSPITAL SWITCHER — Facebook Pages Style
   ============================================================ */
.sidebar-hospital-switcher {
    margin: 12px 0;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    flex-shrink: 0;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.sidebar-switcher-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sidebar-switcher-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-switcher-label i {
    color: var(--primary-rgb);
    font-size: 0.85rem;
}

.sidebar-switcher-add-btn {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary-rgb);
    border: 1px solid rgba(var(--primary), 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-switcher-add-btn:hover {
    background: var(--primary-rgb);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(var(--primary), 0.4);
}

/* Horizontal scrollable circles row */
.sidebar-clinic-circles {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 4px 2px 8px;
    scrollbar-width: none;    /* hide scrollbar Firefox */
    -ms-overflow-style: none; /* hide scrollbar IE */
}
.sidebar-clinic-circles::-webkit-scrollbar {
    display: none;
}

/* Individual clinic circle */
.clinic-circle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 52px;
    max-width: 60px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-tap-highlight-color: transparent;
}

.clinic-circle-item:hover {
    transform: translateY(-3px) scale(1.05);
}

.clinic-circle-item:active {
    transform: scale(0.93);
}

/* The avatar circle */
.clinic-circle-avatar {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a5f, #0ea5e9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
    border: 2.5px solid rgba(255,255,255,0.1);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    overflow: visible;
}

/* Active state — glowing blue ring like Facebook */
.clinic-circle-item.active .clinic-circle-avatar {
    border-color: rgb(var(--primary));
    box-shadow:
        0 0 0 3px rgba(var(--primary), 0.25),
        0 0 12px rgba(var(--primary), 0.4);
    background: linear-gradient(135deg, #0c4a6e, #0ea5e9);
}

/* Checkmark badge for active clinic */
.clinic-circle-check {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgb(var(--primary));
    border: 2px solid var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* Switching spinner state */
.clinic-circle-item.switching .clinic-circle-avatar::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgb(var(--primary));
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Clinic name label */
.clinic-circle-name {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clinic-circle-item.active .clinic-circle-name {
    color: rgb(var(--primary));
    font-weight: 700;
}

/* Empty state */
.clinic-circle-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    line-height: 1.4;
}

.clinic-circle-empty i {
    font-size: 1.4rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Dashboard Main Workspace */
.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    max-width: calc(100vw - 280px);
    overflow-x: hidden;
    transition: var(--transition-smooth);
}

/* Header Navbar */
.header-nav {
    height: 80px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 99;
    overflow: hidden;
    min-width: 0;
    gap: 12px;
    box-sizing: border-box;
    width: 100%;
}

.nav-toggle-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.user-welcome {
    display: flex;
    flex-direction: column;
}

.user-welcome-greet {
    font-size: 1.25rem;
    font-weight: 700;
}

.user-welcome-role {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}

.theme-toggle-btn {
    background: var(--primary-light);
    color: var(--primary-rgb);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition-fast);
}

.theme-toggle-btn:hover {
    transform: scale(1.05);
}

.notification-bell {
    position: relative;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-light);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-rgb);
    font-size: 1.2rem;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: rgb(var(--danger));
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--bg-card);
}

.profile-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 12px;
    transition: var(--transition-fast);
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}

.profile-widget:hover {
    background: var(--bg-input);
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-rgb);
}

.profile-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    min-width: 0;
}

/* Page Workspace Panels */
.workspace-panel {
    padding: 30px;
    flex: 1;
    animation: fadeIn 0.4s ease;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    min-width: 0;
}

/* Cards & Grid Utilities */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: rgb(var(--primary));
    border-radius: 4px 0 0 4px;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.35);
}

.stat-info {
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
    transition: var(--transition-smooth);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-white);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--primary-light);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-rgb);
    font-size: 1.35rem;
    border: 1px solid rgba(var(--primary), 0.2);
    box-shadow: 0 8px 20px -6px rgba(var(--primary), 0.4);
    transition: var(--transition-smooth);
    z-index: 1;
}

.stat-card:hover .stat-icon {
    transform: scale(1.12) rotate(4deg);
}

/* Variant Styles - Accent Borders & Gradients */
.stat-card:not(.success-card):not(.warning-card):not(.danger-card) {
    background: linear-gradient(135deg, rgba(var(--primary), 0.08), rgba(var(--primary), 0.02));
    border-color: rgba(var(--primary), 0.15);
}
.stat-card:not(.success-card):not(.warning-card):not(.danger-card):hover {
    border-color: rgba(var(--primary), 0.35);
    box-shadow: 0 12px 30px -10px rgba(var(--primary), 0.25);
}

.stat-card.success-card::before {
    background: rgb(var(--success));
}
.stat-card.success-card {
    background: linear-gradient(135deg, rgba(var(--success), 0.08), rgba(var(--success), 0.02));
    border-color: rgba(var(--success), 0.15);
}
.stat-card.success-card:hover {
    border-color: rgba(var(--success), 0.35);
    box-shadow: 0 12px 30px -10px rgba(var(--success), 0.25);
}
.stat-card.success-card .stat-label {
    color: rgba(var(--success), 0.85);
}
.stat-card.success-card .stat-icon {
    background: rgba(var(--success), 0.12);
    color: rgb(var(--success));
    border-color: rgba(var(--success), 0.2);
    box-shadow: 0 8px 20px -6px rgba(var(--success), 0.4);
}

.stat-card.warning-card::before {
    background: rgb(var(--warning));
}
.stat-card.warning-card {
    background: linear-gradient(135deg, rgba(var(--warning), 0.08), rgba(var(--warning), 0.02));
    border-color: rgba(var(--warning), 0.15);
}
.stat-card.warning-card:hover {
    border-color: rgba(var(--warning), 0.35);
    box-shadow: 0 12px 30px -10px rgba(var(--warning), 0.25);
}
.stat-card.warning-card .stat-label {
    color: rgba(var(--warning), 0.85);
}
.stat-card.warning-card .stat-icon {
    background: rgba(var(--warning), 0.12);
    color: rgb(var(--warning));
    border-color: rgba(var(--warning), 0.2);
    box-shadow: 0 8px 20px -6px rgba(var(--warning), 0.4);
}

.stat-card.danger-card::before {
    background: rgb(var(--danger));
}
.stat-card.danger-card {
    background: linear-gradient(135deg, rgba(var(--danger), 0.08), rgba(var(--danger), 0.02));
    border-color: rgba(var(--danger), 0.15);
}
.stat-card.danger-card:hover {
    border-color: rgba(var(--danger), 0.35);
    box-shadow: 0 12px 30px -10px rgba(var(--danger), 0.25);
}
.stat-card.danger-card .stat-label {
    color: rgba(var(--danger), 0.85);
}
.stat-card.danger-card .stat-icon {
    background: rgba(var(--danger), 0.12);
    color: rgb(var(--danger));
    border-color: rgba(var(--danger), 0.2);
    box-shadow: 0 8px 20px -6px rgba(var(--danger), 0.4);
}

/* Light Theme overrides for global stat-cards */
body.light-mode .stat-card {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}
body.light-mode .stat-card:not(.success-card):not(.warning-card):not(.danger-card) {
    background: linear-gradient(135deg, rgba(var(--primary), 0.07), rgba(var(--primary), 0.02));
}
body.light-mode .stat-card.success-card {
    background: linear-gradient(135deg, rgba(var(--success), 0.07), rgba(var(--success), 0.02));
}
body.light-mode .stat-card.warning-card {
    background: linear-gradient(135deg, rgba(var(--warning), 0.07), rgba(var(--warning), 0.02));
}
body.light-mode .stat-card.danger-card {
    background: linear-gradient(135deg, rgba(var(--danger), 0.07), rgba(var(--danger), 0.02));
}

/* Responsive Table */
.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    min-width: 0;         /* allow card to shrink in grid */
    box-sizing: border-box;
    overflow: hidden;
}

.panel-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    padding: 16px 20px;
    background: var(--bg-input);
    color: var(--text-white);
    font-weight: 700;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.custom-table th:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}
.custom-table th:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.custom-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-grey);
}

.custom-table tr:hover td {
    background: var(--primary-light);
    color: var(--text-white);
}

.status-pill {
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

.status-pill.active, .status-pill.paid, .status-pill.available, .status-pill.completed {
    background: rgba(var(--success), 0.15);
    color: rgb(var(--success));
}

.status-pill.pending, .status-pill.unpaid, .status-pill.used {
    background: rgba(var(--warning), 0.15);
    color: rgb(var(--warning));
}

.status-pill.suspended, .status-pill.expired, .status-pill.cancelled, .status-pill.occupied {
    background: rgba(var(--danger), 0.15);
    color: rgb(var(--danger));
}

/* Actions Buttons & UI Controls */
.action-btn-row {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.action-btn.edit {
    background: rgba(var(--primary), 0.15);
    color: var(--primary-rgb);
}
.action-btn.edit:hover {
    background: var(--primary-rgb);
    color: #fff;
}

.action-btn.delete {
    background: rgba(var(--danger), 0.15);
    color: rgb(var(--danger));
}
.action-btn.delete:hover {
    background: rgb(var(--danger));
    color: #fff;
}

.action-btn.view {
    background: rgba(var(--success), 0.15);
    color: rgb(var(--success));
}
.action-btn.view:hover {
    background: rgb(var(--success));
    color: #fff;
}

.btn-primary {
    background: var(--primary-rgb);
    color: #fff;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-ghost {
    background: var(--primary-light);
    color: var(--primary-rgb);
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-ghost:hover {
    background: rgba(var(--primary), 0.25);
}

/* Modals & Overlays */
.overlay-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideUp 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
}

/* Loading Skeletal and Loaders */
.loader-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--bg-input);
    border-top: 4px solid var(--primary-rgb);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Search Bar Wrapper */
.search-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    align-items: center;
}

.search-box-wrap {
    flex: 1;
    min-width: 260px;
}

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

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulseGlow {
    0% { text-shadow: 0 0 10px rgba(var(--primary), 0.3); }
    100% { text-shadow: 0 0 25px rgba(var(--primary), 0.7); }
}


/* ============================================================
   MOBILE BOTTOM TAB NAVIGATION
   Hidden on desktop, visible only ≤ 991px
   ============================================================ */
.mobile-bottom-tabs {
    display: none; /* hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 200;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
    /* Tabs distributed evenly */
    justify-content: space-around;
    align-items: center;
}

.bottom-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #64748b;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: color 0.2s ease, transform 0.15s ease;
    padding: 6px 4px;
    -webkit-tap-highlight-color: transparent;
}

.bottom-tab-item i {
    font-size: 1.15rem;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.bottom-tab-item.active {
    color: rgb(var(--primary));
}

.bottom-tab-item.active i {
    transform: translateY(-2px) scale(1.1);
    color: rgb(var(--primary));
    filter: drop-shadow(0 0 6px rgba(var(--primary), 0.5));
}

.bottom-tab-item:active {
    transform: scale(0.93);
}

/* Body scroll lock when sidebar is open on mobile */
body.sidebar-open {
    overflow: hidden;
}

/* ============================================================
   BREAKPOINT 1 — Tablet/Small Laptop: ≤ 991px
   ============================================================ */
@media (max-width: 991px) {
    /* Sidebar: full-height slide-in overlay — no layout shift */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;        /* dvh = dynamic viewport height (handles mobile browser chrome) */
        width: 260px;
        transform: translateX(-110%);
        z-index: 100;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;      /* sidebar scrolls independently */
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 80px;  /* Push footer above mobile bottom tabs */
    }

    /* Sidebar is 100% isolated — does NOT cause page scroll */
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6);
    }

    /* Main content: full width — sidebar is layered on top, not beside */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        min-width: 0 !important;
    }

    /* Show hamburger toggle */
    .nav-toggle-btn {
        display: flex !important;
    }

    /* Bottom tabs visible on mobile/tablet */
    .mobile-bottom-tabs {
        display: flex;
    }

    /* Main content gains bottom padding so content isn't hidden behind tab bar */
    .workspace-panel {
        padding-bottom: 80px;
    }

    /* Header: constrain right side items to prevent overflow */
    .header-nav {
        padding: 0 14px;
        gap: 10px;
    }

    .header-right {
        gap: 8px;
        flex-shrink: 0;
    }

    /* Hide the "No Active Hospital" verbose message on small screens */
    .header-right > div[style*="No Active Hospital"] {
        display: none !important;
    }

    /* Profile name in header: hide on tablet and below */
    .profile-name {
        display: none !important;
    }

    /* Stats grid: 2 columns on tablet */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Pricing grid: 2 columns */
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================================
   BREAKPOINT 2 — Large Phone Landscape / Small Tablet: ≤ 768px
   ============================================================ */
@media (max-width: 768px) {
    /* Header overflow containment */
    .header-nav {
        padding: 0 10px;
        gap: 8px;
        height: 58px;
        min-height: 58px;
    }

    .user-welcome {
        max-width: 120px;
    }

    .user-welcome-greet {
        font-size: 0.8rem !important;
    }

    .user-welcome-role {
        font-size: 0.65rem !important;
    }

    /* Hospital switcher: shrink on small screens */
    .header-right select {
        max-width: 110px;
        font-size: 0.75rem !important;
    }

    /* Stats grid: 2 columns */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px;
    }

    /* Panel cards: full width */
    .panel-card {
        padding: 16px;
    }

    /* Tables: horizontal scroll on small screens */
    .data-table-wrapper,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Main panel padding reduction */
    .workspace-panel {
        padding: 16px 14px 84px;
    }

    /* Auth pages */
    .auth-container {
        padding: 16px;
    }

    .auth-card {
        padding: 28px 20px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Modal fixes */
    .modal-card {
        padding: 20px 16px !important;
        margin: 10px !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Inline grids collapse — catch all common multi-column patterns */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 2fr"],
    div[style*="grid-template-columns: 2fr 1fr"],
    div[style*="grid-template-columns: 1.2fr"],
    div[style*="grid-template-columns: 0.8fr"],
    div[style*="grid-template-columns: repeat(2"],
    div[style*="grid-template-columns: repeat(3"],
    div[style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr !important;
    }

    /* Pricing grid: 1 column */
    .pricing-grid {
        grid-template-columns: 1fr !important;
    }

    /* Flex rows that overflow: wrap them */
    .header-right {
        flex-wrap: nowrap;
        max-width: calc(100vw - 160px);
        overflow: hidden;
    }
}

/* ============================================================
   BREAKPOINT 3 — Mobile Portrait: ≤ 576px
   ============================================================ */
@media (max-width: 576px) {
    /* Hide greeting text, keep just the role pill */
    .user-welcome-greet {
        display: none !important;
    }

    .user-welcome-role {
        font-size: 0.7rem !important;
        font-weight: 700;
    }

    /* Stats grid: 1 column on very small phones */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }

    /* Stat card compact */
    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* Full-width buttons inside modals */
    .modal-card button,
    .modal-card .btn-primary,
    .modal-card .btn-ghost {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Stack flex rows of buttons vertically */
    .modal-card div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    /* Inputs: 16px prevents iOS zoom */
    .input-field,
    input, select, textarea {
        font-size: 16px !important;
    }

    /* Panel heading size reduction */
    .workspace-panel h2,
    .workspace-panel h3 {
        font-size: 1.2rem !important;
    }

    /* Table cells compact */
    td, th {
        padding: 8px 10px !important;
        font-size: 0.78rem !important;
    }

    /* Workspace panel inner padding */
    .workspace-panel {
        padding: 12px 10px 84px !important;
    }

    /* Notif overlay on mobile: full-screen */
    #notif-overlay {
        padding: 0 !important;
        align-items: flex-end !important;
    }

    #notif-overlay .modal-card {
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        margin: 0 !important;
        padding: 24px 16px !important;
    }
}

/* ============================================================
   BREAKPOINT 4 — Tiny Phone: ≤ 400px (Galaxy Z Fold, small)
   ============================================================ */
@media (max-width: 400px) {
    /* Sidebar narrower on tiny screens */
    .sidebar {
        width: 230px !important;
    }

    /* Bottom tab text: smaller */
    .bottom-tab-item {
        font-size: 0.52rem;
    }

    .bottom-tab-item i {
        font-size: 1rem;
    }

    /* Stats: single column */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Header: hide toggle label text */
    .user-welcome {
        display: none !important;
    }

    /* Header nav logo area */
    .header-nav {
        padding: 0 8px;
    }

    /* Workspace reduction */
    .workspace-panel {
        padding: 10px 8px 80px !important;
    }

    /* Action buttons */
    .btn-primary, .btn-ghost {
        padding: 10px 14px !important;
        font-size: 0.82rem !important;
    }

    /* Panel card padding */
    .panel-card {
        padding: 12px 10px;
    }
}

/* ============================================================
   BREAKPOINT 5 — Ultra Tiny: ≤ 320px
   ============================================================ */
@media (max-width: 320px) {
    .sidebar {
        width: 200px !important;
    }

    .bottom-tab-item span {
        display: none; /* icon only on ultra-tiny */
    }

    .bottom-tab-item {
        height: 56px;
    }

    .bottom-tab-item i {
        font-size: 1.2rem;
    }

    .mobile-bottom-tabs {
        height: 56px;
    }

    .workspace-panel {
        padding-bottom: 70px !important;
    }
}

/* ============================================================
   GLOBAL SUPPORT CHAT WIDGET
   ============================================================ */
.support-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.6rem;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    z-index: 9999999;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.support-widget-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.5);
}

.support-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 550px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    z-index: 9999998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9) translateY(20px);
}

.support-chat-window.open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

.support-chat-header {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.support-chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.support-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-rgb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
}

.support-chat-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
}

.support-chat-info p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.support-chat-close {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.support-chat-close:hover {
    color: #ef4444;
}

.support-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(15, 23, 42, 0.4);
}

.chat-msg {
    max-width: 85%;
    display: flex;
    flex-direction: column;
}

.chat-msg.sent {
    align-self: flex-end;
}

.chat-msg.received {
    align-self: flex-start;
}

.chat-msg-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-msg.sent .chat-msg-bubble {
    background: var(--primary-rgb);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg.received .chat-msg-bubble {
    background: var(--bg-input);
    color: var(--text-white);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.chat-msg-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
    align-self: flex-end;
}

.chat-msg.received .chat-msg-time {
    align-self: flex-start;
}

/* Attachments */
.chat-attachment {
    margin-top: 8px;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
}
.chat-attachment img, .chat-attachment video {
    max-width: 100%;
    border-radius: 8px;
    display: block;
}
.chat-attachment a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    padding: 8px 12px;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
}

/* Typing Indicator */
.chat-typing-indicator {
    display: none;
    align-self: flex-start;
    background: var(--bg-input);
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}
.chat-typing-indicator.active {
    display: flex;
    gap: 4px;
}
.chat-typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}
.chat-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.support-chat-input-area {
    padding: 16px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 12px;
}

.chat-input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 0.9rem;
    resize: none;
    max-height: 80px;
    padding: 6px 0;
}
.chat-input-wrapper textarea:focus { outline: none; }

.chat-attach-btn {
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    font-size: 1.1rem;
    transition: color 0.2s;
}
.chat-attach-btn:hover { color: var(--primary-rgb); }

.chat-send-btn {
    background: var(--primary-rgb);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.2s, background 0.2s;
}
.chat-send-btn:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.chat-preview-area {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: rgba(14, 165, 233, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--primary-rgb);
}

/* Mobile Responsive Chat */
@media (max-width: 576px) {
    .support-chat-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        transform: translateY(100%);
    }
    .support-chat-window.open {
        transform: translateY(0);
    }
    .support-widget-btn {
        bottom: 80px; /* Above bottom tabs */
        right: 16px;
    }
}

/* ============================================================
   KPI METRIC SUMMARY CARDS (Dashboard Panel)
   ============================================================ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: transparent;
    border-radius: 4px 0 0 4px;
    transition: var(--transition-smooth);
}

.metric-card:hover {
    transform: translateY(-5px);
}

.metric-info {
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.metric-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
    transition: var(--transition-smooth);
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1;
    margin-bottom: 4px;
}

.metric-subtext {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.2px;
}

.metric-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.35rem;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    z-index: 1;
}

.metric-card:hover .metric-icon {
    transform: scale(1.12) rotate(4deg);
}

/* Variant Styles - Dark Mode Gradients */
.metric-card.primary-card {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(14, 165, 233, 0.02));
    border-color: rgba(14, 165, 233, 0.15);
}
.metric-card.primary-card::before {
    background: rgb(14, 165, 233);
}
.metric-card.primary-card .metric-label {
    color: rgba(14, 165, 233, 0.85);
}
.metric-card.primary-card .metric-icon {
    background: rgba(14, 165, 233, 0.12);
    color: rgb(14, 165, 233);
    border-color: rgba(14, 165, 233, 0.2);
    box-shadow: 0 8px 20px -6px rgba(14, 165, 233, 0.4);
}
.metric-card.primary-card:hover {
    border-color: rgba(14, 165, 233, 0.35);
    box-shadow: 0 12px 30px -10px rgba(14, 165, 233, 0.25);
}

.metric-card.warning-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.02));
    border-color: rgba(245, 158, 11, 0.15);
}
.metric-card.warning-card::before {
    background: rgb(245, 158, 11);
}
.metric-card.warning-card .metric-label {
    color: rgba(245, 158, 11, 0.85);
}
.metric-card.warning-card .metric-icon {
    background: rgba(245, 158, 11, 0.12);
    color: rgb(245, 158, 11);
    border-color: rgba(245, 158, 11, 0.2);
    box-shadow: 0 8px 20px -6px rgba(245, 158, 11, 0.4);
}
.metric-card.warning-card:hover {
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow: 0 12px 30px -10px rgba(245, 158, 11, 0.25);
}

.metric-card.success-card {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.02));
    border-color: rgba(34, 197, 94, 0.15);
}
.metric-card.success-card::before {
    background: rgb(34, 197, 94);
}
.metric-card.success-card .metric-label {
    color: rgba(34, 197, 94, 0.85);
}
.metric-card.success-card .metric-icon {
    background: rgba(34, 197, 94, 0.12);
    color: rgb(34, 197, 94);
    border-color: rgba(34, 197, 94, 0.2);
    box-shadow: 0 8px 20px -6px rgba(34, 197, 94, 0.4);
}
.metric-card.success-card:hover {
    border-color: rgba(34, 197, 94, 0.35);
    box-shadow: 0 12px 30px -10px rgba(34, 197, 94, 0.25);
}

.metric-card.danger-card {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.02));
    border-color: rgba(239, 68, 68, 0.15);
}
.metric-card.danger-card::before {
    background: rgb(239, 68, 68);
}
.metric-card.danger-card .metric-label {
    color: rgba(239, 68, 68, 0.85);
}
.metric-card.danger-card .metric-icon {
    background: rgba(239, 68, 68, 0.12);
    color: rgb(239, 68, 68);
    border-color: rgba(239, 68, 68, 0.2);
    box-shadow: 0 8px 20px -6px rgba(239, 68, 68, 0.4);
}
.metric-card.danger-card:hover {
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 12px 30px -10px rgba(239, 68, 68, 0.25);
}

/* Light Theme overrides for metric cards */
body.light-mode .metric-card {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}
body.light-mode .metric-card.primary-card {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.07), rgba(14, 165, 233, 0.02));
}
body.light-mode .metric-card.warning-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.07), rgba(245, 158, 11, 0.02));
}
body.light-mode .metric-card.success-card {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.07), rgba(34, 197, 94, 0.02));
}
body.light-mode .metric-card.danger-card {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.07), rgba(239, 68, 68, 0.02));
}
