/* css/style.css */

:root {
    /* Healthcare Palette */
    --medical-blue: #2563eb;
    --sidebar-bg: #3b82f6;
    --bg-slate: #f8fafc;
    --white: #ffffff;
    
    /* Semantic Colors */
    --success: #10b981;
    --danger: #ef4444;
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    /* Layout Variables */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-slate);
    color: var(--text-main);
    display: flex; 
    height: 100vh;
    overflow: hidden; /* Fixes the screen to the viewport */
}

/* --- Master Shell --- */

.main-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.fixed-header {
    height: var(--header-height);
    background: var(--white);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

/* This is the magic for fixed-screen scrolling */
.scrollable-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 32px;
}

/* --- Global Components --- */

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    background: transparent;
}

.nav-link:hover {
    background: rgba(96, 165, 250, 0.25);
    color: var(--white);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border-left: 4px solid #fff;
    padding-left: 10px; /* account for border */
    box-shadow: inset 4px 0 0 #fff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.stat-card.urgent {
    border-color: #fecaca;
    background: #fff5f5;
}

.progress-bg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #eee;
}

.progress-fill {
    height: 100%;
    background: var(--danger);
    transition: width 1s ease-in-out;
}

/* css/style.css */
:root {
    --medical-blue: #2563eb;
    --sidebar-bg: #3b82f6;
    --bg-slate: #f8fafc;
    --white: #ffffff;
    --text-main: #1e293b;
    --border: #e2e8f0;
    --radius: 12px;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden; /* Fixes sidebar and header */
}

.main-sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    flex-shrink: 0;
    padding: 20px;
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.fixed-header {
    height: 70px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 30px;
    display: flex;
    align-items: center;
}

.scrollable-area {
    flex-grow: 1;
    overflow-y: auto; /* Only this area scrolls */
    padding: 30px;
}

/* Responsive breakpoints */
@media (max-width: 1024px) {
    body {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .main-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 16px;
        position: relative;
    }

    .content-wrapper {
        width: 100%;
    }

    .fixed-header {
        padding: 0 16px;
    }

    .scrollable-area {
        padding: 16px;
    }
}

@media (max-width: 1024px) {
    body {
        overflow: auto;
    }

    aside#sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.25s ease-in-out;
        z-index: 40;
        box-shadow: 4px 0 14px rgba(0,0,0,0.25);
    }

    aside#sidebar.sidebar-visible {
        transform: translateX(0) !important;
    }

    aside#sidebar.sidebar-hidden {
        transform: translateX(-100%) !important;
    }

    main,
    .content-wrapper,
    .main-sidebar {
        width: 100%;
        margin-left: 0;
    }

    .fixed-header {
        justify-content: space-between;
        padding: 0 12px;
    }

    .scrollable-area {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    /* Patients table responsive  */
    .overflow-x-auto table {
        min-width: 640px;
    }

    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }

    .overflow-x-auto table tbody td {
        padding: 12px;
    }

    @media (min-width: 768px) {
        .overflow-x-auto table tbody td {
            padding: 16px 24px;
        }
    }

    /* Patient table row and cell styling */
    .table-row {
        transition: background-color 0.2s ease;
        cursor: pointer;
    }

    .table-row:hover {
        background-color: #f1f5f9;
    }

    .table-cell-name {
        font-weight: 700;
        color: #1e293b;
    }

    .table-cell-id {
        color: #64748b;
        font-family: monospace;
    }

    .table-cell-action {
        text-align: right;
    }

    .table-cell-empty {
        color: #64748b;
    }

    .status-badge {
        display: inline-block;
        background-color: #e0f2fe;
        color: #0369a1;
        padding: 4px 8px;
        border-radius: 9999px;
        font-size: 9px;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: -0.025em;
    }

    @media (min-width: 768px) {
        .status-badge {
            padding: 4px 12px;
            font-size: 10px;
        }
    }


@media (max-width: 640px) {
    .fixed-header {
        height: auto;
        flex-wrap: wrap;
        gap: 12px;
    }

    .content-wrapper {
        padding-bottom: 20px;
    }

    .scrollable-area {
        padding: 10px;
    }
}

@media (min-width: 1025px) {
    aside#sidebar {
        position: static;
        width: 260px;
        height: auto;
        transform: none !important;
        box-shadow: none;
    }

    main,
    .content-wrapper,
    .main-sidebar {
        width: auto;
        margin-left: 0;
    }

    .fixed-header {
        padding: 0 32px;
    }
}
