/**
 * filter-panel.css – Panel de competiciones + barra de filtros + calendario
 * custom, todo en TEMA CLARO. Colores de marca: #150542 morado, #01efc1 teal,
 * #FF6900 naranja, #0a9d80 teal oscuro (texto). Lo manejan filter-competitions.js
 * y filter-calendar.js.
 *
 * NOTA sobre los !important: el tema base "mahi" aplica estilos a TODOS los
 * <button> con !important (fondo oscuro dentro de .main-container + un ::before
 * decorativo global). Por eso los fondos/colores de nuestros botones necesitan
 * !important para ganarle: no es sobra, es obligado por el tema.
 */

/* =========================================================================
   NEUTRALIZAR EL TEMA (mahi)
   El tema hijo ya oculta el ::before dentro de .main-container, pero el
   calendario se monta en <body> (fuera de .main-container), así que a sus
   botones les llega la franja oscura. La matamos aquí.
   (No tocamos el 'background' en bloque: los ‹ › y el naranja de "Aplicar"
    son fondos legítimos y se los llevaría por delante.)
   ========================================================================= */
.cf-cal-overlay button::before{ content: none !important; }

/* =========================================================================
   PANEL DE COMPETICIONES (#panel-filtros) — tema claro
   ========================================================================= */
#panel-filtros{
  background: #ffffff !important;
  color: #150542;
  border-radius: 14px;
}
#panel-filtros h4{
  color: #150542;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .5;
  margin: .2rem 0 .5rem;
}
#panel-filtros #close-filtros{ color: #150542; }

/* Layout vertical del panel */
#panel-filtros #filtros-radios{
  display: flex !important;
  flex-direction: column !important;
  gap: 1.1rem !important;
}
#panel-filtros .radios-options{ flex-wrap: wrap; }
#panel-filtros .radios-options label{ color: #150542; }
#panel-filtros .radios-options input{ accent-color: #01efc1; }

/* Valor y Stake en la misma fila */
#panel-filtros .cf-valstake{ display: flex; gap: 1.1rem; flex-wrap: wrap; }
#panel-filtros .cf-valstake > section{ flex: 1; min-width: 150px; }

/* ---- Buscador ---- */
#panel-filtros .cf-search{ position: relative; display: flex; align-items: center; margin-top: 10px; }
#panel-filtros .cf-search-ico{ position: absolute; left: 12px; display: flex; pointer-events: none; color: #150542; opacity: .5; }
#panel-filtros .cf-search-input{
  width: 100%; box-sizing: border-box;
  padding: 12px 38px 12px 36px; border-radius: 12px;
  border: 1px solid rgba(21,5,66,.14);
  background: rgba(21,5,66,.04); color: #150542;
  font: inherit; font-size: 15px; outline: none;
}
#panel-filtros .cf-search-input::placeholder{ color: rgba(21,5,66,.45); }
#panel-filtros .cf-search-input:focus{ border-color: rgba(1,239,193,.6); }
#panel-filtros .cf-search-clear{
  position: absolute; right: 8px; width: 26px; height: 26px; border-radius: 7px;
  border: none; background: rgba(21,5,66,.08); color: #150542;
  cursor: pointer; font-size: 13px;
}

/* ---- Chips de seleccionadas ---- */
#panel-filtros .cf-chips{ margin-top: 12px; }
#panel-filtros .cf-chips-head{ display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
#panel-filtros .cf-chips-count{ color: #0a9d80; font-weight: 600; font-size: 12.5px; }
#panel-filtros .cf-chips-clear{
  border: none; background: transparent; color: rgba(21,5,66,.55);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
#panel-filtros .cf-chips-list{ display: flex; flex-wrap: wrap; gap: 6px; }
#panel-filtros .cf-chip{
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 6px 8px 6px 11px; border-radius: 9px;
  background: rgba(1,239,193,.16); border: 1px solid rgba(1,239,193,.45);
  animation: cfChipIn .16s ease;
}
#panel-filtros .cf-chip > span{ color: #150542; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
#panel-filtros .cf-chip button{ border: none; background: transparent; color: #0a9d80; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; display: flex; }
@keyframes cfChipIn{ from{ transform: scale(.85); opacity: 0; } to{ transform: scale(1); opacity: 1; } }

/* ---- Grupos (acordeón) ---- */
#panel-filtros .cf-groups{ margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
#panel-filtros .cf-group-head{
  width: 100%; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; min-height: 54px; border-radius: 13px;
  text-align: left; cursor: pointer; font: inherit;
  background: #f2f0fa !important; border: 1px solid rgba(21,5,66,.12) !important; color: #150542 !important;
}
#panel-filtros .cf-group-title{ color: #150542; font-weight: 700; font-size: 15.5px; }
#panel-filtros .cf-group-count{ color: rgba(21,5,66,.45); font-size: 12.5px; margin-left: 8px; }
#panel-filtros .cf-group-right{ display: flex; align-items: center; gap: 10px; }
#panel-filtros .cf-group-badge{
  min-width: 22px; height: 22px; padding: 0 7px; box-sizing: border-box; border-radius: 99px;
  background: #01efc1; color: #150542; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
#panel-filtros .cf-group-caret{ color: rgba(21,5,66,.45); font-size: 12px; }
#panel-filtros .cf-group.is-open .cf-group-caret{ color: #0a9d80; }
#panel-filtros .cf-rows{ padding: 4px 2px 2px; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 10px; }
#panel-filtros .cf-row{
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; min-height: 48px;
  box-sizing: border-box; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; background-image: none !important; color: #150542;
}
#panel-filtros .cf-row::before{ content: none !important; }
#panel-filtros .cf-row.is-checked{ background: rgba(1,239,193,.12); border-color: rgba(1,239,193,.35); }
#panel-filtros .cf-row input{ width: 20px; height: 20px; flex: none; accent-color: #01efc1; cursor: pointer; }
#panel-filtros .cf-row > span{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; line-height: 1.3; }
#panel-filtros .cf-row mark{ background: rgba(1,239,193,.28); color: #0a9d80; border-radius: 3px; padding: 0 1px; }

/* ---- Estado vacío ---- */
#panel-filtros .cf-empty{ text-align: center; padding: 34px 20px; }
#panel-filtros .cf-empty-emoji{ font-size: 30px; opacity: .5; margin-bottom: 8px; }
#panel-filtros .cf-empty-t{ color: #150542; font-weight: 700; font-size: 15px; margin-bottom: 4px; }
#panel-filtros .cf-empty-s{ color: #150542; font-size: 13px; margin-bottom: 14px; }
#panel-filtros .cf-empty button{
  padding: 9px 16px; border-radius: 10px; border: 1px solid rgba(1,239,193,.4);
  background: rgba(1,239,193,.12); color: #0a9d80; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer;
}

/* ---- Footer ---- */
#panel-filtros .btn-reset{ background: rgba(21,5,66,.06) !important; color: #150542 !important; border: 1px solid rgba(21,5,66,.15) !important; }
#panel-filtros .btn-aplicar{ background: #FF6900 !important; color: #fff !important; }

@media (min-width: 61em){
  #panel-filtros .cf-groups{ max-height: 52vh; overflow-y: auto; }
  #panel-filtros .cf-groups::-webkit-scrollbar{ width: 6px; }
  #panel-filtros .cf-groups::-webkit-scrollbar-thumb{ background: rgba(1,239,193,.25); border-radius: 99px; }
}

/* =========================================================================
   BARRA DE FILTROS (pb-toolbar) — tema CLARO, una fila (grid en móvil).
   Segmentados: deporte/Hoy-Mañana activo = teal; estado activo = naranja.
   ========================================================================= */
.pb-toolbar{
  background: #ffffff !important;
  border-bottom: 3px solid rgba(21, 5, 66, 0.479);
  padding: 10px 12px !important;
  gap: 10px !important;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  scrollbar-width: none;
}
.pb-toolbar::-webkit-scrollbar{ display: none; }
.pb-toolbar > *{ flex: none; }
.pb-toolbar .toolbar-row{ overflow: visible; }
.pb-toolbar .tb-sep{ height: 28px; background: rgba(21,5,66,.1); }

/* Botón "Filtros" (chip borde naranja) */
.pb-toolbar #btn-filtros{
  height: 44px; border-radius: 12px !important;
  background: rgba(255,105,0,.12) !important;
  border: 1px solid rgba(255,105,0,.5) !important;
  color: #150542 !important; font-weight: 700;
}
.pb-toolbar #btn-filtros i{ color: #FF6900; }

/* Grupos segmentados (deporte / estado / Hoy-Mañana) */
.pb-toolbar .deportes,
.pb-toolbar .estado-group,
.pb-toolbar .rangos-rapidos{
  background: rgba(21,5,66,.05);
  padding: 4px; border-radius: 12px; gap: 3px;
}

/* Deporte (iconos SVG con currentColor) */
.pb-toolbar .lbl-sport{
  width: 40px; min-width: 40px; height: 38px; margin: 0;
  background-color: transparent !important; background-image: none !important;
  border-radius: 9px; color: rgba(21,5,66,.55);
  display: flex; align-items: center; justify-content: center;
  transition: background-color .15s ease, color .15s ease;
}
.pb-toolbar .lbl-sport svg{ width: 20px; height: 20px; }
.pb-toolbar .lbl-sport small{ color: rgba(21,5,66,.55); }
.pb-toolbar #sport-top-0 + .lbl-sport{ width: auto; min-width: auto; padding: 0 13px; }
.pb-toolbar .sport-radio:checked + .lbl-sport{ background-color: #01efc1 !important; color: #150542 !important; }
.pb-toolbar .sport-radio:checked + .lbl-sport small{ color: #150542 !important; }
/* Icono de deporte resaltado si filtras por una competición de ese deporte */
.lbl-sport.cf-sport-active{
  box-shadow: 0 0 0 2px #01efc1, 0 0 12px rgba(1, 239, 193, .55) !important;
  border-radius: 8px;
}

/* Estado (segmentado, activo naranja) */
.pb-toolbar .lbl-estado{
  background: transparent !important; min-width: auto; height: 38px; margin: 0;
  padding: 0 13px; border-radius: 9px; color: rgba(21,5,66,.55);
}
.pb-toolbar .estado-radio:checked + .lbl-estado,
.pb-toolbar .lbl-estado.is-active{ background: #FF6900 !important; color: #150542 !important; }

/* Hoy / Mañana (segmentado, activo teal) */
.pb-toolbar .lbl-rango{
  flex-direction: row; min-width: auto; height: 38px; margin: 0; padding: 0 14px;
  border-radius: 9px; background: transparent !important; color: rgba(21,5,66,.55);
}
.pb-toolbar .rango-radio:checked + .lbl-rango,
.pb-toolbar .lbl-rango.is-active{ background: #01efc1 !important; color: #150542 !important; }

/* Disparador del calendario (chip) */
.pb-toolbar .cf-cal-trigger{
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px;
  border: 1px solid #ffffff; border-radius: 12px;
  background-color: rgba(21,5,66,.05) !important;
  color: rgba(21,5,66,.5) !important;
  font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.pb-toolbar .cf-cal-trigger svg{ color: #0a9d80; }
.pb-toolbar .cf-cal-trigger.has-value{ background: rgba(1,239,193,.1); border-color: rgba(1,239,193,.5); color: #150542; }
.pb-toolbar .cf-cal-dash{ color: rgba(21,5,66,.35); font-weight: 700; }

/* ---- Móvil: barra en cuadrícula (sin scroll horizontal) ---- */
@media (max-width: 60.99em){
  /* Barra en móvil = 2 filas fijas (grid):
       fila 1 → Filtros · deportes · 📅 (icono)
       fila 2 → Hoy/Mañana o estado, a lo ancho. */
  .pb-toolbar{
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    gap: 8px; align-items: center; overflow: visible;
  }
  .pb-toolbar .tb-sep{ display: none; }

  /* Desde–Hasta se colapsa a UN solo icono de calendario (ambos botones
     abren el mismo overlay): ocultamos textos, guion y el 2º botón. */
  .pb-toolbar .cf-fechas .cf-cal-lbl,
  .pb-toolbar .cf-fechas .cf-cal-dash,
  .pb-toolbar .cf-fechas .cf-cal-trigger:last-of-type{ display: none; }
  .pb-toolbar .cf-fechas .cf-cal-trigger{ width: 44px; min-width: 44px; padding: 0; gap: 0; justify-content: center; }

  /* Fila 1: Filtros | deportes (crece) | 📅 justo al lado de deportes */
  .pb-toolbar .acciones{ grid-column: 1; grid-row: 1; }
  .pb-toolbar .deportes{ grid-column: 2; grid-row: 1; justify-content: space-around; }
  .pb-toolbar .cf-fechas{ grid-column: 3; grid-row: 1; }
  /* Fila 2: el grupo que exista (Hoy/Mañana o estado), a todo lo ancho */
  .pb-toolbar .rangos-rapidos,
  .pb-toolbar .estado-group{ grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }

  #panel-filtros .cf-valstake{ flex-direction: column; }
}

/* =========================================================================
   CALENDARIO CUSTOM (overlay + hoja) — tema claro (blanco, acentos teal).
   El overlay se monta en <body>; ver "NEUTRALIZAR EL TEMA" arriba.
   ========================================================================= */
.cf-cal-overlay{ position: fixed; inset: 0; z-index: 10050; background: rgba(21,5,66,.35); display: flex; align-items: flex-end; justify-content: center; }
.cf-cal-overlay[hidden]{ display: none; }
.cf-cal-sheet{
  width: 100%; max-width: 440px; box-sizing: border-box;
  background: #ffffff; color: #150542;
  border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px -20px rgba(21,5,66,.3);
  font-family: inherit;
}
@media (min-width: 48em){
  .cf-cal-overlay{ align-items: center; }
  .cf-cal-sheet{ border-radius: 18px; }
}
.cf-cal-grip{ width: 40px; height: 4px; border-radius: 99px; background: rgba(21,5,66,.15); margin: 0 auto 14px; }
.cf-cal-head{ display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cf-cal-title{ font-weight: 700; font-size: 17px; }
.cf-cal-clear{ border: none; background: transparent; color: rgba(21,5,66,.55); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline; }
.cf-cal-fields{ display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.cf-cal-field{ flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: rgba(1,239,193,.08); border: 1px solid rgba(1,239,193,.35); }
.cf-cal-field span{ font-size: 11px; color: rgba(21,5,66,.5); font-weight: 600; }
.cf-cal-field b{ font-size: 15px; font-weight: 700; }
.cf-cal-arrow{ color: rgba(21,5,66,.4); }
.cf-cal-nav{ display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cf-cal-nav button{ width: 34px; height: 34px; border: none; background: rgba(21,5,66,.05); color: #150542; border-radius: 9px; font-size: 18px; cursor: pointer; }
.cf-cal-month{ font-weight: 600; font-size: 15px; font-family: inherit; }
.cf-cal-weekdays{ display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; margin-bottom: 6px; }
.cf-cal-weekdays span{ text-align: center; font-size: 11px; color: rgba(21,5,66,.4); font-weight: 600; }
.cf-cal-grid{ display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cf-cal-empty{ height: 38px; }
.cf-cal-day{ height: 38px; border: none; background: transparent; color: #150542; border-radius: 9px; font: inherit; font-size: 13.5px; cursor: pointer; }
.cf-cal-day.is-range{ background: rgba(21,5,66,.12); border-radius: 0; }
.cf-cal-day.is-end{ background: #150542; color: #fff; font-weight: 700; }
.cf-cal-apply{ width: 100%; margin-top: 16px; padding: 14px; border: none; border-radius: 13px; background: #FF6900; color: #fff; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
