/* ========================================
   RESET E BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    transition: background 0.4s ease;
}

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

/* ========================================
   HEADER E NAVEGAÇÃO
   ======================================== */
header {
    background: var(--header-color);
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
    transition: background 0.3s ease;
    width: 100%;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 0;
}

.site-logo-img {
    height: 50px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.site-logo-img:hover {
    transform: scale(1.05);
}

/* Seletor de Esportes */
.sport-selector {
    display: flex;
    gap: 6px;
    margin-left: 0;
    padding: 12px 20px;
    flex-wrap: wrap;
}

.sport-btn {
    padding: 6px 6px;
    border: 0px solid rgba(255,255,255,0.3);
    background: rgba(255, 255, 255, 0);
    color: white;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    flex: 1;
}

.sport-btn.active {
    padding: 6px 12px;
    background: white;
    color: var(--header-color);
    border-color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.sport-btn:hover:not(.active) {
    padding: 6px 12px;
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

/* ========================================
   TIPOGRAFIA
   ======================================== */
h1 {
    color: var(--text-primary);
    font-size: 2.2em;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1em;
}

/* ========================================
   ESTATÍSTICAS
   ======================================== */
.stats {
    background: var(--bg-secondary);
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    margin: 12px 0px;
    flex-wrap: wrap;
}

.stat {
    flex: 1;
    min-width: 130px;
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    transition: background 0.3s ease;
}

.stat-value {
    font-size: 1.6em;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--accent-color);
    transition: color 0.3s ease;
}

.stat-label {
    font-size: 0.85em;
    color: var(--text-secondary);
}

/* ========================================
   CONTROLES E FILTROS
   ======================================== */
.controls {
    background: var(--bg-secondary);
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    transition: all 0.3s ease;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-primary);
}

/* Inputs */
select, 
input[type="text"] {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95em;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border 0.3s;
}

select:focus, 
input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-color);
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
}

/* ========================================
   BOTÕES
   ======================================== */
/* Botões de Paginação */
.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination button {
    background: var(--accent-color);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.9em;
}

.pagination button:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.pagination button:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.page-info {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.3s ease;
}

/* Botões de Visualização e Filtro */
.view-toggle {
    display: flex;
    gap: 8px;
}

.video-filter-btn,
.view-btn,
.lang-btn {
    padding: 10px 18px;
    border: 2px solid var(--accent-color);
    background: var(--bg-secondary);
    color: var(--accent-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.95em;
}

.video-filter-btn.active,
.view-btn.active {
    background: var(--accent-color);
    color: white;
}

.video-filter-btn:hover,
.view-btn:hover,
.lang-btn:hover {
    transform: translateY(-2px);
}

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

/* ========================================
   CARDS DE PARTIDAS
   ======================================== */
.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.match-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.match-card:hover {
    background: var(--bg-secondary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.match-card.future {
    opacity: 0.5;
    filter: grayscale(1);
}

/* Cards com Vídeo */
.match-card.has-video {
    border: 2px solid #FFD700;
}

.match-card.has-video::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
    animation: shimmerGold 3s infinite;
}

@keyframes shimmerGold {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.match-card.has-video:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.35);
    border-color: #FFA500;
}

.match-card.has-video .match-status {
    right: 50px;
}

/* Cabeçalho do Card */
.match-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.competition-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.competition-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.match-competition {
    background: transparent;
    color: var(--text-primary);
    padding: 0;
    border-radius: 0;
    font-size: 0.95em;
    font-weight: 700;
}

.match-date {
    color: var(--accent-color);
    font-weight: 500;
    font-size: 0.85em;
}

.match-status {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--warning-color);
    color: white;
}

.match-phase {
    font-size: 0.8em;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Times */
.match-teams {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0;
    flex: 1;
}

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

.team-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.team-name {
    font-weight: 600;
    font-size: 1em;
    color: var(--text-primary);
    flex: 1;
}

.team-name.winner {
    font-weight: 700;
    color: var(--success-color);
}

.score {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--accent-color);
    min-width: 35px;
    text-align: center;
    transition: color 0.3s ease;
}

.score.winner {
    color: var(--success-color);
}

/* Rodapé do Card */
.match-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
    padding-top: 10px;
}

.broadcaster-logo {
    height: 24px;
    max-width: 60px;
    object-fit: contain;
}

@media (prefers-color-scheme: dark) {
    .broadcaster-logo {
        filter: brightness(0) invert(1);
    }
}

.tech-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tech-badge {
    padding: 4px 10px;
    border: 1px solid var(--text-primary);
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.3s ease;
}

/* ========================================
   LISTA DE PARTIDAS
   ======================================== */
.matches-list {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 12px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.list-item {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.3s;
    display: grid;
    grid-template-columns: 100px 1fr 130px 60px;
    gap: 15px;
    align-items: center;
}

.list-item:hover {
    background: var(--bg-tertiary);
}

.list-item.future {
    opacity: 0.5;
    filter: grayscale(1);
}

.list-item:last-child {
    border-bottom: none;
}

/* ========================================
   MODAL
   ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    backdrop-filter: blur(6px);
    border-radius: 15px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

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

/* Scrollbar do Modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.modal-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Cabeçalho do Modal */
.modal-header {
    background: var(--accent-color);
    color: white;
    padding: 20px;
    border-radius: 15px 15px 0 0;
    position: relative;
    transition: background 0.3s ease;
}

.modal-title-competition {
    text-align: center;
    font-size: 0.75em;
    font-weight: 600;
}

.modal-title-phase {
    text-align: center;
    font-size: 0.6em;
    font-weight: 500;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 1.3em;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

/* Placar no Modal */
.score-desktop {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.score-mobile {
    display: none;
}

.score-team-name {
    font-weight: 600;
}

.score-team-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.score-value {
    font-size: 1.2em;
    font-weight: 700;
}

.score-vs {
    font-size: 1em;
    font-weight: 600;
}

.score-status-badge {
    margin-left: 10px;
}

.score-mobile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.score-mobile-row:last-of-type {
    margin-bottom: 0;
}

.score-mobile-team {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.score-mobile-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.score-mobile-value {
    font-size: 1.3em;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
}

.score-mobile-status {
    margin-top: 10px;
    text-align: center;
}

/* Imagem e Vídeo do Modal */
.modal-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 8px;
    max-height: 475px;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
    margin-top: 12px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
}

/* Corpo do Modal */
.modal-body {
    padding: 20px;
}

.detail-section {
    margin-bottom: 18px;
}

.section-title {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
    transition: color 0.3s ease;
}

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

.detail-item {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    transition: background 0.3s ease;
}

.detail-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85em;
    margin-bottom: 4px;
}

.detail-value {
    color: var(--text-secondary);
    font-size: 0.95em;
}

/* Badges */
.storage-badges {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 14px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.85em;
}

.badge-success { background: var(--success-color); color: white; }
.badge-info { background: var(--info-color); color: white; }
.badge-warning { background: var(--warning-color); color: white; }

/* Botão Assistir Partida */
.watch-button-container {
    text-align: center;
    margin-top: 10px;
}

.watch-match-button {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    padding: 6px 12px;
    border-radius: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 700;
    font-size: 0.55em;
}

.watch-match-button:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5);
    background: linear-gradient(135deg, #FFA500 0%, #FFD700 100%);
}

/* ========================================
   AUTOMOBILISMO - ACORDEÃO
   ======================================== */
.motor-phase-section {
    margin: 12px 0;
}

.motor-phase-name {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.motor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 10px;
    gap: 10px;
}

.motor-event-item {
    margin-bottom: 20px;
}

.motor-event-item:last-child {
    margin-bottom: 0;
}

.motor-event-accordion {
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.motor-event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    background: var(--bg-tertiary);
    transition: all 0.3s ease;
    user-select: none;
}

.motor-event-header:hover {
    background: var(--border-color);
}

.motor-event-header-content {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.motor-event-title {
    font-size: 1em;
    font-weight: 700;
    color: var(--text-primary);
}

.motor-event-date {
    font-size: 0.85em;
    margin-right: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.motor-event-icon {
    font-size: 1.2em;
    color: var(--accent-color);
    transition: transform 0.3s ease;
    font-weight: bold;
}

.motor-event-content {
    padding: 16px;
    animation: slideDown 0.3s ease-out;
}

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

/* ========================================
   FOOTER
   ======================================== */
.site-footer {
    background: var(--bg-secondary);
    margin-top: 40px;
    padding: 40px 20px 20px;
    border-top: 2px solid var(--border-color);
}

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

.footer-section h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    margin-bottom: 12px;
}

.footer-section h4 {
    color: var(--accent-color);
    font-size: 1.1em;
    margin-bottom: 12px;
    font-weight: 600;
}

.footer-section p {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 8px;
}

.footer-section a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

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

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* ========================================
   NOTIFICAÇÕES E ESTADOS
   ======================================== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-primary);
}

.empty-state h2 {
    font-size: 1.8em;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 1em;
    opacity: 0.9;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========================================
   ANIMAÇÕES GERAIS
   ======================================== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ========================================
   RESPONSIVIDADE - TABLET
   ======================================== */
@media (max-width: 768px) {
    /* Modal */
    .score-desktop {
        display: none !important;
    }
    
    .score-mobile {
        display: block !important;
    }
    
    .modal-content {
        max-width: 95%;
    }

    /* Automobilismo */
    .motor-event-header {
        padding: 12px;
    }
    
    .motor-event-title {
        font-size: 1em;
    }
    
    .motor-event-date {
        font-size: 0.8em;
    }
    
    .motor-event-content {
        padding: 12px;
    }

    /* Footer */
    .site-footer {
        padding: 30px 15px 15px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
        text-align: center;
    }
    
    .footer-section h3 {
        font-size: 1.2em;
    }
    
    .footer-section h4 {
        font-size: 1em;
    }
}

/* ========================================
   RESPONSIVIDADE - MOBILE
   ======================================== */
@media (max-width: 480px) {
    .motor-event-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .motor-event-title {
        font-size: 1em;
    }
    
    .motor-event-date {
        font-size: 0.8em;
    }
}