
/* =====================================================
   HEADER & DASHBOARD CSS
   File: css/head.css
   Header Color: #283957
   Logo: images/legal.png
   ===================================================== */

:root {
    --primary: #3b527c;
    --primary-dark: #283957;
    --header-bg: #283957;
    --accent: #f80707;
    --body-bg: #f4f6fa;
    --text: #283957;
    --muted: #778197;
    --white: #ffffff;
    --border: #e5e9f1;
    --success: #239b56;
}

* {
    box-sizing: border-box;
}

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

body {
    width: 100%;
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--body-bg);
    overflow-x: hidden;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    text-decoration: none;
}

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

.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 26px;
    background: var(--header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left {
    min-width: 0;
}

.header-right {
    justify-content: flex-end;
    margin-left: auto;
    padding: 0 18px;
    flex-shrink: 0;
    font-family: Arial, Helvetica, sans-serif;
}

/* =====================================================
   SITE LOGO
   ===================================================== */

.site-logo {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    color: var(--white);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.4px;
    text-decoration: none;
}

.site-logo:hover {
    color: var(--white);
}

.site-logo-image {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 6px;
}

/* Legacy logo icon support */

.logo-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--white);
    background: var(--primary);
    border-radius: 11px;
    font-size: 25px;
}

/* =====================================================
   HEADER USER IMAGE
   Shared by Login and Logged-in User
   ===================================================== */

.header-user-image {
    display: block;
    width: 36px;
    height: 36px;
    object-fit: cover;
    object-position: center;
    background: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    flex-shrink: 0;
    transition: border-color 0.25s ease,
                box-shadow 0.25s ease;
}

/* =====================================================
   LOGIN BUTTON
   IMPORTANT:
   include/head.php uses class="header-login"
   ===================================================== */

.header-right .header-login {
    appearance: none;
    -webkit-appearance: none;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    min-height: 44px;
    padding: 5px 15px;

    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);

    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 25px;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.2px;

    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;

    transition: background 0.25s ease,
                border-color 0.25s ease,
                box-shadow 0.25s ease,
                transform 0.25s ease;
}

.header-right .header-login:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.17);
    border-color: rgba(255, 255, 255, 0.65);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.header-right .header-login:active {
    transform: translateY(0);
}

.header-right .header-login:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.header-right .header-login .header-user-image {
    width: 36px;
    height: 36px;
}

.header-right .header-login:hover .header-user-image {
    border-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

/* Login text */

.header-login span {
    display: inline-block;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

/* =====================================================
   LOGGED-IN USER
   ===================================================== */

.header-user-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    min-height: 44px;
    max-width: 240px;
    padding: 5px 14px 5px 6px;

    color: #ffffff;
    background: rgba(255, 255, 255, 0.09);

    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 25px;

    flex-shrink: 0;

    transition: background 0.25s ease,
                border-color 0.25s ease;
}

.header-user-info:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.40);
}

.header-user-info .header-user-image {
    width: 36px;
    height: 36px;
}

/* Username */

.header-username {
    display: block;
    max-width: 170px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =====================================================
   LEGACY BUTTON CLASS SUPPORT
   For pages that still use older button classes
   ===================================================== */

.user-image-button,
.lock-in-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    min-height: 42px;
    padding: 8px 15px;

    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);

    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 25px;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;

    transition: background 0.25s ease,
                border-color 0.25s ease,
                box-shadow 0.25s ease,
                transform 0.25s ease;
}

.user-image-button:hover,
.lock-in-button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.20);
    border-color: rgba(255, 255, 255, 0.65);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.user-image-button:active,
.lock-in-button:active {
    transform: translateY(0);
}

.user-image-button:focus-visible,
.lock-in-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.user-image-button .header-user-image {
    width: 36px;
    height: 36px;
}

.header-login-text {
    display: inline-block;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

/* =====================================================
   SIDEBAR TOGGLE BUTTON
   ===================================================== */

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;
    flex-shrink: 0;

    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 9px;

    background: rgba(255, 255, 255, 0.10);
    color: var(--white);

    cursor: pointer;
    font-size: 24px;

    transition: background 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.20);
}

/* =====================================================
   PAGE LAYOUT
   ===================================================== */

.page-layout {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: calc(100vh - 68px);
    min-height: 0;
    margin-top: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.page-container {
    flex: 1;
    min-width: 0;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 28px;
    overflow-wrap: anywhere;
}

/* =====================================================
   PAGE TITLE
   ===================================================== */

.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 28px;
}

.page-title-row h1 {
    margin: 0 0 7px;
    color: var(--primary-dark);
    font-size: 29px;
    font-weight: 800;
}

.page-title-row p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.dashboard-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 15px;

    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 9px;

    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

/* =====================================================
   DASHBOARD SECTIONS
   ===================================================== */

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

.section-title {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 0 17px;

    color: var(--primary-dark);
    font-size: 19px;
    font-weight: 800;
}

.section-title-bar {
    width: 5px;
    height: 24px;
    flex-shrink: 0;
    background: var(--accent);
    border-radius: 5px;
}

/* =====================================================
   SUMMARY GRIDS
   ===================================================== */

.case-summary-grid,
.finance-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

/* =====================================================
   CASE SUMMARY CARDS
   ===================================================== */

.summary-card {
    min-width: 0;
    padding: 22px;

    background: var(--white);
    border: 1px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 13px;

    box-shadow: 0 5px 18px rgba(40, 57, 87, 0.045);

    transition: transform 0.2s ease,
                box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 24px rgba(40, 57, 87, 0.09);
}

.total-box {
    border-top-color: var(--primary);
}

.running-box {
    border-top-color: var(--success);
}

.dismiss-box {
    border-top-color: var(--accent);
}

.summary-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

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

.summary-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 43px;
    height: 43px;
    flex-shrink: 0;

    background: #edf1f8;
    border-radius: 11px;
    font-size: 23px;
}

.running-box .summary-icon {
    background: #e8f7ee;
}

.dismiss-box .summary-icon {
    background: #fff0f0;
}

.summary-number {
    margin-top: 19px;
    color: var(--primary-dark);
    font-size: clamp(25px, 2.4vw, 34px);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.summary-caption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

/* =====================================================
   FINANCIAL SUMMARY CARDS
   ===================================================== */

.finance-card {
    min-width: 0;
    padding: 22px;

    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 13px;

    box-shadow: 0 5px 18px rgba(40, 57, 87, 0.045);

    transition: transform 0.2s ease,
                box-shadow 0.2s ease;
}

.finance-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 24px rgba(40, 57, 87, 0.09);
}

.expense-card {
    border-left-color: var(--accent);
}

.receipt-card {
    border-left-color: var(--primary);
}

.recovery-card {
    border-left-color: var(--success);
}

.finance-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;

    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

.finance-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.finance-amount {
    margin-top: 18px;
    color: var(--primary-dark);
    font-size: clamp(19px, 1.8vw, 25px);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.expense-card .finance-amount {
    color: #d80000;
}

.recovery-card .finance-amount {
    color: #187a42;
}

.finance-caption {
    margin-top: 9px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

/* =====================================================
   FINANCIAL CHART
   ===================================================== */

.finance-chart-card {
    min-width: 0;
    padding: 24px;

    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 13px;

    box-shadow: 0 5px 18px rgba(40, 57, 87, 0.045);
}

.chart-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
}

.chart-heading h2 {
    margin: 0 0 8px;
    color: var(--primary-dark);
    font-size: 19px;
}

.chart-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.finance-chart-container {
    position: relative;
    width: 100%;
    height: 340px;
}

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

.welcome_copyright {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    padding: 22px 8px 8px;

    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* =====================================================
   TABLET RESPONSIVE
   ===================================================== */

@media (max-width: 1050px) {
    .main-content {
        padding: 22px;
    }

    .case-summary-grid,
    .finance-summary-grid {
        gap: 12px;
    }

    .summary-card,
    .finance-card {
        padding: 17px;
    }
}

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

@media (max-width: 760px) {
    .main-header {
        min-height: 62px;
        padding: 10px 13px;
        gap: 8px;
    }

    .header-left,
    .header-right {
        gap: 8px;
    }

    .header-right {
        padding: 0 10px;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .site-logo {
        gap: 7px;
        font-size: 15px;
        letter-spacing: 0;
    }

    .site-logo-image {
        width: 34px;
        height: 34px;
    }

    .logo-icon {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        font-size: 21px;
    }

    .header-right .header-login {
        min-height: 40px;
        padding: 4px 11px;
        gap: 7px;
        font-size: 13px;
    }

    .header-right .header-login span {
        font-size: 13px;
    }

    .header-right .header-login .header-user-image {
        width: 32px;
        height: 32px;
    }

    .header-user-info {
        gap: 8px;
        min-height: 40px;
        padding: 4px 10px 4px 5px;
        max-width: 190px;
    }

    .header-user-info .header-user-image {
        width: 32px;
        height: 32px;
    }

    .header-username {
        max-width: 125px;
        font-size: 13px;
    }

    .user-image-button,
    .lock-in-button {
        min-height: 38px;
        padding: 7px 11px;
        gap: 6px;
        font-size: 12px;
    }

    .header-login-text {
        font-size: 13px;
    }

.page-layout {
    height: calc(100vh - 62px);
    min-height: 0;
    overflow: hidden;
}

    .main-content {
        padding: 20px 14px;
    }

    .page-title-row {
        margin-bottom: 22px;
    }

    .page-title-row h1 {
        font-size: 25px;
    }

    .case-summary-grid,
    .finance-summary-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
    }

    .summary-card,
    .finance-card {
        padding: 19px;
    }

    .summary-number {
        font-size: 30px;
    }

    .finance-amount {
        font-size: 23px;
    }

    .finance-chart-card {
        padding: 17px 12px;
    }

    .chart-heading h2 {
        font-size: 17px;
    }

    .finance-chart-container {
        height: 290px;
    }

    .section-title {
        font-size: 17px;
    }
}

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

@media (max-width: 480px) {
    .header-right {
        padding: 0 6px;
    }

    .header-right .header-login {
        min-height: 36px;
        padding: 4px 9px;
        gap: 6px;
        font-size: 12px;
    }

    .header-right .header-login span {
        font-size: 12px;
    }

    .header-right .header-login .header-user-image {
        width: 28px;
        height: 28px;
    }

    .header-user-info {
        gap: 6px;
        min-height: 36px;
        max-width: 155px;
        padding: 3px 8px 3px 4px;
    }

    .header-user-info .header-user-image {
        width: 28px;
        height: 28px;
    }

    .header-username {
        max-width: 105px;
        font-size: 12px;
    }

    .user-image-button,
    .lock-in-button {
        min-height: 36px;
        padding: 5px 9px;
        gap: 6px;
        font-size: 12px;
    }

    .header-login-text {
        font-size: 12px;
    }
}

/* =====================================================
   EXTRA SMALL MOBILE
   ===================================================== */

@media (max-width: 380px) {
    .main-header {
        padding: 9px 8px;
        gap: 5px;
    }

    .header-left,
    .header-right {
        gap: 5px;
    }

    .sidebar-toggle {
        width: 34px;
        height: 34px;
        font-size: 21px;
    }

    .site-logo {
        gap: 5px;
        font-size: 12px;
    }

    .site-logo-image {
        width: 29px;
        height: 29px;
    }

    .header-right {
        padding: 0 4px;
    }

    .header-right .header-login {
        min-height: 34px;
        padding: 3px 7px;
        gap: 5px;
        font-size: 11px;
    }

    .header-right .header-login span {
        font-size: 11px;
    }

    .header-right .header-login .header-user-image {
        width: 26px;
        height: 26px;
    }

    .header-user-info {
        max-width: 130px;
        gap: 5px;
        padding-right: 7px;
    }

    .header-username {
        max-width: 85px;
    }

    .user-image-button,
    .lock-in-button {
        min-height: 34px;
        padding: 5px 7px;
        font-size: 11px;
    }

    .main-content {
        padding: 16px 10px;
    }
}

/* =====================================================
   ACCESSIBILITY
   ===================================================== */

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid #f09898;
    outline-offset: 3px;
}


/* ==========================================
   LEGAL PAGE: SINGLE CONTENT SCROLLBAR
========================================== */

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden !important;
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.page-layout {
    display: flex;
    width: 100%;
    height: calc(100vh - 68px);
    min-height: 0;
    margin: 0;
    overflow: hidden !important;
}

.page-container {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    height: 100%;
    min-height: 0;

    overflow-y: auto !important;
    overflow-x: auto !important;

    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}
