/*
 * CS 1.6 Command Dashboard
 * A focused server-control surface inspired by classic red/black game panels,
 * tuned to the tactical olive/amber palette used by the rest of the portal.
 */

.command-dashboard {
    --command-bg: var(--cs-bg-deep, #050705);
    --command-panel: var(--cs-surface, #11140d);
    --command-panel-2: var(--cs-surface-2, #171b11);
    --command-panel-3: #090b08;
    --command-line: var(--cs-line, #343b25);
    --command-line-soft: rgba(190, 200, 124, .12);
    --command-text: var(--cs-text, #f2f0df);
    --command-muted: var(--cs-muted, #9da28a);
    --command-amber: var(--cs-amber, #f0b63a);
    --command-orange: var(--cs-orange, #e86e24);
    --command-olive: var(--cs-olive-hot, #a8b65c);
    --command-green: var(--cs-green, #76d36b);
    --command-red: var(--cs-red, #ef6655);
    --command-blue: var(--cs-blue, #76a9cf);
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
    min-width: 0;
    color: var(--command-text);
}

.logo img,
.small-logo img,
.avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.user-server-card.selected {
    border-color: rgba(240, 182, 58, .78) !important;
    box-shadow:
        0 0 0 1px rgba(240, 182, 58, .16),
        0 16px 38px rgba(0, 0, 0, .3),
        0 0 24px rgba(232, 110, 36, .08) !important;
}

.user-server-card.selected::before {
    background: linear-gradient(90deg, #e86e24, #f0b63a) !important;
}

.user-server-card .server-live-meta.is-stale {
    color: #d5a36a;
}

.role-client #dashboardPage > .welcome,
.role-client #dashboardPage > .stats,
.role-client #dashboardPage > .grid {
    display: none;
}

.command-dashboard *,
.command-dashboard *::before,
.command-dashboard *::after {
    box-sizing: border-box;
}

.command-server-shell {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #48502f;
    border-radius: 7px;
    background:
        radial-gradient(circle at 88% -25%, rgba(232, 110, 36, .14), transparent 28rem),
        linear-gradient(145deg, rgba(23, 27, 17, .98), rgba(8, 10, 7, .99));
    box-shadow:
        0 22px 52px rgba(0, 0, 0, .3),
        inset 0 1px rgba(255, 255, 255, .035);
}

.command-server-shell::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--command-orange), var(--command-amber) 52%, transparent 92%);
    pointer-events: none;
}

.command-server-shell::after {
    content: "CS 1.6 // LIVE CONTROL";
    position: absolute;
    top: 13px;
    right: 16px;
    color: rgba(240, 182, 58, .33);
    font: 800 9px/1 Consolas, "Courier New", monospace;
    letter-spacing: 1.45px;
    display: none;
    pointer-events: none;
}

.command-server-shell > header,
.command-server-shell > .command-server-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 68px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--command-line-soft);
}

.command-server-shell > header h2,
.command-server-shell > .command-server-header h2,
.command-server-shell > header h3,
.command-server-shell > .command-server-header h3 {
    margin: 0;
    color: #fff9e8;
    font-family: "Arial Narrow", Impact, "Segoe UI", sans-serif;
    font-size: clamp(18px, 2vw, 23px);
    font-weight: 750;
    letter-spacing: .55px;
    line-height: 1.1;
    text-transform: uppercase;
}

.command-server-shell > header p,
.command-server-shell > .command-server-header p {
    margin: 5px 0 0;
    color: var(--command-muted);
    font-size: 12px;
}

.server-picker {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: min(100%, 270px);
    margin-left: auto;
}

.server-picker label {
    color: #c8cbae;
    font: 800 9px/1 "Segoe UI", sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
}

.server-picker select {
    width: 100%;
    min-height: 38px;
    padding: 0 36px 0 11px;
    border: 1px solid #4a5232;
    border-radius: 3px;
    background-color: #090b08;
    color: var(--command-text);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
}

.server-picker select:hover {
    border-color: #727c48;
}

.server-picker select:focus-visible,
.command-server-tabs button:focus-visible,
.command-refresh:focus-visible {
    outline: 2px solid var(--command-amber);
    outline-offset: 3px;
}

.command-server-tabs {
    display: flex;
    align-items: stretch;
    gap: 2px;
    min-width: 0;
    padding: 0 14px;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid #42492d;
    background: rgba(5, 7, 5, .74);
    scrollbar-width: thin;
    scrollbar-color: #596235 #090b08;
}

.command-server-tabs button,
.command-server-tabs a {
    position: relative;
    flex: 0 0 auto;
    min-height: 43px;
    padding: 0 14px;
    border: 0;
    background: transparent;
    color: #9da28d;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .72px;
    line-height: 43px;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
}

.command-server-tabs button::after,
.command-server-tabs a::after {
    content: "";
    position: absolute;
    right: 50%;
    bottom: -1px;
    left: 50%;
    height: 2px;
    background: var(--command-amber);
    box-shadow: 0 0 12px rgba(240, 182, 58, .45);
    transition: right .18s ease, left .18s ease;
}

.command-server-tabs button:hover,
.command-server-tabs a:hover {
    color: #fff5d4;
    background: rgba(168, 182, 92, .055);
}

.command-server-tabs :is(button, a).active,
.command-server-tabs :is(button, a)[aria-selected="true"] {
    color: #fff2c3;
    background: linear-gradient(180deg, rgba(240, 182, 58, .11), transparent);
}

.command-server-tabs :is(button, a).active::after,
.command-server-tabs :is(button, a)[aria-selected="true"]::after {
    right: 9px;
    left: 9px;
}

.command-layout {
    display: grid;
    grid-template-columns: minmax(250px, .8fr) minmax(380px, 1.45fr);
    grid-template-areas:
        "info live"
        "chart live";
    gap: 14px;
    min-width: 0;
    padding: 16px;
}

.command-info-card,
.command-chart-card,
.command-live-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--command-line);
    border-radius: 5px;
    background:
        linear-gradient(145deg, rgba(20, 24, 15, .98), rgba(9, 11, 8, .98));
    box-shadow: inset 0 1px rgba(255, 255, 255, .025);
}

.command-info-card {
    grid-area: info;
}

.command-chart-card {
    grid-area: chart;
}

.command-live-card {
    grid-area: live;
}

.command-info-card::before,
.command-chart-card::before,
.command-live-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 42px;
    background: linear-gradient(var(--command-amber), var(--command-orange));
}

.command-info-card > header,
.command-chart-card > header,
.command-live-card > header,
.command-info-card > .command-card-header,
.command-chart-card > .command-card-header,
.command-live-card > .command-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 49px;
    padding: 13px 14px 11px 17px;
    border-bottom: 1px solid var(--command-line-soft);
}

.command-info-card :is(h2, h3, h4),
.command-chart-card :is(h2, h3, h4),
.command-live-card :is(h2, h3, h4) {
    margin: 0;
    color: #f8f4df;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .85px;
    line-height: 1.3;
    text-transform: uppercase;
}

.command-chart-card > header > strong {
    color: var(--command-green);
    font: 800 12px/1 Consolas, "Courier New", monospace;
    letter-spacing: .5px;
}

.command-info-list {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 8px 15px 13px;
}

.command-info-list > div,
.command-info-list > li {
    display: grid;
    grid-template-columns: minmax(92px, .72fr) minmax(0, 1.3fr);
    gap: 12px;
    align-items: baseline;
    min-height: 38px;
    padding: 10px 0 8px;
    border-bottom: 1px dashed rgba(190, 200, 124, .1);
    list-style: none;
}

.command-info-list > :last-child {
    border-bottom: 0;
}

.command-info-list dt,
.command-info-list .command-info-label {
    color: var(--command-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .25px;
}

.command-info-list dd,
.command-info-list .command-info-value {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: #eee8d2;
    font: 700 11px/1.45 Consolas, "Courier New", monospace;
    text-align: right;
}

.command-info-list .is-online,
.command-info-list [data-status="online"] {
    color: var(--command-green);
}

.command-info-list .is-offline,
.command-info-list [data-status="offline"] {
    color: var(--command-red);
}

.command-info-list .is-warning {
    color: var(--command-amber);
}

.players-chart {
    position: relative;
    min-height: 188px;
    margin: 0;
    padding: 14px 14px 12px 42px;
    overflow: hidden;
    isolation: isolate;
}

.players-chart::before {
    content: "PLAYERS";
    position: absolute;
    top: 16px;
    left: 13px;
    color: rgba(240, 182, 58, .46);
    font: 800 8px/1 Consolas, monospace;
    letter-spacing: 1.1px;
    transform: rotate(-90deg) translateX(-100%);
    transform-origin: top left;
}

.players-chart svg,
.players-chart canvas {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    height: 160px;
    overflow: visible;
}

.chart-grid {
    position: absolute;
    z-index: 0;
    inset: 14px 14px 28px 42px;
    border-left: 1px solid rgba(168, 182, 92, .26);
    border-bottom: 1px solid rgba(168, 182, 92, .26);
    background-image:
        linear-gradient(rgba(168, 182, 92, .095) 1px, transparent 1px),
        linear-gradient(90deg, rgba(168, 182, 92, .095) 1px, transparent 1px);
    background-size: 100% 25%, 16.666% 100%;
    pointer-events: none;
}

.chart-grid::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(240, 182, 58, .025), rgba(232, 110, 36, .08));
}

.chart-line {
    fill: none;
    stroke: var(--command-amber);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 4px rgba(240, 182, 58, .5));
    vector-effect: non-scaling-stroke;
}

.chart-line-fill {
    fill: url("#command-chart-fill");
    opacity: .22;
    stroke: none;
}

.chart-point {
    fill: #0b0e09;
    stroke: var(--command-amber);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.chart-axis-labels,
.players-chart figcaption {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 7px 1px 0;
    color: #717863;
    font: 700 8px/1 Consolas, monospace;
    letter-spacing: .2px;
}

.command-live-card {
    display: flex;
    flex-direction: column;
}

.command-live-card.is-stale > header::before {
    background: var(--command-orange);
    box-shadow: 0 0 10px rgba(232, 110, 36, .55);
}

.command-live-card > header::before,
.command-live-card > .command-card-header::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: -4px;
    border-radius: 50%;
    background: var(--command-green);
    box-shadow: 0 0 10px rgba(118, 211, 107, .62);
}

.command-live-card > header :is(h2, h3, h4),
.command-live-card > .command-card-header :is(h2, h3, h4) {
    margin-right: auto;
}

.command-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 30px;
    padding: 6px 9px;
    border: 1px solid #4e5734;
    border-radius: 3px;
    background: rgba(168, 182, 92, .075);
    color: #d5d9bd;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .7px;
    line-height: 1;
    text-transform: uppercase;
    cursor: pointer;
}

.command-refresh::before {
    content: "↻";
    color: var(--command-amber);
    font-size: 14px;
    line-height: .8;
}

.command-refresh:hover:not(:disabled) {
    border-color: rgba(240, 182, 58, .58);
    background: rgba(240, 182, 58, .11);
    color: #fff5d3;
}

.command-refresh:disabled,
.command-refresh[aria-busy="true"] {
    cursor: wait;
    opacity: .65;
}

.command-refresh[aria-busy="true"]::before {
    animation: command-spin .7s linear infinite;
}

.command-live-grid {
    display: grid;
    flex: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(94px, 1fr);
    gap: 1px;
    padding: 1px;
    background: rgba(190, 200, 124, .08);
}

.command-live-grid > div,
.command-live-grid > article {
    position: relative;
    min-width: 0;
    min-height: 94px;
    padding: 17px 15px 14px;
    overflow: hidden;
    background: linear-gradient(145deg, #11140d, #0b0e09);
}

.command-live-grid > div::after,
.command-live-grid > article::after {
    content: "";
    position: absolute;
    right: -17px;
    bottom: -28px;
    width: 70px;
    height: 70px;
    border: 1px solid rgba(168, 182, 92, .07);
    transform: rotate(45deg);
}

.command-live-grid small,
.command-live-grid .command-live-label {
    display: block;
    margin-bottom: 8px;
    color: var(--command-muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .95px;
    line-height: 1.3;
    text-transform: uppercase;
}

.command-live-value {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: #fff7dc;
    font-family: "Arial Narrow", Impact, "Segoe UI", sans-serif;
    font-size: clamp(17px, 2vw, 25px);
    font-weight: 700;
    letter-spacing: .4px;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-live-value[data-status="online"] {
    color: var(--command-green);
}

.command-live-value[data-status="starting"] {
    color: var(--command-amber);
}

.command-live-value[data-status="offline"] {
    color: var(--command-red);
}

.command-live-value.is-map {
    color: var(--command-amber);
}

.command-live-value.is-players {
    color: var(--command-green);
}

.command-live-value.is-address {
    color: var(--command-blue);
    font-family: Consolas, "Courier New", monospace;
    font-size: clamp(10px, 1.25vw, 16px);
    letter-spacing: -.2px;
}

.command-live-card > footer,
.command-live-card > .command-live-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 46px;
    margin-top: auto;
    padding: 11px 14px;
    border-top: 1px solid var(--command-line-soft);
    background: rgba(4, 5, 4, .48);
    color: #747b66;
    font: 700 9px/1.4 Consolas, monospace;
}

.command-live-card > footer time,
.command-live-card > .command-live-footer time {
    color: #aeb39d;
}

.command-live-footer [data-state="live"] {
    color: var(--command-green);
}

.command-live-footer [data-state="error"] {
    color: #e9a069;
}

.command-live-card [data-live-status="loading"] {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.command-live-card [data-live-status="loading"]::before {
    content: "Updating…";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    color: var(--command-muted);
    font: 800 10px/1 Consolas, monospace;
    letter-spacing: .5px;
}

.command-empty {
    display: grid;
    place-items: center;
    min-height: 280px;
    padding: 34px 20px;
    border: 1px dashed #4d5533;
    border-radius: 6px;
    background:
        radial-gradient(circle, rgba(240, 182, 58, .07), transparent 17rem),
        rgba(8, 10, 7, .68);
    color: var(--command-muted);
    text-align: center;
}

.command-empty::before {
    content: "CS";
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border: 1px solid rgba(240, 182, 58, .42);
    border-radius: 50%;
    color: var(--command-amber);
    font: 900 14px/1 Consolas, monospace;
    box-shadow: 0 0 0 6px rgba(240, 182, 58, .035);
}

.command-empty h2,
.command-empty h3 {
    margin: 0 0 7px;
    color: #f2ecd5;
    font-size: 15px;
    letter-spacing: .45px;
    text-transform: uppercase;
}

.command-empty p {
    max-width: 430px;
    margin: 0;
    font-size: 12px;
    line-height: 1.65;
}

@keyframes command-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1080px) {
    .command-layout {
        grid-template-columns: minmax(230px, .78fr) minmax(330px, 1.22fr);
    }

    .command-server-shell::after {
        display: none;
    }
}

@media (max-width: 900px) {
    .command-server-shell > header,
    .command-server-shell > .command-server-header {
        align-items: flex-start;
        flex-direction: column;
        padding-top: 20px;
    }

    .server-picker {
        width: 100%;
        margin-left: 0;
    }

    .command-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "live"
            "info"
            "chart";
    }

    .command-live-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 540px) {
    .command-dashboard {
        gap: 11px;
    }

    .command-server-shell {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .command-server-tabs {
        padding: 0 8px;
    }

    .command-server-tabs button,
    .command-server-tabs a {
        min-height: 40px;
        padding: 0 11px;
        font-size: 9px;
        line-height: 40px;
    }

    .command-layout {
        gap: 10px;
        padding: 10px;
    }

    .command-info-list > div,
    .command-info-list > li {
        grid-template-columns: minmax(80px, .7fr) minmax(0, 1.3fr);
        gap: 9px;
    }

    .command-live-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .command-live-grid > div,
    .command-live-grid > article {
        min-height: 79px;
        padding: 14px;
    }

    .players-chart {
        min-height: 170px;
        padding-right: 10px;
        padding-left: 34px;
    }

    .chart-grid {
        right: 10px;
        left: 34px;
    }

    .command-live-card > footer,
    .command-live-card > .command-live-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .command-server-tabs button::after,
    .command-server-tabs a::after {
        transition: none;
    }

    .command-refresh[aria-busy="true"]::before {
        animation: none;
    }
}
