/* ===================== Variables CSS ===================== */
:root {
    --c-primary: #1a2e4a;
    --c-bg:       #ffffff;
    --c-border:   #e2e8f0;
    --c-secondary: #4CAF50;
    --c-text-dark: #333;
    --c-text-medium: #5a677d;
    --c-text-light: #888;
}

/* ===================== Estilos Generales ===================== */
body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #eef2f7;
    color: var(--c-text-dark);
    margin: 0;
    line-height: 1.6;
}

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

h1 {
    text-align: center;
    margin: 20px 0 40px;
    font-size: 1.4rem;
    color: var(--c-primary);
    line-height: 1.2;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}


/* ===================== Header y Navegación (MEJORADO) ===================== */
.site-header {
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: .5rem 0;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between; /* Alinea logo a la izq y nav/botón a la der */
    align-items: center;
    gap: 1.5rem;
}
.logo img {
    display: block;
    height: 40px;
    width: auto;
}
.main-nav {
    display: flex; /* En desktop, flex para alinear */
    align-items: center;
}
.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-link {
    display: block;
    padding: .5rem .75rem;
    border-radius: 4px;
    font-weight: 500;
    text-decoration: none;
    color: var(--c-text-dark);
    transition: background .2s ease, color .2s ease;
    border-bottom: 2px solid transparent;
}
.nav-link:hover,
.nav-link:focus {
    background: #f1f5f9;
    color: var(--c-primary);
}
/* Estilo para el enlace de la página activa */
.nav-link.is-active {
    font-weight: 700;
    color: var(--c-primary);
    border-bottom-color: var(--c-secondary);
}

/* Dropdown */
.has-dropdown { position: relative; }
.has-dropdown > .dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    min-width: 180px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 6px;
    box-shadow: 0 8px 16px rgba(0,0,0,.08);
    list-style: none;
    padding: .5rem 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    z-index: 10;
}
.has-dropdown:hover > .dropdown,
.has-dropdown:focus-within > .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.dropdown-link {
    display: block;
    padding: .5rem 1rem;
    color: var(--c-primary);
    text-decoration: none;
    white-space: nowrap;
}
.dropdown-link:hover,
.dropdown-link:focus {
    background: #f8fafc;
}

/* --- Botón hamburguesa (MEJORADO) --- */
.nav-toggle {
    display: none; /* Oculto en desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: .5rem;
    z-index: 1010; /* Debe estar por encima del nav y el overlay */
    position: relative;
    width: 40px;
    height: 40px;
}
.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
    content: '';
    display: block;
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--c-primary);
    border-radius: 2px;
    transition: transform .3s ease, top .3s ease, bottom .3s ease;
}
.nav-toggle-icon { top: 50%; transform: translateY(-50%); }
.nav-toggle-icon::before { top: -8px; }
.nav-toggle-icon::after { bottom: -8px; }

/* Animación del botón a "X" cuando el nav está abierto */
.body.nav-open .nav-toggle-icon { background: transparent; } /* La barra del medio desaparece */
.body.nav-open .nav-toggle-icon::before { transform: rotate(45deg); top: 0; }
.body.nav-open .nav-toggle-icon::after { transform: rotate(-45deg); bottom: 0; }


/* --- Estilos Mobile (Header/Nav MEJORADO) --- */
@media (max-width: 900px) {
    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100%;
        background: var(--c-bg);
        transform: translateX(100%);
        transition: transform .3s ease-in-out;
        padding-top: 5rem;
        box-shadow: -2px 0 8px rgba(0,0,0,.1);
        overflow-y: auto;
        z-index: 1005;
    }
    .body.nav-open .main-nav {
        transform: translateX(0);
    }
    .nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
    .nav-link {
        padding: .75rem 1.5rem;
        width: 100%;
        border-bottom: 1px solid var(--c-border);
    }
    .has-dropdown > .dropdown {
        position: static;
        border: none;
        box-shadow: none;
        transform: none;
        opacity: 1;
        visibility: visible;
        padding: 0 0 0 1.5rem; /* Indentación */
        background: #f8fafc;
        max-height: 0;
        overflow: hidden;
        transition: max-height .3s ease-in-out, padding .3s;
    }
    .has-dropdown.dropdown-open > .dropdown {
        max-height: 500px; /* Un valor alto para permitir contenido */
        padding: .5rem 0 .5rem 1.5rem;
    }
    .nav-toggle {
        display: block; /* Visible en móvil */
    }
}

/* Overlay para el menú móvil */
.site-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s;
    z-index: 999;
}
.body.nav-open .site-overlay {
    opacity: 1;
    visibility: visible;
}


/* ===================== Sección Equipo/Competición Info ===================== */
.info-box {
    background: var(--c-bg);
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 40px;
}

.info-head {
    display: flex;
    align-items: center;
    background: #f8fafc;
    padding: 15px 10px;
    border-bottom: 1px solid var(--c-border);
}

.info-logo {
    width: 70px;
    height: auto;
    margin-right: 20px;
    border-radius: 8px;
    background: var(--c-bg);
    padding: 5px;
    object-fit: contain;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.info-details {
    flex-grow: 1;
}

.info-head:not(.has-logo) .info-details {
    text-align: center;
    width: 100%;
}

.info-details h2 {
    font-size: 1.8rem;
    color: var(--c-primary);
    margin: 0 0 5px 0;
    line-height: 1.2;
}

.info-details p {
    margin: 0;
    color: var(--c-text-medium);
    font-size: 1rem;
}


/* ===================== Sección de Filtro (Desplegable) ===================== */
details.filter-details {
    background: var(--c-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 40px;
    overflow: hidden;
}

summary.filter-summary {
    display: block;
    padding: 15px 20px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--c-primary);
    background-color: #f8fafc;
    border-bottom: 1px solid var(--c-border);
    cursor: pointer;
    outline: none;
    position: relative;
    list-style: none; /* Ocultar marcador en Firefox */
}
summary.filter-summary::-webkit-details-marker {
    display: none; /* Ocultar marcador en Chrome/Safari */
}

summary.filter-summary::after {
    content: '\25B6'; /* Triángulo derecho ► */
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.2s ease;
}

details[open] > summary.filter-summary::after {
    transform: translateY(-50%) rotate(90deg); /* Rotar 90 grados hacia abajo ▼ */
}

.filter-content {
    padding: 20px;
}

.filter-content form {
    margin: 0;
    padding: 0;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 15px;
    margin-bottom: 20px;
    padding: 0;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    color: var(--c-text-dark);
}

.filter-checkbox input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: flex-end;
}

.filter-button {
    background-color: var(--c-primary);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.filter-button:hover {
    background-color: #34495e;
}

.clear-filter-link {
    color: var(--c-text-medium);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.clear-filter-link:hover {
    color: var(--c-primary);
}


/* ===================== Sección y Lista de Partidos (Tarjetas) ===================== */
.matches-section {
     margin-top: 30px;
}

main > .matches-section:first-child {
     margin-top: 0;
}

main > details.filter-details + .matches-section {
    margin-top: 30px;
}

.match-list {
    display: block;
    padding: 0;
}

.match-item {
    background: var(--c-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 5px solid var(--c-secondary);
    border-top: 1px solid var(--c-border);
    border-right: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
    padding: 15px;
    margin-bottom: 20px;
}

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

.match-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.match-top-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.match-top-info .competition-info {
    display: flex;
    align-items: center;
    color: var(--c-secondary);
    font-weight: 600;
}

.competition-logo-small {
    width: 20px;
    height: auto;
    margin-right: 5px;
    object-fit: contain;
}

.match-top-info .match-date-time time {
     font-size: 0.95rem;
     color: var(--c-text-medium);
     font-weight: normal;
     display: inline;
     margin-bottom: 0;
}

.match-team-logos-small {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f8fafc;
}

.match-team-logos-small img {
    width: 30px;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

.match-title {
     margin-bottom: 15px;
}

.match-title h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--c-primary);
    line-height: 1.2;
    text-align: left;
    font-weight: bold;
    display: block;
}

.match-title h3 .match-local,
.match-title h3 .match-visitor {
    font-weight: bold;
    display: inline;
}

.match-title h3 abbr {
   text-decoration: none;
   color: var(--c-text-medium);
   font-weight: normal;
   font-size: 1.2rem;
   margin: 0 8px;
}

.match-bottom-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--c-text-medium);
    margin-bottom: 10px;
    padding-top: 10px;
    border-top: 1px dashed #eef2f7;
}

.match-payment-info {
     color: var(--c-text-light);
}

.match-channels {
    text-align: right;
    font-weight: bold;
    color: var(--c-primary);
}

.match-additional-details {
    font-size: 0.85rem;
    color: var(--c-text-medium);
    padding-top: 5px;
    border-top: 1px dashed #eef2f7;
    margin-top: auto;
}

.match-additional-details dl {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin: 0;
    padding: 0;
}

.match-additional-details dl > div {
    display: flex;
    flex-direction: row;
    gap: 5px;
}

.match-additional-details dt {
    font-weight: normal;
    color: var(--c-text-medium);
    margin-bottom: 0;
}

.match-additional-details dd {
    margin: 0;
    color: var(--c-text-dark);
    font-weight: bold;
}


/* ===================== Mensaje "No hay datos" ===================== */
.no-data {
    padding: 40px;
    text-align: center;
    color: var(--c-text-medium);
    font-size: 1.2rem;
    background: var(--c-bg);
    border-radius: 8px;
    margin: 20px auto;
    max-width: 600px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}


/* ===================== Footer ===================== */
/* ===== Footer moderno ===== */
footer{
  /* fondo oscuro con buena lectura */
  background:#0b1220;
  color:#e2e8f0;
  border-top:1px solid #0f213a;
  position:relative;
  isolation:isolate;
}

/* franja decorativa superior */
footer::before{
  content:"";
  position:absolute; inset:0 auto auto 0;
  height:4px; width:100%;
  background:linear-gradient(90deg,#0ea5e9, #22c55e, #a78bfa);
  opacity:.75;
}

/* contenedor interno del footer */
footer .footer-content{
  padding:36px 16px;
}

/* grid de secciones */
footer .footer-grid{
  display:grid;
  grid-template-columns:2fr 1fr 1fr; /* Sobre Nosotros / Navegación / Legal */
  gap:22px;
  align-items:start;
}

/* responsive */
@media (max-width:900px){
  footer .footer-grid{ grid-template-columns:1fr 1fr; }
}
@media (max-width:600px){
  footer .footer-grid{ grid-template-columns:1fr; }
}

/* títulos */
footer .footer-section h3{
  margin:0 0 10px;
  font-size:14px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.12em;
  color:#93c5fd; /* azul suave de sección */
}

/* textos */
footer p{ margin:0; color:#cbd5e1; }

/* listas de enlaces */
footer .footer-section ul{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:8px;
}

footer .footer-section a{
  display:inline-flex;
  align-items:center;
  gap:8px;
  text-decoration:none;
  color:#e5e7eb;
  line-height:1.35;
  transition:color .15s ease, opacity .15s ease;
}

/* flechita sutil antes de cada enlace de menús */
footer .footer-nav a::before,
footer .footer-legal a::before{
  content:"›";
  color:#7c8aa5;
  font-weight:700;
  transform:translateY(-1px);
}

/* estados de interacción accesibles */
footer .footer-section a:hover{ color:#38bdf8; text-decoration:underline; }
footer .footer-section a:active{ opacity:.9; }
footer .footer-section a:focus-visible{
  outline:3px solid #38bdf8;
  outline-offset:3px;
  border-radius:6px;
}

/* bloque inferior */
footer .footer-bottom{
  margin-top:22px;
  padding-top:14px;
  border-top:1px solid rgba(226,232,240,.14);
  font-size:13px;
  color:#94a3b8;
  text-align:center;
}

/* texto de "Sobre nosotros" no muy ancho */
footer .footer-about p{ max-width:52ch; }

/* (Opcional) estilos para redes sociales si las activas */
footer .social-links{
  display:flex;
  gap:10px;
  margin-top:6px;
}
footer .social-links img{
  width:20px; height:20px;
  filter:grayscale(1) brightness(1.2);
  transition:filter .15s ease, transform .15s ease;
}
footer .social-links a:hover img{
  filter:none; transform:translateY(-1px);
}
