* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
 
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    border-radius: 15px;
    padding: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 2px solid #0f3460;
}

/* Header Section Styles */
.header-section {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 30px;
    gap: 30px;
    position: relative;
    padding-left: 0px;
}

.header-main {
    flex: 0 0 auto;
    text-align: left;
    margin-right: auto;
    margin-left: 0px;
}

.header-main h1 {
    color: #ffffff;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.header-main .track-info {
    color: #bb86fc;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.header-main .version-info {
    color: #87CEEB;
    font-size: 0.9rem;
    font-weight: 400;
    margin-top: 5px;
    font-style: italic;
    opacity: 0.8;
}

/* Compact Upload Section Styles */
.upload-section-compact {
    position: absolute;
    right: 10px;
    top: -18px;
    flex-shrink: 0;
    min-width: 420px;
    max-width: 480px;
    z-index: 10;
}

.upload-card-compact {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid #0f3460;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-card-compact h4 {
    color: #ffffff;
    font-size: 0.8rem;
    margin: 0;
    text-align: center;
}

.upload-content-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.upload-area-compact {
    border: 2px dashed #0f3460;
    border-radius: 6px;
    padding: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(15, 52, 96, 0.1);
    flex: 1;
    min-width: 100px;
}

.upload-button-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 0 0 60px;
}

.upload-status-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 120px;
}

.upload-area-compact:hover {
    border-color: #bb86fc;
    background: rgba(187, 134, 252, 0.1);
}

.upload-area-compact.dragover {
    border-color: #bb86fc;
    background: rgba(187, 134, 252, 0.2);
}

.upload-icon-compact {
    font-size: 1rem;
    margin-bottom: 2px;
}

.upload-text-compact p {
    color: #ffffff;
    margin: 0;
    font-size: 0.7rem;
    line-height: 1.1;
}

.upload-btn-compact {
    background: linear-gradient(135deg, #bb86fc 0%, #9c4df4 100%);
    border: none;
    padding: 6px 8px;
    border-radius: 4px;
    color: white;
    font-size: 0.65rem;
    width: 100%;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    writing-mode: horizontal-tb;
    text-align: center;
}

.upload-btn-compact:hover {
    background: linear-gradient(135deg, #9c4df4 0%, #bb86fc 100%);
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(187, 134, 252, 0.4);
}

.upload-btn-compact:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Compact upload status styles */
.upload-section-compact .upload-status {
    font-size: 0.75rem;
    text-align: left;
    padding: 8px 6px;
    border-radius: 4px;
    margin: 0;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.upload-section-compact .upload-status.success {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid #4CAF50;
}

.upload-section-compact .upload-status.error {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid #f44336;
}

.upload-section-compact .upload-status.info {
    background: rgba(33, 150, 243, 0.2);
    color: #2196F3;
    border: 1px solid #2196F3;
}

.upload-section-compact .upload-status.warning {
    background: rgba(255, 152, 0, 0.2);
    color: #FF9800;
    border: 1px solid #FF9800;
}

/* Mobile responsiveness for header section */
@media (max-width: 768px) {
    .header-section {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        position: static;
        padding-left: 0;
    }
    
    .header-main {
        text-align: center;
        margin-left: 0;
    }
    
    .upload-section-compact {
        position: static;
        min-width: auto;
        max-width: none;
        width: 100%;
        max-width: 400px;
    }
    
    .upload-content-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .upload-area-compact,
    .upload-button-col,
    .upload-status-col {
        min-width: auto;
        flex: none;
    }
    
    .upload-button-col {
        flex: none;
    }
    
    .upload-status-col .upload-status {
        text-align: center;
        min-height: 30px;
        font-size: 0.8rem;
    }
    
    .header-main h1 {
        font-size: 2rem;
        text-align: center;
    }
    
    .header-main .track-info {
        text-align: center;
        font-size: 1.1rem;
    }
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #0f3460;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.header .track-info {
    font-size: 1.2rem;
    color: #bbbbbb;
    margin-bottom: 15px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid #0f3460;
}

.leaderboard-table th {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    color: #ffffff;
    padding: 10px 5px;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    border-right: 1px solid #1a1a2e;
    height: 40px;
}

.leaderboard-table th:last-child {
    border-right: none;
}

.leaderboard-table td {
    padding: 8px 5px;
    border-bottom: 1px solid #0f3460;
    border-right: 1px solid rgba(15, 52, 96, 0.2);
    background: linear-gradient(135deg, rgba(15, 52, 96, 0.1) 0%, rgba(26, 26, 46, 0.1) 100%);
    height: 30px;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
}

.leaderboard-table td:last-child {
    border-right: none;
}

.leaderboard-table tr:hover {
    background: linear-gradient(135deg, rgba(15, 52, 96, 0.4) 0%, rgba(26, 26, 46, 0.3) 100%);
    transition: background 0.3s ease;
}

.position {
    font-weight: bold;
    color: #FFFFFF;
    text-align: center;
    font-size: 1.1rem;
}

.position.p1 { color: #FFD700; }
.position.p2 { color: #C0C0C0; }
.position.p3 { color: #CD7F32; }

.class-position {
    font-weight: bold;
    color: #FFFFFF;
    text-align: center;
    font-size: 1.1rem;
}

.class-position.cp1 { color: #FFD700; }
.class-position.cp2 { color: #C0C0C0; }
.class-position.cp3 { color: #CD7F32; }

.driver-name {
    font-weight: bold;
    color: #ffffff;
    font-size: 16px;
    text-align: left;
    margin-left: 5px;
}

/* Car Class Colors:
   Hyper: #FF4444 (Red)
   LMP2: #87CEEB (Sky Blue) - includes LMP2_ELMS
   LMP3: #FFB6C1 (Baby Pink)
   GTE: #F39C12 (Orange)
   GT3: #07D300 (Green)
*/

.driver-name.Hyper {
    color: #FF4444;
}

.driver-name.LMP2 {
    color: #87CEEB;
}

.driver-name.LMP2_ELMS {
    color: #87CEEB;
}

.driver-name.LMP3 {
    color: #FFB6C1;
}

.driver-name.GTE {
    color: #F39C12;
}

.driver-name.GT3 {
    color: #07D300;
}

.car-type {
    color: #ffffff;
    font-size: 16px;
    text-align: left;
    margin-left: 5px;
}

.car-class-text {
    font-weight: bold;
    font-size: 16px;
    text-align: center;
}

.car-class-text.Hyper {
    color: #FF4444;
}

.car-class-text.LMP2 {
    color: #87CEEB;
}

.car-class-text.LMP2_ELMS {
    color: #87CEEB;
}

.car-class-text.LMP3 {
    color: #FFB6C1;
}

.car-class-text.GTE {
    color: #F39C12;
}

.car-class-text.GT3 {
    color: #07D300;
}

.lap-time {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: normal;
    color: #ffffff;
    font-size: 16px;
    text-align: center;
}

.lap-time.no-time {
    color: #ff6b6b;
}

.delta {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    font-weight: normal;
    text-align: center;
}

.delta.fastest {
    color: #4CAF50;
}

.delta.overall {
    color: #F39C12;
}

.driver-name.Hyper {
    color: #FF4444;
}

.car-class-text.Hyper {
    color: #FF4444;
}

.delta.class-hyper {
    color: #FF4444;
}

.delta.class-lmp2 {
    color: #87CEEB;
}

.delta.class-lmp2_elms {
    color: #87CEEB;
}

.delta.class-lmp3 {
    color: #FFB6C1;
}

.delta.class-gte {
    color: #F39C12;
}

.delta.class-gt3 {
    color: #07D300;
}

.sector {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #ffffff;
    font-size: 16px;
    text-align: center;
}

.sector.fastest-sector {
    color: #bb86fc;
    font-weight: bold;
}

.top-speed {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #ffffff;
    font-size: 16px;
    text-align: center;
}

.top-speed.Hyper {
    color: #FF4444;
}

.top-speed.LMP2 {
    color: #87CEEB;
}

.top-speed.LMP2_ELMS {
    color: #87CEEB;
}

.top-speed.LMP3 {
    color: #FFB6C1;
}

.top-speed.GTE {
    color: #F39C12;
}

.top-speed.GT3 {
    color: #07D300;
}

.fuel-level {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #ffffff;
    font-size: 16px;
    text-align: center;
}

.fastest-lap {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(15, 52, 96, 0.3);
    border: 2px solid #0f3460;
}

.fastest-lap h3 {
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.fastest-lap .time {
    font-size: 2rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    margin-bottom: 5px;
}

.fastest-lap .driver {
    font-size: 1.1rem;
    opacity: 0.9;
}

.loading {
    text-align: center;
    padding: 50px;
    font-size: 1.2rem;
    color: #bbbbbb;
}

/* Upload Section Styles */
.upload-section {
    margin-bottom: 30px;
}

.upload-card {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 2px solid #0f3460;
    margin-bottom: 20px;
}

.upload-card h3 {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

.upload-area {
    border: 2px dashed #0f3460;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(15, 52, 96, 0.1);
}

.upload-area:hover {
    border-color: #bb86fc;
    background: rgba(187, 134, 252, 0.1);
}

.upload-area.dragover {
    border-color: #bb86fc;
    background: rgba(187, 134, 252, 0.2);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-text p {
    color: #ffffff;
    margin: 5px 0;
}

.upload-hint {
    color: #bbbbbb !important;
    font-size: 0.9rem;
}

.upload-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
}

.upload-status.success {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid #4CAF50;
}

.upload-status.error {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid #f44336;
}

.upload-status.info {
    background: rgba(33, 150, 243, 0.2);
    color: #2196F3;
    border: 1px solid #2196F3;
}

.upload-status.warning {
    background: rgba(255, 152, 0, 0.2);
    color: #FF9800;
    border: 1px solid #FF9800;
}

#uploadBtn {
    background: linear-gradient(135deg, #bb86fc 0%, #9c5dfd 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#uploadBtn:hover {
    background: linear-gradient(135deg, #9c5dfd 0%, #bb86fc 100%);
    transform: translateY(-2px);
}

#uploadBtn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .session-stats {
        gap: 15px;
    }
    
    .leaderboard-table {
        font-size: 0.8rem;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 5px;
    }
    
    .upload-card {
        padding: 20px;
        margin: 10px 0;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .upload-text p {
        font-size: 0.9rem;
    }
    
    .driver-selection-modal .driver-selection-content {
        margin: 20px;
        max-height: 80vh;
    }
    
    .driver-list {
        max-height: 300px;
    }
    
    .driver-selection-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .driver-selection-buttons button {
        width: 100%;
    }
}

/* Driver Selection Modal Styles */
.driver-selection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.driver-selection-content {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 2px solid #0f3460;
    color: #ffffff;
}

.driver-selection-content h3 {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 15px;
    text-align: center;
}

.driver-selection-content p {
    color: #bbbbbb;
    margin-bottom: 20px;
    text-align: center;
}

.driver-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 10px;
    background: rgba(15, 52, 96, 0.1);
}

.driver-item {
    padding: 12px;
    margin: 8px 0;
    border-radius: 6px;
    background: rgba(15, 52, 96, 0.2);
    border: 1px solid #0f3460;
    transition: all 0.3s ease;
}

.driver-item:hover {
    background: rgba(15, 52, 96, 0.4);
    border-color: #bb86fc;
}

.driver-item.select-all-item {
    background: rgba(187, 134, 252, 0.1);
    border-color: #bb86fc;
    margin-bottom: 15px;
}

.driver-item.select-all-item:hover {
    background: rgba(187, 134, 252, 0.2);
}

.driver-item label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    width: 100%;
}

.driver-item input[type="checkbox"] {
    margin: 0;
    transform: scale(1.2);
    accent-color: #bb86fc;
    flex-shrink: 0;
    margin-top: 2px;
}

.driver-info {
    flex: 1;
    line-height: 1.4;
}

.driver-info strong {
    color: #ffffff;
    font-size: 1.1rem;
}

.driver-info small {
    color: #bbbbbb;
    font-size: 0.9rem;
}

.driver-selection-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.confirm-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 200px;
}

.confirm-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.confirm-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 200px;
}

.cancel-btn:hover {
    background: linear-gradient(135deg, #d32f2f 0%, #f44336 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(244, 67, 54, 0.4);
}
