/* ============================================================
   SmartCare Hospital Management System - Main Stylesheet
   Color Scheme: Professional Blue + White
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --primary:        #1565C0;
    --primary-dark:   #0D47A1;
    --primary-light:  #1976D2;
    --accent:         #00ACC1;
    --accent-light:   #E0F7FA;
    --success:        #2E7D32;
    --warning:        #F57F17;
    --danger:         #C62828;
    --bg:             #F0F4F8;
    --sidebar-w:      260px;
    --navbar-h:       64px;
    --white:          #ffffff;
    --text:           #1A2B3C;
    --text-muted:     #607D8B;
    --border:         #DEE2E6;
    --shadow:         0 2px 12px rgba(21,101,192,0.10);
    --shadow-lg:      0 8px 30px rgba(21,101,192,0.15);
    --radius:         12px;
    --radius-sm:      8px;
    --transition:     all 0.25s ease;
}

/* --- Base Reset --- */
*, *::before, *::after { box-sizing: border-box; }

html {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.hms-navbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    height: var(--navbar-h);
    box-shadow: 0 2px 20px rgba(13,71,161,0.4);
    z-index: 1050;
}

.brand-icon {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: white;
}

.brand-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: white;
    letter-spacing: -0.3px;
}

.role-badge {
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.3);
}

.nav-icon-btn {
    cursor: pointer;
    padding: 4px;
}

.notif-dot {
    position: absolute;
    top: 2px; right: 2px;
    width: 8px; height: 8px;
    background: #FF5722;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.user-avatar {
    width: 34px; height: 34px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: white;
    font-size: 0.85rem;
    border: 2px solid rgba(255,255,255,0.4);
}

.user-btn { background: none; border: none; padding: 0; }
.user-btn:focus { box-shadow: none; }
.sidebar-toggle-btn { padding: 6px; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.hms-sidebar {
    position: fixed;
    top: var(--navbar-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--navbar-h));
    background: var(--white);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 1040;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(0,0,0,0.05);
}

.sidebar-header {
    padding: 20px 20px 8px;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.sidebar-nav {
    padding: 6px 10px;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1px;
    transition: var(--transition);
}

.sidebar-link:hover {
    background: #EBF3FF;
    color: var(--primary);
}

.sidebar-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(21,101,192,0.35);
}

.sidebar-icon {
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border);
}

/* Scrollbar styling for sidebar */
.hms-sidebar::-webkit-scrollbar { width: 4px; }
.hms-sidebar::-webkit-scrollbar-track { background: transparent; }
.hms-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.hms-main {
    margin-left: var(--sidebar-w);
    margin-top: var(--navbar-h);
    min-height: calc(100vh - var(--navbar-h));
    transition: margin-left 0.3s ease;
}

.content-area {
    padding: 4px 28px 28px 28px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.page-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 3px 0 0;
}

/* ============================================================
   STATS CARDS
   ============================================================ */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--card-color, var(--primary));
    border-radius: 4px 0 0 4px;
}

.stat-card-blue   { --card-color: #1565C0; }
.stat-card-green  { --card-color: #2E7D32; }
.stat-card-orange { --card-color: #E65100; }
.stat-card-teal   { --card-color: #00838F; }
.stat-card-purple { --card-color: #6A1B9A; }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    background: var(--icon-bg, #EBF3FF);
    color: var(--icon-color, var(--primary));
}

.stat-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin: 6px 0 2px;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-change {
    font-size: 0.78rem;
    font-weight: 600;
}

.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   CARDS (general)
   ============================================================ */
.hms-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.hms-card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.hms-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hms-card-body {
    padding: 18px;
}

/* ============================================================
   TABLES
   ============================================================ */
.hms-table-wrap { overflow-x: auto; }

.hms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.hms-table thead th {
    background: #F8FAFF;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.hms-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #F0F4F8;
    color: var(--text);
    vertical-align: middle;
}

.hms-table tbody tr:last-child td { border-bottom: none; }

.hms-table tbody tr:hover td {
    background: #F8FAFF;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}

.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    padding: 8px 12px;
    color: var(--text);
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
    outline: none;
}

.input-group-text {
    background: #F8FAFF;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 18px;
    box-shadow: 0 4px 12px rgba(21,101,192,0.3);
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(21,101,192,0.4);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
}
.btn-outline-primary:hover { background: var(--primary); color: white; }

.btn-success { background: var(--success); border: none; font-weight: 600; }
.btn-success:hover { background: #1B5E20; }

.btn-danger { background: var(--danger); border: none; font-weight: 600; }
.btn-danger:hover { background: #AD1457; }

.btn-warning { background: var(--warning); border: none; font-weight: 600; color: white; }
.btn-warning:hover { background: #E65100; }

.btn-secondary { background: #9E9E9E; border: none; font-weight: 600; color: white; }
.btn-secondary:hover { background: #757575; }

.action-btns .btn { margin: 0 2px; }

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.88rem;
    transition: var(--transition);
    background: white;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.1);
    background: white;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group {
    margin-bottom: 16px;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    background: #F8FAFC;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ============================================================
   TABLES
   ============================================================ */
.hms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.hms-table thead {
    background: #F8FAFC;
}

.hms-table th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 700;
    color: var(--text);
    border-bottom: 2px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hms-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.hms-table tbody tr:hover {
    background: #F8FAFC;
}

.hms-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    font-size: 0.73rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.badge.bg-success { background: var(--success) !important; }
.badge.bg-danger { background: var(--danger) !important; }
.badge.bg-warning { background: var(--warning) !important; }
.badge.bg-info { background: var(--accent) !important; }
.badge.bg-secondary { background: #9E9E9E !important; }

/* ============================================================
   FLASH ALERT
   ============================================================ */
.flash-alert {
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.hms-breadcrumbs {
    background: white;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.hms-breadcrumbs .breadcrumb {
    margin: 0;
    background: transparent;
}

.hms-breadcrumbs .breadcrumb-item {
    font-size: 0.85rem;
}

.hms-breadcrumbs .breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.hms-breadcrumbs .breadcrumb-item a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.hms-breadcrumbs .breadcrumb-item.active {
    color: var(--text);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.hms-breadcrumbs .breadcrumb-item + .breadcrumb-item::before {
    content: " / ";
    color: var(--text-muted);
    padding: 0 8px;
}

/* ============================================================
   PROFILE CARD
   ============================================================ */
.profile-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    height: 120px;
    position: relative;
}

.profile-info-section {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.profile-info-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.profile-info-value {
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 500;
}

/* ============================================================
   PATIENT / DOCTOR AVATAR
   ============================================================ */
.patient-avatar, .doctor-avatar {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem;
    color: white;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-card-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--accent) 100%);
    padding: 40px 30px;
    text-align: center;
    color: white;
}

.profile-avatar-lg {
    width: 100px; height: 100px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.5);
    object-fit: cover;
    margin-bottom: 14px;
}

.profile-avatar-placeholder {
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 4px solid rgba(255,255,255,0.5);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; color: white;
    margin: 0 auto 14px;
}

.info-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.info-row:last-child { border-bottom: none; }
.info-label { width: 180px; color: var(--text-muted); font-weight: 500; flex-shrink: 0; }
.info-value { color: var(--text); font-weight: 600; }

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-box {
    position: relative;
}

.search-box .bi-search {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-box input {
    padding-left: 36px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 14px 20px;
}

.modal-title { font-weight: 700; font-size: 1rem; }
.btn-close-white { filter: brightness(0) invert(1); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 40%, var(--accent) 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.login-logo {
    width: 68px; height: 68px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; color: white;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(21,101,192,0.35);
}

.login-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 1.6rem;
    color: var(--text);
    text-align: center;
    margin-bottom: 6px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 28px;
}

.login-tab-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 6px;
    transition: var(--transition);
}

.login-tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow);
}

.login-tabs-wrap {
    background: #F0F4F8;
    border-radius: 10px;
    padding: 4px;
    display: flex;
    margin-bottom: 24px;
}

/* ============================================================
   INVOICE / PRESCRIPTION PRINT
   ============================================================ */
@media print {
    .hms-navbar, .hms-sidebar, .hms-main > .content-area > .page-header .btn,
    .no-print { display: none !important; }
    .hms-main { margin-left: 0 !important; margin-top: 0 !important; }
    .content-area { padding: 0 !important; }
    .print-card { border: none !important; box-shadow: none !important; }
}

.invoice-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 30px;
    border-radius: var(--radius) var(--radius) 0 0;
}

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container {
    position: relative;
    padding: 10px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .hms-sidebar {
        transform: translateX(-100%);
    }

    .hms-sidebar.show {
        transform: translateX(0);
        z-index: 1045;
    }

    .hms-main {
        margin-left: 0;
    }

    .content-area {
        padding: 16px;
    }
}

@media (max-width: 575.98px) {
    .stat-value { font-size: 1.6rem; }
    .page-title { font-size: 1.2rem; }
    .login-card { padding: 28px 20px; }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-primary-custom { color: var(--primary) !important; }
.bg-primary-custom { background: var(--primary) !important; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 3.5rem; margin-bottom: 12px; opacity: 0.3; }
.empty-state h5 { font-weight: 600; margin-bottom: 6px; }
.empty-state p  { font-size: 0.875rem; }

.time-slot-btn {
    font-size: 0.82rem;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: white;
    transition: var(--transition);
    margin: 3px;
}

.time-slot-btn:hover, .time-slot-btn.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.time-slot-btn.booked {
    background: #F0F4F8;
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: var(--border);
    text-decoration: line-through;
}

/* Medicine rows in prescription */
.medicine-row { background: #F8FAFF; border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; }