﻿/* ================================================================
   ReferredPatients.css
   Aesthetic: Warm clinical — ivory + deep forest green + terracotta
   Fonts: Cormorant Garamond (display) + Jost (body)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600;700&family=Jost:wght@300;400;500;600&display=swap');

:root {
    --bg: #f7f4ef;
    --surface: #ffffff;
    --surface2: #f0ece4;
    --forest: #2d4a3e;
    --forest-mid: #3d6355;
    --forest-light: #5a8a76;
    --terra: #c4623a;
    --terra-light: #e8855f;
    --gold: #c8983a;
    --sky: #4a7fa5;
    --border: #ddd8ce;
    --text: #2a2420;
    --text-soft: #6b5f55;
    --muted: #9e9088;
    --white: #ffffff;
    --shadow: 0 4px 24px rgba(45,74,62,.12);
    --shadow-lg: 0 12px 48px rgba(45,74,62,.18);
    --radius: 10px;
    --radius-sm: 6px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    font-family: 'Jost', sans-serif;
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

/* ── Page ────────────────────────────────────────────────────── */
.ref-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 28px 80px;
    animation: fadeUp .4s ease both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Header ──────────────────────────────────────────────────── */
.ref-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 36px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--forest);
}

    .ref-header h1 {
        font-family: 'Cormorant Garamond', serif;
        font-size: 2.2rem;
        font-weight: 700;
        color: var(--forest);
        letter-spacing: -.01em;
        line-height: 1.1;
    }

        .ref-header h1 span {
            color: var(--terra);
        }

    .ref-header .sub {
        color: var(--muted);
        font-size: .85rem;
        font-weight: 300;
        margin-top: 4px;
    }

/* ── Summary stat tiles ──────────────────────────────────────── */
.summary-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}

    .stat-tile:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

    .stat-tile .st-icon {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.3rem;
        flex-shrink: 0;
    }

    .stat-tile.referred .st-icon {
        background: rgba(74,127,165,.12);
    }

    .stat-tile.allocated .st-icon {
        background: rgba(200,152,58,.12);
    }

    .stat-tile.assisted .st-icon {
        background: rgba(45,74,62,.12);
    }

    .stat-tile .st-body .st-val {
        font-family: 'Cormorant Garamond', serif;
        font-size: 2rem;
        font-weight: 700;
        line-height: 1;
    }

    .stat-tile.referred .st-val {
        color: var(--sky);
    }

    .stat-tile.allocated .st-val {
        color: var(--gold);
    }

    .stat-tile.assisted .st-val {
        color: var(--forest);
    }

    .stat-tile .st-body .st-label {
        font-size: .72rem;
        font-weight: 600;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--muted);
        margin-top: 2px;
    }

/* ── Filter panel ────────────────────────────────────────────── */
.filter-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 26px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

    .filter-panel .fp-title {
        font-size: .7rem;
        font-weight: 600;
        letter-spacing: .12em;
        text-transform: uppercase;
        color: var(--forest-mid);
        margin-bottom: 16px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .filter-panel .fp-title::before {
            content: '';
            display: inline-block;
            width: 14px;
            height: 2px;
            background: var(--terra);
        }

.filter-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 140px;
}

    .filter-group label {
        font-size: .7rem;
        font-weight: 600;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--text-soft);
    }

    .filter-group input,
    .filter-group select {
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        color: var(--text);
        padding: 9px 13px;
        font-family: 'Jost', sans-serif;
        font-size: .88rem;
        outline: none;
        transition: border-color .2s, box-shadow .2s;
    }

        .filter-group input:focus,
        .filter-group select:focus {
            border-color: var(--forest-mid);
            box-shadow: 0 0 0 3px rgba(61,99,85,.1);
        }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-family: 'Jost', sans-serif;
    font-size: .85rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
    letter-spacing: .02em;
}

.btn-forest {
    background: var(--forest);
    color: var(--white);
}

    .btn-forest:hover {
        background: var(--forest-mid);
        transform: translateY(-1px);
    }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-soft);
}

    .btn-outline:hover {
        border-color: var(--forest);
        color: var(--forest);
    }

.btn-sm {
    padding: 7px 14px;
    font-size: .78rem;
}

/* ── Result count ────────────────────────────────────────────── */
.result-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    font-size: .82rem;
    color: var(--muted);
}

    .result-bar strong {
        color: var(--forest);
    }

/* ── Table ───────────────────────────────────────────────────── */
.ref-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.ref-table {
    width: 100%;
    border-collapse: collapse;
}

    .ref-table thead tr {
        background: var(--forest);
    }

        .ref-table thead tr th {
            text-align: left;
            font-size: .68rem;
            font-weight: 600;
            letter-spacing: .1em;
            text-transform: uppercase;
            color: rgba(255,255,255,.75);
            padding: 13px 16px;
            white-space: nowrap;
        }

    .ref-table tbody tr {
        border-bottom: 1px solid var(--border);
        transition: background .15s;
    }

        .ref-table tbody tr:last-child {
            border-bottom: none;
        }

        .ref-table tbody tr:hover {
            background: var(--surface2);
        }

        .ref-table tbody tr td {
            padding: 13px 16px;
            font-size: .86rem;
            color: var(--text);
            vertical-align: middle;
        }

/* Patient name cell */
.patient-cell .pc-name {
    font-weight: 600;
    color: var(--forest);
    font-size: .9rem;
}

.patient-cell .pc-sub {
    font-size: .74rem;
    color: var(--muted);
    margin-top: 2px;
}

/* Resource cell */
.resource-cell .rc-name {
    font-weight: 500;
}

.resource-cell .rc-cat {
    font-size: .74rem;
    color: var(--muted);
    margin-top: 2px;
}

/* ── Status badges ───────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-referred {
    background: rgba(74,127,165,.12);
    color: var(--sky);
    border: 1px solid rgba(74,127,165,.3);
}

.status-allocated {
    background: rgba(200,152,58,.12);
    color: #a07820;
    border: 1px solid rgba(200,152,58,.3);
}

.status-assisted {
    background: rgba(45,74,62,.12);
    color: var(--forest-mid);
    border: 1px solid rgba(45,74,62,.3);
}

/* ── Utilised tick ───────────────────────────────────────────── */
.tick-yes {
    color: var(--forest-mid);
    font-size: 1.1rem;
}

.tick-no {
    color: var(--border);
    font-size: 1.1rem;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-row td {
    padding: 56px 24px;
    text-align: center;
    color: var(--muted);
}

.empty-row .ei {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
}

.empty-row p {
    font-size: .88rem;
}

/* ── Alert ───────────────────────────────────────────────────── */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: .87rem;
    display: flex;
    align-items: center;
    gap: 9px;
}

.alert-success {
    background: rgba(45,74,62,.08);
    border: 1px solid rgba(45,74,62,.25);
    color: var(--forest);
}

.alert-warning {
    background: rgba(200,152,58,.1);
    border: 1px solid rgba(200,152,58,.3);
    color: #7a5c18;
}
