/*****************************
* Mobile-First F1 Betting Redesign
* Modern, Minimalistic, Mobile-Optimized
*****************************/

:root {
    /* Compact F1 Racing Color Palette */
    --primary: #e10600;
    /* F1 Red */
    --accent: #ff8000;
    /* F1 Orange */
    --success: #005CAA;
    /* F1 Teal */
    --text: #ffffff;
    /* White */
    --text-muted: #999999;
    /* Muted text */
    --background: #121212;
    /* Dark background */
    --surface: #1e1e1e;
    /* Card surfaces */
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/*****************************
* Base Reset & Typography
*****************************/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/*****************************
* Mobile-First Container System
*****************************/
.container {
    width: 100%;
    padding: 0 16px;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
        padding: 0 24px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
        padding: 0 32px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}

/*****************************
* Navigation - Mobile Optimized
*****************************/
nav {
    background-color: var(--primary);
    color: white;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.nav-left {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-left::before {
    content: "🏎️";
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-link {
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Info button styling */
.info-link {
    background-color: var(--primary);
    padding: 6px 10px;
    border-radius: 20px;
    font-weight: bold;
    margin-left: 8px;
}

.info-link:hover {
    background-color: var(--accent);
    transform: scale(1.05);
}

/* Login/Register link styling */
.login-link, .register-link {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 500;
}

.login-link:hover, .register-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Beta badge styling */
.beta-badge {
    background-color: var(--accent);
    color: black;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 12px;
    vertical-align: middle;
    display: inline-block;
}

/* Legal notice page styling */
.legal-content h1, .legal-content h2, .legal-content h3 {
    color: var(--text);
    margin-bottom: 12px;
}

.legal-content p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Add spacing under navigation for content pages */
.main-content-offset {
    margin-top: 80px;
}

@media (max-width: 768px) {
    .main-content-offset {
        margin-top: 60px;
    }
}

.legal-content ul {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
    padding-left: 20px;
}

.legal-content li {
    margin-bottom: 8px;
}

.feature-list {
    list-style-type: disc;
}

.scoring-list {
    list-style-type: circle;
    padding-left: 20px;
}

.section-title {
    color: var(--primary);
    font-size: 1.1em;
    margin-top: 16px;
    margin-bottom: 8px;
}

.important-notice {
    color: var(--accent);
    font-weight: bold;
}

.footer-card {
    margin-top: 32px;
    background-color: var(--surface);
}

/* Mobile menu button */
.menu-button {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

@media (max-width: 768px) {
    .nav-right {
        display: none;
    }

    .menu-button {
        display: block;
    }

    .nav-right.mobile-menu {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--primary);
        padding: 16px;
        box-shadow: var(--shadow-lg);
    }

    .nav-right.mobile-menu .nav-link {
        width: 100%;
        text-align: center;
        padding: 12px;
    }
}

/*****************************
* Buttons - Unified System
*****************************/
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 14px;
    gap: 6px;
    min-height: 40px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--surface);
    border-color: var(--primary);
}

.btn-danger {
    background-color: var(--primary);
    color: white;
}

.btn-danger:hover {
    background-color: var(--accent);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #00e6d6;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
}

.btn-block {
    width: 100%;
    display: flex;
    justify-content: center;
}

/*****************************
* Cards - Modern Design
*****************************/
.card {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.card-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.card-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.card-header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto; /* Push to the right */
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.card-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.card-content {
    margin-bottom: 16px;
}

.card-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.bet-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/*****************************
* Forms - Clean & Accessible
*****************************/
.form-group {
    margin-bottom: 16px;
}

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

.form-control {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--surface);
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(225, 6, 0, 0.2);
}

.select-control {
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="white" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/*****************************
* Flash Messages
*****************************/
.flash-message {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
}

.flash-success {
    background-color: rgba(0, 210, 190, 0.2);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.flash-error {
    background-color: rgba(225, 6, 0, 0.2);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

.flash-info {
    background-color: rgba(255, 136, 0, 0.2);
    color: var(--accent);
    border-left: 4px solid var(--accent);
}

/*****************************
* Timer Styles - Consistent look for all timers
*****************************/
.next-session-timer {
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.next-session-label,
.betting-timer-label {
    font-weight: 600;
    color: var(--text);
}

.next-session-type {
    font-weight: 500;
    color: var(--text-muted);
}

.betting-timer-row {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

/*****************************
* Tables - Responsive
*****************************/
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.table th,
.table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background-color: var(--background);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tr:hover {
    background-color: var(--success);
}

.table tr.current-user {
    background-color: var(--primary);
}

/*****************************
* Auth Pages - Mobile Optimized
*****************************/
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.auth-card h1 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 24px;
    font-size: 24px;
    font-weight: 700;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form .form-group {
    margin-bottom: 12px;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
}

/*****************************
* Welcome Page
*****************************/
.welcome-section {
    text-align: center;
    padding: 48px 16px;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-card {
    padding: 24px;
}

.welcome-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 16px;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 480px) {
    .auth-actions {
        flex-direction: row;
    }

    .auth-actions .btn {
        flex: 1;
    }
}

/*****************************
* Dashboard & Overview
*****************************/
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.dashboard-header h1 {
    color: var(--primary);
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 16px;
}

.stat-card .card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--success);
    margin: 8px 0;
}

.stat-card .card-description {
    color: var(--text-muted);
    font-size: 14px;
}

/*****************************
* Race Pages
*****************************/
.races-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.race-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.race-card {
    background-color: var(--surface);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    transition: transform 0.2s ease;
}

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

.race-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.race-title {
    color: var(--primary);
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.race-info-line,
.race-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}

.race-date {
    color: var(--text);
    font-weight: 500;
    margin-left: auto;
}

.status-indicator {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-indicator.resolved {
    background-color: var(--success);
    color: var(--background);
}

.status-indicator.closed {
    background-color: var(--primary);
    color: var(--surface);
}

.race-info-line span::after {
    content: "•";
    margin-left: 12px;
    color: var(--text-muted);
}

.race-info-line span:last-child::after {
    content: "";
    margin-left: 0;
}

.sessions-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.session-inline::after {
    content: "•";
    margin: 0 8px;
}

.session-inline:last-child::after {
    content: "";
}

/*****************************
* Betting Pages - Enhanced Styles
*****************************/
.betting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

/* Enhanced Betting Table Styles */
.bets-table {
    width: 100%;
    font-size: 14px;
}

.bets-table th,
.bets-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.bets-table th {
    background-color: var(--surface);
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bets-table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.bets-table tr.current-user {
    background-color: rgba(0, 210, 190, 0.1);
}

.bets-table .position-cell {
    text-align: center;
    font-weight: 600;
}

.bets-table .points-cell {
    text-align: right;
    font-weight: 700;
    color: var(--success);
}

.bets-table .points-cell:empty,
.bets-table .points-cell {
    color: var(--text-muted);
    font-weight: 400;
}

.actual-results-row {
    background-color: rgba(225, 6, 0, 0.1);
    font-weight: 600;
    color: var(--primary);
}

.actual-results-row td:first-child {
    font-weight: 700;
}

.you-badge {
    background-color: var(--primary);
    color: var(--surface);
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    margin-left: 6px;
    font-weight: 600;
}

.bet-form-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.position-selector-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.driver-select {
    width: 100%;
}

.bets-table {
    width: 100%;
    font-size: 13px;
}

.bets-table th,
.bets-table td {
    padding: 10px 12px;
}

.user-bet-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.race-bet-section {
    margin-bottom: 20px;
}

.race-bet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

/*****************************
* Profile Pages
*****************************/
.profile-container {
    max-width: 800px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.profile-section {
    margin-bottom: 24px;
}

.profile-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.profile-info-item {
    background-color: var(--surface);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.profile-info-item strong {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 4px;
}

.profile-info-item span {
    color: var(--text);
    font-size: 14px;
}

/*****************************
* Admin Dashboard
*****************************/
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-section {
    margin-bottom: 32px;
}

.admin-section h2 {
    color: var(--primary);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.data-action-card {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.data-action-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.log-container {
    background-color: var(--background);
    border-radius: 8px;
    padding: 16px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    max-height: 400px;
    overflow-y: auto;
}

/*****************************
* Countdown Timers
*****************************/
.countdown-timer {
    font-size: 13px;
    font-weight: 600;
    min-width: 80px;
    text-align: right;
}

.countdown-active {
    color: var(--success);
}

.countdown-expired {
    color: var(--primary);
}

/*****************************
* Utility Classes
*****************************/
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: var(--surface);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.back-button:hover {
    background-color: var(--surface);
    transform: translateY(-1px);
}

.back-button::before {
    content: "←";
}



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

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.gap-2 {
    gap: 8px;
}

.gap-4 {
    gap: 16px;
}

/*****************************
* Animations
*****************************/
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/*****************************
* Prediction Items - User Overview
*****************************/
.predictions-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.prediction-item {
    background: var(--surface);
    border-radius: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.prediction-label {
    font-weight: 600;
    color: var(--text-muted);
}

.prediction-value {
    font-weight: 700;
    font-family: 'F1', monospace;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
}

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

.bet-meta .meta-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/*****************************
* Comment Section
*****************************/
.comment-section {
    margin-top: 32px;
}

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

.refresh-button {
    white-space: nowrap;
}

.comment-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.comment-input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background-color: var(--surface);
    color: var(--text);
    font-size: 13px;
    transition: border-color 0.2s ease;
}

.comment-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(225, 6, 0, 0.2);
}

.comment-submit {
    padding: 8px 16px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 13px;
}

.comment-submit:hover {
    background-color: #c10500;
}

.comment-submit:disabled {
    background-color: #666;
    cursor: not-allowed;
}

.comments-container {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: -12px; /* Compensate for scrollbar */
    padding-right: 8px; /* Space for scrollbar */
}

/* Custom scrollbar for WebKit browsers */
.comments-container::-webkit-scrollbar {
    width: 6px;
}

.comments-container::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 3px;
}

.comments-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.comments-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 60px; /* Minimum height when empty */
}

.comment-item {
    background-color: var(--surface);
    border-radius: 6px;
    padding: 12px;
    border: 1px solid var(--border);
    font-size: 13px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.comment-username {
    font-weight: 600;
    color: var(--primary);
    font-size: 12px;
}

.comment-timestamp {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.comment-text {
    font-size: 13px;
    line-height: 1.3;
    color: var(--text);
}

.no-comments {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-style: italic;
}

/*****************************
* Dark Mode Support
*****************************/
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0a0a12;
        --surface: #0f0f1a;
    }
}