/**
 * Identity: Global CSS design tokens and theme styles.
 * Dependencies: None.
 * Contract: Defines the visual style variables, typography, and base utility classes.
 */

:root {
    --bg-color: #0b1016;
    --sidebar-bg: #0f151d;
    --text-primary: #d7dee7;
    --text-secondary: #8e99a8;
    --text-tertiary: #697587;
    --value-primary: #f8fbff;
    --chart-hud-text: rgba(232, 238, 245, 0.78);
    --axis-text: #9eacbc;
    --grid-contrast: rgba(151, 166, 189, 0.07);
    --focus-overlay: rgba(3, 6, 10, 0.22);
    --accent: #0066ff;
    --accent-rgb: 0, 102, 255;
    --border: rgba(151, 166, 189, 0.12);
    --border-strong: rgba(151, 166, 189, 0.18);
    --card-bg: #121922;
    --card-bg-elevated: #151e29;
    --card-glow: rgba(6, 10, 16, 0.45);
    --success: #3fb950;
    --warning: #d29922;
    --sidebar-width: 124px;
    --top-nav-height: 60px;
    --main-content-pad-y: 14px;
    --main-content-pad-x: 18px;
    --hub-header-gap: 10px;
    --hub-tabs-gap: 6px;
    --hub-tab-pad-y: 7px;
    --chart-grid-gap: 10px;
    --chart-card-height-dense: clamp(174px, calc((100vh - 184px) / 3), 216px);
    --chart-card-height-regular: clamp(188px, calc((100vh - 198px) / 3), 228px);
    --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.24);
    --shadow-card: 0 12px 30px rgba(0, 0, 0, 0.18);
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    --font-main: var(--font-sans);
    --text-xs: 10px;
    --text-sm: 12px;
    --text-base: 13px;
    --text-md: 15px;
    --text-lg: 20px;
    --text-xl: 28px;
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.status-panel {
    padding: 14px 10px 0;
    border-top: 1px solid rgba(151, 166, 189, 0.08);
    flex-shrink: 0;
    margin-top: 10px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.status-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px 7px;
    border-radius: 11px;
    border: 1px solid rgba(151, 166, 189, 0.06);
    background: rgba(10, 15, 23, 0.78);
    box-shadow: none;
    transition: border-color 220ms ease, background 220ms ease, box-shadow 220ms ease, opacity 220ms ease, transform 220ms ease;
}

.status-row {
    display: flex;
    align-items: stretch;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.08);
    flex-shrink: 0;
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    margin-right: 1px;
}

.status-updated-value {
    display: none !important;
}

.status-note {
    display: none;
    font-size: 11px;
    line-height: 1.25;
    color: rgba(215, 222, 231, 0.76);
    letter-spacing: 0.01em;
    margin-top: -2px;
}

.status-note[hidden] {
    display: none !important;
}

#refresh-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    min-height: 28px;
    border: 1px solid rgba(151, 166, 189, 0.08);
    border-radius: 9px;
    padding: 0 11px;
    background: rgba(255, 255, 255, 0.01);
    color: #edf3fa;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease, color 160ms ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

#refresh-btn:hover {
    border-color: rgba(var(--accent-rgb), 0.2);
    background: rgba(var(--accent-rgb), 0.05);
    transform: none;
    box-shadow: none;
}

#refresh-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

#refresh-btn:disabled {
    cursor: progress;
    opacity: 0.96;
}

.refresh-btn-icon {
    display: inline-flex;
    width: 12px;
    height: 12px;
    align-items: center;
    justify-content: center;
    transform-origin: 50% 50%;
    color: rgba(240, 246, 252, 0.85);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease, height 0.3s ease;
}

.refresh-btn-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.refresh-btn-title {
    font-size: 11px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.runtime-mode-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 159, 10, 0.16);
    background: rgba(255, 159, 10, 0.08);
    color: rgba(255, 214, 153, 0.98);
    font-size: 10px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    align-self: flex-start;
}

.runtime-mode-badge[hidden] {
    display: none !important;
}

@media (max-height: 820px) {
    .status-panel {
        padding: 12px 10px 0;
    }

    .status-card {
        gap: 5px;
        padding: 6px 7px;
    }

    .status-note {
        font-size: 10px;
    }

    #refresh-btn {
        min-height: 26px;
    }

    .refresh-btn-title {
        font-size: 10px;
    }
}

/* REFRESHING STATE - APPLE AESTHETICS */
#refresh-btn .status-dot {
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.status-card.is-refreshing #refresh-btn .status-dot {
    background-color: #FF9F0A !important;
    box-shadow: 0 0 0 4px rgba(255, 159, 10, 0.15) !important;
    animation: appleBreathe 2s ease-in-out infinite;
}

.status-card.is-refreshing .status-note,
.status-card.is-booting .status-note,
.status-card.is-warning .status-note,
.status-card.is-error .status-note {
    display: none !important;
}

.status-card.is-refresh-failed .status-note {
    display: block;
}

.status-card.is-booting {
    border-color: rgba(0, 102, 255, 0.18);
}

.status-card.is-booting #refresh-btn .status-dot {
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.16);
    animation: appleBreathe 2.2s ease-in-out infinite;
}

@keyframes appleBreathe {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 4px rgba(255, 159, 10, 0.15); opacity: 1; }
    50% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(255, 159, 10, 0.05); opacity: 0.8; }
}

.status-progress-dots {
    display: none;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 24px;
    height: 12px;
    margin-left: 2px !important;
    pointer-events: none;
}

.status-card.is-refreshing .status-progress-dots {
    display: inline-flex;
}

.progress-dot {
    position: absolute;
    width: 1.5px;
    height: 1.5px;
    border-radius: 50%;
    background-color: #FF9F0A;
    opacity: 0;
    transform: scale(0.5);
    animation: dotAppear 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes dotAppear {
    to { opacity: 0.8; transform: scale(1); }
}

.status-card.is-refreshing .refresh-btn-icon {
    width: 13px !important;
    height: 13px !important;
    animation: appleSpin 1s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
    color: rgba(255, 255, 255, 0.95);
}

.status-card.is-refreshing #refresh-btn {
    border-color: rgba(255, 159, 10, 0.2) !important;
    background: rgba(255, 159, 10, 0.08) !important;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

@keyframes appleSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-card.is-error {
    border-color: rgba(210, 153, 34, 0.16);
}

.status-card.is-refresh-failed {
    border-color: rgba(210, 153, 34, 0.16);
}

.status-card.is-warning {
    border-color: rgba(255, 159, 10, 0.18);
}

.status-card.is-error #refresh-btn,
.status-card.is-refresh-failed #refresh-btn {
    border-color: rgba(210, 153, 34, 0.18);
    background: rgba(210, 153, 34, 0.08);
}

.status-card.is-warning #refresh-btn {
    border-color: rgba(255, 159, 10, 0.2);
    background: rgba(255, 159, 10, 0.08);
}

.status-card.is-error #refresh-btn .status-dot,
.status-card.is-refresh-failed #refresh-btn .status-dot {
    background: var(--warning);
    box-shadow: 0 0 0 4px rgba(210, 153, 34, 0.16);
}

.status-card.is-warning #refresh-btn .status-dot {
    background: #FF9F0A;
    box-shadow: 0 0 0 4px rgba(255, 159, 10, 0.16);
}

@keyframes refreshSpin {
    to { transform: rotate(360deg); }
}

@keyframes statusPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.09);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(63, 185, 80, 0.04);
    }
}

@keyframes bobbyStatusIntro {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.08);
        opacity: 0.92;
    }
    35% {
        transform: scale(1.22);
        box-shadow: 0 0 0 10px rgba(63, 185, 80, 0.05);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.08);
        opacity: 1;
    }
}

.action-btn {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    border: 1px solid rgba(151, 166, 189, 0.1);
    padding: 8px 12px;
    width: 100%;
    border-radius: 999px;
    cursor: pointer;
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(var(--accent-rgb), 0.18);
    color: var(--text-primary);
}

.action-btn.active {
    background: rgba(var(--accent-rgb), 0.1);
    border-color: rgba(var(--accent-rgb), 0.22);
    color: #f0f6fc;
    box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.08);
}

.action-btn.secondary {
    background-color: transparent;
    border-style: solid;
    color: var(--text-tertiary);
}

.action-btn.secondary:hover {
    color: var(--text-primary);
}

.disabled,
.nav-links li a.disabled,
.dropdown-content a.disabled {
    opacity: 0.42;
    pointer-events: none;
}
