/* Wallboard-specific styles — designed for wall-mounted displays */

.header {
    background: var(--cassling-dark-blue);
    color: #ffffff;
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    justify-content: center;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    font-weight: 400;
    color: rgba(255,255,255,0.7);
    position: absolute;
    right: 40px;
}

.refresh-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--cassling-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.content {
    padding: 24px 40px;
}

/* Summary cards */
.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
}

.card-critical { border-left-color: var(--cassling-medium-blue); }
.card-over24 { border-left-color: var(--danger); }
.card-parts { border-left-color: var(--cassling-gold); }

.card-label {
    font-size: 15px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.card-value {
    font-size: 40px;
    font-weight: 900;
    line-height: 1;
}

.card-critical .card-value { color: var(--cassling-dark-blue); }
.card-over24 .card-value { color: var(--danger); }
.card-parts .card-value { color: #b8960e; }

.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: var(--cassling-deep-blue);
    color: white;
    padding: 16px 18px;
    text-align: left;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

thead th:first-child {
    padding-left: 20px;
}

tbody tr {
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 14px 18px;
    font-size: 20px;
    font-weight: 400;
    vertical-align: top;
}

tbody td:first-child {
    padding-left: 20px;
}

.main-row td {
    padding-top: 14px;
    padding-bottom: 4px;
    font-weight: 700;
}

.detail-row td {
    padding-top: 6px;
    padding-bottom: 10px;
    font-size: 18px;
    font-weight: 400;
    color: var(--text-secondary);
    vertical-align: middle;
}

/* Collapse the empty alert cell in detail rows so parts tag aligns with Call # */
.detail-row td:first-child {
    padding: 0;
    width: 0;
    font-size: 0;
}

/* Distinct blue/white alternating bands (every 2 rows = 1 record) */
.band-blue { background: var(--row-blue); }
.band-white { background: var(--row-white); }

.call-number {
    font-weight: 700;
    color: var(--cassling-dark-blue);
    font-variant-numeric: tabular-nums;
}

.customer { font-weight: 700; }

/* Over 24hr alert icon */
.alert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.alert-icon.over-24 {
    color: var(--danger);
    animation: alertPulse 1.5s infinite;
}

.alert-icon svg {
    width: 24px;
    height: 24px;
}

.over-24-border {
    border-left: 4px solid var(--danger) !important;
}

.over-24-border td:first-child {
    padding-left: 16px;
}

.problem-desc { color: var(--text-secondary); }
.room-ref { color: var(--text-secondary); font-style: italic; }

/* Legend / footer */
.legend {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: #f4f5f7;
    border-top: 1px solid var(--border);
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
}

.legend .alert-icon.over-24 {
    animation: none;
}

/* Page transition animations */
.page-fade-out {
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

.page-fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Page indicator */
.page-indicator {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-dots {
    display: flex;
    gap: 6px;
}

.page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.3s ease;
}

.page-dot.active {
    background: var(--cassling-medium-blue);
}

.page-label {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* All-clear state */
.all-clear {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
}

.all-clear-icon {
    width: 80px;
    height: 80px;
    background: #e8f5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.all-clear-icon svg {
    width: 40px;
    height: 40px;
    color: #3d6b1e;
}

.all-clear h2 {
    font-size: 28px;
    font-weight: 700;
    color: #3d6b1e;
    margin-bottom: 8px;
}

.all-clear p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* ── Mobile responsive (iPhone 13–17: 375–430px viewports) ── */
@media (max-width: 768px) {

    /* Header — stack vertically */
    .header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 4px;
    }

    .header h1 {
        font-size: 14px;
        text-align: center;
        letter-spacing: 0.3px;
    }

    .header-right {
        position: static;
        gap: 12px;
        font-size: 11px;
    }

    /* Content area */
    .content {
        padding: 12px;
    }

    /* Summary cards — 3-across, compact with colored left borders */
    .cards {
        gap: 8px;
        margin-bottom: 12px;
    }

    .card {
        padding: 10px 12px;
        text-align: center;
    }

    .card-label {
        font-size: 9px;
        letter-spacing: 0.3px;
        margin-bottom: 2px;
    }

    .card-value {
        font-size: 24px;
    }

    /* Hide "Critical " on mobile to align card numbers */
    .desktop-only {
        display: none;
    }

    /* ── Table → stacked card layout ── */
    .table-container {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }

    thead {
        display: none;
    }

    tbody, tbody tr, tbody td {
        display: block;
        width: 100%;
    }

    tbody tr {
        border-bottom: none;
    }

    /* Hide alert-icon column — red left border provides the signal */
    td.cell-alert {
        display: none !important;
    }

    /* Main row = top of card */
    .main-row {
        background: var(--card-bg) !important;
        border-radius: var(--radius) var(--radius) 0 0;
        margin-top: 10px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }

    tbody tr.main-row:first-child {
        margin-top: 0;
    }

    .main-row td {
        padding: 3px 14px 3px 108px;
        font-size: 14px;
        font-weight: 400;
        position: relative;
    }

    .main-row td:first-child {
        padding-left: 108px;
    }

    .main-row .call-number {
        padding-top: 12px;
        font-size: 16px;
        font-weight: 700;
    }

    .main-row .customer {
        font-size: 15px;
        font-weight: 700;
    }

    /* Detail row = bottom of card */
    .detail-row {
        background: var(--card-bg) !important;
        border-radius: 0 0 var(--radius) var(--radius);
        box-shadow: 0 2px 4px rgba(0,0,0,0.06);
    }

    .detail-row td {
        padding: 3px 14px 3px 108px;
        font-size: 13px;
        color: var(--text-secondary);
        position: relative;
    }

    .detail-row td:first-child {
        padding-left: 108px;
    }

    /* Hide empty parts cell */
    .cell-parts:empty {
        display: none !important;
    }

    /* Parts tag — show full-width, no label */
    .cell-parts {
        padding-left: 14px !important;
    }

    /* Room ref — hide if empty */
    .room-ref:empty {
        display: none !important;
    }

    /* Problem description — full width, no label */
    .detail-row .problem-desc {
        padding-left: 14px !important;
        padding-bottom: 12px;
        font-style: italic;
    }

    .detail-row .problem-desc:empty {
        display: none !important;
    }

    /* Record card left borders — color-coded by status */
    .main-row.default-border,
    .detail-row.default-border {
        border-left: 4px solid var(--cassling-medium-blue);
    }

    .main-row.parts-border,
    .detail-row.parts-border {
        border-left: 4px solid var(--cassling-gold);
    }

    .main-row.over-24-border,
    .detail-row.over-24-border {
        border-left: 4px solid var(--danger);
    }

    /* Labels via data-label attribute (positioned left of value) */
    tbody td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        position: absolute;
        left: 14px;
        font-size: 11px;
        font-weight: 700;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.3px;
        width: 88px;
    }

    /* Over-24 border cells — adjust label position */
    .over-24-border td[data-label]:not([data-label=""])::before {
        left: 14px;
    }

    /* Alert icon sizing in card context */
    .alert-icon {
        width: 20px;
        height: 20px;
    }

    .alert-icon svg {
        width: 16px;
        height: 16px;
    }

    /* Legend — hidden on mobile, over-24 indicated by red card border */
    .legend {
        display: none;
    }

    /* All-clear */
    .all-clear {
        padding: 40px 20px;
    }

    .all-clear-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 16px;
    }

    .all-clear-icon svg {
        width: 30px;
        height: 30px;
    }

    .all-clear h2 {
        font-size: 20px;
    }

    .all-clear p {
        font-size: 13px;
    }
}

/* Large display scaling (4K wall mounts) */
@media (min-width: 2400px) {
    .header { padding: 30px 60px; }
    .header h1 { font-size: 42px; }
    .content { padding: 36px 60px; }
    .cards { gap: 24px; margin-bottom: 28px; }
    .card { padding: 24px 32px; }
    .card-label { font-size: 22px; }
    .card-value { font-size: 56px; }
    thead th { font-size: 28px; padding: 22px 28px; }
    tbody td { font-size: 30px; padding: 18px 28px; }
    .detail-row td { font-size: 24px; }
    .legend { font-size: 22px; }
    .alert-icon { width: 36px; height: 36px; }
    .alert-icon svg { width: 32px; height: 32px; }
    .header-right { right: 60px; }
    .page-label { font-size: 22px; }
    .page-dot { width: 12px; height: 12px; }
}
