/* ------------------------------------------------------------------
   vgui.css
   Source engine VGUI-style dialog styling.
   Emulates the look of Half-Life 2 / Source 2004 VGUI panels:
   charcoal panels, raised tabs with an inner content frame, sunken
   image wells, flat Tahoma typography and small chiseled buttons.

   NOTE on specificity:
   Blazor's CSS isolation rewrites `*` resets in `.razor.css` files to
   `*[b-xxxxx]`, which has the SAME specificity (0,1,0) as a single
   class. When this stylesheet is loaded before the scoped bundle the
   reset wins on source order and zeroes our padding/margins out.
   Every rule below is therefore scoped under `.vgui-overlay` so each
   selector lands at 0,2,0 and reliably wins the cascade.
   ------------------------------------------------------------------ */
:root {
    --panel-bg: rgba(132,132,132,0.85);
    --panel-bg-nonalpha: rgb(132,132,132);
    --blk-overlay: rgba(0,0,0,0.45);
    --border-light: #ffffff;
    --border-dark: #1a1a1a;
}

.vgui-overlay {
    position: fixed;
    inset: 0;
    background-color: var(--blk-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-family: Tahoma, Verdana, Arial, sans-serif;
    color: #d8d8d8;
    animation: vgui-fade-in 120ms ease-out;
}

    /* ---------- Outer dialog ---------- */
    .vgui-overlay .vgui-dialog {
        background-color: var(--panel-bg);
        border: 1px solid #111;
        border-radius: 10px;
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.75);
        width: 760px;
        max-width: 95vw;
        display: flex;
        flex-direction: column;
        font-size: 13px;
        color: #d8d8d8;
        padding: 8px;
        gap: 8px;
        box-sizing: border-box;
    }

    /* ---------- Title bar ---------- */
    .vgui-overlay .vgui-titlebar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px 0px 0px 4px;
        margin: 0;
        cursor: move;
        touch-action: none;
    }

    .vgui-overlay .vgui-titlebar-text {
        color: #ffffff;
        font-size: 13px;
        font-weight: bold;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        margin: 0;
    }

    .vgui-overlay .vgui-titlebar-close {
        background: transparent;
        border: none;
        color: #c8c8c8;
        font-family: Tahoma, sans-serif;
        font-size: 20px;
        line-height: 1;
        cursor: pointer;
        padding: 0;
        margin: 0;
        width: 24px;
        height: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: color 0.1s ease;
        touch-action: auto;
    }

        .vgui-overlay .vgui-titlebar-close:hover {
            color: #ffffff;
        }

    /* ---------- Tabs + content panel ----------
   The tab strip and the body share a single bordered surface so the
   active tab visually "merges" into the panel below it. */
    .vgui-overlay .vgui-panel {
        display: flex;
        flex-direction: column;
        margin: 0;
        padding: 0;
    }

    .vgui-overlay .vgui-tabs {
        display: flex;
        padding: 0;
        gap: 2px;
        margin: 0;
    }

    .vgui-overlay .vgui-tab {
        background-color: var(--panel-bg-nonalpha);
        color: #d8d8d8;
        border: 1px solid var(--border-dark);
        border-top-color: var(--border-light);
        border-left-color: var(--border-light);
        border-bottom: none;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        padding: 9px 24px;
        margin: 0;
        font-family: Tahoma, sans-serif;
        font-size: 12px;
        font-weight: bold;
        cursor: pointer;
        margin-bottom: -1px;
        position: relative;
        transition: color 0.1s ease, background-color 0.1s ease;
    }

        .vgui-overlay .vgui-tab:hover {
            color: red;
        }

        .vgui-overlay .vgui-tab.active {
            background-color: var(--panel-bg-nonalpha);
            color: #ffffff;
            z-index: 2;
            /* Opaque bottom border that paints OVER the content panel's
               top border behind the active tab, creating the merged-surface
               illusion. Must match the content panel's bg exactly. */
            border-bottom: 1px solid var(--panel-bg-nonalpha);
            padding-bottom: 9px;
        }

    .vgui-overlay .vgui-tab-content {
        background-color: var(--panel-bg-nonalpha);
        border: 1px solid var(--border-dark);
        border-top-color: var(--border-light);
        border-left-color: var(--border-light);
        border-bottom-color: var(--border-dark);
        border-right-color: var(--border-dark);
        padding: 28px 30px;
        margin: 0;
        min-height: 280px;
        box-sizing: border-box;
    }

    .vgui-overlay .vgui-content-body {
        display: flex;
        gap: 40px;
        align-items: flex-start;
        margin: 0;
        padding: 0;
    }

    /* ---------- Chapter carousel ----------
       Etched horizontal rules above and below frame the strip the way
       Source's chapter picker does. The list itself is a horizontally
       scrollable flex track; the scrollbar is hidden because the
       "More >" button drives navigation. */
    .vgui-overlay .vgui-content-carousel {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 0;
        padding: 10px 0;
        border-top: 1px solid var(--border-dark);
        border-bottom: 1px solid var(--border-light);
        box-shadow: 0 -1px 0 0 var(--border-light), 0 1px 0 0 var(--border-dark);
    }

    .vgui-overlay .vgui-chapter-list {
        list-style: none;
        display: flex;
        align-items: flex-start;
        gap: 18px;
        margin: 0;
        padding: 4px 4px 6px 4px;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none; /* Firefox */
        scroll-behavior: smooth;
    }

        .vgui-overlay .vgui-chapter-list::-webkit-scrollbar {
            display: none; /* Chromium / Safari */
        }

    .vgui-overlay .vgui-chapter-item {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 0;
        padding: 0;
        cursor: pointer;
    }

    .vgui-overlay .vgui-chapter-header {
        display: flex;
        flex-direction: column;
        line-height: 1.15;
        font-family: Tahoma, sans-serif;
        font-size: 11px;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #ffffff;
        text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
    }

    .vgui-overlay .vgui-chapter-num,
    .vgui-overlay .vgui-chapter-name {
        display: block;
    }

    .vgui-overlay .vgui-chapter-item.selected .vgui-chapter-header {
        color: #ffb400;
    }

    .vgui-overlay .vgui-chapter-item.selected .vgui-image-frame {
        outline: 2px solid #ffb400;
        outline-offset: -1px;
    }

    .vgui-overlay .vgui-carousel-actions {
        display: flex;
        justify-content: flex-end;
        padding: 0 4px;
        margin: 0;
    }

    .vgui-overlay .vgui-btn--more {
        min-width: 72px;
        padding: 4px 14px;
        font-size: 11px;
    }

    .vgui-overlay .vgui-content-text {
        flex: 1 1 auto;
        min-width: 0;
        line-height: 1.6;
        color: #e0e0e0;
        padding: 0 12px 0 0;
        margin: 0;
    }

        .vgui-overlay .vgui-content-text h3 {
            margin: 0 0 14px 0;
            padding: 0;
            font-size: 15px;
            font-weight: bold;
            color: #ffffff;
        }

        .vgui-overlay .vgui-content-text p {
            margin: 0 0 12px 0;
            padding: 0;
            font-size: 13px;
        }

        .vgui-overlay .vgui-content-text .vgui-label-muted {
            color: #9a9a9a;
            font-size: 11px;
            margin-top: 20px;
            margin-bottom: 6px;
        }

    /* ---------- Sunken square image frame ---------- */
    .vgui-overlay .vgui-image-frame {
        width: 240px;
        height: 240px;
        flex: 0 0 240px;
        background-color: #1a1a1a;
        border-top: 1px solid var(--border-dark);
        border-left: 1px solid var(--border-dark);
        border-right: 1px solid var(--border-light);
        border-bottom: 1px solid var(--border-light);
        padding: 3px;
        margin: 0;
        box-sizing: border-box;
        box-shadow: inset 0 0 0 1px #2a2a2a;
        overflow: hidden
    }

        .vgui-overlay .vgui-image-frame img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            margin: 0;
        }

        /* Carousel frames are smaller so multiple chapters fit in the
           dialog while keeping the same chiseled look. */
        .vgui-overlay .vgui-chapter-item .vgui-image-frame {
            width: 160px;
            height: 100px;
            flex: 0 0 160px;
        }

    /* ---------- Footer ---------- */
    .vgui-overlay .vgui-footer {
        padding: 6px 6px 4px 6px;
        margin: 0;
        display: flex;
        justify-content: flex-end;
        gap: 10px;
    }

    /* ---------- Buttons ---------- */
    .vgui-overlay .vgui-btn {
        background-color: var(--panel-bg);
        color: #ffffff;
        border-top: 1px solid var(--border-light);
        border-left: 1px solid var(--border-light);
        border-right: 1px solid var(--border-dark);
        border-bottom: 1px solid var(--border-dark);
        border-radius: 2px;
        padding: 8px 28px;
        margin: 0;
        font-family: Tahoma, sans-serif;
        font-size: 12px;
        cursor: pointer;
        min-width: 96px;
        transition: background-color 0.1s ease;
    }

        .vgui-overlay .vgui-btn:hover {
            /* background-color: #636363; */
        }

        .vgui-overlay .vgui-btn:active {
            border-top-color: var(--border-dark);
            border-left-color: var(--border-dark);
            border-right-color: var(--border-light);
            border-bottom-color: var(--border-light);
        }

    /* ---------- Simple message dialog (alerts / prompts) ---------- */
    .vgui-overlay .vgui-dialog--message {
        width: 440px;
    }

    .vgui-overlay .vgui-message {
        padding: 22px 24px;
        margin: 0;
        color: #f0f0f0;
        font-size: 13px;
        line-height: 1.55;
        white-space: pre-wrap;
        min-height: 60px;
        background-color: var(--panel-bg);
        border: 1px solid var(--border-dark);
        border-top-color: var(--border-light);
        border-left-color: var(--border-light);
        box-sizing: border-box;
    }

    .vgui-overlay .vgui-label {
        display: flex;
        align-content: center;
        align-items: center;
        justify-content: center;
        padding: 0;
        margin: 0;
        color: #f0f0f0;
        font-size: 13px;
        line-height: 1.55;
        white-space: pre-wrap;
        min-height: 40px;
    }


    /* ---------- Console dialog ---------- */
    .vgui-overlay .vgui-dialog--console {
        width: 640px;
        height: 440px;
    }

    .vgui-overlay .vgui-console-output {
        flex: 1 1 auto;
        min-height: 0; /* lets the flex child actually scroll instead of growing */
        overflow-y: auto;
        background-color: #1a1a1a;
        color: #d8d8d8;
        font-family: 'Courier New', Courier, monospace;
        font-size: 13px;
        padding: 10px 12px;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 4px;
        border: 1px solid var(--border-dark);
        border-top-color: var(--border-dark);
        border-left-color: var(--border-dark);
        border-right-color: var(--border-light);
        border-bottom-color: var(--border-light);
        box-sizing: border-box;
    }

    .vgui-overlay .vgui-console-input-row {
        display: flex;
        gap: 8px;
        margin: 0;
        padding: 0;
        flex: 0 0 auto;
    }

    .vgui-overlay .vgui-console-input {
        flex: 1 1 auto;
        min-width: 0;
        background-color: #1a1a1a;
        color: #ffffff;
        font-family: 'Courier New', Courier, monospace;
        font-size: 13px;
        padding: 6px 10px;
        margin: 0;
        outline: none;
        border: 1px solid var(--border-dark);
        border-top-color: var(--border-dark);
        border-left-color: var(--border-dark);
        border-right-color: var(--border-light);
        border-bottom-color: var(--border-light);
        box-sizing: border-box;
    }

        .vgui-overlay .vgui-console-input:focus {
            border-color: #cccccc;
        }

@keyframes vgui-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .vgui-overlay .vgui-dialog {
        width: 95vw;
        padding: 12px;
    }

    .vgui-overlay .vgui-tab-content {
        padding: 18px;
    }

    .vgui-overlay .vgui-content-body {
        flex-direction: column-reverse;
        align-items: center;
        gap: 18px;
    }

    .vgui-overlay .vgui-image-frame {
        width: 200px;
        height: 200px;
        flex-basis: 200px;
    }
}
