/* =========================================================
   PGT TREATMENT TRACKER UI
   Shared layout for pgt/header.php + pgt/footer.php
========================================================= */

:root {
    --primary: #0f766e;
    --primary-dark: #115e59;
    --primary-soft: #ecfdf5;
    --text: #172033;
    --muted: #667085;
    --border: #e5e7eb;
    --surface: #ffffff;
    --background: #f5f7fa;
    --danger: #b42318;
    --shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
                 "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================================================
   STICKY HEADER
========================================================= */

.pgt-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(12px);
}

.header-inner {
    width: min(1440px, calc(100% - 32px));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
}

.brand-mark,
.footer-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    font-size: 22px;
    font-weight: 700;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-text strong {
    font-size: 16px;
    letter-spacing: -0.2px;
}

.brand-text small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.pgt-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pgt-nav > a {
    min-height: 42px;
    padding: 0 12px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #475467;
    font-size: 13px;
    font-weight: 600;
    transition: 0.18s ease;
}

.pgt-nav > a:hover {
    background: #f2f4f7;
    color: var(--primary-dark);
}

.pgt-nav > a.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.pgt-nav > a span {
    font-size: 16px;
}

.nav-divider {
    width: 1px;
    height: 30px;
    background: var(--border);
    margin: 0 7px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #ccfbf1;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 800;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-info strong {
    font-size: 12px;
}

.user-info small {
    color: var(--muted);
    font-size: 10px;
    margin-top: 3px;
}

.pgt-nav .logout-link {
    color: var(--danger);
}

.pgt-nav .logout-link:hover {
    background: #fef3f2;
    color: var(--danger);
}

/* Mobile menu button */

.menu-toggle {
    display: none;
    margin-left: auto;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: white;
    cursor: pointer;
    padding: 9px;
}

.menu-toggle span {
    display: block;
    height: 2px;
    margin: 5px 0;
    background: var(--text);
    border-radius: 2px;
    transition: 0.2s;
}

.menu-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* =========================================================
   MAIN
========================================================= */

.pgt-main {
    flex: 1;
    width: 100%;
    /* Reserve space for the fixed footer */
    padding-bottom: 92px;
}

.pgt-container {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 30px 0 44px;
}

/* =========================================================
   GENERIC DASHBOARD STYLING
========================================================= */

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.page-kicker {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.2px;
    margin-bottom: 7px;
}

.page-header h1 {
    margin: 0;
    font-size: clamp(25px, 3vw, 34px);
    letter-spacing: -0.8px;
}

.page-subtitle {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.dashboard-stat {
    min-height: 145px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.stat-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 21px;
    font-weight: 800;
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.stat-number {
    margin-top: 5px;
    font-size: 32px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -1px;
}

.stat-description {
    margin-top: 9px;
    color: var(--muted);
    font-size: 11px;
}

/* Sections */

.dashboard-section {
    margin-bottom: 28px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 13px;
}

.section-heading h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -0.3px;
}

.section-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.section-link {
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
}

/* Quick actions */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.quick-action {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 17px;
    display: flex;
    align-items: center;
    gap: 13px;
    transition: 0.18s ease;
}

.quick-action:hover {
    transform: translateY(-2px);
    border-color: #99d5cf;
    box-shadow: var(--shadow);
}

.quick-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 18px;
    font-weight: 800;
    flex-shrink: 0;
}

.quick-action strong,
.quick-action span {
    display: block;
}

.quick-action strong {
    font-size: 13px;
}

.quick-action span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

/* Patient table */

.patient-card {
    overflow: hidden;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.patient-table {
    width: 100%;
    min-width: 850px;
    border-collapse: collapse;
}

.patient-table th {
    padding: 13px 16px;
    background: #f8fafc;
    color: #667085;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}

.patient-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #eef0f3;
    font-size: 12px;
    vertical-align: middle;
}

.patient-table tbody tr:last-child td {
    border-bottom: 0;
}

.patient-table tbody tr:hover {
    background: #fbfdfd;
}

.patient-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.patient-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #ccfbf1;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.patient-name strong,
.patient-name small {
    display: block;
}

.patient-name strong {
    font-size: 12px;
}

.patient-name small {
    color: var(--muted);
    font-size: 10px;
    margin-top: 2px;
}

.registration-number {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
}

.admission-date {
    white-space: nowrap;
}

.diagnosis-text {
    color: #475467;
}

.action-cell {
    text-align: right;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 3px 10px rgba(15, 118, 110, 0.18);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-small {
    min-height: 32px;
    padding: 0 11px;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.btn-small:hover {
    background: #d9f7f1;
}

/* Empty state */

.empty-state {
    padding: 55px 20px;
    text-align: center;
}

.empty-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #f2f4f7;
    font-size: 22px;
}

.empty-state h3 {
    margin: 0;
    font-size: 16px;
}

.empty-state p {
    margin: 6px 0 18px;
    color: var(--muted);
    font-size: 12px;
}

/* =========================================================
   FOOTER
========================================================= */

.pgt-footer {
    /* Fixed/sticky footer: always stays at the bottom of the viewport */
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    min-height: 78px;
    background: #101828;
    color: white;
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.10);
}

.footer-inner {
    width: min(1440px, calc(100% - 32px));
    min-height: 78px;
    margin: 0 auto;
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 17px;
}

.footer-brand strong,
.footer-brand span {
    display: block;
}

.footer-brand strong {
    font-size: 12px;
}

.footer-brand span {
    color: #98a2b3;
    font-size: 10px;
    margin-top: 2px;
}

.footer-links {
    display: flex;
    gap: 18px;
}

.footer-links a {
    color: #d0d5dd;
    font-size: 11px;
}

.footer-links a:hover {
    color: white;
}

.footer-copy {
    color: #98a2b3;
    font-size: 10px;
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 1050px) {

    .pgt-nav > a {
        padding: 0 8px;
        font-size: 12px;
    }

    .user-info {
        display: none;
    }

    .header-inner {
        gap: 12px;
    }
}

@media (max-width: 800px) {

    .header-inner {
        min-height: 64px;
    }

    .menu-toggle {
        display: block;
    }

    .pgt-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 16px;
        right: 16px;
        margin: 0;
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 3px;
        background: white;
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: 0 14px 35px rgba(15, 23, 42, 0.14);
    }

    .pgt-nav.open {
        display: flex;
    }

    .pgt-nav > a {
        min-height: 44px;
        padding: 0 13px;
    }

    .nav-divider {
        width: 100%;
        height: 1px;
        margin: 6px 0;
    }

    .user-menu {
        padding: 8px 10px;
    }

    .user-info {
        display: flex;
    }

    .pgt-main {
        padding-bottom: 145px;
    }

    .pgt-container {
        padding-top: 22px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-header .btn {
        width: 100%;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px 0;
    }

    .footer-links {
        flex-wrap: wrap;
        gap: 12px 18px;
    }
}

@media (max-width: 480px) {

    .header-inner,
    .pgt-container,
    .footer-inner {
        width: min(100% - 20px, 1440px);
    }

    .brand-text small {
        display: none;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .brand-text strong {
        font-size: 14px;
    }

    .dashboard-stat {
        padding: 17px;
    }

    .stat-number {
        font-size: 28px;
    }
}
