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

:root {
    --primary: #4cc9f0;
    --secondary: #f72585;
    --bg-dark: #1a1a2e;
    --bg-darker: #0f0f1e;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --gold: #ffd700;
    --silver: #c0c0c0;
    --bronze: #cd7f32;
    --success: #4caf50;
    --error: #f44336;
    --card-bg: rgba(255, 255, 255, 0.05);
    --border-color: rgba(76, 201, 240, 0.2);
}

/* Tema Claro - Cores Ajustadas */
[data-theme="light"] {
    --primary: #0891b2; /* Cyan mais escuro */
    --secondary: #db2777; /* Pink mais escuro */
    --bg-dark: #f8fafc; /* Cinza muito claro */
    --bg-darker: #e2e8f0; /* Cinza claro para contraste */
    --text-primary: #1e293b; /* Quase preto azulado */
    --text-secondary: #475569; /* Cinza médio */
    --card-bg: #ffffff;
    --border-color: rgba(8, 145, 178, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Validation Page */
.validation-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.loading-spinner, .error-container {
    text-align: center;
    padding: 40px;
    background: var(--card-bg);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    max-width: 500px;
    width: 100%;
    border: 1px solid var(--border-color);
}

[data-theme="light"] .loading-spinner,
[data-theme="light"] .error-container {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid rgba(76, 201, 240, 0.3);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.error-details {
    margin-top: 30px;
    padding: 20px;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 10px;
    border-left: 4px solid var(--error);
}

.error-details p {
    margin: 10px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Results Container */
.results-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

[data-theme="light"] .header {
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    margin-bottom: 15px;
}

.header-left {
    flex: 1;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
}

.logo-right {
    max-width: 180px;
    height: auto;
    border-radius: 10px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: right;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.contact-item a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.contact-item a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.contact-icon {
    font-size: 16px;
}

.header-content h1 {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

[data-theme="dark"] .header-content h1 {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Corrigir emoji para não ficar azul */
.flag-emoji {
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    background-clip: initial !important;
    background: none !important;
    color: initial !important;
    font-style: normal;
}

.header-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.header-info span {
    color: var(--text-secondary);
    font-size: 16px;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    gap: 15px;
}

.theme-toggle {
    background: rgba(76, 201, 240, 0.15);
    border: 2px solid var(--primary);
    color: var(--text-primary);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.update-time {
    color: var(--text-secondary);
    font-size: 14px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--error);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    color: white;
}

.pulse {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Category Dropdown */
.category-selector-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.category-dropdown {
    flex: 1;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.dropdown-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.category-select {
    flex: 1;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234cc9f0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
    padding-right: 45px;
}

[data-theme="light"] .category-select {
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.category-select:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(76, 201, 240, 0.2);
}

.category-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.2);
}

.category-select option {
    padding: 10px;
    background: var(--bg-dark);
    color: var(--text-primary);
}

[data-theme="light"] .category-select option {
    background: white;
}

.clear-filter {
    padding: 12px 20px;
    background: rgba(244, 67, 54, 0.1);
    border: 2px solid var(--error);
    color: var(--error);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.clear-filter:hover {
    background: var(--error);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

[data-theme="light"] .clear-filter {
    background: rgba(244, 67, 54, 0.08);
}

/* Results Table */
.results-table-container {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px;
    overflow-x: auto;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

[data-theme="light"] .results-table-container {
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.results-table thead {
    background: rgba(76, 201, 240, 0.1);
}

[data-theme="light"] .results-table thead {
    background: rgba(8, 145, 178, 0.08);
}

.results-table th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 14px;
    border-bottom: 2px solid var(--primary);
}

.results-table td {
    padding: 15px 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    color: var(--text-primary);
}

.results-table tbody tr {
    transition: all 0.2s ease;
}

.results-table tbody tr:hover {
    background: rgba(76, 201, 240, 0.05);
}

[data-theme="light"] .results-table tbody tr:hover {
    background: rgba(8, 145, 178, 0.08);
}

/* Posições de Destaque */
.first-place {
    background: rgba(255, 215, 0, 0.08) !important;
}

.second-place {
    background: rgba(192, 192, 192, 0.08) !important;
}

.third-place {
    background: rgba(205, 127, 50, 0.08) !important;
}

[data-theme="light"] .first-place {
    background: rgba(255, 215, 0, 0.20) !important;
}

[data-theme="light"] .second-place {
    background: rgba(192, 192, 192, 0.25) !important;
}

[data-theme="light"] .third-place {
    background: rgba(205, 127, 50, 0.20) !important;
}

.position-badge {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    border-radius: 50%;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

[data-theme="light"] .position-badge {
    background: rgba(0, 0, 0, 0.08);
}

.first-place .position-badge {
    background: var(--gold);
    color: #1a1a2e;
}

.second-place .position-badge {
    background: var(--silver);
    color: #1a1a2e;
}

.third-place .position-badge {
    background: var(--bronze);
    color: #1a1a2e;
}

.tempo-badge {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: bold;
    display: inline-block;
}

/* Colunas */
.col-pos { width: 60px; text-align: center; }
.col-plate { width: 80px; text-align: center; font-weight: bold; }
.col-nome { min-width: 200px; font-weight: 600; }
.col-categoria { width: 150px; }
.col-cidade { width: 150px; color: var(--text-secondary); }
.col-tempo { width: 120px; text-align: right; }

/* Loading e Empty States */
.loading-results, .no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-primary);
}

.no-results {
    opacity: 0.6;
}

.no-results .small {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 10px;
}

/* Error Message */
.error-message {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid var(--error);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
    color: var(--text-primary);
}

[data-theme="light"] .error-message {
    background: rgba(244, 67, 54, 0.08);
    border: 2px solid var(--error);
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .header-main {
        flex-direction: column;
        align-items: stretch;
    }

    .header-right {
        align-items: center;
        order: -1;
    }

    .logo-right {
        max-width: 150px;
    }

    .contact-info {
        text-align: center;
        align-items: center;
    }

    .contact-item {
        justify-content: center;
        font-size: 13px;
    }

    .header-content h1 {
        font-size: 24px;
        text-align: center;
    }

    .header-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
        text-align: center;
    }

    .header-actions {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .category-selector-container {
        flex-direction: column;
        align-items: stretch;
    }

    .category-dropdown {
        flex-direction: column;
        align-items: stretch;
        min-width: 100%;
    }

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

    .clear-filter {
        width: 100%;
    }

    .results-table-container {
        padding: 10px;
    }

    .results-table th, .results-table td {
        padding: 10px 5px;
        font-size: 14px;
    }

    .col-cidade {
        display: none;
    }

    .tempo-badge {
        font-size: 14px;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .results-container {
        padding: 10px;
    }

    .header {
        padding: 15px;
    }

    .logo-right {
        max-width: 120px;
    }

    .contact-item {
        font-size: 12px;
    }

    .col-categoria {
        display: none;
    }
}
