/**
 * css/schedule.css — Calendario & Agenda Pública
 * 100% Transparente con Glassmorphism para integración fluida en iframe.
 */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg-main: transparent;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.1);
  --bg-past: rgba(0, 0, 0, 0.25);
  --bg-current: rgba(16, 185, 129, 0.15);
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-active: #10b981;
  --border-past: rgba(255, 255, 255, 0.05);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-past: #64748b;
  --accent-live: #10b981;
  --accent-live-glow: rgba(16, 185, 129, 0.4);
  --accent-streamer: #f59e0b;
  --accent-streamer-bg: rgba(245, 158, 11, 0.2);
  --accent-playlist: #38bdf8;
  --accent-playlist-bg: rgba(56, 189, 248, 0.18);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.25);
  --shadow-active: 0 0 25px rgba(16, 185, 129, 0.3);
}

/* Modo Fondo Sólido Oscuro (opcional vía ?theme=solid) */
body.theme-solid {
  --bg-main: #0b0f19;
  background-color: #0b0f19 !important;
}

/* Modo Claro (opcional vía ?theme=light) */
body.theme-light {
  --bg-main: transparent;
  --bg-card: rgba(0, 0, 0, 0.04);
  --bg-card-hover: rgba(0, 0, 0, 0.08);
  --bg-past: rgba(0, 0, 0, 0.02);
  --bg-current: rgba(16, 185, 129, 0.12);
  --border-subtle: rgba(0, 0, 0, 0.1);
  --border-active: #10b981;
  --border-past: rgba(0, 0, 0, 0.05);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-past: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-sans);
  background: transparent !important;
  background-color: transparent !important;
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  min-height: 100%;
}

.calendar-app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 12px;
  max-width: 900px;
  margin: 0 auto;
  background: transparent;
}

/* Cabecera / Header Transparente Glass */
.schedule-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}

.station-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.4);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-icon.spinning svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* Barra de Filtros y Días (Transparente) */
.schedule-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 0 10px 0;
  margin-bottom: 8px;
}

.days-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.days-scroll::-webkit-scrollbar {
  display: none;
}

.day-pill {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.day-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.day-pill.active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-color: #10b981;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.day-pill.is-today {
  position: relative;
}

.day-pill.is-today::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  margin-left: 6px;
  vertical-align: middle;
}

/* Filtros secundarios */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 4px 10px 4px;
  background: transparent;
}

.filter-chips {
  display: flex;
  gap: 6px;
}

.chip {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 11px;
  font-weight: 500;
}

.chip.active, .chip:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

.tz-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  opacity: 0.85;
}

/* Contenedor de la Agenda */
.agenda-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  padding-bottom: 60px;
  background: transparent;
}

/* Cabecera de grupo de Día (Transparente) */
.day-divider {
  position: sticky;
  top: 48px;
  z-index: 10;
  background: transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  scroll-margin-top: 80px;
}

.day-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.day-divider.is-today-divider {
  color: var(--accent-live);
}

/* Tarjeta de Agenda Glass */
.agenda-card {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  gap: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
  scroll-margin-top: 80px;
  scroll-margin-bottom: 80px;
}

.agenda-card:hover {
  transform: translateY(-1px);
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* 1. Actividad Pasada */
.agenda-card.is-past {
  opacity: 0.5;
  background: var(--bg-past);
  border-color: var(--border-past);
  filter: grayscale(35%);
}

.agenda-card.is-past:hover {
  opacity: 0.85;
  filter: grayscale(0%);
}

/* 2. Actividad En Vivo / Ahora */
.agenda-card.is-now {
  background: var(--bg-current);
  border: 1.5px solid var(--border-active);
  box-shadow: var(--shadow-active);
}

.agenda-card.is-now::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-live);
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

/* Columna de Horario */
.card-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 75px;
  padding-right: 12px;
  border-right: 1px solid var(--border-subtle);
  text-align: center;
}

.time-start {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  font-feature-settings: "tnum";
}

.time-sep {
  font-size: 10px;
  color: var(--text-muted);
  margin: 1px 0;
}

.time-end {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  font-feature-settings: "tnum";
}

.time-duration {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Columna de Contenido */
.card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 0;
  gap: 4px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}

.badge-live {
  background: var(--accent-live);
  color: #042f2e;
  animation: pulse-live 1.8s infinite;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  display: inline-block;
}

@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.badge-streamer {
  background: var(--accent-streamer-bg);
  color: var(--accent-streamer);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-playlist {
  background: var(--accent-playlist-bg);
  color: var(--accent-playlist);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.badge-past {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-past);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Botón flotante 'Ir a Ahora' */
.btn-jump-now {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  padding: 10px 16px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  cursor: pointer;
  z-index: 50;
  transition: all 0.2s ease;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.btn-jump-now.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.btn-jump-now:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55);
}

/* Estados vacíos y skeletons */
.skeleton-card {
  height: 76px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
  opacity: 0.6;
}

/* Modo Compacto (para iframe de sidebar o widgets estrechos) */
body.compact-mode .calendar-app {
  padding: 6px;
}

body.compact-mode .schedule-header {
  padding: 8px 12px;
  margin-bottom: 8px;
}

body.compact-mode .brand-icon {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

body.compact-mode .brand-title {
  font-size: 14px;
}

body.compact-mode .agenda-card {
  padding: 10px 12px;
  gap: 10px;
}

body.compact-mode .card-time {
  min-width: 60px;
  padding-right: 8px;
}

body.compact-mode .time-start {
  font-size: 13px;
}

body.compact-mode .time-end {
  font-size: 11px;
}

body.compact-mode .card-title {
  font-size: 13.5px;
}

/* Responsividad móvil */
@media (max-width: 480px) {
  .schedule-header {
    padding: 10px 12px;
  }
  
  .agenda-card {
    padding: 10px 12px;
    gap: 10px;
  }

  .card-time {
    min-width: 64px;
    padding-right: 8px;
  }

  .time-start {
    font-size: 13.5px;
  }

  .time-end {
    font-size: 11px;
  }

  .card-title {
    font-size: 13.5px;
  }
}
