/*!
 * ScheduleGrid — estilos
 * Grid semanal de programación (radio/TV), independiente, sin dependencias.
 */

.sg {
  --sg-bg: #10182b;
  --sg-bg-2: #161f38;
  --sg-card: #182342;
  --sg-card-2: #1d2a4d;
  --sg-accent: #e2a63b;
  --sg-accent-2: #f4c469;
  --sg-live: #ef4444;
  --sg-text: #ffffff;
  --sg-text-dim: #a9b3c9;
  --sg-border: rgba(255, 255, 255, 0.1);
  --sg-radius: 16px;

  width: 100%;
  color: var(--sg-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}
.sg *, .sg *::before, .sg *::after { box-sizing: border-box; }

/* ---------- Selector de día (visible solo en móvil/tablet) ---------- */
.sg-day-tabs {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}
.sg-day-tabs::-webkit-scrollbar { height: 5px; }
.sg-day-tabs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 999px; }
.sg-day-tab {
  flex: none;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--sg-border);
  background: var(--sg-card);
  color: var(--sg-text-dim);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.sg-day-tab:hover { background: var(--sg-card-2); color: var(--sg-text); }
.sg-day-tab.is-active {
  background: linear-gradient(155deg, var(--sg-accent-2), var(--sg-accent));
  color: #161018;
  border-color: transparent;
}
.sg-day-tab .sg-today-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sg-live);
  margin-left: 6px;
  vertical-align: middle;
}

/* ---------- Grid semanal (escritorio) ---------- */
.sg-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.sg-day-col {
  background: linear-gradient(180deg, var(--sg-bg) 0%, var(--sg-bg-2) 100%);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  padding: 14px 12px;
  min-width: 0;
}
.sg-day-col.is-today {
  border-color: rgba(226, 166, 59, 0.55);
  box-shadow: 0 0 0 1px rgba(226, 166, 59, 0.2), 0 12px 26px rgba(0, 0, 0, 0.3);
}

.sg-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--sg-border);
}
.sg-day-name {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sg-text);
}
.sg-day-col.is-today .sg-day-name { color: var(--sg-accent-2); }
.sg-today-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(226, 166, 59, 0.18);
  color: var(--sg-accent-2);
  text-transform: uppercase;
}

.sg-empty-day {
  font-size: 0.78rem;
  color: var(--sg-text-dim);
  padding: 10px 2px;
  text-align: center;
  opacity: 0.7;
}

/* ---------- Tarjeta de programa ---------- */
.sg-slot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 11px;
  border-radius: 12px;
  background: var(--sg-card);
  margin-bottom: 8px;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.sg-slot:last-child { margin-bottom: 0; }
.sg-slot:hover { background: var(--sg-card-2); }

.sg-slot.is-live {
  background: linear-gradient(155deg, rgba(226, 166, 59, 0.16), rgba(226, 166, 59, 0.05));
  border-color: rgba(226, 166, 59, 0.5);
}

.sg-slot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.sg-time {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--sg-accent-2);
  letter-spacing: 0.02em;
}
.sg-live-badge {
  /* Oculto por defecto: solo se muestra dentro de una tarjeta marcada
     ".is-live" (ver regla siguiente). No se confía únicamente en el
     atributo "hidden" porque una regla de igual especificidad como
     "display: inline-flex" aquí mismo lo vencería en la cascada. */
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ff8686;
}
.sg-slot.is-live .sg-live-badge { display: inline-flex; }
.sg-live-badge .sg-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sg-live);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  animation: sg-pulse 1.6s ease-out infinite;
}
@keyframes sg-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.sg-program {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--sg-text);
}
.sg-locutor {
  font-size: 0.74rem;
  color: var(--sg-text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}
.sg-locutor::before { content: "🎙️"; font-size: 0.7rem; }

.sg-description {
  font-size: 0.74rem;
  color: var(--sg-text-dim);
  line-height: 1.45;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sg-slot.is-expanded .sg-description {
  -webkit-line-clamp: unset;
  overflow: visible;
}
.sg-more-toggle {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  margin-top: 1px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--sg-accent-2);
  cursor: pointer;
}
.sg-more-toggle:hover { text-decoration: underline; }

.sg-listen {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sg-text);
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.sg-listen:hover { background: var(--sg-accent); color: #161018; }
.sg-slot.is-live .sg-listen {
  background: linear-gradient(155deg, var(--sg-accent-2), var(--sg-accent));
  color: #161018;
}
.sg-listen svg { width: 12px; height: 12px; }

/* ---------- Responsivo ---------- */
/* De 7 columnas -> filas de a 4 en pantallas medianas */
@media (max-width: 1180px) {
  .sg-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Por debajo de cierto ancho, se cambia a selector de día + una sola
   columna visible (mucho más usable en celulares que 7 columnas). */
@media (max-width: 620px) {
  .sg-day-tabs { display: flex; }
  .sg-grid { grid-template-columns: minmax(0, 1fr); }
  .sg-day-col { display: none; }
  .sg-day-col.is-selected { display: block; }
}
