/* ==========================================================================
   ApexCare Medical Center Management System - Modern UI Design System
   ========================================================================== */

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

:root {
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --primary-light: #ccfbf1;
    --primary-gradient: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
    
    --secondary: #64748b;
    --secondary-light: #f1f5f9;
    
    --accent: #2563eb;
    --accent-light: #dbeafe;
    
    --success: #10b981;
    --success-light: #d1fae5;
    
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    
    --danger: #ef4444;
    --danger-light: #fee2e2;
    
    --info: #06b6d4;
    --info-light: #cffafe;
    
    --dark: #0f172a;
    --dark-card: #1e293b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    
    --sidebar-width: 270px;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: linear-gradient(90deg, #0d9488 0%, #0284c7 100%);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-teal: 0 10px 20px -5px rgba(13, 148, 136, 0.35);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    font-size: 0.925rem;
    line-height: 1.5;
    overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Layout & Sidebar
   -------------------------------------------------------------------------- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: #ffffff;
}

.sidebar-brand-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #ffffff;
    box-shadow: var(--shadow-teal);
}

.sidebar-brand-logo-wrap {
    width: 46px;
    height: 46px;
    background: #ffffff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.sidebar-brand-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-brand-text h4 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.sidebar-brand-text span {
    font-size: 0.725rem;
    color: #0d9488;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #64748b;
    padding: 14px 12px 6px;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #94a3b8;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.885rem;
    transition: all 0.2s ease;
}

.nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: #64748b;
    transition: color 0.2s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.nav-link:hover i {
    color: #0d9488;
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}

.nav-link.active i {
    color: #ffffff;
}

.nav-link .badge {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
}

.sidebar-user {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.725rem;
    color: #0d9488;
    text-transform: capitalize;
    font-weight: 600;
}

/* Main Content Area */
.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header Navbar */
.app-header {
    height: 72px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.header-title-box h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.header-title-box p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Quick Action Badges & Buttons */
.btn-quick-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-teal {
    background: var(--primary);
    color: #ffffff;
    border: 1px solid var(--primary);
}
.btn-teal:hover {
    background: var(--primary-hover);
    color: #ffffff;
    box-shadow: var(--shadow-teal);
    transform: translateY(-1px);
}

.btn-outline-teal {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline-teal:hover {
    background: var(--primary-light);
    color: var(--primary-hover);
}

.app-content {
    flex: 1;
    padding: 28px;
}

.app-footer {
    padding: 18px 28px;
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    font-size: 0.825rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --------------------------------------------------------------------------
   Cards, Widgets & Stat Counters
   -------------------------------------------------------------------------- */
.stat-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 22px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: all 0.25s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

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

.stat-card.primary::before { background: var(--primary); }
.stat-card.accent::before { background: var(--accent); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }

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

.stat-card-title {
    font-size: 0.825rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0;
}

.stat-card-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-card-icon.accent { background: var(--accent-light); color: var(--accent); }
.stat-card-icon.success { background: var(--success-light); color: var(--success); }
.stat-card-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-card-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-card-icon.info { background: var(--info-light); color: var(--info); }

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--dark);
    margin: 0;
    letter-spacing: -0.02em;
}

.stat-card-footer {
    margin-top: 8px;
    font-size: 0.775rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Custom Card */
.card-custom {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-custom-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
}

.card-custom-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-custom-body {
    padding: 24px;
}

/* --------------------------------------------------------------------------
   Tables & Data Presentation
   -------------------------------------------------------------------------- */
.table-custom {
    width: 100%;
    margin-bottom: 0;
}

.table-custom th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table-custom td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.9rem;
}

.table-custom tr:hover td {
    background-color: #f8fafc;
}

/* Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 9999px;
    text-transform: capitalize;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-status.booked { background: #e0e7ff; color: #3730a3; }
.badge-status.booked::before { background: #4f46e5; }

.badge-status.arrived, .badge-status.waiting { background: #fef3c7; color: #92400e; }
.badge-status.arrived::before, .badge-status.waiting::before { background: #f59e0b; }

.badge-status.calling { background: #fed7aa; color: #9a3412; animation: pulseCall 1.5s infinite; }
.badge-status.calling::before { background: #ea580c; }

.badge-status.in_consultation { background: #dbeafe; color: #1e40af; }
.badge-status.in_consultation::before { background: #2563eb; }

.badge-status.completed { background: #d1fae5; color: #065f46; }
.badge-status.completed::before { background: #10b981; }

.badge-status.cancelled, .badge-status.no_show { background: #fee2e2; color: #991b1b; }
.badge-status.cancelled::before, .badge-status.no_show::before { background: #ef4444; }

.badge-status.paid { background: #dcfce7; color: #166534; }
.badge-status.paid::before { background: #22c55e; }

.badge-status.unpaid { background: #fee2e2; color: #991b1b; }
.badge-status.unpaid::before { background: #ef4444; }

@keyframes pulseCall {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

/* --------------------------------------------------------------------------
   Token Number Badges
   -------------------------------------------------------------------------- */
.token-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 800;
    font-size: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(13, 148, 136, 0.2);
}

.token-badge-lg {
    width: 60px;
    height: 60px;
    font-size: 1.6rem;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-teal);
}

/* --------------------------------------------------------------------------
   Queue Display Board (Waiting Room TV Screen)
   -------------------------------------------------------------------------- */
.queue-board-container {
    background: linear-gradient(180deg, #090e17 0%, #111827 100%);
    min-height: 100vh;
    color: #ffffff;
    padding: 24px;
}

.queue-board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 28px;
}

.queue-board-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.queue-board-time {
    text-align: right;
}

.queue-board-time .clock {
    font-size: 2.2rem;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
}

.queue-doctor-card {
    background: rgba(30, 41, 59, 0.75);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transition: all 0.3s ease;
}

.queue-doctor-card.active-calling {
    border-color: #0d9488;
    box-shadow: 0 0 30px rgba(13, 148, 136, 0.4);
    animation: glowCard 2s infinite alternate;
}

@keyframes glowCard {
    from { box-shadow: 0 0 20px rgba(13, 148, 136, 0.3); }
    to { box-shadow: 0 0 35px rgba(13, 148, 136, 0.6); }
}

.queue-token-current {
    font-size: 4rem;
    font-weight: 900;
    color: #2dd4bf;
    line-height: 1;
    text-shadow: 0 0 20px rgba(45, 212, 191, 0.5);
}

.queue-token-next-badge {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #e2e8f0;
    display: inline-block;
    margin-right: 6px;
}

/* --------------------------------------------------------------------------
   Forms & Controls
   -------------------------------------------------------------------------- */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #334155;
    margin-bottom: 6px;
}

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.input-group-text {
    border-radius: var(--radius-sm);
    background: #f8fafc;
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Interactive Medicine Check & Search
   -------------------------------------------------------------------------- */
.medicine-search-box {
    position: relative;
}

.medicine-search-input {
    padding-left: 42px;
    height: 48px;
    font-size: 1rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--primary-light);
}

.medicine-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 1.1rem;
}

.medicine-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    background: #ffffff;
    transition: all 0.2s ease;
}

.medicine-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stock-pill {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}
.stock-pill.in-stock { background: var(--success-light); color: var(--success); }
.stock-pill.low-stock { background: var(--warning-light); color: var(--warning); }
.stock-pill.out-of-stock { background: var(--danger-light); color: var(--danger); }

/* --------------------------------------------------------------------------
   Doctor Consultation Room Layout
   -------------------------------------------------------------------------- */
.consultation-vitals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.vital-input-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    text-align: center;
}

.vital-input-card label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}

.vital-input-card input {
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   Thermal / A4 Printable Receipt Styles
   -------------------------------------------------------------------------- */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .no-print, .app-sidebar, .app-header, .app-footer, .btn, .sidebar-toggle-btn {
        display: none !important;
    }
    .app-main {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .app-content {
        padding: 0 !important;
    }
    .print-area {
        display: block !important;
        width: 100% !important;
    }
    .receipt-thermal {
        width: 80mm !important;
        margin: 0 auto !important;
        padding: 10px !important;
        font-family: 'Courier New', monospace !important;
        font-size: 12px !important;
    }
}

.receipt-thermal {
    max-width: 380px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.receipt-divider {
    border-top: 1px dashed #94a3b8;
    margin: 14px 0;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .sidebar-toggle-btn {
        display: block;
    }
}
