:root {
    --bg-dark: #09090b;
    --surface: rgba(24, 24, 27, 0.7);
    --surface-highlight: rgba(39, 39, 42, 0.5);
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.4);
    --accent: #06b6d4;
    --text-main: #f4f4f5;
    --text-dim: #a1a1aa;
    --success: #10b981;
    --danger: #ef4444;
    --border: rgba(63, 63, 70, 0.5);
    --glass-bg: rgba(9, 9, 11, 0.85);
}

* {
    box-sizing: border-box;
    outline: none;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
    overflow-x: hidden;
}

/* Header & Navigation */
header {
    width: 100%;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    z-index: 1000;
    position: sticky;
    top: 0;
    flex-shrink: 0;
}

.logo {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--text-main), var(--text-dim));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#nav-container {
    display: flex;
    gap: 30px;
    align-items: center;
}

#nav-links {
    display: flex;
    gap: 25px;
    align-items: center;
}

#nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

#nav-links a:hover,
#nav-links a.active {
    color: var(--text-main);
}

#nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

#mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

/* Layout System */
.layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 30px;
    flex: 1;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px 40px;
}

.panel {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 25px;
    height: fit-content;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: relative;
}

#sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Scrollbar styles for Sidebar */
#sidebar::-webkit-scrollbar {
    width: 6px;
}
#sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.viz-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    min-height: 0;
}

.viz-panel-wrapper {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    #sidebar {
        position: static;
        max-height: none;
        width: 100%;
    }
    header {
        padding: 15px 20px;
    }
}

@media (max-width: 768px) {
    #mobile-menu-toggle {
        display: block;
    }

    #nav-links {
        display: none; /* Hidden by default on mobile */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--glass-bg);
        flex-direction: column;
        padding: 20px;
        gap: 15px;
        border-bottom: 1px solid var(--border);
        backdrop-filter: blur(20px);
        box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    }

    #nav-links.active {
        display: flex;
    }

    .matchup-header {
        flex-direction: column;
        gap: 20px;
    }

    .team-display {
        width: 100%;
        justify-content: center;
    }
    
    .team-away, .team-home {
        justify-content: center;
    }

    .team-name {
        font-size: 1.5rem;
    }

    .prob-bar-container {
        height: 60px;
        width: 100%;
        margin-bottom: 5px;
    }

    .prob-value {
        font-size: 1.4rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .layout {
        padding: 15px;
        gap: 20px;
    }
    
    header {
        padding: 10px 15px;
    }
}

/* Existing utility and component styles */
h2 {
    margin-top: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

.control-group {
    margin-bottom: 20px;
}

label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

select, input[type="number"], input[type="text"] {
    width: 100%;
    padding: 12px;
    background: var(--surface-highlight);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
}

.val-display {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    background: var(--surface-highlight);
    height: 6px;
    border-radius: 3px;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-secondary {
    padding: 10px 15px;
    background: var(--surface-highlight);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--text-main);
}

.terminal {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-dim);
    height: 250px;
    overflow-y: auto;
    backdrop-filter: blur(8px);
}

.term-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #555;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 5px;
}

.badge {
    font-size: 0.65rem;
    background: var(--surface-highlight);
    color: var(--accent);
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 2000;
    transform: translateY(100px);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.toast.show {
    transform: translateY(0);
}

/* Refactored Inline Styles */

.text-primary {
    color: var(--primary);
}

.nav-premium-link {
    color: var(--accent) !important; 
    font-weight: 800 !important;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sim-factors-summary {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 15px;
}

.team-selector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.advanced-factors-details {
    margin-bottom: 20px;
}

.btn-save-mini {
    font-size: 0.7rem;
    padding: 4px 8px;
}

.hidden {
    display: none;
}

.team-name-placeholder {
    color: var(--text-dim);
}

/* Matchup Header: Unified Row */
.matchup-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
    width: 100%;
}

.team-display {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 150px; /* Prevent shrinking too much */
}

/* Specific alignments for sides */
.team-away {
    justify-content: flex-start;
}

.team-home {
    justify-content: flex-end;
}

.team-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.team-name {
    font-size: 1.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-primary);
}

.prob-bar-container {
    display: flex;
    flex-grow: 1; /* Fill the center space */
    height: 40px; /* Slightly slimmer */
    background: var(--surface-highlight);
    border-radius: 20px; /* Pill shape */
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    margin: 0; /* Remove old margin */
}

.bar-segment {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
}

.prob-bar-initial {
    width: 50%;
    background: var(--surface-highlight);
}

.stat-sublabel {
    font-size: 0.6rem;
    color: var(--text-dim);
}

.weather-val {
    font-size: 1.1rem;
    color: var(--accent);
}

.news-container-box {
    margin-top: 30px;
    display: none;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.news-header {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 15px;
}

.news-feed-content {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.shap-container {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-online {
    color: #10b981;
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.auth-panel {
    width: 400px;
    max-width: 90%;
}

.auth-terms-group {
    display: none;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 15px;
}

.auth-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 15px;
}

.link-accent {
    color: var(--accent);
}

.w-full {
    width: 100%;
}

.premium-panel {
    width: 500px;
    max-width: 90%;
    text-align: center;
}

.justify-center {
    justify-content: center;
}

.premium-desc {
    color: var(--text-dim);
    margin: 20px 0;
}

.price-box {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid var(--primary);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.price-large {
    font-size: 2rem;
    font-weight: 800;
}

.price-per-mo {
    font-size: 1rem;
    font-weight: 400;
}

.btn-later {
    width: 100%;
    margin-top: 10px;
}

/* App.js Dynamic Styles */

.log-timestamp {
    color: #666;
    font-size: 0.75rem;
}

.log-arrow {
    color: var(--primary);
    font-weight: bold;
}

.badge-pro {
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-right: 10px;
}

.btn-upgrade-mini {
    margin: 0;
    width: auto;
    padding: 4px 10px;
    font-size: 0.7rem;
    margin-right: 10px;
    border-color: var(--primary);
    color: var(--primary);
}

.auth-header-wrapper {
    display: flex;
    align-items: center;
}

.user-email-display {
    font-size: 0.8rem;
    margin-right: 10px;
    color: var(--text-dim);
}

.btn-logout-mini {
    margin: 0;
    width: auto;
    padding: 4px 10px;
    font-size: 0.7rem;
}

.btn-login-mini {
    margin: 0;
    width: auto;
    padding: 8px 16px;
}

.news-lock-container {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
}

.lock-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.btn-unlock {
    margin-top: 10px;
    border-color: var(--primary);
    color: var(--primary);
}

.news-no-content {
    color: #666;
    font-style: italic;
}

.news-item {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.news-hl-injury {
    color: var(--danger);
}

.news-link {
    color: #ccc;
    text-decoration: none;
    font-weight: bold;
    display: block;
}

.news-desc {
    font-size: 0.75rem;
    color: #777;
    margin-top: 2px;
}

.news-error {
    color: var(--danger);
}

/* Custom Vars */
.custom-var-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.cv-header {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.cv-input-desc {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #444;
    color: white;
    padding: 5px;
    border-radius: 4px;
}

.btn-del-var {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-weight: bold;
}

.cv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.cv-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cv-input-range {
    width: 100%;
}

.cv-select {
    width: 100%;
    padding: 4px;
    font-size: 0.75rem;
    background: #222;
    color: white;
    border: 1px solid #444;
    border-radius: 4px;
}
