/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Background Elements */
.bg-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.bg-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(0, 188, 212, 0.1) 0%, rgba(0, 0, 0, 0.8) 70%);
}

.bg-track {
    position: absolute;
    top: 50%;
    right: -200px;
    width: 600px;
    height: 400px;
    background: url('../assets/images/nyst-track-layout.jpg') no-repeat center;
    background-size: contain;
    opacity: 0.03;
    transform: translateY(-50%) rotate(15deg);
}

/* Header */
.header {
    padding: 30px 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(26, 26, 26, 0.9) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 188, 212, 0.2);
}

.header-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 40px;
}

.logo {
    height: 80px;
    width: auto;
    filter: drop-shadow(0 0 20px rgba(0, 188, 212, 0.3));
    transition: all 0.3s ease;
}

.logo:hover {
    filter: drop-shadow(0 0 30px rgba(0, 188, 212, 0.5));
    transform: scale(1.05);
}

.title-section {
    text-align: center;
}

.main-title {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 10px;
}

.title-line-1 {
    display: block;
    background: linear-gradient(135deg, #00bcd4 0%, #0097a7 50%, #006064 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-line-2 {
    display: block;
    color: #ffffff;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    color: #cccccc;
    font-weight: 400;
}

.track-section {
    display: flex;
    align-items: center;
}

.partner-logo {
    position: relative;
    text-align: center;
}

.partner-logo-img {
    height: 80px;
    width: auto;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px;
    transition: all 0.3s ease;
}

.partner-logo-img:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.1);
}

/* Stats Bar */
.stats-bar {
    padding: 30px 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.1) 0%, rgba(0, 0, 0, 0.3) 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 188, 212, 0.2);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 188, 212, 0.2);
    border-color: rgba(0, 188, 212, 0.4);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #00bcd4;
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: #cccccc;
    font-weight: 500;
}

/* Controls */
.controls {
    padding: 20px 0;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.sort-controls,
.filter-controls,
.signup-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sort-controls label {
    color: #cccccc;
    font-weight: 500;
}

.sort-select,
.filter-select {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 188, 212, 0.3);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    min-width: 150px;
    transition: all 0.3s ease;
}

.sort-select:focus,
.filter-select:focus {
    outline: none;
    border-color: #00bcd4;
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.3);
}

.sort-order-btn {
    padding: 10px 12px;
    background: rgba(0, 188, 212, 0.2);
    border: 1px solid rgba(0, 188, 212, 0.3);
    border-radius: 8px;
    color: #00bcd4;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.sort-order-btn:hover {
    background: rgba(0, 188, 212, 0.3);
    transform: translateY(-2px);
}

.sort-order-btn[data-order="DESC"] i {
    transform: rotate(180deg);
}

/* Track Day Signup Button */
.signup-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.signup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
    background: linear-gradient(135deg, #f7931e 0%, #ff6b35 100%);
}

.signup-btn i {
    font-size: 16px;
}

/* Leaderboard */
.leaderboard {
    padding: 40px 0 80px;
    min-height: 60vh;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.leaderboard-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 188, 212, 0.4);
}

.refresh-btn i {
    transition: transform 0.3s ease;
}

.refresh-btn:hover i {
    transform: rotate(180deg);
}

/* Table */
.leaderboard-table-container {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(0, 188, 212, 0.2);
    backdrop-filter: blur(10px);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    background: linear-gradient(135deg, rgba(0, 188, 212, 0.2) 0%, rgba(0, 0, 0, 0.5) 100%);
    padding: 20px 15px;
    text-align: left;
    font-weight: 600;
    color: #00bcd4;
    border-bottom: 2px solid rgba(0, 188, 212, 0.3);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-table td {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.leaderboard-table tbody tr {
    transition: all 0.3s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(0, 188, 212, 0.1);
    transform: scale(1.01);
}

.leaderboard-table tbody tr:nth-child(1) {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.leaderboard-table tbody tr:nth-child(2) {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.leaderboard-table tbody tr:nth-child(3) {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1) 0%, rgba(0, 0, 0, 0.2) 100%);
}

.pos-col {
    width: 60px;
    text-align: center;
}

.position {
    font-weight: 700;
    font-size: 1.2rem;
    color: #00bcd4;
}

.position.first {
    color: #ffd700;
}

.position.second {
    color: #c0c0c0;
}

.position.third {
    color: #cd7f32;
}

.driver-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 1.1rem;
}

.vehicle {
    color: #cccccc;
    font-weight: 500;
}

.lap-time {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 1.2rem;
    color: #00bcd4;
}

.car-type {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.car-type.street {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.car-type.track {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.car-type.race {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.specs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85rem;
}

.spec-item {
    color: #cccccc;
}

.spec-value {
    color: #00bcd4;
    font-weight: 600;
}

.record-date {
    color: #999999;
    font-size: 0.85rem;
}

/* Loading and Error States */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #cccccc;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 188, 212, 0.3);
    border-top: 3px solid #00bcd4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: #f44336;
    font-weight: 600;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(26, 26, 26, 0.9) 100%);
    border-top: 1px solid rgba(0, 188, 212, 0.2);
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    color: #00bcd4;
    margin-bottom: 15px;
    font-weight: 600;
}

.footer-section p {
    color: #cccccc;
    line-height: 1.6;
    margin-bottom: 8px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #999999;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .header-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 20px;
    }
    
    .track-section {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 20px 0;
    }
    
    .logo {
        height: 60px;
    }
    
    .main-title {
        font-size: 1.8rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.4rem;
    }
    
    .controls-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sort-controls,
    .filter-controls {
        justify-content: center;
    }
    
    .leaderboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .leaderboard-table {
        font-size: 0.85rem;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 12px 8px;
    }
    
    .specs-col,
    .date-col {
        display: none;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .leaderboard-table {
        font-size: 0.8rem;
    }
    
    .type-col {
        display: none;
    }
    
    .vehicle-col {
        max-width: 120px;
    }
    
    .vehicle {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

