/* ==========================================================================
   LMU Live Timing Dashboard Styling
   ========================================================================== */

:root {
    --bg-gradient: linear-gradient(135deg, #090a0f 0%, #121420 100%);
    --panel-bg: rgba(22, 25, 41, 0.7);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #90a0c7;
    --accent-color: #ff3366;
    
    /* Class Colors */
    --hypercar-color: #e10600;
    --lmp2-color: #0056b3;
    --gt3-color: #ff9f00;
    --gte-color: #00b074;
    
    /* Flag Colors */
    --yellow-flag: #ffd000;
    --red-flag: #ff3333;
    --green-flag: #00d26a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    padding: 20px;
}

.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Font helpers */
.font-accent {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}
.font-mono {
    font-family: monospace;
    font-size: 1.05rem;
}

/* ==========================================================================
   Flag Status Banner
   ========================================================================== */
.flag-banner {
    width: 100%;
    padding: 12px;
    text-align: center;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 1.4rem;
    letter-spacing: 2px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.flag-banner.hide-banner {
    display: none;
}

.flag-banner.active-banner {
    display: block;
    animation: flash-banner 1.5s infinite alternate;
}

.flag-banner.yellow, .flag-banner.full_course_yellow {
    background-color: var(--yellow-flag);
    color: #000;
}

.flag-banner.red {
    background-color: var(--red-flag);
    color: #fff;
}

@keyframes flash-banner {
    0% { opacity: 0.85; }
    100% { opacity: 1; transform: scale(1.005); }
}

/* ==========================================================================
   Header Panels
   ========================================================================== */
.dashboard-header {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 51, 102, 0.15);
    border: 1px solid rgba(255, 51, 102, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 50%;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.5; }
}

.live-label {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--accent-color);
}

.track-info h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.2;
}

.session-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.session-badge.practice { background-color: #6c757d; }
.session-badge.qualifying { background-color: #9b51e0; }
.session-badge.race { background-color: #27ae60; }
.session-badge.offline { background-color: #c0392b; }

.header-center {
    text-align: center;
}

.time-counter {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.time-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

#session-time {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 2.2rem;
    letter-spacing: 1px;
}

.weather-widget {
    display: flex;
    gap: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    border-radius: 8px;
}

.weather-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.weather-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.weather-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
}

/* ==========================================================================
   Timing Table (Leaderboard)
   ========================================================================== */
.leaderboard-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    overflow: hidden;
}

.table-container {
    width: 100%;
    overflow-x: auto;
}

.timing-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.timing-table th {
    background: rgba(14, 16, 26, 0.8);
    padding: 16px 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-transform: uppercase;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
}

.timing-table td {
    padding: 14px 20px;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

/* Row states */
.driver-row {
    transition: background-color 0.2s ease;
}

.driver-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.01);
}

.driver-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.driver-row.in-pits {
    background: rgba(231, 76, 60, 0.04);
}

/* Class Badges */
.class-badge {
    display: inline-block;
    padding: 4px 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.75rem;
    border-radius: 4px;
    text-align: center;
    width: 90px;
}

.class-hypercar { background-color: var(--hypercar-color); color: #fff; }
.class-lmp2 { background-color: var(--lmp2-color); color: #fff; }
.class-lmgt3 { background-color: var(--gt3-color); color: #000; }
.class-gte { background-color: var(--gte-color); color: #fff; }

/* Tyre compound pills */
.tyre-pill {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    border-radius: 50%;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 0.8rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tyre-soft { background-color: #ffffff; color: #000; }
.tyre-medium { background-color: #f1c40f; color: #000; }
.tyre-hard { background-color: #e74c3c; color: #fff; }
.tyre-wet { background-color: #3498db; color: #fff; }
.tyre-inter { background-color: #2ecc71; color: #fff; }
.tyre-unknown { background-color: #7f8c8d; color: #fff; }

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.status-badge.track {
    background-color: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
}

.status-badge.pit {
    background-color: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    font-weight: 900;
    animation: pulse-pit 1s infinite alternate;
}

.status-badge.dnf { background-color: rgba(127, 140, 141, 0.2); color: #bdc3c7; }
.status-badge.dq { background-color: rgba(0, 0, 0, 0.5); color: #ff0000; border: 1px solid #ff0000; }

@keyframes pulse-pit {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

.purple-highlight {
    color: #d896ff;
}

/* ==========================================================================
   Loading & Empty States
   ========================================================================== */
.loading-state, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    gap: 15px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

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

.pulse-icon {
    font-size: 3rem;
    animation: heartbeat 2s infinite ease-in-out;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.dashboard-footer {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1200px) {
    .col-team, .col-interval, .col-tyre {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    
    .header-left {
        flex-direction: column;
        gap: 10px;
    }
    
    #session-time {
        font-size: 1.8rem;
    }

    .col-best-lap, .col-last-lap, .col-laps {
        display: none;
    }
}
