/* HotelWorks shell styles. Built on Bootstrap 5; only the pieces Bootstrap does not give us
   are defined here — the sidebar, the tape chart grid and the touch POS tiles. */

:root {
    --hw-sidebar-width: 240px;
    --hw-navbar-height: 56px;
    --hw-brand: #0f4c81;
    --hw-brand-dark: #0a3557;
    --hw-accent: #d97706;

    /* Room and folio state colours, used by both the tape chart and the housekeeping board
       so a colour means the same thing wherever staff see it. */
    --hw-vacant: #e8f5e9;
    --hw-vacant-border: #a5d6a7;
    --hw-occupied: #1976d2;
    --hw-reserved: #64b5f6;
    --hw-dirty: #fff3e0;
    --hw-dirty-border: #ffb74d;
    --hw-oos: #eceff1;
    --hw-oos-border: #90a4ae;
    --hw-arrival: #43a047;
    --hw-departure: #e53935;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background-color: #f4f6f9;
    font-size: 0.9375rem;
}

/* ---------- Layout shell ---------- */

.hw-navbar {
    height: var(--hw-navbar-height);
    background: linear-gradient(90deg, var(--hw-brand) 0%, var(--hw-brand-dark) 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
}

.hw-navbar .navbar-brand {
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.02em;
    width: var(--hw-sidebar-width);
}

.hw-sidebar {
    position: fixed;
    top: var(--hw-navbar-height);
    bottom: 0;
    left: 0;
    width: var(--hw-sidebar-width);
    background: #fff;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    z-index: 1030;
    transition: transform 0.2s ease;
}

.hw-content {
    margin-left: var(--hw-sidebar-width);
    padding: calc(var(--hw-navbar-height) + 1rem) 1.25rem 3rem;
    min-height: 100vh;
}

.hw-sidebar .nav-link {
    color: #495057;
    padding: 0.5rem 1rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.hw-sidebar .nav-link:hover {
    background-color: #f1f3f5;
    color: var(--hw-brand);
}

.hw-sidebar .nav-link.active {
    background-color: #e7f1ff;
    color: var(--hw-brand);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--hw-brand);
}

.hw-sidebar .nav-section {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #adb5bd;
    padding: 1rem 1rem 0.375rem;
    font-weight: 600;
}

/* On tablets the sidebar slides away so the tape chart and POS get the full width. */
@media (max-width: 991.98px) {
    .hw-sidebar {
        transform: translateX(-100%);
    }

    .hw-sidebar.show {
        transform: translateX(0);
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.15);
    }

    .hw-content {
        margin-left: 0;
    }

    .hw-navbar .navbar-brand {
        width: auto;
    }
}

/* ---------- Page furniture ---------- */

.hw-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.hw-page-header h1 {
    font-size: 1.375rem;
    font-weight: 600;
    margin: 0;
}

.card {
    border: 1px solid #e5e8ec;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e5e8ec;
    font-weight: 600;
    padding: 0.75rem 1rem;
}

.hw-stat {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.hw-stat .hw-stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    font-weight: 600;
}

.hw-stat .hw-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
}

/* Money is read in columns and compared line to line — tabular figures keep digits aligned. */
.hw-money {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.hw-negative {
    color: #c62828;
}

/* ---------- Business date banner ---------- */

.hw-audit-warning {
    background-color: #fff3cd;
    border-bottom: 1px solid #ffe69c;
    color: #664d03;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ---------- Tape chart ---------- */

.hw-tape-wrapper {
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: #fff;
}

.hw-tape {
    border-collapse: separate;
    border-spacing: 0;
    min-width: max-content;
    font-size: 0.8125rem;
}

.hw-tape th,
.hw-tape td {
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    padding: 0;
}

/* The room column stays visible while the date columns scroll. */
.hw-tape .hw-room-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    min-width: 150px;
    max-width: 150px;
    padding: 0.375rem 0.625rem;
    border-right: 2px solid #dee2e6;
}

.hw-tape thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8f9fa;
    text-align: center;
    padding: 0.25rem;
    min-width: 46px;
    font-weight: 600;
    white-space: nowrap;
}

.hw-tape thead th.hw-room-col {
    z-index: 4;
}

.hw-tape thead th.hw-weekend {
    background: #eef2f7;
}

.hw-tape thead th.hw-today {
    background: var(--hw-brand);
    color: #fff;
}

.hw-tape td.hw-cell {
    height: 34px;
    position: relative;
    background: var(--hw-vacant);
    cursor: pointer;
}

.hw-tape td.hw-cell:hover {
    outline: 2px solid var(--hw-brand);
    outline-offset: -2px;
}

.hw-tape td.hw-cell.hw-weekend {
    background: #dff0e1;
}

/* A booking is drawn as a bar positioned across its cells rather than by colouring cells,
   so a stay reads as one continuous block with the guest's name on it. */
.hw-stay {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 50%;
    border-radius: 0.25rem;
    padding: 0 0.375rem;
    font-size: 0.75rem;
    line-height: 28px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 1;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.hw-stay-occupied {
    background: var(--hw-occupied);
}

.hw-stay-reserved {
    background: var(--hw-reserved);
}

.hw-stay-oos {
    background: repeating-linear-gradient(45deg, #90a4ae, #90a4ae 6px, #b0bec5 6px, #b0bec5 12px);
    color: #263238;
}

.hw-stay:hover {
    filter: brightness(1.08);
}

.hw-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8125rem;
    align-items: center;
}

.hw-legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 0.1875rem;
    margin-right: 0.375rem;
    vertical-align: -2px;
}

/* ---------- Housekeeping board ---------- */

.hw-room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.625rem;
}

.hw-room-tile {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.625rem;
    background: #fff;
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.hw-room-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.hw-room-tile .hw-room-number {
    font-size: 1.125rem;
    font-weight: 700;
}

.hw-room-tile.hw-status-clean {
    background: var(--hw-vacant);
    border-color: var(--hw-vacant-border);
}

.hw-room-tile.hw-status-dirty {
    background: var(--hw-dirty);
    border-color: var(--hw-dirty-border);
}

.hw-room-tile.hw-status-inspected {
    background: #e3f2fd;
    border-color: #90caf9;
}

.hw-room-tile.hw-status-oos {
    background: var(--hw-oos);
    border-color: var(--hw-oos-border);
}

/* ---------- POS terminal ---------- */

/* Touch targets are sized for a finger on a tablet, not a mouse on a desktop. */
.hw-pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.hw-pos-tile {
    border: none;
    border-radius: 0.5rem;
    min-height: 84px;
    padding: 0.5rem;
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left;
    background: var(--hw-brand);
    cursor: pointer;
}

.hw-pos-tile:active {
    transform: scale(0.97);
}

.hw-pos-tile .hw-pos-price {
    font-size: 0.8125rem;
    font-weight: 500;
    opacity: 0.9;
}

.hw-pos-tile:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.hw-pos-cart {
    position: sticky;
    top: calc(var(--hw-navbar-height) + 1rem);
    max-height: calc(100vh - var(--hw-navbar-height) - 3rem);
    display: flex;
    flex-direction: column;
}

.hw-pos-cart-items {
    overflow-y: auto;
    flex: 1 1 auto;
}

.hw-pos-cart-item {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f3f5;
}

.hw-pos-cart-item.hw-sent {
    opacity: 0.65;
}

.hw-table-tile {
    border-radius: 0.5rem;
    min-height: 92px;
    border: 2px solid #dee2e6;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    cursor: pointer;
    font-weight: 600;
}

.hw-table-tile.hw-table-occupied {
    border-color: var(--hw-occupied);
    background: #e3f2fd;
}

.hw-table-tile.hw-table-billed {
    border-color: var(--hw-accent);
    background: #fff8e1;
}

/* ---------- Print ---------- */

@media print {
    .hw-navbar,
    .hw-sidebar,
    .hw-no-print,
    .btn {
        display: none !important;
    }

    .hw-content {
        margin: 0;
        padding: 0;
    }

    body {
        background: #fff;
        font-size: 11pt;
    }

    .card {
        border: none;
        box-shadow: none;
    }

    /* Receipts and kitchen tickets print to 80mm roll printers. */
    .hw-receipt {
        width: 72mm;
        font-family: "Consolas", "Courier New", monospace;
        font-size: 9pt;
    }
}
