/* ==================== AGENDA CSS ==================== */

:root {
  --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 ==================== */
.agenda-container *,
.agenda-container *::before,
.agenda-container *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
}

.agenda-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 0px;
    background-color: #0d0d0d;
    color: #ffffff;
}

/* ==================== DATE HEADER ==================== */
.date-header {
    background-color: #032d56;
    color: #ffffff;
    padding: 10px;
    border-radius: 10px 10px 0 0;
    text-align: center;
    font-size: 1.2em;
}

/* ==================== AGENDA SCROLLER ==================== */
.agenda-scroller {
    position: relative;
    overflow-y: auto;
    height: 60vh;
    background-color: #111;
    padding: 10px;
    border-radius: 0 0 10px 10px;
    scrollbar-width: thin;
    scrollbar-color: #444 #111;
}

.agenda-scroller::-webkit-scrollbar {
    width: 8px;
}

.agenda-scroller::-webkit-scrollbar-track {
    background: #111;
    border-radius: 10px;
}

.agenda-scroller::-webkit-scrollbar-thumb {
    background-color: #444;
    border-radius: 10px;
    border: 2px solid #111;
}

/* ==================== CONTENEDOR DE AGENDA ==================== */
.agenda {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.agenda.compact { 
  gap: var(--spacing-xs); 
  padding: 10px;
}

.matches {
  display: flex;
  flex-direction: column;
}

/* ==================== MATCH CONTAINER ==================== */
.match-container {
    display: flex;
    align-items: center;
    padding: 0px 20px;
    background-color: #222;
    margin-bottom: 5px;
    border-radius: 10px;
    color: #ffffff;
    gap: 0%;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--agenda-transition);
}

@media (hover: hover) and (pointer: fine) {
  .match-container:hover {
    background-color: #444;
  }
}

@media (hover: none) and (pointer: coarse) {
  .match-container:active {
    background-color: #444;
  }
}

/* ==================== TIME Y VS ==================== */
.time,
.vs {
    font-size: 1.3em;
    color: #cccccc;
}

/* ==================== TEAM CONTAINER ==================== */
.team-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    text-align: center;
}

.team-name {
    font-size: 0.8em;
    font-weight: bold;
    text-align: center;
    max-width: 100%;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1em;
    height: 2.2em;
}

/* ==================== TEAM LOGO (hueco reservado) ==================== */
.team-logo {
    width: 40px;
    height: 40px;
    margin-bottom: 1px;
    display: block;
    background-color: transparent;
    object-fit: contain;
}

/* ==================== EVENT LOGO ==================== */
.event-logo {
    width: 50px;
    height: 50px;
}

/* ==================== LINKS CONTAINER (acordeón) ==================== */
.links-container {
    display: none;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
    padding: 10px;
    background-color: #333;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 5px;
}

.links-container.open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.link-button {
    display: block;
    margin: 5px 0;
    padding: 10px;
    text-decoration: none;
    background-color: #444;
    color: white;
    border-radius: 5px;
    text-align: center;
    transition: background-color 0.3s ease-in-out;
}

.link-button:hover {
    background-color: #555;
}

/* ==================== ESTADOS DE MENSAJES ==================== */
.no-events {
  text-align: center;
  padding: 3rem 1rem;
  color: #aaa;
  font-size: 1.1rem;
  border-radius: 0px 0px 9px 9px;
}

.loading {
  background: #1a1a1a;
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  color: #aaa;
}

.loading-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #aaa;
}

.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: 10px;
}

.error-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

.retry-btn {
  padding: 0.5rem 1.5rem;
  background: #3223dc;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 5px;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1rem;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.events-counter {
  display: none;
}

/* ==================== FILTROS Y BÚSQUEDA ==================== */
.agenda-controls {
  display: flex;
  flex-wrap: wrap;
  padding: 0px 10px 0px 10px;
}

.search-container {
  flex: 1;
  min-width: 250px;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.search-container input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 42px 13px 46px;
  background: #333;
  color: white;
  border: none;
  font-size: 0.9em;
  border-radius: 4px;
  outline: none;
  transition: background 0.3s;
}

.search-container input:focus {
  outline: none;
  background: #3a3a3a;
}

.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;
}

/* ==================== INDICADORES DE ESTADO ==================== */
.live-indicator {
  display: inline-block;
  background: #fa002e;
  color: white;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 8px;
}

.sources-badge {
  background: #3223dc;
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 0.75em;
  font-weight: 600;
  margin-left: 8px;
}

/* ==================== EN VIVO ==================== */
.match-container.live .time {
  color: #fa002e;
  padding: 2px 8px;
  letter-spacing: 0.5px;
  font-size: 1.0em;
  font-weight: 700;
}

/* ==================== EVENTO PASADO (oculto) ==================== */
.match-container.past {
  display: none !important;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .agenda-container {
    max-width: calc(100% - 4px);
  }
  .date-header { font-size: 1rem; padding: 1rem 1.2rem; }
  .match-container {
    flex-direction: row;
    gap: 5px;
    justify-content: space-between;
  }
  .time,
  .vs {
    font-size: 1.1em;
  }
  .team-name {
    font-size: 0.6em;
  }
}

@media (max-width: 480px) {
  .agenda-container {
    max-width: calc(100% - 10px);
    padding: 0;
  }
  .no-events { padding: 2rem 1rem; font-size: 1rem; }
}

@media (max-width: 360px) {
  .date-header { font-size: 0.9rem; padding: 0.75rem 0.875rem; }
  .match-container { padding: 0.625rem 0.75rem; }
}

/* ==================== ACCESIBILIDAD ==================== */
.match-container:focus-visible,
.link-button:focus-visible {
  outline: 2px solid #3223dc;
  outline-offset: 2px;
}

@media (prefers-contrast: high) {
  .match-container { border: 2px solid #3223dc; }
  .link-button { border-left: 3px solid #3223dc; }
}