:root {
    --primary-color: #e63946;
    --secondary-color: #457b9d;
    --dark-color: #1d3557;
    --light-color: #f1faee;
    --success-color: #2a9d8f;
    --warning-color: #e9c46a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
}

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

header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px 0;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

header .event-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
}

header .event-title {
    flex: 2;
}

header .event-image {
    flex: 1;
    text-align: right;
    height: 120px;
}

header .event-image img {
    height: 100%;
    object-fit: contain;
}

.search-section {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.search-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.verify-box {
    display: flex;
    align-items: center;
}

.verify-certificate-button {
    display: inline-block;
    padding: 10px 15px;
    background-color: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s;
    font-weight: bold;
}

.verify-certificate-button i {
    margin-right: 5px;
}

.verify-certificate-button:hover {
    background-color: #45a049;
}

.verify-link {
    display: inline-block;
    margin-top: 5px;
    color: #3498db;
    text-decoration: none;
    font-size: 12px;
}

.verify-link:hover {
    text-decoration: underline;
}

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

.search-box label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--dark-color);
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

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

.filter-box label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--dark-color);
}

.filter-box select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    background-color: white;
}

.button-container {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

button.secondary {
    background-color: var(--secondary-color);
    color: white;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.results-section {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.results-count {
    font-weight: 600;
    color: var(--dark-color);
}

.sort-by {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-by label {
    font-weight: 600;
    color: var(--dark-color);
}

.sort-by select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

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

.results-table th, .results-table td {
    padding: 12px 15px;
    text-align: left;
}

.results-table th {
    background-color: #f8f9fa;
    color: var(--dark-color);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.results-table tr {
    border-bottom: 1px solid #eee;
}

.results-table tr:hover {
    background-color: #f8f9fa;
}

.results-table tr.highlighted {
    background-color: rgba(230, 57, 70, 0.1);
}

.position {
    font-weight: 700;
    width: 50px;
    text-align: center;
}

.position.top-3 {
    color: white;
    background-color: var(--primary-color);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

tr.top-3-row {
    background-color: rgba(230, 57, 70, 0.05);
}

tr.top-3-row:hover {
    background-color: rgba(230, 57, 70, 0.1);
}

.runner-details {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bib-number {
    background-color: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    color: var(--dark-color);
}

.runner-name {
    font-weight: 600;
}

.runner-category {
    font-size: 14px;
    color: #666;
}

.runner-unique-id {
    font-size: 13px;
    color: #e63946;
    margin-top: 4px;
    font-family: monospace;
    background-color: #f8f9fa;
    padding: 3px 6px;
    border-radius: 3px;
    display: inline-block;
    border: 1px dashed #e63946;
}

.unique-id-value {
    font-weight: bold;
    letter-spacing: 1px;
}

.time {
    font-family: monospace;
    font-size: 16px;
    font-weight: 600;
}

.pace {
    font-size: 14px;
    color: #666;
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 5px;
    flex-wrap: wrap;
    padding: 10px;
}

.pagination button {
    padding: 8px 12px;
    background-color: white;
    border: 1px solid #ddd;
    color: var(--dark-color);
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.pagination button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:hover:not(.active) {
    background-color: #f5f5f5;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: #666;
}

.runner-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    position: relative;
}

.runner-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Modal para detalles del corredor */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 60px auto;
    width: 90%;
    max-width: 800px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
    z-index: 10;
}

.modal-close:hover {
    color: var(--primary-color);
}

.runner-header {
    background-color: var(--primary-color);
    color: white;
    padding: 25px;
    border-radius: 10px 10px 0 0;
    position: relative;
}

.runner-name-large {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.runner-verification-id {
    color: white;
    font-size: 14px;
    font-family: monospace;
    margin-top: 5px;
}

.modal-unique-id {
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
}

.runner-certificate {
    margin-top: 10px;
}

.certificate-btn {
    display: inline-block;
    background-color: white;
    color: var(--primary-color);
    padding: 8px 18px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.certificate-btn:hover {
    background-color: #f1f1f1;
    transform: translateY(-2px);
}

.runner-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.detail-box {
    text-align: center;
    padding: 15px;
}

.detail-label {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.detail-value {
    font-size: 22px;
    font-weight: 700;
}

.detail-sub {
    font-size: 14px;
    color: #666;
}

.times-grid {
    display: grid;
    padding: 20px 20px 0;
}

.parcials-grid {
    grid-template-columns: repeat(5, 1fr);
    margin-bottom: 0px;
}

.final-times-grid {
    grid-template-columns: repeat(2, 1fr);
    border-top: 1px dashed #eee;
    margin-top: 10px;
    padding-top: 10px;
}

.time-box {
    text-align: center;
    padding: 10px;
}

.time-label {
    font-weight: 600;
    margin-bottom: 5px;
}

.time-value {
    font-size: 20px;
    font-weight: 700;
    font-family: monospace;
}

.pace-value {
    color: #666;
    font-size: 14px;
}

.photos-section {
    padding: 20px;
    border-top: 1px solid #eee;
}

.photos-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.photo-item {
    position: relative;
    height: 120px;
    border-radius: 5px;
    overflow: hidden;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.photo-item img:hover {
    transform: scale(1.05);
    cursor: pointer;
}

.photo-time {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    text-align: center;
    font-family: monospace;
}

.navigation-buttons {
    display: flex;
    justify-content: center;
    padding: 15px;
    gap: 10px;
}

.nav-btn {
    padding: 8px 16px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-btn:hover {
    background-color: #e9ecef;
}

/* Footer */
footer {
    background-color: #000000;
    color: white;
    padding: 40px 0 0;
    margin-top: 50px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 30px;
    padding: 0 20px;
}

.footer-about img {
    max-width: 180px;
    margin-bottom: 15px;
}

.footer-about p {
    color: #bbb;
    line-height: 1.6;
    margin-bottom: 15px;
}

.footer-links h3, .footer-contact h3 {
    font-size: 18px;
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 10px;
}

.footer-links h3:after, .footer-contact h3:after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: #bbb;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

.contact-info {
    margin-bottom: 20px;
}

.contact-info p {
    color: #bbb;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.contact-info i {
    margin-right: 10px;
    color: var(--primary-color);
}

.social-media {
    display: flex;
    gap: 10px;
}

.social-media a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: #333;
    color: white;
    border-radius: 50%;
    transition: all 0.3s;
}

.social-media a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    background-color: #111;
    padding: 15px 0;
    text-align: center;
    color: #777;
    font-size: 14px;
}

.footer-bottom a {
    color: #bbb;
    text-decoration: none;
}

@media (max-width: 768px) {
    .search-box, .filter-box {
        min-width: 100%;
    }

    .results-table {
        display: none;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .runner-details-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .parcials-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .final-times-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .photos-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .pagination {
        gap: 3px;
    }

    .pagination button {
        min-width: 36px;
        height: 36px;
        padding: 6px;
        font-size: 13px;
    }
    
    .results-card {
        display: block;
    }

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

    .results-count {
        width: 100%;
    }

    .sort-by {
        width: 100%;
    }

    .sort-by select {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .photos-grid {
        grid-template-columns: 1fr 1fr;
    }

    .pagination {
        gap: 2px;
    }

    .pagination button {
        min-width: 32px;
        height: 32px;
        padding: 4px;
        font-size: 12px;
    }
    
    .parcials-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .time-box {
        padding: 8px 5px;
    }
    
    .time-label small {
        display: block;
        margin-top: 2px;
    }
}

.race-banner {
    width: 100%;
    margin-bottom: 30px;
    text-align: center;
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.race-banner-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.top-navbar {
    width: 100%;
    height: 50px;
    background: #000;
}

.actions-cell {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #bbb;
    background: #fff;
    color: #1d3557;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.2s;
    box-shadow: none;
    padding: 0;
}

.action-btn:hover {
    border-color: #e63946;
    color: #e63946;
    background: #f8f9fa;
    transform: scale(1.12);
}

.btn-certificado,
.btn-metricas,
.btn-fotos {
    background: #fff;
    color: #1d3557;
    border: 1.5px solid #bbb;
}

.btn-certificado:hover,
.btn-metricas:hover,
.btn-fotos:hover {
    background: #f8f9fa;
    color: #e63946;
    border-color: #e63946;
}

.actions-cell-horizontal {
    display: flex;
    gap: 6px;
    align-items: center;
}

.action-btn-rect {
    border: 1.5px solid #bbb;
    background: #fff;
    color: #1d3557;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.2s;
    box-shadow: none;
    min-width: 32px;
    min-height: 28px;
}

.action-btn-rect i {
    font-size: 15px;
}

.action-btn-rect:hover {
    border-color: #e63946;
    color: #e63946;
    background: #f8f9fa;
    transform: scale(1.08);
}

/* Estilos para el modal de galería */
.gallery-modal-content {
    max-width: 95%;
    height: 95vh;
    display: flex;
    flex-direction: column;
    background-color: #000;
    padding: 0;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.gallery-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px 0;
}

.gallery-main-photo {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-main-photo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.photo-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 16px;
    display: flex;
    gap: 15px;
    z-index: 2;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.gallery-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav.prev-photo {
    left: 20px;
}

.gallery-nav.next-photo {
    right: 20px;
}

.gallery-nav i {
    font-size: 24px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 3;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.gallery-thumbnails {
    height: 100px;
    padding: 10px;
    display: flex;
    gap: 10px;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: transparent;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.gallery-thumbnail {
    height: 80px;
    width: auto;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.gallery-thumbnail:hover {
    opacity: 0.9;
}

.gallery-thumbnail.active {
    border-color: #2A9D8F;
    opacity: 1;
}

/* Media queries para dispositivos móviles */
@media (max-width: 768px) {
    .gallery-modal-content {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .gallery-container {
        padding: 10px 0;
    }

    .gallery-nav {
        width: 40px;
        height: 40px;
    }

    .gallery-nav.prev-photo {
        left: 10px;
    }

    .gallery-nav.next-photo {
        right: 10px;
    }

    .photo-info {
        bottom: 15px;
        font-size: 14px;
        padding: 8px 16px;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }

    .gallery-thumbnails {
        height: 80px;
    }

    .gallery-thumbnail {
        height: 60px;
    }
}

/* Media query para pantallas muy pequeñas */
@media (max-width: 480px) {
    .gallery-nav {
        width: 36px;
        height: 36px;
    }

    .gallery-nav i {
        font-size: 20px;
    }

    .photo-info {
        bottom: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Estilos del modal de ganadores */
#winners-modal .modal-content {
    max-width: 800px;
    width: 95%;
}

.winners-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.winners-header h2 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 10px;
}

.winners-header h2 i {
    color: #ffd700;
    margin-right: 10px;
}

.winners-header p {
    color: #666;
    font-size: 16px;
}

.winners-podium {
    margin-bottom: 40px;
}

.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    padding: 20px;
}

.podium-place {
    text-align: center;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 15px;
    padding: 20px 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    position: relative;
    min-width: 180px;
}

.podium-place:hover {
    transform: translateY(-5px);
}

.first-place {
    order: 2;
    transform: scale(1.1);
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
}

.second-place {
    order: 1;
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
}

.third-place {
    order: 3;
    background: linear-gradient(135deg, #cd7f32 0%, #daa520 100%);
    color: white;
}

.place-number {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 50%;
    display: inline-block;
    min-width: 40px;
}

.first-place .place-number {
    background: rgba(255,255,255,0.3);
}

.second-place .place-number {
    background: rgba(255,255,255,0.3);
}

.third-place .place-number {
    background: rgba(255,255,255,0.2);
}

.runner-info {
    margin: 15px 0;
}

.runner-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
}

.runner-time {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 3px;
}

.first-place .runner-time {
    color: #b8860b;
}

.third-place .runner-time {
    color: #fff;
}

.runner-category {
    font-size: 12px;
    opacity: 0.8;
}

.medal {
    font-size: 24px;
    margin-top: 10px;
}

.medal.gold {
    color: #ffd700;
}

.medal.silver {
    color: #c0c0c0;
}

.medal.bronze {
    color: #cd7f32;
}

.winners-details {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.winners-details h3 {
    color: var(--dark-color);
    margin-bottom: 15px;
    text-align: center;
}

.winners-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.winners-table th,
.winners-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.winners-table th {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
}

.winners-table tr:nth-child(even) {
    background: #f8f9fa;
}

.winners-table tr:hover {
    background: #e3f2fd;
}

/* Responsive para el modal de ganadores */
@media (max-width: 768px) {
    .podium-container {
        flex-direction: column;
        align-items: center;
    }
    
    .first-place {
        order: 1;
        transform: none;
        margin-bottom: 15px;
    }
    
    .podium-place {
        min-width: 250px;
        margin-bottom: 10px;
    }
    
    .winners-table th,
    .winners-table td {
        padding: 8px 10px;
        font-size: 14px;
    }
}