/* Tokyo Night Color Palette & Base Styles */
:root {
    --bg-dark: #121212;
    --card-bg: #1a1b26;
    /* Slightly lighter charcoal from Tokyo Night palette */
    --text-primary: #c0caf5;
    --text-highlight: #ffffff;
    --accent-emerald: #00ff9d;
    /* Neon Emerald */
    --accent-purple: #bb9af7;
    --accent-blue: #7aa2f7;
    --accent-red: #f7768e;
    --border-color: #414868;
}

body {
    margin: 0;
    padding: 20px;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    box-sizing: border-box;
}

h1,
h2,
h3 {
    color: var(--text-highlight);
    margin: 0;
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.dashboard-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.last-updated {
    font-size: 0.8rem;
    color: var(--border-color);
    font-weight: 500;
}

.refresh-btn {
    background: transparent;
    border: 1px solid var(--accent-emerald);
    color: var(--accent-emerald);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    position: relative;
}

.refresh-btn:hover {
    background: rgba(0, 255, 157, 0.1);
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.2);
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: var(--border-color);
    color: var(--border-color);
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-left-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-spinner.hidden {
    display: none;
}

.refresh-btn .btn-text.hidden {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.live-indicator {
    background-color: rgba(0, 255, 157, 0.1);
    color: var(--accent-emerald);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-indicator::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

/* Bento Grid Layout */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.card h2 {
    font-size: 1rem;
    color: var(--accent-blue);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    opacity: 0.9;
}

/* Gauge Card Specifics */
.gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    position: relative;
    padding: 20px;
}

.gauge-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-highlight);
    position: absolute;
    bottom: 35px;
}

.gauge-svg {
    width: 100%;
    max-width: 250px;
    overflow: visible;
}

.gauge-range {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 250px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--border-color);
}

/* Metrics Card Specifics */
.metrics-card {
    grid-column: span 1;
    /* Default to single column */
}

@media (min-width: 900px) {
    .metrics-card {
        grid-column: span 2;
        /* Span 2 columns on larger screens */
    }
}

.chart-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    justify-content: center;
}

.bar-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar-group label {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.bar-wrapper {
    background-color: rgba(255, 255, 255, 0.05);
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
}

.bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 8px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

#retail-sentiment-bar {
    background: linear-gradient(90deg, var(--accent-red), orange);
    /* Retail typically orange/red heat */
}

.bar-value {
    position: absolute;
    right: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 1;
    color: var(--text-highlight);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Status Card Specifics */
.verdict-display {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-highlight);
    text-align: center;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: capitalize;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .metrics-card {
        grid-column: span 1;
    }

    .gauge-value {
        font-size: 2.5rem;
    }

    .verdict-display {
        font-size: 2rem;
    }
}