:root {
    --bg-dark: #0f1115;
    --bg-panel: #1a1d24;
    --bg-sidebar: #0b0d10;
    --primary: #0074e4;
    --text-main: #ffffff;
    --text-muted: #8a8d95;
    --accent-red: #d32f2f;
    --accent-orange: #f57c00;
    --accent-green: #388e3c;
    --license-r: #d32f2f;
    --license-d: #f57c00;
    --license-c: #fbc02d;
    --license-b: #388e3c;
    --license-a: #1976d2;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-area {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo-icon {
    color: var(--primary);
    font-size: 24px;
}

.nav-group {
    padding: 20px 0;
}

.nav-title {
    padding: 0 20px 10px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    gap: 15px;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
    background-color: rgba(255,255,255,0.05);
    border-left: 3px solid var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 20px 40px;
}

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

.season-info {
    font-family: 'Exo 2', sans-serif;
}

.season-title {
    font-size: 14px;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
}

.current-time {
    color: var(--text-muted);
    font-size: 14px;
    margin-left: 10px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.welcome-section {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}

.welcome-text h1 {
    font-family: 'Exo 2', sans-serif;
    font-size: 2rem;
    margin-bottom: 10px;
    color: #fff;
}
.welcome-text p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 15px;
}
.btn-update {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.btn-update:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}
.btn-update.updating {
    opacity: 0.6;
    pointer-events: none;
    cursor: wait;
}
.btn-update i {
    font-size: 0.8rem;
}

.tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-top: 20px;
}

.tab {
    padding-bottom: 10px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab.active {
    color: var(--text-main);
    border-color: var(--primary);
}

/* Featured Series Grid */
.featured-section {
    grid-column: 1 / -1;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Right Sidebar */
.right-sidebar {
    width: 90px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255,255,255,0.05);
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    padding: 20px 0;
    align-items: center;
    gap: 25px;
    overflow-y: auto;
}

.main-content {
    margin-right: 90px;
}

.license-gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.gauge {
    width: 56px;
    height: 56px;
    position: relative;
    border-radius: 50%;
    /* 270 degree arc starting from bottom left (-135deg or 225deg) */
    background: conic-gradient(from 225deg, 
        var(--color) calc(var(--percentage) * 2.7deg), 
        rgba(255,255,255,0.1) 0deg 270deg, 
        transparent 270deg
    );
    display: flex;
    justify-content: center;
    align-items: center;
}

.gauge::before {
    content: '';
    position: absolute;
    width: 46px; /* 56 - 10 (thickness 5px * 2) */
    height: 46px;
    background-color: var(--bg-sidebar);
    border-radius: 50%;
    z-index: 1;
}

.gauge-icon {
    position: relative;
    z-index: 2;
    width: 26px;
    height: 26px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gauge-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* If icons are black, invert them to white */
    /* filter: invert(1); */ 
}

.license-text {
    text-align: center;
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

.license-class {
    font-size: 13px;
    margin-bottom: 2px;
}

.license-ir {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.5px;
}

.series-card {
    background: var(--bg-panel);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.05);
}

.series-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.1);
}

.series-card-header {
    height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
}

.series-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.8));
    z-index: 1;
}

.series-tag {
    position: relative;
    z-index: 2;
    background: var(--primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
    text-transform: uppercase;
}

.series-card-logo {
    position: relative;
    z-index: 2;
    max-height: 50px;
    max-width: 100%;
    object-fit: contain;
    align-self: flex-end;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.series-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.series-card-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-main);
}

.series-card-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.detail-item i {
    width: 16px;
    text-align: center;
}

.detail-item.highlight {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 6px;
    color: var(--text-main);
    margin-top: 5px;
    font-weight: 500;
}

.detail-item.highlight i {
    color: var(--accent-orange);
}

/* Cards */
.card {
    background: var(--bg-panel);
    border-radius: 12px;
    padding: 20px;
    height: 100%;
}

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

.card-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 18px;
    font-weight: 600;
}

/* Recent Results */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.result-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    align-items: center;
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.car-thumb {
    width: 60px; /* Reduced size slightly for grid */
    height: 40px;
    background: #333;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #555;
    flex-shrink: 0; /* Prevent shrinking */
}

.result-info h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.result-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    background: rgba(255,255,255,0.1);
    margin-top: 5px;
}

/* Licenses - Removed unused classes */

.btn {
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: inline-block;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
    padding: 5px;
}

.btn-icon:hover {
    color: var(--text-main);
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-panel);
    margin: 10% auto;
    padding: 30px;
    border: 1px solid rgba(255,255,255,0.1);
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.5);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-main);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    font-weight: 600;
    width: 100%;
    font-size: 16px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #0062c4;
}

.btn-add {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-add:hover {
    background: #0062c4;
}

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

.section-header .card-title {
    margin: 0;
}

.section-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 20px;
    font-weight: 600;
}

.btn-remove-series {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: #ff4444;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.btn-remove-series:hover {
    background: #ff4444;
    color: white;
}

   .welcome-section {
            background: linear-gradient(rgba(30, 33, 36, 0.9), rgba(30, 33, 36, 0.9)), url('images/bg-pattern.png');
            background-size: cover;
            padding: 30px;
            border-radius: 15px;
            margin-bottom: 30px;
            border: 1px solid rgba(255, 255, 255, 0.05);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .welcome-text h1 {
            font-family: 'Exo 2', sans-serif;
            font-size: 2rem;
            margin-bottom: 10px;
            color: #fff;
        }
        .welcome-text p {
            color: var(--text-muted);
            font-size: 1.1rem;
        }

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

        .status-dot {
            height: 10px;
            width: 10px;
            background-color: #4caf50;
            border-radius: 50%;
            display: inline-block;
            margin-right: 8px;
            box-shadow: 0 0 5px #4caf50;
        }

        /* Championship Grid & Cards for Favorites */
        .championship-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }
        .championship-card {
            background: var(--bg-panel);
            border-radius: 12px;
            overflow: hidden;
            border: 1px solid rgba(255, 255, 255, 0.05);
            transition: transform 0.2s, box-shadow 0.2s;
            display: flex;
            flex-direction: column;
            text-decoration: none; /* In case we wrap in anchor */
        }
        .championship-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.3);
            border-color: var(--primary);
        }
        .championship-image-container {
            width: 100%;
            height: 160px;
            overflow: hidden;
            position: relative;
            background: #000;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
        }
        .championship-image-container img {
            width: 55%;
            object-fit: cover;
        }
        .championship-info {
            padding: 15px;
            flex-grow: 1;
        }
        .championship-name {
            font-family: 'Exo 2', sans-serif;
            font-weight: 600;
            font-size: 1rem;
            color: var(--text-main);
            margin-bottom: 5px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* Recent Sessions List */
        .recent-sessions-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .session-row {
            display: flex;
            align-items: center;
            background: var(--bg-panel);
            border: 1px solid rgba(255,255,255,0.05);
            border-radius: 10px;
            padding: 12px;
            gap: 15px;
            transition: all 0.2s;
            text-decoration: none;
        }
        .session-row:hover {
            transform: translateX(5px);
            border-color: rgba(255,255,255,0.1);
            background: rgba(255,255,255,0.03);
        }
        .session-track-img {
            width: 100px;
            height: 60px;
            border-radius: 6px;
            object-fit: cover;
            background: #000;
            flex-shrink: 0;
        }
        .session-info {
            flex: 1;
            min-width: 0; /* for truncation */
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        .session-track-name {
            font-weight: 600;
            color: var(--text-main);
            font-size: 0.95rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .session-track-variant {
            font-size: 0.8rem;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .session-car-info {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.8rem;
            color: var(--primary);
            margin-top: 4px;
        }
        .session-stats {
            text-align: right;
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: 4px;
            flex-shrink: 0;
        }
        .session-date {
            font-size: 0.85rem;
            color: var(--text-main);
            font-weight: 500;
        }
        .session-meta {
            font-size: 0.75rem;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 8px;
        }
