﻿/* Holidays Maker brand palette, taken from holidaysmaker.pk:
   teal #108474 (primary), navy #16304a (deep), orange #f7952f (accent). */
:root {
    --hm-teal: #108474;
    --hm-teal-dark: #0b6357;
    --hm-teal-light: #16a894;
    --hm-navy: #16304a;
    --hm-orange: #f7952f;
    --hm-ink: #1f2d3d;
    --hm-muted: #5d6b7a;
}

html { font-size: 14px; }
body { background: #f6f8fb; color: var(--hm-ink); }

.card {
    box-shadow: 0 1px 3px rgba(22, 48, 74, .08);
    border: 1px solid rgba(22, 48, 74, .08);
    border-radius: .5rem;
}
.table td, .table th { vertical-align: middle; }
.table-sm td, .table-sm th { padding: .3rem .5rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table thead th {
    background: #eef3f7;
    color: var(--hm-navy);
    white-space: nowrap;
    border-bottom: 2px solid rgba(16, 132, 116, .25);
}
.table-hover > tbody > tr:hover > * { background-color: rgba(16, 132, 116, .06); }

.page-head {
    display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid rgba(16, 132, 116, .18);
}
.page-head h1 { font-size: 1.5rem; margin: 0; color: var(--hm-navy); font-weight: 600; }

.stat { font-size: 1.6rem; font-weight: 600; color: var(--hm-navy); }
.stat-label { color: var(--hm-muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }

/* Buttons and links follow the brand rather than Bootstrap's default blue. */
.btn-primary {
    background: linear-gradient(135deg, var(--hm-teal) 0%, var(--hm-teal-dark) 100%);
    border-color: var(--hm-teal-dark);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--hm-teal-light) 0%, var(--hm-teal) 100%);
    border-color: var(--hm-teal-dark);
}
.btn-outline-primary { color: var(--hm-teal); border-color: var(--hm-teal); }
.btn-outline-primary:hover { background: var(--hm-teal); border-color: var(--hm-teal); color: #fff; }
.btn-success { background: var(--hm-teal); border-color: var(--hm-teal-dark); }
.btn-success:hover { background: var(--hm-teal-dark); border-color: var(--hm-teal-dark); }
a { color: var(--hm-teal); }
a:hover { color: var(--hm-teal-dark); }
.form-control:focus, .form-select:focus {
    border-color: var(--hm-teal-light);
    box-shadow: 0 0 0 .2rem rgba(16, 132, 116, .18);
}
.badge.bg-primary { background: var(--hm-teal) !important; }
.badge.bg-success { background: var(--hm-teal) !important; }
.badge.bg-warning { background: var(--hm-orange) !important; color: #fff !important; }

/* Invoice line editor - one brand-tinted stripe per service type */
.line-card { border-left: 4px solid var(--hm-teal); }
.line-card[data-type="Visa"] { border-left-color: var(--hm-teal-light); }
.line-card[data-type="Hotel"] { border-left-color: var(--hm-orange); }
.line-card[data-type="Transport"] { border-left-color: var(--hm-navy); }
.line-card[data-type="General"] { border-left-color: var(--hm-muted); }
.line-card .form-label { font-size: .8rem; margin-bottom: .1rem; color: #555; }

.row-void td { text-decoration: line-through; color: #999; }
.tree-group { font-weight: 600; }

@page { margin: 12mm; }

@media print {
    body { background: #fff; }
    .card { box-shadow: none; border: none; }
    .container-fluid { padding: 0; }
    a { text-decoration: none; color: inherit; }
    /* The menu never belongs on a printed report. */
    .sidebar { display: none !important; }
    .content-with-sidebar { margin-left: 0 !important; }

    /* Readable size, and only the things that must not be split are protected - the
       footer band was being pushed to a second page whole rather than following the
       content it belongs under. */
    .inv-sheet { padding: 1.25rem !important; font-size: 12.5px; }
    .inv-band { padding: .75rem 1.25rem !important; }
    .table-sm > :not(caption) > * > * { padding: .28rem .4rem; }
    /* Keep a single ROW from being split across pages, but let a long table break:
       applying this to the table itself dropped multi-page reports like the account
       ledger off the printout entirely. The invoice keeps the stricter rule below. */
    tr, td, th { page-break-inside: avoid; break-inside: avoid; }
    .inv-sheet table { page-break-inside: avoid; break-inside: avoid; }
    /* A long report repeats its headings on each page. */
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }

    /* Reports print landscape: the ledger carries eleven columns and portrait squeezes
       the date and description into three wrapped lines each. @page cannot be scoped by
       selector, so the landscape rule lives on the report pages themselves - putting it
       here would rotate the invoice too, which must stay portrait. */
    .report-table { font-size: 10.5px; }
    .report-table td, .report-table th { padding: .2rem .35rem !important; }
    /* Dates and amounts must never wrap; the description takes what is left. */
    .report-table td:first-child, .report-table th:first-child { white-space: nowrap; }
    .report-table .num { white-space: nowrap; }
    .bank-grid .border.rounded { page-break-inside: avoid; break-inside: avoid; }
    .inv-sheet .mt-5 { margin-top: 1rem !important; }
    .inv-sheet .mt-4 { margin-top: .9rem !important; }
    .inv-sheet .mb-3, .inv-sheet .mb-4 { margin-bottom: .6rem !important; }
    .bank-grid .border.rounded { padding: .4rem !important; }
    /* Bootstrap drops table borders when printing; the invoice needs them. */
    .table-bordered, .table-bordered th, .table-bordered td { border: 1px solid #adb5bd !important; }
}

/* ---- Left side menu ----
   Written without Bootstrap's responsive offcanvas, which this build (5.1) does not have. */
.sidebar {
    /* Deep navy fading into the brand teal. */
    background: linear-gradient(170deg, var(--hm-navy) 0%, #124055 45%, var(--hm-teal-dark) 100%);
    color: #fff;
    width: 240px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1045;
    box-shadow: 2px 0 12px rgba(22, 48, 74, .18);
}

/* A wide table scrolls inside its own card instead of stretching the page. */
.content-with-sidebar { max-width: 100%; overflow-x: hidden; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 1040;
}

/* Large screens: always visible, content sits beside it.
   The width must shrink by the same amount as the margin, or a full-width
   container keeps the window's width and overflows off the right edge. */
@media (min-width: 992px) {
    .content-with-sidebar {
        margin-left: 240px;
        width: calc(100% - 240px);
    }
}

/* Small screens: slides in over the content when the menu button is tapped. */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease-in-out;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar.open ~ .sidebar-backdrop { display: block; }
}

.sidebar-brand {
    display: block;
    padding: 1.1rem 1.25rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, .15);
}
.sidebar-brand:hover { color: #fff; }

/* A group heading is a button that opens and closes its links. */
.sidebar-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: .6rem 1.25rem;
    margin: 0;
    font-size: .74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: rgba(255, 255, 255, .62);
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}
.sidebar-section:hover { color: #fff; background: rgba(255, 255, 255, .07); }

/* Chevron, rotating when the group is open. */
.sidebar-section::after {
    content: "";
    width: .4rem;
    height: .4rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .18s ease;
    margin-left: .5rem;
    flex: none;
}
.sidebar-section.expanded::after { transform: rotate(45deg); }

/* Groups are closed unless opened. */
.sidebar-group { display: none; padding-bottom: .3rem; }
.sidebar-group.show { display: block; }

.sidebar-link {
    display: block;
    padding: .4rem 1.25rem;
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
    font-size: .92rem;
    /* The hover stripe grows from the left edge. */
    border-left: 3px solid transparent;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.sidebar-link:hover {
    background: rgba(255, 255, 255, .1);
    border-left-color: var(--hm-orange);
    color: #fff;
}

/* Dashboard sits above the collapsible groups, so it reads as a destination, not a group. */
.sidebar-link.sidebar-top {
    font-weight: 600;
    padding-top: .55rem;
    padding-bottom: .55rem;
    margin-bottom: .25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

/* Narrow-screen top bar, matching the sidebar's deep end. */
.mobile-bar { background: linear-gradient(135deg, var(--hm-navy) 0%, var(--hm-teal-dark) 100%); }

/* Charts: a fixed box per chart. Chart.js fills its container, so without a set height the
   canvas grows on every redraw inside a stretched card. */
.chart-box { position: relative; height: 240px; }
.chart-box.chart-tall { height: 300px; }
.chart-box > canvas { position: absolute; inset: 0; }
@media (max-width: 575.98px) {
    .chart-box { height: 220px; }
    .chart-box.chart-tall { height: 240px; }
}

/* ===========================================================================
   Presentation refresh. Styling only - no markup, no behaviour, no handlers.
   =========================================================================== */

/* ---- Buttons that ran into each other ----
   .page-head wraps, but the button cluster inside it was a plain d-flex, so once the
   buttons outgrew the row they overflowed instead of flowing onto a second line. Every
   horizontal button group wraps now, and carries its own spacing whether or not the
   markup remembered a gap class. */
.page-head > .d-flex,
.card-header > .d-flex,
.d-flex.gap-1, .d-flex.gap-2, .d-flex.gap-3 {
    flex-wrap: wrap;
}
.page-head > .d-flex { gap: .5rem; row-gap: .5rem; }

/* Buttons sitting as direct siblings with no spacing class between them. A flex row with
   its own gap already spaces them, and a btn-group is meant to be joined, so neither gets
   this margin - otherwise the spacing doubles. */
.btn + .btn { margin-left: .35rem; }
.btn-group > .btn + .btn,
.d-flex > .btn + .btn,
.gap-1 > .btn + .btn, .gap-2 > .btn + .btn, .gap-3 > .btn + .btn { margin-left: 0; }

/* Action cells in tables: keep the buttons on one line, spaced, never overlapping. */
td .btn-sm + .btn-sm { margin-left: .3rem; }
td .d-flex .btn-sm + .btn-sm { margin-left: 0; }
td > .d-flex { flex-wrap: wrap; gap: .3rem; }

/* ---- A fresher, calmer surface ---- */
body {
    background: linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
    background-attachment: fixed;
}

.card {
    border-radius: .75rem;
    border: 1px solid rgba(22, 48, 74, .07);
    box-shadow: 0 1px 2px rgba(22, 48, 74, .04), 0 4px 16px rgba(22, 48, 74, .05);
    transition: box-shadow .18s ease;
}
.card:hover { box-shadow: 0 1px 2px rgba(22, 48, 74, .05), 0 8px 24px rgba(22, 48, 74, .08); }
.card-header {
    background: rgba(255, 255, 255, .7);
    border-bottom: 1px solid rgba(22, 48, 74, .07);
    font-weight: 600;
    color: var(--hm-navy);
}
/* The hover lift is for cards you browse, not for a document or a form being read. */
.inv-sheet, .card:has(.inv-band), .card:has(form) { transition: none; }
.card:has(.inv-band):hover, .card:has(form):hover {
    box-shadow: 0 1px 2px rgba(22, 48, 74, .04), 0 4px 16px rgba(22, 48, 74, .05);
}

/* ---- Buttons ---- */
.btn {
    border-radius: .45rem;
    font-weight: 500;
    padding: .4rem .85rem;
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.btn-sm { padding: .25rem .6rem; border-radius: .375rem; }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-success, .btn-danger, .btn-warning {
    box-shadow: 0 1px 2px rgba(22, 48, 74, .12);
}
.btn-primary:hover, .btn-success:hover { box-shadow: 0 3px 10px rgba(16, 132, 116, .28); }
.btn-danger:hover { box-shadow: 0 3px 10px rgba(220, 53, 69, .25); }
/* A focus ring that is visible for keyboard users without shouting on mouse click. */
.btn:focus-visible {
    outline: 2px solid var(--hm-teal-light);
    outline-offset: 2px;
    box-shadow: none;
}

/* ---- Tables ---- */
.table thead th {
    background: linear-gradient(180deg, #f2f6fa 0%, #e9eff5 100%);
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .035em;
    font-weight: 600;
}
.table > tbody > tr { transition: background .12s ease; }
.card > .table-responsive > .table > :last-child > tr:last-child > td { border-bottom: 0; }

/* ---- Forms ---- */
.form-control, .form-select {
    border-radius: .45rem;
    border-color: rgba(22, 48, 74, .16);
}
.form-control:hover, .form-select:hover { border-color: rgba(22, 48, 74, .3); }
.form-label { font-weight: 500; color: var(--hm-navy); font-size: .88rem; }

/* ---- Badges, alerts ---- */
.badge { font-weight: 600; letter-spacing: .02em; padding: .35em .6em; border-radius: .35rem; }
.alert { border: 0; border-left: 3px solid; border-radius: .5rem; }
.alert-success { border-left-color: var(--hm-teal); }
.alert-danger  { border-left-color: #dc3545; }
.alert-warning { border-left-color: var(--hm-orange); }
.alert-info, .alert-secondary { border-left-color: var(--hm-navy); }

/* ---- Page heading ---- */
.page-head h1 { letter-spacing: -.01em; }
.stat { letter-spacing: -.02em; }

/* ---- Sidebar polish ---- */
/* The page you are on. Without this nothing in the menu showed which page was open. */
.sidebar-link.active,
.sidebar-link[aria-current="page"] {
    background: rgba(255, 255, 255, .16);
    border-left-color: var(--hm-orange);
    border-left-width: 4px;
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 0 18px rgba(247, 149, 47, .12);
}
.sidebar-link.active::after {
    content: "";
    float: right;
    width: .35rem; height: .35rem;
    margin-top: .45rem;
    border-radius: 50%;
    background: var(--hm-orange);
}
/* An open group reads as a heading over its links rather than another grey row. */
.sidebar-section.expanded { color: #fff; background: rgba(255, 255, 255, .05); }
.sidebar-group.show {
    background: rgba(0, 0, 0, .14);
    border-left: 2px solid rgba(247, 149, 47, .25);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 3px; }

/* ---- Narrow screens: the real overlap fix ----
   Below ~576px a row of full-size buttons cannot fit. Let them stretch to the row
   instead of spilling out of it. */
@media (max-width: 575.98px) {
    .page-head { align-items: flex-start; }
    .page-head > .d-flex { width: 100%; }
    .page-head > .d-flex > .btn,
    .page-head > .d-flex > form > .btn { flex: 1 1 auto; }
    html { font-size: 13.5px; }
}

/* Nothing above should alter the printed page. */
@media print {
    body { background: #fff !important; }
    .card, .card:hover { box-shadow: none !important; }
    .btn { display: none; }
}
