/* RESET Y ESTILOS GENERALES */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, sans-serif;
}

body {
    background-color: #0f172a;
    color: #f8fafc;
    padding-bottom: 3rem;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* CABECERA UNIFICADA */
nav {
    background: #1e293b;
    padding: 1.5rem 0;
    border-bottom: 1px solid #334155;
}

.nav-box {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    text-align: center;
}

/* Bloque Izquierdo */
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 150px;
    width: auto;
    display: block;
}

.logo-text {
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.logo-text span {
    color: #ef4444;
}

/* Bloque Derecho */
.header-right {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.header-right h1 {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
}

.header-right h1 span {
    background: linear-gradient(135deg, #ef4444, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right .lead {
    color: #94a3b8;
    font-size: 0.95rem;
}




/* HERO SECTION */
header {
    text-align: center;
    padding: 2.5rem 0 1.5rem;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

header h1 span {
    background: linear-gradient(135deg, #ef4444, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header .lead {
    color: #94a3b8;
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* SECCIONES Y TITULARES */
/* CABECERA DE AGRUPACIÓN POR FEDERACIÓN (FUERA DEL BUCLE) */
.group-organizer-header {
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 2.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ef4444; /* Línea roja deportiva que subraya la federación */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.group-icon {
    font-size: 1.2rem;
}

/* Ajuste fino para el título secundario del bloque */
.tournament-group-section .section-title {
    font-size: 0.95rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    border-left: none; /* Quitamos el borde antiguo ya que el principal tiene la línea roja */
    padding-left: 0;
}






/* REJILLA DE CARTELES */
.grid-posters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.5rem;
}

.card-poster {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* El contenedor del cartel ahora es un enlace clickable */
.poster-link {
    display: block;
    width: 100%;
    height: 380px;
    background-color: #0b0f19;
    position: relative;
    cursor: pointer;
}

.poster-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.poster-link:hover .poster-img {
    opacity: 0.85; /* Efecto visual sutil al pasar el ratón */
}


/* CONTENEDOR DE METADATOS UNIFICADO */
.tournament-header-meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.75rem; /* Separación compacta antes de los botones */
}

/* Fila horizontal que empuja los extremos */
.tournament-meta-row {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* Reajuste del Organizador (Izquierda) */
.fed-name {
    font-size: 12px;
    color: #ef4444;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tournament-date {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 0.25rem;
    margin-bottom: 0.3rem;
    font-weight: 500;
}


/* Título compacto debajo de la línea unificada */
.tournament-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.35;
}


/* ETIQUETAS DE ESTADO */
.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #10b981;
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 0.3rem;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    z-index: 10;
}

.status-closed {
    background: #64748b;
}

/* DETALLES Y DOS BOTONES ESTRUCTURADOS */
.poster-details {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Grupo de dos botones paralelos */
.poster-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.btn-action {
    display: block;
    text-align: center;
    background: #203869;
    color: #fff;
    padding: 0.6rem 0;
    border-radius: 0.4rem;
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    transition: background-color 0.2s ease;
}

.btn-action:hover {
    background-color: #475569;
}

.btn-left {
    background: #ef4444;
}

.btn-left:hover {
    background-color: #dc2626;
    color: #fff;
}

.btn-right {
    background: #203869;
}

.btn-right:hover {
    background-color: #192A4D;
    color: #fff;
}


/* SECCIÓN FEDERACIONES */
.grid-federaciones {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.fed-card-item {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.fed-card-item:hover {
    transform: translateY(-2px);
    border-color: #ef4444;
}

/* Formateo para que todos los escudos tengan la misma altura */
.fed-logo {
    height: 65px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3)); /* Sombra para dar volumen a los escudos */
}

.fed-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1.3;
}














/* SECCIÓN HISTÓRICO TIPO MOSAICO CON ANCHO LIMITADO */
.history-section-wrap {
    max-width: 100%;
    margin: 0 auto;
}


/* REJILLA GENERAL DEL MOSAICO (2 por fila en móvil, hasta 4 en PC) */
.mosaic-history {
    display: grid;
    /* Configuración por defecto para móviles: 2 columnas fijas del mismo tamaño */
    grid-template-columns: 1fr 1fr; 
    gap: 0.5rem; /* Reducimos el espacio en móvil para que las tarjetas no se estrechen demasiado */
    margin-bottom: 1.5rem;
}

/* RESPONSIVE: En pantallas más grandes (Tablets y PCs), vuelve al cálculo automático */
@media (min-width: 540px) {
    .mosaic-history {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
        gap: 1rem; /* Restauramos el espacio normal entre tarjetas en pantallas grandes */
    }
}




.mosaic-item {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mosaic-item-datos {
    padding-top: 0.25rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    display: flex;
    flex-direction: column;  
}

/* Contenedor de la miniatura del póster */
.mosaic-poster-link {
    width: 100%;
    background: #0b0f19;
    display: block;
}

.mosaic-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.mosaic-poster-link:hover .mosaic-thumb {
    opacity: 0.8;
}

/* Detalles de la tarjeta del mosaico */
.mosaic-details {
    padding-top: 0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.75rem;
}

.mosaic-links {
    padding-right: 0.2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
}

.mosaic-info {
    display: flex;
    flex-direction: row;
    justify-content: space-between; 
    gap: 0.2rem;
}

.mosaic-fed {
    margin-top: 3px;
    font-size: 9px;
    color: #ef4444;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1;
}

.mosaic-tournament-date {
    float: right;
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

.mosaic-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.3rem; /* Mantiene estable el cuadro de texto */
    margin-bottom: 0rem;
}

.mosaic-date {
    font-size: 10px;
    color: #64748b;
    margin-top: 0.1rem;
}

.mosaic-actions {
    display: flex;
    flex-direction: column; 
    gap: 1.25rem;
    width: 100%;
    margin: auto 0;
}

.btn-mosaic {
    display: block;
    width: 100%;  
    text-align: center;
    background: #203869;
    color: #fff;
    padding: 4px 2px !important; 
    border-radius: 0.35rem;
    text-decoration: none;
    font-size: 0.75rem !important; 
    font-weight: 600;
    transition: background 0.1s;
}

.btn-mosaic:hover {
    background: #475569;
}

.btn-mosaic-main {
    background: #ef4444;
}

.btn-mosaic-main:hover {
    background: #dc2626;
}











/* CAJA COMERCIAL INFERIOR */
.footer-banner {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    align-items: center;
}

.footer-banner h3 {
    font-weight: 800;
    margin-bottom: 0.2rem;
    font-size: 1.1rem;
}

.footer-banner p {
    font-size: 0.85rem;
    color: #fecaca;
}

.price-box {
    font-size: 1.4rem;
    font-weight: 900;
    background: rgba(0, 0, 0, 0.15);
    padding: 0.4rem 1rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* TARJETA DE ACCESO AL ARCHIVO HISTÓRICO ANTIGUO */
.archive-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1.1rem 1.5rem;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.archive-cta:hover {
    transform: translateY(-2px);
    border-color: #ef4444;
    background: #24324a;
}

.archive-cta-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.archive-cta-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.15);
    font-size: 1.4rem;
    flex-shrink: 0;
}

.archive-cta-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.archive-cta-title {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
}

.archive-cta-subtitle {
    color: #94a3b8;
    font-size: 0.85rem;
}

.archive-cta-arrow {
    color: #ef4444;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.archive-cta:hover .archive-cta-arrow {
    transform: translateX(4px);
}




/* PIE DE PÁGINA (ACTUALIZADO CON LOGO) */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #334155;
}

.footer-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
}

.footer-logo-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-logo {
    height: 45px; /* Altura estilizada para mantener el pie discreto pero elegante */
    width: auto;
    display: block;
    /* Mantengo este filtro de manera temporal para que se vea el logo actual mientras subes la versión oscura */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2)); 
}

.footer-text {
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.5;
}

.footer-subtext {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 0.25rem;
}




.ranking-link {
    display: inline-block;
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 1rem;
    overflow: hidden;
    padding: 0.5rem; /* Pequeño marco decorativo */
    width: 100%;     /* Ocupa todo el espacio disponible en móviles */
    max-width: 540px; /* Ancho máximo elegante para que no se vea gigante en ordenadores */
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.ranking-link:hover {
    transform: translateY(-4px);
    border-color: #ef4444;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.15) !important;
}

.ranking-img {
    height: auto; /* Mantiene la proporción correcta de la imagen al encogerse */
    display: block;
    border-radius: 0.6rem;
    object-fit: contain;
}



/* RESPONSIVE: De ordenador a móvil cambia el orden automáticamente */
@media (min-width: 800px) {
    .nav-box {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
        align-items: center;
    }
    .header-right {
        align-items: flex-end;
        text-align: right;
    }
}

/* RESPONSIVE: Comportamiento en escritorio con límites proporcionales */
@media (min-width: 800px) {
    .history-details {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0 0.75rem;
    }
    .history-info {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        flex-grow: 1;
        overflow: hidden; /* Evita desbordes internos */
    }
    .history-title {
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 320px; /* Reducido para ajustarse al nuevo ancho de la sección */
    }
    .history-date {
        margin: 0;
        white-space: nowrap;
    }
    .history-fed {
        min-width: 80px;
    }
}

/* RESPONSIVE: En ordenadores se alinea a los lados */
@media (min-width: 800px) {
    .footer-box {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
    .footer-text {
        text-align: right;
    }
}
