﻿/* =========================================================
   RAPID CARE HMS — HOME DASHBOARD
   Tokens fall back to sensible defaults but read from the same
   --hms-* variables as the sidebar, so the two surfaces feel
   like one product instead of two different white panels.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

.hms-dashboard {
    --primary: var(--hms-primary, #5B4FE5);
    --primary-soft: var(--hms-primary-soft, #EDEBFF);
    --ink: var(--hms-ink, #101827);
    --ink-soft: #667085;
    --border: var(--hms-border, #E7E9F2);
    /* Slightly cool-tinted, distinct from the sidebar's pure white
       so the two surfaces read as separate layers, not one wash. */
    --page-bg: #F2F3FA;
    --surface: #FFFFFF;
    --surface-muted: #F6F6FC;
    --sky-600: #0284C7;
    --sky-100: #E0F2FE;
    --amber-600: #D97706;
    --amber-100: #FEF3C7;
    --rose-600: #E11D48;
    --rose-100: #FFE4E9;
    --emerald-600: #059669;
    --emerald-100: #D1FAE5;
    --violet-600: #7C3AED;
    --violet-100: #EDE9FE;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 11px;
    --shadow-card: 0 1px 2px rgba(16, 24, 39, .04), 0 6px 16px rgba(16, 24, 39, .05);
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--ink);
    background: var(--page-bg);
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

    .hms-dashboard h4,
    .hms-dashboard h5,
    .hms-dashboard h3 {
        font-family: 'Sora', 'Inter', sans-serif;
        color: var(--ink);
    }

    .hms-dashboard .row {
        --bs-gutter-y: 1rem;
    }

    /* =========================================================
   PAGE HEAD — one slim line, no banner
   ========================================================= */

    .hms-dashboard .page-head {
        gap: 12px;
    }

    .hms-dashboard .page-title {
        font-size: 19px;
        font-weight: 700;
        letter-spacing: -.01em;
    }

    .hms-dashboard .page-subtitle {
        display: block;
        margin-top: 2px;
        font-size: 13px;
        color: var(--ink-soft);
    }

    .hms-dashboard .btn-hms-primary,
    .hms-dashboard .btn-hms-outline {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        font-family: 'Inter', sans-serif;
        font-size: 13.5px;
        font-weight: 600;
        border-radius: 10px;
        padding: 8px 16px;
        border: 1px solid transparent;
        transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    }

    .hms-dashboard .btn-hms-primary {
        background: var(--primary);
        color: #fff;
        box-shadow: 0 6px 14px rgba(91, 79, 229, .25);
    }

        .hms-dashboard .btn-hms-primary:hover {
            transform: translateY(-1px);
            color: #fff;
        }

    .hms-dashboard .btn-hms-outline {
        background: var(--surface);
        border-color: var(--border);
        color: var(--ink);
    }

        .hms-dashboard .btn-hms-outline:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

    /* =========================================================
   KPI CARDS — compact, single line of breathing room
   ========================================================= */

    .hms-dashboard .kpi-card {
        display: flex;
        gap: 12px;
        align-items: flex-start;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 16px;
        height: 100%;
        box-shadow: var(--shadow-card);
    }

    .hms-dashboard .kpi-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
        border-radius: 11px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
    }

    .hms-dashboard .kpi-primary .kpi-icon {
        background: var(--primary-soft);
        color: var(--primary);
    }

    .hms-dashboard .kpi-sky .kpi-icon {
        background: var(--sky-100);
        color: var(--sky-600);
    }

    .hms-dashboard .kpi-amber .kpi-icon {
        background: var(--amber-100);
        color: var(--amber-600);
    }

    .hms-dashboard .kpi-rose .kpi-icon {
        background: var(--rose-100);
        color: var(--rose-600);
    }

    .hms-dashboard .kpi-body {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
    }

    .hms-dashboard .kpi-label {
        font-size: 12.5px;
        color: var(--ink-soft);
        font-weight: 500;
    }

    .hms-dashboard .kpi-value {
        font-family: 'Sora', sans-serif;
        font-size: 26px;
        font-weight: 700;
        line-height: 1.15;
    }

    .hms-dashboard .kpi-trend {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        font-weight: 500;
    }

    .hms-dashboard .kpi-trend-up {
        color: var(--emerald-600);
    }

    .hms-dashboard .kpi-trend-neutral {
        color: var(--ink-soft);
    }

    /* =========================================================
   GENERIC CARD
   Cards are flex columns so content can distribute across
   the full card height once Bootstrap's row-stretch gives
   every card in a row the same height — this is what keeps
   a short list from leaving a dead gap under a taller sibling.
   ========================================================= */

    .hms-dashboard .hms-card {
        display: flex;
        flex-direction: column;
        height: 100%;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 16px 18px 18px;
        box-shadow: var(--shadow-card);
    }

    .hms-dashboard .hms-card-head {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 14px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border);
    }

        .hms-dashboard .hms-card-head h5 {
            margin: 0;
            font-size: 15px;
            font-weight: 700;
        }

    .hms-dashboard .card-tag {
        font-size: 11.5px;
        font-weight: 600;
        padding: 3px 9px;
        border-radius: 999px;
        white-space: nowrap;
    }

    .hms-dashboard .card-tag-primary {
        background: var(--primary-soft);
        color: var(--primary);
    }

    .hms-dashboard .card-tag-sky {
        background: var(--sky-100);
        color: var(--sky-600);
    }

    .hms-dashboard .card-tag-rose {
        background: var(--rose-100);
        color: var(--rose-600);
    }

    /* =========================================================
   PATIENT FLOW (signature element)
   ========================================================= */

    .hms-dashboard .flow-card {
        border-radius: var(--radius-lg);
        justify-content: space-between;
    }

    .hms-dashboard .live-tag {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: var(--emerald-100);
        color: var(--emerald-600);
        font-size: 11.5px;
        font-weight: 700;
        padding: 4px 11px;
        border-radius: 999px;
    }

    .hms-dashboard .live-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--emerald-600);
        animation: hms-pulse 1.6s ease-in-out infinite;
    }

@keyframes hms-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .45;
        transform: scale(1.6);
    }
}

.hms-dashboard .flow-track {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin: 4px 0 18px;
}

.hms-dashboard .flow-step {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    white-space: nowrap;
}

    .hms-dashboard .flow-step .mdi {
        font-size: 16px;
    }

.hms-dashboard .flow-done {
    background: var(--primary-soft);
    border-color: transparent;
    color: var(--primary);
}

.hms-dashboard .flow-active {
    background: var(--primary);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 14px rgba(91, 79, 229, .28);
}

.hms-dashboard .flow-rail {
    flex: 1;
    min-width: 20px;
    height: 2px;
    background: var(--border);
    margin: 0 8px;
}

.hms-dashboard .flow-rail-done {
    background: var(--primary);
}

.hms-dashboard .flow-stats-row {
    margin-top: auto;
}

.hms-dashboard .flow-stat {
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}

    .hms-dashboard .flow-stat h3 {
        margin: 0;
        font-size: 23px;
        font-weight: 800;
    }

    .hms-dashboard .flow-stat span {
        display: block;
        margin-top: 3px;
        font-size: 12px;
        color: var(--ink-soft);
    }

/* =========================================================
   CHARTS
   ========================================================= */

.hms-dashboard .chart-card ::deep .apexcharts-canvas {
    margin: 0 auto;
}

.hms-dashboard .chart-card ::deep .apexcharts-legend-text {
    font-family: 'Inter', sans-serif !important;
    font-size: 12px !important;
}

/* =========================================================
   BED MAP
   ========================================================= */

.hms-dashboard .bed-map {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 7px;
    margin-bottom: 14px;
}

.hms-dashboard .bed-cell {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    transition: transform .15s ease;
}

    .hms-dashboard .bed-cell:hover {
        transform: scale(1.08);
    }

.hms-dashboard .bed-free {
    background: var(--emerald-600);
}

.hms-dashboard .bed-occupied {
    background: var(--rose-600);
}

.hms-dashboard .bed-icu {
    background: var(--violet-600);
}

.hms-dashboard .bed-cleaning {
    background: #CBD2E1;
    color: var(--ink-soft);
}

.hms-dashboard .bed-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: auto;
    font-size: 12px;
    color: var(--ink-soft);
}

    .hms-dashboard .bed-legend span {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

.hms-dashboard .bed-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

    .hms-dashboard .bed-dot.bed-free {
        background: var(--emerald-600);
    }

    .hms-dashboard .bed-dot.bed-occupied {
        background: var(--rose-600);
    }

    .hms-dashboard .bed-dot.bed-icu {
        background: var(--violet-600);
    }

    .hms-dashboard .bed-dot.bed-cleaning {
        background: #CBD2E1;
    }

/* =========================================================
   DOCTOR LIST — spreads across the card's full height so a
   4-item list matches a chart's height without a dead gap
   ========================================================= */

.hms-dashboard .doctor-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.hms-dashboard .doctor-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
}

.hms-dashboard .doctor-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    font-weight: 700;
    color: #fff;
}

.hms-dashboard .doctor-avatar-primary {
    background: var(--primary);
}

.hms-dashboard .doctor-avatar-sky {
    background: var(--sky-600);
}

.hms-dashboard .doctor-avatar-violet {
    background: var(--violet-600);
}

.hms-dashboard .doctor-avatar-amber {
    background: var(--amber-600);
}

.hms-dashboard .doctor-info {
    flex: 1;
    min-width: 0;
}

    .hms-dashboard .doctor-info p {
        margin: 0;
        font-size: 13.5px;
        font-weight: 600;
        color: var(--ink);
    }

    .hms-dashboard .doctor-info span {
        font-size: 11.5px;
        color: var(--ink-soft);
    }

.hms-dashboard .doctor-status {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.hms-dashboard .doctor-status-emerald {
    background: var(--emerald-100);
    color: var(--emerald-600);
}

.hms-dashboard .doctor-status-sky {
    background: var(--sky-100);
    color: var(--sky-600);
}

.hms-dashboard .doctor-status-violet {
    background: var(--violet-100);
    color: var(--violet-600);
}

.hms-dashboard .doctor-status-amber {
    background: var(--amber-100);
    color: var(--amber-600);
}

/* =========================================================
   QUICK ACTIONS — fills remaining card height evenly
   ========================================================= */

.hms-dashboard .quick-actions-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
}

.hms-dashboard .quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    transition: border-color .15s ease, transform .15s ease;
}

    .hms-dashboard .quick-action .mdi {
        font-size: 21px;
        color: var(--primary);
    }

    .hms-dashboard .quick-action:hover {
        border-color: var(--primary);
        transform: translateY(-2px);
    }

/* =========================================================
   ALERTS — same fill-the-card treatment as the doctor list
   ========================================================= */

.hms-dashboard .alert-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.hms-dashboard .alert-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 10px 11px;
    border-radius: var(--radius-sm);
}

    .hms-dashboard .alert-item .mdi {
        font-size: 18px;
        margin-top: 1px;
    }

    .hms-dashboard .alert-item p {
        margin: 0;
        font-size: 13px;
        font-weight: 600;
    }

    .hms-dashboard .alert-item span {
        font-size: 11.5px;
        color: var(--ink-soft);
    }

.hms-dashboard .alert-critical {
    background: var(--rose-100);
    color: var(--rose-600);
}

.hms-dashboard .alert-warning {
    background: var(--amber-100);
    color: var(--amber-600);
}

.hms-dashboard .alert-info {
    background: var(--sky-100);
    color: var(--sky-600);
}

/* =========================================================
   ACTIVITY
   ========================================================= */

.hms-dashboard .activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.hms-dashboard .activity-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 4px 2px;
}

.hms-dashboard .activity-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.hms-dashboard .activity-icon-primary {
    background: var(--primary-soft);
    color: var(--primary);
}

.hms-dashboard .activity-icon-emerald {
    background: var(--emerald-100);
    color: var(--emerald-600);
}

.hms-dashboard .activity-icon-sky {
    background: var(--sky-100);
    color: var(--sky-600);
}

.hms-dashboard .activity-icon-violet {
    background: var(--violet-100);
    color: var(--violet-600);
}

.hms-dashboard .activity-item p {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.hms-dashboard .activity-item span {
    font-size: 11.5px;
    color: var(--ink-soft);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 992px) {
    .hms-dashboard .bed-map {
        grid-template-columns: repeat(10, 1fr);
    }
}

@media (max-width: 768px) {
    .hms-dashboard {
        padding: 16px 14px 24px;
    }

        .hms-dashboard .page-title {
            font-size: 17px;
        }

        .hms-dashboard .kpi-value {
            font-size: 22px;
        }

        .hms-dashboard .flow-track {
            flex-direction: column;
            align-items: stretch;
        }

        .hms-dashboard .flow-rail {
            width: 2px;
            height: 14px;
            margin: 2px 0 2px 20px;
        }

        .hms-dashboard .bed-map {
            grid-template-columns: repeat(8, 1fr);
        }
}

@media (max-width: 576px) {
    .hms-dashboard .page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .hms-dashboard .page-head-actions {
        justify-content: stretch;
    }

        .hms-dashboard .page-head-actions .btn {
            flex: 1;
        }

    .hms-dashboard .quick-actions-grid {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }
}
