/* Lap Timer Tracker - Public Page Stylesheet */

/* Page Back Button */
.page-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: white;
    background: var(--theme-accent, #1976d2);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    padding: 8px 18px 8px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.page-back:hover {
    background: var(--theme-accent-dark, #1565c0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
    transform: translateY(-1px);
    color: white;
}
.page-back .material-icons { font-size: 18px; }

/* Utility Classes */
.hidden {
    display: none !important;
}

.mb-24 {
    margin-bottom: 24px;
}

.mt-12 {
    margin-top: 12px;
}

/* Info Text Block */
.info-text {
    color: var(--theme-text-muted, #666);
    font-size: 15px;
    line-height: 1.6;
}

/* Intro Card */
.intro-card {
    background: linear-gradient(135deg, #1976d2 0%, #64b5f6 100%);
    color: white;
    text-align: center;
    padding: 32px 24px;
}

.intro-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 12px 0;
    letter-spacing: -0.5px;
}

.intro-text {
    font-size: 16px;
    line-height: 1.7;
    margin: 0;
    opacity: 0.95;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* Homepage quick links */
.quick-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.quick-link-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    background: var(--theme-card-bg, white);
    color: var(--theme-text, #333);
    border: 1px solid var(--theme-border, #e0e0e0);
    border-radius: 10px;
    padding: 16px 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.quick-link-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--theme-accent-light, #64b5f6);
}

.quick-link-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1976d2 0%, #64b5f6 100%);
    color: white;
    flex-shrink: 0;
}

.quick-link-content {
    flex: 1;
}

.quick-link-content h3 {
    margin: 0 0 4px 0;
    font-size: 17px;
    font-weight: 600;
}

.quick-link-content p {
    margin: 0;
    color: var(--theme-text-muted, #666);
    font-size: 14px;
}

.quick-link-arrow {
    color: var(--theme-text-muted, #777);
}

/* Filter Section */
.filter-header {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--theme-text, #333);
}

.filter-icon {
    vertical-align: middle;
    margin-right: 8px;
}

/* Public Page Layout */
.public-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--theme-bg, #f5f5f5);
}

/* Public App Bar */
.public-app-bar {
    background-color: var(--theme-header, #64b5f6);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.public-app-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.app-bar-left {
    display: flex;
    align-items: center;
}

.app-bar-logo {
    height: 40px;
    margin-right: 15px;
    vertical-align: middle;
}

/* Login Button */
.btn-login {
    background-color: var(--theme-card-bg, white);
    color: var(--theme-accent, #1976d2);
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-login:hover {
    background-color: var(--theme-hover, #f5f5f5);
    transform: translateY(-1px);
}

/* Main Content Area */
.public-main-content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Game Sections */
.game-section {
    margin-bottom: 32px;
}

.game-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--theme-accent-light, #64b5f6);
}

.game-header-icon {
    color: var(--theme-accent-light, #64b5f6);
    font-size: 28px;
}

.game-title {
    font-size: 24px;
    font-weight: 500;
    color: var(--theme-text, #333);
}

/* Circuit Cards */
.circuit-card {
    background: var(--theme-card-bg, white);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid var(--theme-border, transparent);
}

.circuit-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.circuit-name {
    font-size: 18px;
    font-weight: 500;
}

.circuit-info {
    display: flex;
    gap: 16px;
    font-size: 13px;
    opacity: 0.9;
}

.circuit-info span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.circuit-info .material-icons {
    font-size: 16px;
}

/* Laptimes Table */
.laptimes-table {
    width: 100%;
    border-collapse: collapse;
}

.laptimes-table th {
    background-color: var(--theme-table-header, #f5f5f5);
    padding: 12px;
    text-align: left;
    font-weight: 500;
    color: var(--theme-text-muted, #666);
    font-size: 13px;
    border-bottom: 2px solid var(--theme-border, #e0e0e0);
}

.laptimes-table td {
    padding: 12px;
    border-bottom: 1px solid var(--theme-border-light, #f0f0f0);
    font-size: 14px;
    color: var(--theme-text, #333);
}

.laptimes-table tbody tr:hover {
    background-color: var(--theme-table-hover, #fafafa);
}

/* Laptime Display */
.laptime-value {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--theme-accent, #1976d2);
}

.fastest-time {
    color: var(--theme-success, #4caf50);
}

/* Driver and Team */
.driver-name {
    font-weight: 500;
}

.team-name {
    color: var(--theme-text-muted, #666);
}

.team-dash {
    color: var(--theme-text-muted, #999);
}

/* Car Info */
.car-info {
    display: flex;
    flex-direction: column;
}

.car-name {
    font-weight: 500;
}

.car-class {
    font-size: 11px;
    color: var(--theme-text-muted, #888);
}

/* Weather Badge */
.weather-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    background: var(--theme-info-bg, #e3f2fd);
    color: var(--theme-info-text, #1565c0);
}

.weather-badge.rain {
    background: var(--theme-info-bg, #e8eaf6);
    color: var(--theme-info-text, #3949ab);
}

/* Session Badge */
.session-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.session-badge.race {
    background: var(--theme-error-bg, #ffebee);
    color: var(--theme-error-text, #c62828);
}

.session-badge.qualifying {
    background: var(--theme-warning-bg, #fff3e0);
    color: var(--theme-warning-text, #e65100);
}

.session-badge.practice {
    background: var(--theme-success-bg, #e8f5e9);
    color: var(--theme-success-text, #2e7d32);
}

/* Display Setup Icons */
.display-setup-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 5px;
}

.display-setup-icon {
    font-size: 28px !important;
    vertical-align: middle;
    cursor: default;
    line-height: 1;
    color: #1565c0;
}

.display-setup-label {
    font-size: 10px;
    color: #1565c0;
    font-weight: 500;
    line-height: 1;
}

.setup-cell {
    white-space: nowrap;
}

/* Setup Link Icon */
.setup-link {
    color: var(--theme-success, #2e7d32);
    font-size: 18px;
    margin-left: 6px;
    text-decoration: none !important;
    vertical-align: middle;
    cursor: pointer;
    font-weight: bold;
}

.setup-link:hover {
    color: var(--theme-success, #1b5e20);
    text-decoration: none !important;
}

/* Loading State */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    flex-direction: column;
    gap: 16px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--theme-border-light, #f0f0f0);
    border-top-color: var(--theme-accent, #1976d2);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--theme-text-secondary, #666);
}

.empty-state .material-icons {
    font-size: 64px;
    color: var(--theme-border, #ddd);
    margin-bottom: 16px;
}

/* Stats Summary */
.stats-summary {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.summary-card {
    background: var(--theme-card-bg, white);
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-card .material-icons {
    font-size: 32px;
    color: var(--theme-accent-light, #64b5f6);
}

a.summary-card-link {
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow 0.18s, transform 0.18s, background 0.18s, border-color 0.18s;
    border-left: 4px solid var(--theme-accent, #1976d2);
    background: linear-gradient(to right, rgba(25, 118, 210, 0.07) 0%, transparent 65%);
    position: relative;
    overflow: hidden;
}
a.summary-card-link .material-icons {
    color: var(--theme-accent, #1976d2);
}
a.summary-card-link::after {
    content: '›';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    color: var(--theme-accent, #1976d2);
    opacity: 0.35;
    transition: opacity 0.18s, right 0.18s;
}
a.summary-card-link:hover {
    box-shadow: 0 4px 14px rgba(25, 118, 210, 0.22);
    transform: translateY(-2px);
    background: linear-gradient(to right, rgba(25, 118, 210, 0.13) 0%, transparent 65%);
}
a.summary-card-link:hover::after {
    opacity: 0.75;
    right: 10px;
}
a.summary-card-link:hover .summary-label {
    color: var(--theme-accent, #1976d2);
}
a.summary-card-link .summary-label::after {
    content: '';
}

.summary-content .summary-value {
    font-size: 24px;
    font-weight: 500;
    color: var(--theme-text, #333);
}

.summary-content .summary-label {
    font-size: 12px;
    color: var(--theme-text-secondary, #666);
    text-transform: uppercase;
}

/* Position Indicators */
.position-cell {
    text-align: center;
    font-weight: 600;
}

.position-medal {
    font-size: 16px;
}

.position-gold {
    color: #ffd700;
}

.position-silver {
    color: #c0c0c0;
}

.position-bronze {
    color: #cd7f32;
}

/* Footer */
.public-footer {
    background: var(--theme-bg-secondary, #333);
    color: var(--theme-text-muted, #aaa);
    text-align: center;
    padding: 16px;
    font-size: 13px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .public-app-bar-content {
        padding: 12px 16px;
    }
    
    .app-title {
        font-size: 18px;
    }
    
    .public-main-content {
        padding: 16px;
    }
    
    .circuit-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .laptimes-table {
        font-size: 12px;
    }
    
    .laptimes-table th,
    .laptimes-table td {
        padding: 8px 6px;
    }
    
    .stats-summary {
        flex-direction: column;
    }
    
    .summary-card {
        width: 100%;
    }

    .quick-link-tile {
        padding: 14px;
    }
    
    .game-header {
        flex-wrap: wrap;
    }
    
    .game-title {
        font-size: 20px;
    }
}

/* How To Box */
.how-to-box {
    background: linear-gradient(135deg, #43a047 0%, #66bb6a 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
}

.how-to-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.how-to-icon {
    font-size: 28px;
    opacity: 0.9;
}

.how-to-text {
    margin: 0;
    font-size: 15px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.how-to-text .inline-icon {
    font-size: 20px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    padding: 2px;
    vertical-align: middle;
}

/* Accordion Styles */
.accordion-item {
    margin-bottom: 12px;
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.accordion-header:hover {
    opacity: 0.95;
}

.accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #ff9800;
    border-radius: 50%;
    transition: transform 0.3s ease, background-color 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.accordion-toggle:hover {
    background: #ffa726;
}

.accordion-toggle .material-icons {
    font-size: 16px;
    color: white;
    transition: transform 0.3s ease;
}

.accordion-header.expanded .accordion-toggle {
    background: #f57c00;
}

.accordion-header.expanded .accordion-toggle .material-icons {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    padding: 16px 0 0 0;
}

.accordion-content.expanded {
    display: block;
}

/* Game Accordion */
.game-accordion {
    background: var(--theme-card-bg, white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 16px;
}

.game-accordion-header {
    background: linear-gradient(135deg, #1976d2 0%, #64b5f6 100%);
    color: white;
    padding: 16px 20px;
}

.game-accordion-header .game-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.game-accordion-header .game-stats {
    display: flex;
    gap: 16px;
    margin-right: 16px;
    font-size: 13px;
    opacity: 0.9;
}

.game-accordion-header .game-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.game-accordion-header .game-stats .material-icons {
    font-size: 16px;
}

.game-accordion-content {
    padding: 16px 20px;
    background: var(--theme-bg-tertiary, #f9f9f9);
}

/* Circuit Accordion */
.circuit-accordion {
    background: var(--theme-card-bg, white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 12px;
}

.circuit-accordion-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 16px;
    flex-wrap: wrap;
}

.circuit-accordion-header .circuit-main-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.circuit-accordion-header .circuit-stats {
    display: flex;
    gap: 12px;
    margin-right: 12px;
    font-size: 12px;
    opacity: 0.9;
}

.circuit-accordion-header .circuit-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.circuit-accordion-header .circuit-stats .material-icons {
    font-size: 14px;
}

.circuit-accordion-content {
    padding: 0;
}

/* Loading indicator inside accordion */
.accordion-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 12px;
    color: var(--theme-text-secondary, #666);
}

.accordion-loading .loading-spinner-small {
    width: 24px;
    height: 24px;
    border: 3px solid var(--theme-border-light, #f0f0f0);
    border-top-color: var(--theme-accent, #1976d2);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Best laptime indicator in circuit header */
.best-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 13px;
}

.best-time-badge .material-icons {
    font-size: 14px;
}

/* Team Info Section */
.team-info-container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.team-info-logo {
    flex-shrink: 0;
}

.team-logo-large {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--theme-border, #e0e0e0);
    background: var(--theme-bg, #f5f5f5);
}

.no-logo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    border: 2px dashed var(--theme-border, #e0e0e0);
    background: var(--theme-bg-tertiary, #f9f9f9);
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-logo-placeholder .material-icons {
    font-size: 48px;
    color: var(--theme-text-muted, #bdbdbd);
}

.team-info-content {
    flex: 1;
    min-width: 0;
}

.team-info-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--theme-accent, #1976d2);
    margin: 0 0 8px 0;
}

.team-info-description {
    color: var(--theme-text-secondary, #666);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.team-members-section {
    background: var(--theme-bg-tertiary, #f5f7fa);
    border-radius: 8px;
    padding: 12px 16px;
}

.team-members-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--theme-text, #333);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.team-members-title .material-icons {
    font-size: 18px;
    color: var(--theme-accent, #1976d2);
}

.team-members-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.team-members-list li {
    background: var(--theme-card-bg, white);
    border: 1px solid var(--theme-border, #e0e0e0);
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 13px;
    color: var(--theme-text, #333);
}

/* View Mode Toggle */
.view-mode-container {
    padding: 16px 20px;
}

.view-mode-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--theme-text, #333);
    margin-bottom: 12px;
}

.view-mode-header .material-icons {
    color: var(--theme-accent-light, #1976d2);
}

.view-mode-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.view-mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid var(--theme-border, #e0e0e0);
    border-radius: 8px;
    background: var(--theme-card-bg, white);
    color: var(--theme-text-muted, #666);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-mode-btn:hover {
    border-color: var(--theme-accent-light, #1976d2);
    color: var(--theme-accent-light, #1976d2);
}

.view-mode-btn.active {
    background: linear-gradient(135deg, #1976d2 0%, #64b5f6 100%);
    border-color: #1976d2;
    color: white;
}

.view-mode-btn.active .material-icons {
    color: white;
}

.view-mode-btn .material-icons {
    font-size: 20px;
}

/* Circuit View Mode Styles */
.circuit-view-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.circuit-view-header .circuit-main-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.circuit-view-header .circuit-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    opacity: 0.9;
    margin-right: 16px;
    flex-shrink: 0;
}

.circuit-view-header .circuit-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.circuit-view-header .circuit-stats .material-icons {
    font-size: 14px;
}

.circuit-header-icon {
    color: white;
    margin-right: 8px;
    font-size: 24px;
}

.circuit-view-item {
    margin-bottom: 12px;
}

/* Car Class View Mode Styles (top-level accordion) */
.carclass-view-accordion {
    margin-bottom: 12px;
}

.carclass-view-header {
    background: linear-gradient(135deg, #7b1fa2 0%, #ab47bc 100%);
    border-radius: 8px;
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s;
}

.carclass-view-header:hover {
    background: linear-gradient(135deg, #6a1b9a 0%, #9c27b0 100%);
}

.carclass-view-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 8px;
}

.carclass-view-header.expanded + .carclass-view-content {
    max-height: 10000px;
    padding: 8px;
}

.carclass-view-header.expanded {
    border-radius: 8px 8px 0 0;
}

/* Car Accordion Styles */
.car-accordion {
    margin: 4px 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--theme-card-bg, white);
    border: 1px solid var(--theme-border, #e0e0e0);
}

.car-accordion-header {
    background: linear-gradient(135deg, #26a69a 0%, #4db6ac 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s;
}

.car-accordion-header:hover {
    background: linear-gradient(135deg, #00897b 0%, #26a69a 100%);
}

.car-main-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.car-header-icon {
    font-size: 20px;
}

.car-info-text {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.car-info-text .car-name {
    font-weight: 500;
    font-size: 14px;
}

.car-class-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.car-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    align-items: center;
}

.car-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.car-stats .material-icons {
    font-size: 16px;
}

.car-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--theme-bg, #f5f5f5);
}

.car-accordion-header.expanded + .car-accordion-content {
    max-height: 2000px;
}

/* Car Class Accordion Styles (Game view: Game > Circuit > Car Class > Laptimes) */
.carclass-accordion {
    margin: 4px 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--theme-card-bg, white);
    border: 1px solid var(--theme-border, #e0e0e0);
}

.carclass-accordion-header {
    background: linear-gradient(135deg, #7b1fa2 0%, #ab47bc 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s;
}

.carclass-accordion-header:hover {
    background: linear-gradient(135deg, #6a1b9a 0%, #9c27b0 100%);
}

.carclass-main-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.carclass-header-icon {
    font-size: 20px;
}

.carclass-name {
    font-weight: 500;
    font-size: 14px;
}

.carclass-label {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.85;
}

.carclass-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    align-items: center;
}

.carclass-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.carclass-stats .material-icons {
    font-size: 16px;
}

.carclass-best-time {
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
}

.carclass-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--theme-bg, #f5f5f5);
    padding: 0 8px;
}

.carclass-accordion-header.expanded + .carclass-accordion-content {
    max-height: 5000px;
    padding: 8px;
}

/* Fixed Setup Badge */
.fixed-setup-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    background: var(--theme-purple-bg, #ede7f6);
    color: var(--theme-purple-text, #4527a0);
    margin-left: 6px;
}

/* Game Badge in Laptimes Table */
.game-badge {
    background: linear-gradient(135deg, #1976d2 0%, #64b5f6 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .team-info-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .team-members-section {
        width: 100%;
    }
    
    .team-members-list {
        justify-content: center;
    }
    
    /* Accordion responsive styles */
    .game-accordion-header {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .game-accordion-header .game-stats {
        flex-wrap: wrap;
        gap: 8px;
        margin-right: 8px;
    }
    
    .circuit-accordion-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .circuit-accordion-header .circuit-stats {
        flex-wrap: wrap;
        gap: 6px;
        margin-right: 8px;
        font-size: 11px;
    }
    
    .circuit-main-info {
        width: 100%;
        margin-bottom: 4px;
    }
    
    .best-time-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    /* View mode responsive */
    .view-mode-buttons {
        flex-direction: column;
    }
    
    .view-mode-btn {
        justify-content: center;
    }
    
    /* Car accordion responsive */
    .car-accordion-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .car-stats {
        font-size: 11px;
        gap: 10px;
    }
    
    .car-info-text {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    /* Car class accordion responsive */
    .carclass-accordion-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .carclass-stats {
        font-size: 11px;
        gap: 10px;
    }
    
    .carclass-main-info {
        width: 100%;
        margin-bottom: 4px;
    }
}

/* ========================================
   Laptime Gap Visualization Chart
   ======================================== */

.laptime-chart {
    margin-top: 20px;
    padding: 20px;
    background: var(--theme-card-bg, #fff);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--theme-border, #e0e0e0);
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--theme-text, #333);
}

.chart-title .material-icons {
    color: var(--theme-primary, #1976d2);
    font-size: 22px;
}

.chart-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--theme-bg, #f5f5f5);
    transition: background-color 0.2s ease;
}

.chart-row:hover {
    background: var(--theme-hover, #eeeeee);
}

.chart-position {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
    background: var(--theme-surface, #e0e0e0);
    color: var(--theme-text, #333);
    flex-shrink: 0;
}

.chart-position.gold {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.chart-position.silver {
    background: linear-gradient(135deg, #E8E8E8, #C0C0C0);
    color: #333;
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.chart-position.bronze {
    background: linear-gradient(135deg, #CD7F32, #B8860B);
    color: #fff;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.chart-driver {
    width: 140px;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--theme-text, #333);
    flex-shrink: 0;
}

.chart-bar-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.chart-bar-wrapper {
    flex: 1;
    height: 28px;
    background: var(--theme-border, #e0e0e0);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.chart-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--theme-primary, #1976d2), var(--theme-primary-light, #64b5f6));
    border-radius: 6px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chart-bar-car {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
    max-width: 100%;
    z-index: 1;
}

.chart-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    border-radius: 6px 6px 0 0;
}

.chart-bar.gold {
    background: linear-gradient(90deg, #FFD700, #FFC107);
}

.chart-bar.gold .chart-bar-car {
    color: rgba(0, 0, 0, 0.85);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}

.chart-bar.silver {
    background: linear-gradient(90deg, #B8C5D0, #9AA8B5);
}

.chart-bar.silver .chart-bar-car {
    color: rgba(0, 0, 0, 0.8);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}

.chart-bar.bronze {
    background: linear-gradient(90deg, #CD7F32, #D4883A);
}

.chart-gap {
    font-size: 13px;
    font-weight: 600;
    min-width: 80px;
    text-align: right;
    flex-shrink: 0;
}

.chart-gap.leader {
    color: var(--theme-success, #2e7d32);
    background: rgba(46, 125, 50, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

.chart-gap.behind {
    color: var(--theme-danger, #d32f2f);
}

.chart-time {
    font-family: 'Roboto Mono', 'Consolas', monospace;
    font-weight: 600;
    font-size: 14px;
    color: var(--theme-primary, #1976d2);
    min-width: 85px;
    text-align: right;
    flex-shrink: 0;
}

/* Responsive adjustments for chart */
@media (max-width: 768px) {
    .laptime-chart {
        padding: 16px;
    }
    
    .chart-row {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }
    
    .chart-driver {
        width: calc(100% - 44px);
        order: 1;
    }
    
    .chart-position {
        order: 0;
    }
    
    .chart-bar-container {
        width: 100%;
        order: 2;
    }
    
    .chart-time {
        order: 3;
        width: 100%;
        text-align: left;
        margin-top: 4px;
    }
    
    .chart-gap {
        min-width: 70px;
    }
}

@media (max-width: 480px) {
    .chart-driver {
        font-size: 13px;
        width: calc(100% - 40px);
    }
    
    .chart-position {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .chart-bar-wrapper {
        height: 24px;
    }
    
    .chart-time {
        font-size: 13px;
    }
}

/* =============================================
   Active Team Challenges Section
   ============================================= */

/* Challenges Section Header */
.challenges-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--theme-border, #e0e0e0);
    background: linear-gradient(135deg, #ff9800 0%, #ffc107 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    margin: -1px -1px 0 -1px;
}

.challenges-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.challenges-title h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.challenges-title .material-icons {
    font-size: 28px;
}

.challenges-subtitle {
    margin: 8px 0 0;
    opacity: 0.9;
    font-size: 14px;
}

/* Challenges Grid */
.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 24px;
}

/* Public Challenge Card */
.public-challenge-card {
    background: var(--theme-card-bg, white);
    border-radius: 8px;
    border: 1px solid var(--theme-border, #e0e0e0);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.public-challenge-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    border-color: var(--theme-accent, #1976d2);
}

.challenge-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.challenge-team-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.challenge-team-logo {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
}

.challenge-team-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: var(--theme-hover, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
}

.challenge-team-icon .material-icons {
    font-size: 18px;
    color: var(--theme-text-muted, #666);
}

.challenge-team-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--theme-text-muted, #666);
}

.challenge-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.challenge-status-badge.status-active {
    background: var(--theme-success-bg, #e8f5e9);
    color: var(--theme-success-text, #2e7d32);
}

.challenge-status-badge .material-icons {
    font-size: 14px;
}

.challenge-card-title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--theme-text, #333);
}

.challenge-card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--theme-border, #e0e0e0);
}

.challenge-detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--theme-text-muted, #666);
}

.challenge-detail-row .material-icons {
    font-size: 18px;
    color: var(--theme-accent, #1976d2);
}

.challenge-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.challenge-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--theme-text-muted, #666);
}

/* Country flag image */
.circuit-flag {
    width: 24px;
    height: auto;
    flex-shrink: 0;
    border-radius: 2px;
    vertical-align: middle;
}

/* GPS icon */
.gps-icon {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    color: #6ec1ff;
    opacity: 0.95;
    filter: drop-shadow(0 0 3px rgba(110, 193, 255, 0.65));
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.gps-icon:hover {
    opacity: 1;
    filter: drop-shadow(0 0 6px rgba(110, 193, 255, 0.95));
}

.gps-icon .material-icons {
    font-size: 18px;
}

.challenge-stat .material-icons {
    font-size: 16px;
}

.challenge-stat.best-time {
    color: var(--theme-accent, #1976d2);
    font-weight: 600;
}

/* Public Challenge Modal */
.public-challenge-info {
    margin-bottom: 24px;
}

.challenge-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.challenge-info-grid .info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--theme-hover, #f5f5f5);
    border-radius: 8px;
}

.challenge-info-grid .info-item .material-icons {
    font-size: 24px;
    color: var(--theme-accent, #1976d2);
}

.challenge-info-grid .info-item label {
    display: block;
    font-size: 12px;
    color: var(--theme-text-muted, #666);
    margin-bottom: 2px;
}

.challenge-info-grid .info-item span:not(.material-icons) {
    font-size: 14px;
    font-weight: 500;
    color: var(--theme-text, #333);
}

.challenge-description {
    color: var(--theme-text-muted, #666);
    font-size: 14px;
    line-height: 1.6;
    padding: 12px;
    background: var(--theme-hover, #f5f5f5);
    border-radius: 8px;
    margin: 0;
}

.challenge-leaderboard-section {
    margin-bottom: 20px;
}

.leaderboard-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--theme-text, #333);
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--theme-accent-light, #64b5f6);
}

.leaderboard-title .material-icons {
    color: var(--theme-accent, #1976d2);
}

.empty-leaderboard {
    text-align: center;
    padding: 40px 20px;
    color: var(--theme-text-muted, #666);
}

.empty-leaderboard .material-icons {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 12px;
}

.empty-leaderboard p {
    margin: 0;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--theme-border, #e0e0e0);
}

/* Status badge in modal */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.status-active {
    background: var(--theme-success-bg, #e8f5e9);
    color: var(--theme-success-text, #2e7d32);
}

.status-badge.status-upcoming {
    background: var(--theme-info-bg, #e3f2fd);
    color: var(--theme-info-text, #1565c0);
}

.status-badge.status-completed {
    background: var(--theme-hover, #f5f5f5);
    color: var(--theme-text-muted, #757575);
}

/* Gap value styling */
.gap-value {
    color: var(--theme-text-muted, #666);
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .challenges-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    
    .challenge-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Modal Styles for Public Page */
.modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--theme-card-bg, white);
    margin: auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--theme-border, #e0e0e0);
    background: var(--theme-card-bg, white);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--theme-text, #333);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: var(--theme-text-muted, #666);
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--theme-hover, #f0f0f0);
    color: var(--theme-text, #333);
}

.modal-body {
    padding: 24px;
}

/* Button styles for public page */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--theme-accent, #1976d2);
    color: white;
}

.btn-primary:hover {
    background: var(--theme-accent-dark, #1565c0);
}

.btn-secondary {
    background: var(--theme-hover, #f0f0f0);
    color: var(--theme-text, #333);
}

.btn-secondary:hover {
    background: var(--theme-border, #e0e0e0);
}

/* ===== Track Info Buttons ===== */
.track-info-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 4px 0 2px;
    width: 100%;
    order: 10;
}

.track-info-btn {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    cursor: pointer;
    line-height: 1.4;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.track-info-btn:hover {
    background: rgba(255, 255, 255, 0.38);
    border-color: #fff;
}

.deeplink-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.75);
    padding: 4px;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.deeplink-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
}

.deeplink-btn .material-icons {
    font-size: 18px;
}

.deeplink-btn.deeplink-copied {
    color: #a5d6a7;
}

/* ===== Track Info Modal ===== */
.modal-track-info {
    max-width: 600px;
    width: 92%;
}

/* Track sections cards */
.ti-section-card {
    border: 1px solid var(--theme-border, #e0e0e0);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
}

.ti-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.ti-section-name {
    font-weight: 600;
    font-size: 15px;
}

.ti-risk-badge {
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ti-section-desc {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--theme-text, #333);
}

.ti-list {
    margin: 0;
    padding-left: 20px;
}

.ti-list li {
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.55;
}

/* Track setup rows */
.ti-setup-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.ti-setup-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 14px;
    line-height: 1.5;
    flex-wrap: wrap;
}

.ti-setup-label {
    font-weight: 500;
    color: var(--theme-text-muted, #666);
    min-width: 120px;
    flex-shrink: 0;
    text-transform: capitalize;
}

.ti-setup-value {
    font-weight: 600;
    color: var(--theme-text, #333);
}

.ti-setup-note {
    font-size: 12px;
    color: var(--theme-text-muted, #888);
    font-style: italic;
}
