/* ==================== AGENDA CSS ====================
   Mismo archivo unificado de siempre. Se sacaron las variables
   locales que redefinían --accent / --text-primary / --radius
   en :root: como este archivo carga DESPUÉS de espacial-base.css,
   esas redefiniciones pisaban la paleta viva en TODA la web, no
   solo acá. Ahora todo usa las variables globales del sistema
   (--accent, --accent-2, --accent-3, --bevel-top/bottom, etc.)
   Se unificaron además los bloques que estaban duplicados
   (.matches, .time-col, .time-badge, .match-header:hover,
   .competition-logo) para que no compitan entre sí.
   ==================== */

:root {
  /* Solo lo que NO existe ya en espacial-base.css */
  --agenda-transition: 0.2s ease;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --font-size-md: 1rem;
  --font-size-xl: 1.25rem;
}

/* ==================== RESET Y ESTILOS BASE ==================== */
.container-agenda *,
.container-agenda *::before,
.container-agenda *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.container-agenda {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin-inline: auto;
  position: relative;
  z-index: 2;
}

/* ==================== BANNER DEL DÍA ==================== */
.day-banner {
  position: relative;

  background: linear-gradient(
    135deg,
    rgba(114, 214, 255, 0.2) 0%,   /* azul cyan al 20% */
    rgba(255, 127, 255, 0.2) 100%  /* magenta/rosa al 20% */
  );
  color: #ffffff;

  border: 1px solid transparent;
  border-top-color: var(--bevel-top);
  border-bottom-color: var(--bevel-bottom);
  border-radius: 9px 9px 0 0;
  padding: 1.2rem clamp(1rem, 3vw, 1.5rem);
  text-align: center;
  font-size: clamp(var(--font-size-md), 2vw, var(--font-size-xl));
  font-weight: 700;
  color: var(--text-primary);
}

.day-banner::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(60%, 200px);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-2), var(--accent-3), transparent);
  border-radius: 1px;
}

/* ==================== CONTENEDOR DE AGENDA ==================== */
.agenda {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.agenda.compact { gap: var(--spacing-xs); }

.matches {
  display: flex;
  flex-direction: column;
}

/* ==================== LISTA DE PARTIDOS ==================== */
.match-card {
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    border-bottom-color: var(--bevel-top);
    box-shadow: var(--shadow-depth-sm);
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform var(--agenda-transition);
}

.match-header {
    padding: 1rem 1.25rem;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.1rem;
    flex-direction: column;
    justify-content: center;
    border: 1px solid transparent;
    border-top-color: var(--bevel-top);
    border-bottom-color: var(--bevel-bottom);
    box-shadow: var(--shadow-depth-sm);
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    transition: border-color var(--transition), background var(--transition);
}

@media (hover: hover) and (pointer: fine) {
  .match-header:hover {
    background: var(--panel-grad-hover);
        border-top-color: rgba(var(--accent-2-rgb), 0.5);
        border-bottom-color: rgba(var(--accent-3-rgb), 0.35);
    
    }
  .match-card:hover .teams { 
    color: var(--accent-2); 
  }
  
}

@media (hover: none) and (pointer: coarse) {
  .match-header:active { background: var(--panel-grad-hover); }
  .match-card:active { transform: scale(0.98); }
}

.time-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 0.25rem;
}


.time-badge {
    color: var(--accent);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    transition: all var(--agenda-transition) ease;
}
.competition-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 50%;
}

.match-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.match-text { min-width: 0; }

.teams {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.competition-name {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.15rem;
}

.meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.meta span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.competition {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-soft);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
}

.competition img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
}

.expand-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.expand-icon.expanded { transform: rotate(180deg); }

.dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition);
  border-top: 1px solid transparent;
}

.dropdown:not(.hidden) {
  max-height: 500px;
  border-top-color: var(--border-soft);
}

.hidden { display: none; }

.channel-menu { list-style: none; }

.channel-item {
  padding: 12px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 3px solid transparent;
  min-height: 44px;
  transition: background var(--transition), border-color var(--transition);
}

.channel-item .left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  color: var(--text-primary);
}

.play-icon {
  width: 20px;
  height: 20px;
  background: var(--accent-grad);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #04141a;
  flex-shrink: 0;
}

.play-icon::before { content: '▶'; }

@media (hover: hover) and (pointer: fine) {
  .channel-item:hover {
    background: var(--panel-grad-hover);
    border-left-color: var(--accent-2);
  }
}

@media (hover: none) and (pointer: coarse) {
  .channel-item:active {
    background: var(--panel-grad-hover);
    border-left-color: var(--accent-2);
  }
}

/* ==================== ESTADOS DE MENSAJES ==================== */
.no-events {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 1.1rem;
  background: var(--panel-grad);
border-radius: 0px 0px 9px 9px;
}

.loading {
  background: var(--panel-grad);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
}

.loading-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
  text-align: center;
  padding: 3rem 1rem;
  background: rgba(255, 69, 104, 0.08);
  border: 1px solid rgba(255, 69, 104, 0.3);
  border-radius: var(--radius-md);
}

.error-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

.retry-btn {
  padding: 0.5rem 1.5rem;
  background: var(--accent-grad);
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-sm);
  color: #04141a;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1rem;
  box-shadow: var(--shadow-depth-sm);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.events-counter {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.75rem;
}

/* ==================== FILTROS Y BÚSQUEDA ==================== */
.agenda-controls {
  display: flex;
  flex-wrap: wrap;
}

.search-container {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-container input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 42px 13px 46px;
  background: var(--bg-panel-strong);
  border: 1px solid transparent;
  border-top-color: var(--bevel-bottom);
  border-bottom-color: var(--bevel-top);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1;
  outline: none;
  transition: border-color var(--animation-speed),
              box-shadow var(--animation-speed),
              background var(--animation-speed);
}

.search-container input:focus {
  outline: none;
  border-bottom-color: rgba(var(--accent-rgb), 0.25);
}

.search-container::before {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2393a8c9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='9' r='5.5'/%3E%3Cline x1='13.5' y1='13.5' x2='18' y2='18'/%3E%3C/svg%3E");
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.6;
  width: 16px;
  height: 16px;
  display: block;
  line-height: 0;
  pointer-events: none;
}

.agenda-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1rem;
  background: var(--panel-grad);
  border: 1px solid transparent;
  border-top-color: var(--bevel-top);
  border-bottom-color: var(--bevel-bottom);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-btn:hover {
  background: var(--panel-grad-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  border-top-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.filter-btn::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  flex-shrink: 0;
}

.filter-btn[data-filter="all"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2' width='7' height='7'/%3E%3Crect x='11' y='2' width='7' height='7'/%3E%3Crect x='2' y='11' width='7' height='7'/%3E%3Crect x='11' y='11' width='7' height='7'/%3E%3C/svg%3E");
}

.filter-btn[data-filter="live"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 10 Q5 4 10 4 Q15 4 18 10'/%3E%3Cpath d='M5 13 Q7 9 10 9 Q13 9 15 13'/%3E%3Ccircle cx='10' cy='16' r='1.5' fill='%23ffffff'/%3E%3C/svg%3E");
}

.filter-btn[data-filter="football"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='10' r='8'/%3E%3Cpolygon points='10,6 12.5,8.5 11.5,11.5 8.5,11.5 7.5,8.5' fill='%23ffffff' stroke='%23ffffff' stroke-width='0.5'/%3E%3Cline x1='10' y1='6' x2='10' y2='2'/%3E%3Cline x1='12.5' y1='8.5' x2='16' y2='7'/%3E%3Cline x1='11.5' y1='11.5' x2='14.5' y2='14'/%3E%3Cline x1='8.5' y1='11.5' x2='5.5' y2='14'/%3E%3Cline x1='7.5' y1='8.5' x2='4' y2='7'/%3E%3C/svg%3E");
}

.filter-btn[data-filter="f1"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='4' y1='2' x2='4' y2='18'/%3E%3Crect x='4' y='2' width='3' height='3' fill='%23ffffff'/%3E%3Crect x='7' y='2' width='3' height='3' fill='none'/%3E%3Crect x='10' y='2' width='3' height='3' fill='%23ffffff'/%3E%3Crect x='4' y='5' width='3' height='3' fill='none'/%3E%3Crect x='7' y='5' width='3' height='3' fill='%23ffffff'/%3E%3Crect x='10' y='5' width='3' height='3' fill='none'/%3E%3Crect x='4' y='8' width='3' height='3' fill='%23ffffff'/%3E%3Crect x='7' y='8' width='3' height='3' fill='none'/%3E%3Crect x='10' y='8' width='3' height='3' fill='%23ffffff'/%3E%3C/svg%3E");
}

/* ==================== INDICADORES DE ESTADO ==================== */
.match-card.live { border-left: 4px solid var(--live); }
.match-card.upcoming { border-left: 4px solid var(--accent); }

.live-indicator {
  display: inline-block;
  background: var(--live);
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 8px;
}

.sources-badge {
  background: var(--accent-grad);
  color: #04141a;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75em;
  font-weight: 600;
  margin-left: 8px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .day-banner { font-size: 1rem; padding: 1rem 1.2rem; }
  .match-header { padding: 0.875rem 1rem; gap: 0.875rem; }
  .teams { font-size: 1rem; }
  .meta { gap: 0.6rem; }
  .channel-item { padding: 10px 16px; }
  .competition-logo { width: 32px; height: 32px; }
}

@media (max-width: 640px) {
  .match-header {
    grid-template-columns: 1fr auto;
    grid-template-areas: "main icon" "time time";
    row-gap: 0.5rem;
  }
  .time-col { grid-area: time; flex-direction: row; justify-content: flex-start; width: 100%; }
  .match-main { grid-area: main; width: 100%; }
  .expand-icon { grid-area: icon; }
}

@media (max-width: 480px) {
  .container-agenda { padding: 0; }
  .day-banner { font-size: 0.95rem; padding: 0.875rem 1rem; }
  .match-header { padding: 0.75rem 0.875rem; }
  .teams { font-size: 0.95rem; }
  .meta {
    gap: 0.5rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .meta span { font-size: 0.8rem; }
  .competition { padding: 0.2rem 0.5rem; font-size: 0.8rem; }
  .channel-item { padding: 8px 14px; }
  .no-events { padding: 2rem 1rem; font-size: 1rem; }
}

@media (max-width: 360px) {
  .day-banner { font-size: 0.9rem; padding: 0.75rem 0.875rem; }
  .match-header { padding: 0.625rem 0.75rem; }
  .channel-item { padding: 6px 12px; }
}

/* ==================== ACCESIBILIDAD ==================== */
.match-header:focus-visible,
.channel-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .match-card, .dropdown, .play-icon, .competition, .channel-item, .expand-icon {
    transition: none !important;
  }
  .dropdown:not(.hidden) { max-height: none; }
}

@media (prefers-contrast: high) {
  .match-card { border: 2px solid var(--accent); }
  .channel-item { border-left: 3px solid var(--accent); }
  .sources-badge { background: var(--accent); color: var(--bg-void); }
}

/* ==================== OPTIMIZACIÓN MÓVIL (Android/iOS) ==================== */
@media (hover: none) and (pointer: coarse) {
  body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }
}