/* ============================================================
   Digital Signage Player — Estilos del Reproductor
   Diseñado para Smart TVs (LG WebOS / Samsung Tizen)
   ============================================================ */

/* Reset total — sin márgenes, sin scroll */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --transition-duration: 0.8s;
  --overlay-bg: rgba(0, 0, 0, 0.75);
  --accent-color: #00d4ff;
  --accent-secondary: #7c3aed;
  --text-primary: #ffffff;
  --status-online: #22c55e;
  --status-offline: #ef4444;
  --status-cached: #f59e0b;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  cursor: none; /* Ocultar cursor en modo TV */
}

/* ============================================================
   Contenedor principal del reproductor
   ============================================================ */
#player-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
}

/* ============================================================
   Elemento de Video
   ============================================================ */
.media-element {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Sin barras negras */
  opacity: 0;
  transition: opacity var(--transition-duration) ease-in-out;
  z-index: 1;
}

.media-element.active {
  opacity: 1;
}

.media-element.exiting {
  opacity: 0;
}

/* ============================================================
   Imagen como Slide
   ============================================================ */
.slide-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--transition-duration) ease-in-out;
  z-index: 1;
}

.slide-image.active {
  opacity: 1;
}

/* ============================================================
   Pantalla de Carga / Splash
   ============================================================ */
#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0a0f 0%, #0d0d1a 50%, #0a0a0f 100%);
  transition: opacity 1s ease, visibility 1s ease;
}

#splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-logo {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.splash-subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,0.5);
  font-family: 'Inter', system-ui, sans-serif;
  margin-bottom: 2.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Barra de progreso de carga */
.loading-bar-container {
  width: 300px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-secondary));
  border-radius: 99px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px var(--accent-color);
}

.loading-text {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: 0.05em;
}

/* Spinner animado */
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 2rem;
}

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

/* ============================================================
   HUD — Información en pantalla (esquina)
   ============================================================ */
#hud {
  position: fixed;
  z-index: 50;
  pointer-events: none;
}

/* Reloj digital */
#clock-display {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 50;
  font-family: 'Inter', system-ui, sans-serif;
  text-align: right;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#clock-display.visible {
  opacity: 1;
}

.clock-time {
  font-size: 2.5rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 2px 20px rgba(0,0,0,0.8);
  letter-spacing: -0.02em;
  line-height: 1;
}

.clock-date {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* ============================================================
   Indicador de Estado de Conexión
   ============================================================ */
#connection-status {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.08);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

#connection-status.visible {
  opacity: 1;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-online);
  box-shadow: 0 0 8px var(--status-online);
  flex-shrink: 0;
}

.status-dot.offline {
  background: var(--status-offline);
  box-shadow: 0 0 8px var(--status-offline);
}

.status-dot.cached {
  background: var(--status-cached);
  box-shadow: 0 0 8px var(--status-cached);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* ============================================================
   Indicador de item actual / progreso
   ============================================================ */
#playlist-indicator {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 50;
  display: flex;
  gap: 6px;
  align-items: center;
  pointer-events: none;
}

.indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: all 0.4s ease;
}

.indicator-dot.active {
  width: 20px;
  border-radius: 3px;
  background: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-color);
}

/* ============================================================
   Barra de progreso para imágenes (countdown)
   ============================================================ */
#image-progress {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 50;
  background: transparent;
  pointer-events: none;
}

#image-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-secondary));
  box-shadow: 0 0 6px var(--accent-color);
  transform-origin: left;
  transform: scaleX(0);
}

#image-progress-bar.animating {
  transition: transform linear;
  transform: scaleX(1);
}

/* ============================================================
   Overlay de Error
   ============================================================ */
#error-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
  font-family: 'Inter', system-ui, sans-serif;
}

#error-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.error-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.error-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.error-msg {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* ============================================================
   Fade entre slides (capa negra intermedia)
   ============================================================ */
#transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-duration) ease;
}

#transition-overlay.fading-in {
  opacity: 1;
}

/* ============================================================
   Modo Offline — banner superior
   ============================================================ */
#offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: 0.6rem;
  background: linear-gradient(90deg, #7c3aed, #db2777);
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  letter-spacing: 0.05em;
  transform: translateY(-100%);
  transition: transform 0.4s ease;
}

#offline-banner.visible {
  transform: translateY(0);
}
