/* ==========================================================
   MAIN.CSS — Layout principal del player ICBF
   ========================================================== */

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

html, body {
  width: 100vw; height: 100vh; overflow: hidden;
  background: var(--bg-app, transparent);
  font-family: 'Nunito', system-ui, sans-serif;
}

.app-shell { position: relative; width: 100vw; height: 100vh; overflow: hidden; }

.app-shell.layout-fullscreen,
.app-shell.layout-fullscreen .main-card,
.app-shell.layout-fullscreen .content-area,
.app-shell.layout-fullscreen .content-render,
.app-shell.layout-fullscreen #app {
  width: 100vw !important; height: 100vh !important;
  overflow: hidden !important; padding: 0 !important; margin: 0 !important;
  position: fixed !important; top: 0 !important; left: 0 !important;
}

.app-shell.layout-video,
.app-shell.layout-video .main-card,
.app-shell.layout-video .content-area,
.app-shell.layout-video .content-render,
.app-shell.layout-video #app {
  width: 100vw !important; height: 100vh !important;
  overflow: hidden !important; padding: 0 !important; margin: 0 !important;
  position: fixed !important; top: 0 !important; left: 0 !important;
}

/* ── Loading veil ── */
.app-loading-veil {
  position: fixed; inset: 0; background: rgba(255,255,255,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 99999; transition: opacity 0.3s;
}
.app-loading-veil.hidden { display: none; }
.app-loading-content { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.app-spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--green-light, #e8f5e9);
  border-top-color: var(--green-main, #2e7d32);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   PILL NAV — reducida
   ══════════════════════════════════════════ */

.pill-nav {
  position: fixed !important;
  right: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  background: var(--amber-main) !important;
  border-radius: 20px 0 0 20px !important;
  padding: 6px 5px !important;
  gap: 1px !important;
}

.pill-btn {
  display: flex !important; flex-direction: column !important;
  align-items: center !important; gap: 1px !important;
  background: transparent !important; border: none !important;
  cursor: pointer !important;
  padding: 3px 2px !important;
  color: var(--white) !important; transition: opacity 0.2s;
}
.pill-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.pill-icon {
  width: 24px !important;
  height: 24px !important;
  background: #ffffff !important; border-radius: 50% !important;
  display: flex !important; align-items: center !important;
  justify-content: center !important; color: #bbc443 !important;
}
.pill-icon svg {
  width: 12px !important;
  height: 12px !important;
  display: block !important;
}
.pill-label {
  font-size: 0.42rem !important;
  font-weight: 700 !important; color: white !important; text-align: center !important;
}

/* Badge de módulo */
.pill-module-circle {
  width: 24px !important;
  height: 24px !important;
}

/* 💻 Tablet landscape (768px – 1023px) */
@media (max-width: 1023px) {
  .pill-nav { padding: 8px 6px !important; gap: 1px !important; }
}

/* 📱 Tablet portrait + Móvil L (≤ 767px) — barra inferior */
@media (max-width: 767px) {
  .pill-nav {
    left: 0 !important; right: 0 !important;
    top: auto !important; bottom: 0 !important;
    transform: none !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    border-radius: 16px 16px 0 0 !important;
    padding: 8px 12px !important;
    width: 100% !important;
  }
  .pill-btn { padding: 4px 6px !important; }
  .pill-icon { width: 32px !important; height: 32px !important; }
  .pill-icon svg { width: 17px !important; height: 17px !important; }
  .pill-label { font-size: 0.55rem !important; }
}

/* 📱 Móvil (< 576px) */
@media (max-width: 575px) {
  .pill-nav { padding: 6px 10px !important; }
  .pill-icon { width: 28px !important; height: 28px !important; }
  .pill-icon svg { width: 15px !important; height: 15px !important; }
  .pill-label { display: none !important; }
}

/* Ocultar pill-nav en pantallas sin navegación */
body.hide-pill .pill-nav {
  display: none !important;
}
  opacity: 0.5; pointer-events: none; cursor: not-allowed;
}

/* ══════════════════════════════════════════
   BARRA DE PROGRESO DEL MÓDULO — arriba centro
   ══════════════════════════════════════════ */
.module-progress-bar {
  position: fixed !important;
  top: 10px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 9998 !important;
  background: rgba(255,255,255,0.92) !important;
  backdrop-filter: blur(8px) !important;
  border-radius: 0 0 16px 16px !important;
  padding: clamp(10px, 1vh, 10px) clamp(16px, 3vw, 24px) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
  min-width: clamp(200px, 35vw, 420px) !important;
  display: visible !important;
}

.module-progress-bar.visible { display: block !important; }

.module-progress-inner {
  display: flex !important;
  align-items: center !important;
  gap: clamp(6px, 1vw, 10px) !important;
}

.module-progress-label {
  font-size: clamp(0.65rem, 1.2vw, 0.75rem) !important;
  font-weight: 800 !important;
  color: var(--green-main) !important;
  white-space: nowrap !important;
  font-family: 'Nunito', sans-serif !important;
  min-width: 60px !important;
}

.module-progress-track {
  flex: 1 !important;
  height: clamp(6px, 1vh, 10px) !important;
  background: #e0e0e0 !important;
  border-radius: 99px !important;
  overflow: hidden !important;
}

.module-progress-fill {
  height: 100% !important;
  background: linear-gradient(90deg, var(--amber-main), var(--green-main)) !important;
  border-radius: 99px !important;
  transition: width 0.5s ease !important;
  width: 0% !important;
}

.module-progress-pct {
  font-size: clamp(0.65rem, 1.2vw, 0.75rem) !important;
  font-weight: 800 !important;
  color: var(--amber-main) !important;
  min-width: 36px !important;
  text-align: right !important;
  font-family: 'Nunito', sans-serif !important;
}

@media (max-width: 575px) {
  .module-progress-bar {
    min-width: 90vw !important;
    padding: 5px 12px !important;
  }
  .module-progress-label { min-width: 48px !important; font-size: 0.6rem !important; }
}

/* ── Page error ── */
.page-error {
  padding: 24px; color: #c00; background: #fff0f0;
  border-radius: 8px; margin: 24px;
}