﻿@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ── Design tokens — mirrors PMS schedule / equipment monitoring ── */
:root {
    --bg: #f4f7f9;
    --surface: #ffffff;
    --surface2: #f8f9fa;
    --border: #dee2e6;
    --border2: #e9ecef;
    --text: #212529;
    --text-muted: #6c757d;
    --text-dim: #adb5bd;
    --dmci-blue: #0056b3;
    --dmci-dark-blue: #003d80;
    --accent: #0056b3;
    --green: #28a745;
    --yellow: #ffc107;
    --purple: #6f42c1;
    --orange: #fd7e14;
    --sys-bg: #e7f1ff;
    --equip-bg: #f0f4f8;
    --act-bg: #ffffff;
    --main-header-h: 60px;
    --topbar-h: 70px;
    --tabs-h: 48px;
}

main {
    margin: 0;
    padding: 0;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-top: var(--main-header-h);
}

#main-header {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--main-header-h);
    z-index: 300;
    background: var(--surface);
}

/* ── TOPBAR (centered title, below navbar, not sticky) ── */
.topbar {
    height: var(--topbar-h);
    background: var(--dmci-blue);
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-icon {
    display: none;
}

.topbar-title {
    font-size: 22px;
    color: #fff;
    font-weight: 700;
    letter-spacing: 1px;
    text-align: center;
    text-transform: uppercase;
    font-family: 'IBM Plex Sans', sans-serif;
}

.topbar-sub {
    display: none;
}

.topbar-right {
    display: none;
}

/* ── SHEET TABS (bottom-border active style) ── */
.tab-section {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tab-buttons {
    min-height: var(--tabs-h);
    height: auto;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 24px;
    gap: 2px;
    position: sticky;
    top: var(--main-header-h);
    z-index: 190;
    flex-wrap: wrap;
    overflow-x: visible;
}

.tab-btn {
    padding: 8px 20px;
    border-radius: 6px 6px 0 0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    border-bottom: none;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: .3px;
    color: var(--text-muted);
    background: var(--surface2);
    transition: all .15s;
    white-space: nowrap;
    flex-shrink: 0;
    max-width: none;
    flex: none;
}

    .tab-btn:hover {
        color: var(--text);
        background: var(--surface2);
    }

    .tab-btn.active {
        background: var(--bg);
        border-color: var(--border);
        color: var(--dmci-blue);
        border-bottom: 3px solid var(--dmci-blue);
        margin-bottom: -2px;
    }

/* ── IFRAME CONTAINER ── */
.iframe-container {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: relative;
    min-height: 0;
    transition: opacity .25s ease;
    margin-top: 0;
}

    .iframe-container.fade-in {
        opacity: 0;
    }

    .iframe-container iframe {
        width: 100%;
        min-height: 0;
        border: none;
        display: block;
    }

/* ── SPINNER ── */
.iframe-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border: 4px solid var(--border);
    border-top-color: var(--dmci-blue);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    z-index: 10;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ── BUTTONS (topbar actions) ── */
.btn {
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .3);
    color: #fff;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 11px;
    font-family: 'IBM Plex Mono', monospace;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

    .btn:hover {
        background: rgba(255, 255, 255, .25);
        border-color: rgba(255, 255, 255, .5);
    }

/* ── SEARCH (in topbar) ── */
.search-wrap {
    position: relative;
}

    .search-wrap svg {
        position: absolute;
        left: 9px;
        top: 50%;
        transform: translateY(-50%);
        color: rgba(255, 255, 255, .6);
        pointer-events: none;
    }

#search {
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .3);
    color: #fff;
    padding: 5px 10px 5px 28px;
    border-radius: 6px;
    font-size: 11px;
    width: 180px;
    outline: none;
    font-family: 'IBM Plex Sans', sans-serif;
}

    #search:focus {
        border-color: rgba(255, 255, 255, .6);
        background: rgba(255, 255, 255, .22);
    }

    #search::placeholder {
        color: rgba(255, 255, 255, .5);
    }

/* ── CHARTS ── */
.chart-wrapper {
    margin: 10px auto;
    width: 95%;
    padding: 16px;
    background: var(--surface);
}

#bar-chart-container,
#bar-chart-labor,
#bar-chart-parts {
    width: 100%;
    height: 560px;
}

/* ── MODAL backdrop ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
}

/* ── MODAL content box ── */
.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 8px;
    padding: 0;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
    min-width: 340px;
    animation: mPop .18s ease;
}

@keyframes mPop {
    from {
        opacity: 0;
        transform: scale(.96) translateY(8px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ── MODAL header strip (dark blue, matches topbar) ── */
.modal-header-strip {
    background: var(--dmci-blue);
    padding: 14px 18px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

    .modal-header-strip h3 {
        font-size: 14px;
        font-weight: 700;
        color: #fff;
        font-family: 'IBM Plex Mono', monospace;
        letter-spacing: .3px;
        margin: 0;
    }

/* If modal uses a plain close button ID */
#closeModal {
    position: static;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 5px;
    color: rgba(255, 255, 255, .85);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all .14s;
    flex-shrink: 0;
}

    #closeModal:hover {
        background: rgba(255, 255, 255, .25);
        color: #fff;
    }

/* ── MODAL table ── */
.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    font-family: 'IBM Plex Sans', sans-serif;
    margin-top: 0;
}

    .modal-table th {
        background: var(--surface2);
        border: 1px solid var(--border2);
        padding: 6px 10px;
        text-align: left;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: .3px;
        text-transform: uppercase;
        color: var(--text-muted);
        font-family: 'IBM Plex Mono', monospace;
        white-space: nowrap;
        user-select: none;
    }

    .modal-table td {
        padding: 6px 10px;
        border: 1px solid var(--border2);
        vertical-align: middle;
        color: var(--text);
    }

    .modal-table tr:nth-child(even) td {
        background: var(--surface2);
    }

    .modal-table tbody tr:hover td {
        background: var(--sys-bg);
    }

/* ── Pill / badge ── */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    font-family: 'IBM Plex Mono', monospace;
}

.pill-blue {
    background: #e7f1ff;
    color: var(--dmci-blue);
}

.pill-green {
    background: #d4edda;
    color: #155724;
}

.pill-yellow {
    background: #fff3cd;
    color: #856404;
}

.pill-orange {
    background: #ffe5d0;
    color: #7d3100;
}

.pill-red {
    background: #f8d7da;
    color: #721c24;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: var(--surface2);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-dim);
    }

/* ── Responsive ── */
@media (max-width: 700px) {
    .topbar {
        padding: 0 14px;
        gap: 8px;
    }

    .topbar-title {
        font-size: 13px;
    }

    .topbar-right {
        gap: 5px;
    }

    #search {
        width: 120px;
    }

    .tab-buttons {
        padding: 0 12px;
    }

    .tab-btn {
        padding: 7px 12px;
        font-size: 11px;
    }
}
