/* Reset e Variáveis */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    padding-top: env(safe-area-inset-top, 0);
}
.statusbar-fill {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    z-index: 9999;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0;
    height: 140px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: "";
    position: absolute;
    top: -40px;
    right: -60px;
    width: 220px;
    height: 220px;
    background: radial-gradient( circle at center, rgba(255,255,255,0.25), rgba(255,255,255,0) 60% );
    filter: blur(6px);
    pointer-events: none;
}

.header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.35) 100%);
}

.header .container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-logo {
    height: auto;
    max-height: 100px; /* limite no desktop */
    width: auto;
    max-width: 100%;
    margin: 0;
    padding: 0;
    display: block;
    vertical-align: middle;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}

/* subtitle removido */

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 300px);
}

/* Banners */
.banners-section {
    padding: 1.25rem 0 0.5rem;
}
.banners-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.banner-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    aspect-ratio: 4 / 1; /* 1200x300 */
}
.banner-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.banner-vertical { aspect-ratio: 3 / 4; } /* vertical */
.banner-vertical img { object-fit: cover; }

.ad-chip {
    position: absolute;
    z-index: 2;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: clamp(0.62rem, 1.8vw, 0.75rem);
    font-weight: 600;
}

.chip-light { color: #1e3a8a; background: #f1f5f9; border: 1px solid #e2e8f0; }
.chip-dark { color: #fff; background: rgba(0,0,0,0.75); border: 1px solid rgba(255,255,255,0.25); }

/* posições do chip */
.pos-tl { top: 8px; left: 8px; }
.pos-tc { top: 8px; left: 50%; transform: translateX(-50%); }
.pos-tr { top: 8px; right: 8px; }
.pos-ml { top: 50%; left: 8px; transform: translateY(-50%); }
.pos-mr { top: 50%; right: 8px; transform: translateY(-50%); }
.pos-bl { bottom: 8px; left: 8px; }
.pos-bc { bottom: 8px; left: 50%; transform: translateX(-50%); }
.pos-br { bottom: 8px; right: 8px; }

/* Responsividade: chip menor no mobile para não cobrir o banner */
@media (max-width: 480px) {
    .ad-chip { padding: 2px 6px; }
    .pos-tl, .pos-tr, .pos-bl, .pos-br { top: auto; bottom: auto; }
    .pos-tl { top: 6px; left: 6px; }
    .pos-tr { top: 6px; right: 6px; }
    .pos-bl { bottom: 6px; left: 6px; }
    .pos-br { bottom: 6px; right: 6px; }
}
}

@media (max-width: 768px) {
    .banners-grid {
        grid-template-columns: 1fr;
    }
}

/* Filtros */
.filters-section {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.filters-section .results-info { border-top: 1px solid rgba(255,255,255,0.3); }
.filters-collapsed .results-info { border-top: none; }

.filters-collapsed .filters-form { display: none; }
.filters-section.filters-collapsed { padding: 1rem; }
.filters-collapsed .filters-toggle { margin-bottom: 0; }
.filters-collapsed .results-info { margin-top: 0; padding-top: 0; }
.filters-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    margin-bottom: 1rem;
    transition: background 0.2s, box-shadow 0.2s;
}
.filters-toggle h2 { margin: 0; font-size: 1.25rem; }
.filters-toggle .chevron {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
    background: rgba(255,255,255,0.15);
}
.filters-open .filters-toggle .chevron { transform: rotate(180deg); }
.filters-toggle:hover { background: rgba(255,255,255,0.12); box-shadow: var(--shadow); }
.filters-toggle:focus { outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

.filters-section h2 {
    margin-bottom: 1.5rem;
    color: #fff;
    font-size: 1.5rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #fff;
}

.filter-group input,
.filter-group select {
    padding: 0.75rem;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: #fff;
    color: var(--text-primary);
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.results-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.9);
}

.results-info .highlight {
    color: #fff;
    font-weight: 600;
}

/* Paginação */
.pagination-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.5rem 0 1rem;
}
.pagination-toolbar.bottom { margin-top: 1.25rem; }
.pagination-toolbar .page-size { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.pagination-toolbar .page-size select { padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 8px; }
.pagination-toolbar .results-range { margin-left: 8px; }
.pager { display: flex; align-items: center; gap: 8px; }
.btn-sm { padding: 0.5rem 0.75rem; font-size: 0.9rem; border-radius: 8px; }
.btn.disabled, .btn[aria-disabled="true"] { pointer-events: none; opacity: 0.6; }

@media (max-width: 640px) {
    .pagination-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
    .pagination-toolbar .page-size { width: 100%; justify-content: space-between; }
    .pagination-toolbar .pager { width: 100%; justify-content: space-between; }
    .pagination-toolbar .pager .pager-page { display: none; }
}

/* Pager inferior ocupa toda a largura e centraliza no desktop */
.pagination-toolbar.bottom { width: 100%; }
.pagination-toolbar.bottom .pager { width: 100%; justify-content: center; }

/* Botões */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-disabled {
    background-color: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Grid de Corridas */
.corridas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.corrida-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.corrida-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.highlight-card {
    outline: 3px solid var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), var(--shadow-lg);
}

/* Overlay de foco do evento */
.focus-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 998;
    display: none;
}
.focus-mode .focus-overlay { display: block; }
.focus-mode .highlight-card { position: relative; z-index: 999; }

.corrida-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.corrida-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.corrida-content { padding: 1.5rem; display: flex; flex-direction: column; flex: 1; }

.corrida-content h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.corrida-info {
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-item .icon {
    font-size: 1.1rem;
}

.corrida-descricao {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.corrida-actions { margin-top: auto; }

.btn-icon {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: 42px;
    height: 42px;
    padding: 0;
    margin-left: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover {
    background: var(--background);
}

/* Compartilhar: sempre abaixo do botão principal, com texto */
.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    margin-left: 0;
    margin-top: 5px;
}
.btn-share:hover { background: var(--background); }

/* Garante que no desktop também fique abaixo */
@media (min-width: 1024px) {
    .corrida-actions .btn-share { display: inline-flex; }
}

/* Largura e centralização dos botões de ação */
.corrida-actions .btn-primary {
    display: block;
    width: 100%;
    margin: 0 auto;
}
.corrida-actions .btn-share {
    display: flex;
    width: 100%;
    margin: 5px auto 0;
    justify-content: center;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-today {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-soon {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-past {
    background-color: #f3f4f6;
    color: #6b7280;
}

.corrida-card .badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

/* Distâncias em chips */
.distance-chips-wrapper { display: block; width: 100%; }
.distance-groups { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.distance-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.distance-label { font-weight: 600; color: var(--text-primary); min-width: 90px; text-transform: capitalize; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips-inline { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.chips-inline::-webkit-scrollbar { height: 6px; }
.chips-inline::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 999px; }
.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: #fff;
}
.chip-kids { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.chip-walk { background: #ecfccb; color: #365314; border-color: #d9f99d; }
.chip-run  { background: #ffe4e6; color: #9f1239; border-color: #fecdd3; }

@media (max-width: 480px) {
    .distance-label { min-width: 72px; font-size: 0.9rem; }
    .chip { font-size: 0.78rem; }
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    background-color: var(--text-primary);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* Responsividade */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    .header { height: 110px; }
    .site-logo { max-height: 72px; }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .corridas-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

