@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --bg-main: #f8fafc;
    --bg-header: rgba(255, 255, 255, 0.85);
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: rgba(226, 232, 240, 0.8);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 20px -2px rgba(148, 163, 184, 0.12), 0 2px 8px -1px rgba(148, 163, 184, 0.08);
    --shadow-hover: 0 20px 25px -5px rgba(148, 163, 184, 0.18), 0 8px 10px -6px rgba(148, 163, 184, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Header & Nav */
header {
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 2rem;
    transition: var(--transition);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    text-decoration: none;
}

.logo-title img {
    height: 44px;
    object-fit: contain;
    transition: var(--transition);
}

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

.logo-title h1 {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    margin: 0;
}

.nav-main {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.nav-link.active {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* SPA Transitions */
.view-content {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.view-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Hero Section */
.hero-section {
    padding: 3rem 2rem 1rem;
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-section h2 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -1px;
    position: relative;
    display: inline-block;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.hero-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 25%;
    width: 50%;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* Grids */
.eventos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Event Cards */
.evento-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.evento-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(37, 99, 235, 0.2);
}

.evento-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.evento-card:hover .evento-img {
    transform: scale(1.02);
}

.evento-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.evento-info h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    text-align: center;
    line-height: 1.3;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.evento-info ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 7rem;
    justify-content: center;
}

.evento-info ul li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.evento-info ul li strong {
    color: var(--text-main);
}

/* Badges / States */
.estado {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 20px;
    margin: 0 auto 1.25rem;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estado.abierto {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.estado.cerrado {
    background-color: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

/* Countdown Clock */
.countdown {
    background: var(--primary-light);
    border: 1px dashed rgba(37, 99, 235, 0.25);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    letter-spacing: 0.2px;
}

/* Buttons */
.evento-botones {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-inscripcion {
    display: block;
    width: 100%;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-inscripcion.rojo {
    background: linear-gradient(135deg, var(--danger), #be123c);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-inscripcion.rojo:hover {
    background: linear-gradient(135deg, #dc2626, #9f1239);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

.btn-inscripcion.azul {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-inscripcion.azul:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--accent-hover));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.btn-inscripcion.verde {
    background: linear-gradient(135deg, var(--success), #047857);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-inscripcion.verde:hover {
    background: linear-gradient(135deg, var(--success-hover), #065f46);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-inscripcion.negro {
    background: #0f172a;
    color: white;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
}

.btn-inscripcion.negro:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Results section (stand-alone and dynamic view) */
.year-section {
    max-width: 1200px;
    margin: 3rem auto 1.5rem;
    padding: 0 2rem;
}

.year-section h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    padding: 1.25rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.year-section h2::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15));
    transform: skewX(-20deg);
}

/* Volver Button container */
.volver-container {
    max-width: 1200px;
    margin: 1.5rem auto 0;
    padding: 0 2rem;
}

.btn-volver {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card-bg);
    color: var(--primary);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.btn-volver:hover {
    background: var(--primary-light);
    border-color: rgba(37, 99, 235, 0.2);
    transform: translateX(-4px);
}

/* Carousel/Slider styling (retained for future-proofing) */
.carousel-container {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius-lg);
    margin: 1.5rem auto;
    max-width: 1200px;
}

.carousel-slide {
    display: none;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-size: cover;
    background-position: center;
}

.carousel-slide.active {
    display: flex;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.carousel-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
}

.slide-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: white;
    text-align: center;
    z-index: 2;
}

.slide-content h2 {
    font-size: 3.5rem;
    margin: 0;
    font-weight: 800;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    letter-spacing: -1px;
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    color: white;
    border: none;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
    border-radius: 50%;
}

.carousel-button:hover {
    background: rgba(255, 255, 255, 0.45);
    transform: translateY(-50%) scale(1.05);
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: var(--transition);
}

.dot.active {
    background: white;
    transform: scale(1.25);
}

/* Hamburguesa & Side Menu styling for mobile & results fallback */
.menu-toggle {
    display: none;
    font-size: 1.8rem;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
}

.menu-toggle:hover {
    color: var(--primary);
}

/* Footer styling */
footer {
    text-align: center;
    padding: 2.5rem 1rem;
    background-color: #0f172a;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Modal styling for images */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 40px 20px;
    overflow-y: auto;
    align-items: center;
    justify-content: center;
}

.modal-contenido {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: zoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#caption {
    margin-top: 1.5rem;
    text-align: center;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.cerrar {
    position: absolute;
    top: 25px;
    right: 25px;
    color: #94a3b8;
    font-size: 2.5rem;
    font-weight: 300;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.cerrar:hover {
    color: white;
    transform: rotate(90deg);
}

/* Responsive Media Queries */
@media (max-width: 900px) {
    .menu-toggle {
        display: block;
    }

    .nav-main {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        padding: 1.5rem;
        gap: 1rem;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
        border-bottom: 1px solid var(--border-color);
        align-items: stretch;
    }

    .nav-main.show {
        display: flex;
    }

    .nav-link {
        text-align: center;
        padding: 0.75rem;
    }

    .header-container {
        width: 100%;
    }
}

@media (max-width: 600px) {
    header {
        padding: 0.75rem 1.25rem;
    }

    .logo-title h1 {
        font-size: 1.2rem;
    }

    .hero-section {
        padding: 2rem 1.25rem 0.5rem;
    }

    .hero-section h2 {
        font-size: 1.75rem;
    }

    .eventos-grid {
        grid-template-columns: 1fr;
        padding: 1.25rem;
        gap: 1.5rem;
    }

    .year-section h2 {
        font-size: 1.4rem;
        padding: 1rem 1.5rem;
    }
}

/* --- Live Dashboard Specific Styles --- */

.live-info {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.live-badge {
    background: white;
    border: 2px solid var(--danger);
    color: var(--danger);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

.contador {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 99px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Último Arribo (Last Arrival Banner) */
.ultimo-box {
    background: var(--card-bg);
    border-left: 6px solid var(--primary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    transition: var(--transition);
}

.ultimo-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.ultimo-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.ultimo-runner {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.ultimo-tiempo {
    margin-top: 0.5rem;
    color: var(--primary);
    font-size: 2.25rem;
    font-weight: 900;
    font-family: monospace;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* Filtros for Live timing search */
.filtros input[type="text"] {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    transition: var(--transition);
    flex: 1;
    min-width: 200px;
}

.filtros input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Distancia title in live view */
.distancia-title {
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 800;
}

/* Participant/Runner Card in Live view */
.runner-card {
    background: var(--card-bg);
    border-left: 6px solid var(--primary);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.runner-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(37, 99, 235, 0.2);
}

.runner-card strong {
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 700;
}

.runner-card .time {
    font-size: 1.75rem;
    color: var(--primary);
    font-weight: 800;
    font-family: monospace;
}

.runner-card .extra-details {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.runner-card .poscat {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.95rem;
}

.runner-card .medalla {
    font-size: 1.5rem;
}

/* Live certificate modal additions */
.cert-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 60px 20px 40px;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.cert-modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 540px;
    margin: auto;
    border-radius: var(--radius-lg);
    padding: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    animation: zoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.cert-close {
    position: absolute;
    top: -45px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 3100;
}

.cert-close:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    transform: rotate(90deg);
}

.cert {
    position: relative;
    border: 8px double #fbbf24;
    outline: 2px solid var(--primary);
    outline-offset: -12px;
    border-radius: var(--radius-md);
    padding: 2.5rem 2rem;
    text-align: center;
    background: #ffffff;
    color: #0f172a;
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(251, 191, 36, 0.05);
}

.cert-watermark {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: auto;
    opacity: 0.07;
    pointer-events: none;
    z-index: 0;
}

.cert-header {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.cert-logo {
    height: 48px;
    width: auto;
}

.cert-subtitle {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--primary);
    text-transform: uppercase;
}

.cert-title {
    position: relative;
    z-index: 1;
    color: #1e3a8a;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.cert-recipient {
    position: relative;
    z-index: 1;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.cert-name {
    position: relative;
    z-index: 1;
    font-size: 2.25rem;
    font-weight: 800;
    color: #1e3a8a;
    margin: 0.5rem auto 1rem;
    line-height: 1.2;
    max-width: 95%;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.cert-congratulations {
    position: relative;
    z-index: 1;
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}

.cert-congratulations strong {
    color: #0f172a;
    font-weight: 700;
}

.cert-hero-stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1rem;
    margin: 0.5rem auto 1.5rem;
    max-width: 100%;
}

.hero-stat-item {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.hero-stat-item.main-time {
    border-color: rgba(37, 99, 235, 0.3);
    background: linear-gradient(to bottom, #ffffff, #eff6ff);
}

.hero-stat-item.main-pos {
    border-color: rgba(251, 191, 36, 0.3);
    background: linear-gradient(to bottom, #ffffff, #fffbeb);
}

.hero-stat-item .stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.hero-stat-item.main-time .stat-value {
    font-size: 2.25rem;
    font-weight: 900;
    color: var(--primary);
    font-family: monospace;
    line-height: 1.1;
}

.hero-stat-item.main-pos .stat-value {
    font-size: 2.25rem;
    font-weight: 900;
    color: #d97706;
    line-height: 1.1;
}

.cert-meta-grid {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px dashed #e2e8f0;
    border-bottom: 1px dashed #e2e8f0;
}

.meta-item {
    font-size: 0.85rem;
    color: #64748b;
}

.meta-item span {
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.meta-item strong {
    color: #0f172a;
    font-weight: 700;
    margin-left: 0.25rem;
}

.cert-footer {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.cert-stamp {
    width: 65px;
    height: 65px;
}

.cert-seal {
    width: 100%;
    height: 100%;
}

.cert-signature {
    text-align: center;
    width: 150px;
}

.signature-line {
    border-bottom: 2px solid #94a3b8;
    margin-bottom: 0.5rem;
    height: 30px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="30" viewBox="0 0 100 30"><path d="M10 20 C 30 5, 40 25, 60 10 C 70 5, 80 25, 90 15" fill="none" stroke="%232563eb" stroke-width="1.5"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

.cert-signature span {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
}

.cert-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.btn-print {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-print:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

/* --- Results Subpages Specific Styles & Overrides --- */

/* Class Card (runners ranking list) styling */
.card {
    background: var(--card-bg);
    border-left: 6px solid var(--primary);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(37, 99, 235, 0.2);
}

.card strong {
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 700;
    display: block;
    margin-bottom: 0.25rem;
}

.card .time {
    font-size: 1.75rem;
    color: var(--primary);
    font-weight: 800;
    font-family: monospace;
    display: inline-block;
    margin-top: 0.25rem;
}

.card .medalla {
    font-size: 1.5rem;
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* Certificate Modal & Layout Overrides */
.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 60px 20px 40px;
    overflow-y: auto;
    align-items: center;
    justify-content: center;
}

/* Force flex display if JS opens modal as display: block */
.modal[style*="display: block"] {
    display: flex !important;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 540px;
    margin: auto;
    border-radius: var(--radius-lg);
    padding: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    animation: zoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.modal-content .close {
    position: absolute;
    top: -45px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    float: none;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 3100;
}

.modal-content .close:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    transform: rotate(90deg);
}

.cert {
    border: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    background: var(--card-bg);
}

.cert h2 {
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    background: none;
    -webkit-text-fill-color: initial;
}

.cert p, .cert div {
    margin: 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.cert p strong, .cert div strong {
    color: var(--text-main);
}

/* Filters for subpages */
.filters, .filtros {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.filters select, .filtros select {
    padding: 0.75rem 1.5rem 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    min-width: 180px;
}

.filters select:focus, .filtros select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Titles inside subpage content */
.content h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 2rem 0 1.5rem;
    text-align: center;
}

.content h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    margin: 2.5rem 0 1.25rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

/* --- Legacy Results Pages (2025 and older) Styles --- */

body > h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    margin: 2.5rem auto 1.25rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
    max-width: 1200px;
    width: 90%;
}

body > table {
    max-width: 1200px;
    width: 90%;
    margin: 0 auto 2.5rem;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.05));
}

body > table thead {
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%) !important;
}

body > table th {
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white !important;
    border: none;
}

body > table td {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    color: var(--text-main, #0f172a);
    border-bottom: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
}

body > table tr:last-child td {
    border-bottom: none;
}

body > table tr:hover td {
    background-color: var(--primary-light, #eff6ff);
}

/* Ver Certificado Button styling */
.btn-cert {
    background: linear-gradient(135deg, var(--primary, #2563eb), var(--accent, #0ea5e9));
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm, 8px);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition, all 0.3s);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.btn-cert:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

/* Printing styles for certificates */
@media print {
    /* Hide everything on the page */
    body * {
        visibility: hidden;
    }
    
    /* Show ONLY the certificate modal and its content */
    #certModal, 
    #certModal *, 
    #certificado, 
    #certificado * {
        visibility: visible;
    }
    
    /* Style the modal as a plain white background container for printing */
    #certModal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        overflow: visible;
    }
    
    .cert-modal, .modal {
        background: transparent !important;
    }

    .cert-modal-content, .modal-content {
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        background: transparent !important;
        animation: none !important;
    }
    
    /* Hide modal action buttons and close button when printing */
    .cert-close, 
    .close, 
    .cert-actions {
        display: none !important;
    }
    
    /* Format the certificate card to fill the printed page elegantly */
    .cert {
        border: 12px double #fbbf24 !important;
        outline: 3px solid #2563eb !important;
        outline-offset: -16px !important;
        background: #ffffff !important;
        color: #000000 !important;
        box-shadow: none !important;
        padding: 3rem 2rem !important;
        width: 90% !important;
        max-width: 650px !important;
        margin: 2rem auto !important;
        page-break-inside: avoid;
    }
    
    .hero-stat-item {
        background: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        box-shadow: none !important;
    }
    
    .cert-meta-grid {
        border-top: 1px dashed #cbd5e1 !important;
        border-bottom: 1px dashed #cbd5e1 !important;
    }
}

/* Mobile responsive adjustments for certificates */
@media (max-width: 576px) {
    .cert-modal, .modal {
        padding: 50px 10px 20px;
    }
    
    .cert {
        padding: 1.75rem 1rem 1.5rem;
        outline-width: 1.5px;
        outline-offset: -8px;
        border-width: 6px;
    }
    
    .cert-logo {
        height: 38px;
    }
    
    .cert-title {
        font-size: 1.4rem;
        margin-bottom: 0.5rem;
    }
    
    .cert-recipient {
        font-size: 0.8rem;
        margin-top: 1rem;
    }
    
    .cert-name {
        font-size: 1.6rem;
        max-width: 100%;
        margin-bottom: 0.75rem;
    }
    
    .cert-congratulations {
        font-size: 0.8rem;
        margin-bottom: 1.25rem;
        line-height: 1.4;
    }
    
    .cert-hero-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }
    
    .hero-stat-item {
        padding: 0.75rem;
    }
    
    .hero-stat-item.main-time .stat-value,
    .hero-stat-item.main-pos .stat-value {
        font-size: 1.85rem;
    }
    
    .cert-meta-grid {
        gap: 1rem;
        margin-bottom: 1.25rem;
        padding: 0.5rem;
        flex-wrap: wrap;
    }
    
    .meta-item {
        font-size: 0.8rem;
    }
    
    .cert-footer {
        margin-top: 1rem;
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
    }
    
    .cert-stamp {
        width: 50px;
        height: 50px;
    }
    
    .cert-signature {
        width: 100%;
        max-width: 200px;
    }
    
    .signature-line {
        height: 25px;
    }
    
    .cert-close, .close {
        top: -40px;
        right: 5px;
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
    }
}
