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

*, *::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;
}

/* ── 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 #e8f5e9;
  border-top-color: #2e7d32;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================
   PILL-NAV — PANEL BOOKMARK IZQUIERDA
   ========================================================== */

.pill-nav {
  position: fixed !important;
  left: 2% !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(--pill-bg, #028b7b) !important;
  border-radius: 0 0 20px 20px !important;

  clip-path: polygon(
    -5% 0%,
    70% 0%,
    100% 10%,
    100% 100%,
    30% 100%,
    0% 90%
  ) !important;

  padding: 28px 14px 22px 14px !important;
  gap: 1px !important;
  width: 80px !important;
  min-height: 300px !important;

  box-shadow: 4px 4px 18px rgba(0,0,0,0.30) !important;
  transition: background 0.35s ease !important;
}

.pill-nav.hidden,
.pill-nav[hidden] { display: none !important; }

.pill-btn {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  padding: 8px 4px !important;
  width: 100% !important;
  color: #fff !important;
  transition: opacity 0.2s, transform 0.15s;
}
.pill-btn:hover  { opacity: 0.85; transform: scale(1.08); }
.pill-btn:active { transform: scale(0.96); }
.pill-btn:disabled,
.pill-btn.disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.pill-icon {
  width: 46px !important; height: 46px !important;
  background: rgba(255,255,255,0.20) !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #fff !important;
  transition: background 0.2s;
}
.pill-btn:hover .pill-icon { background: rgba(255,255,255,0.35) !important; }
.pill-icon svg {
  width: 15px !important; height: 20px !important;
  display: block !important;
  fill: none; stroke: #fff; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}

.pill-label {
  font-size: 0.50rem !important;
  font-weight: 700 !important;
  color: #fff !important;
  text-align: center !important;
  line-height: 1.1 !important;
  letter-spacing: 0.01em !important;
  text-transform: uppercase !important;
}

.pill-divider {
  width: 60%; height: 1px;
  background: rgba(255,255,255,0.25);
  margin: 2px auto;
}

/* ==========================================================
   BATERÍA DE PROGRESO — dentro de pill-nav
   ========================================================== */

.pill-battery {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 3px !important;
  margin-top: 6px !important;
  padding-top: 6px !important;
  border-top: 1px solid rgba(255,255,255,0.20) !important;
  width: 100% !important;
}

/* Cuerpo de la batería — más pequeño que el diseño exterior */
#battery-body {
  position: relative;
  width: 22px;
  height: 52px;
  border: 2px solid rgba(255,255,255,0.70);
  border-radius: 5px;
  background: rgba(0,0,0,0.25);
  overflow: hidden;
}

/* Terminal positivo arriba */
#battery-body::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 4px;
  background: rgba(255,255,255,0.65);
  border-radius: 2px 2px 0 0;
}

/* Relleno — crece de abajo hacia arriba */
#battery-fill {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  height: 0%;
  border-radius: 0 0 3px 3px;
  transition: height 0.6s ease, background 0.4s ease;
  background: #4ade80;
}

/* Líneas decorativas */
#battery-body::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to top,
    transparent 0px,
    transparent 12px,
    rgba(255,255,255,0.08) 12px,
    rgba(255,255,255,0.08) 13px
  );
  pointer-events: none;
}

/* Porcentaje debajo */
#battery-pct {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 0.52rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.40);
  line-height: 1;
  letter-spacing: 0.01em;
}

/* ==========================================================
   COLORES POR MÓDULO
   ========================================================== */

body.modulo-azul .pill-nav,
.app-shell.modulo-azul .pill-nav {
  --pill-bg: #0284c7;
  background: linear-gradient(180deg, #0369a1 0%, #0284c7 100%) !important;
}
.app-shell.modulo-azul #battery-fill { background: #38bdf8 !important; }

body.modulo-verde .pill-nav,
.app-shell.modulo-verde .pill-nav {
  --pill-bg: #028b7b;
  background: linear-gradient(180deg, #016b5e 0%, #028b7b 100%) !important;
}
.app-shell.modulo-verde #battery-fill { background: #4ade80 !important; }

body.modulo-naranja .pill-nav,
.app-shell.modulo-naranja .pill-nav {
  --pill-bg: #d97706;
  background: linear-gradient(180deg, #b45309 0%, #d97706 100%) !important;
}
.app-shell.modulo-naranja #battery-fill { background: #fbbf24 !important; }

body.modulo-m3 .pill-nav,
.app-shell.modulo-m3 .pill-nav {
  --pill-bg: #1a6b3a;
  background: linear-gradient(180deg, #155230 0%, #1a6b3a 100%) !important;
}
.app-shell.modulo-m3 #battery-fill { background: #34d399 !important; }

body.modulo-m4 .pill-nav,
.app-shell.modulo-m4 .pill-nav {
  --pill-bg: #1a3d6b;
  background: linear-gradient(180deg, #122d52 0%, #1a3d6b 100%) !important;
}
.app-shell.modulo-m4 #battery-fill { background: #60a5fa !important; }

/* ==========================================================
   BOTÓN INGRESAR
   ========================================================== */

.btn-ingresar-wrap {
  position: fixed !important; right: 5% !important;
  top: 50% !important; transform: translateY(-50%) !important;
  z-index: 1100 !important;
}

.btn-ingresar {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 34px; border: none; border-radius: 50px; cursor: pointer;
  font-family: 'Nunito', system-ui, sans-serif; font-size: 1.05rem; font-weight: 800;
  color: #1a1a1a;
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 50%, #fbbf24 100%);
  background-size: 200% 200%; animation: goldShimmer 2.4s ease infinite;
  box-shadow: 0 4px 22px rgba(217,119,6,0.55); text-transform: uppercase;
  letter-spacing: 0.07em; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-ingresar:hover { transform: scale(1.07); box-shadow: 0 6px 30px rgba(217,119,6,0.75); }
.btn-ingresar .arrow { display: inline-block; animation: arrowPulse 1.1s ease-in-out infinite; font-size: 1.25em; }

@keyframes goldShimmer { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes arrowPulse { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }

/* ==========================================================
   ERRORES Y MISC
   ========================================================== */

#btn-next:disabled, #btn-next.disabled { opacity: 0.5; pointer-events: none; cursor: not-allowed; }
.page-error { padding: 24px; color: #c00; background: #fff0f0; border-radius: 8px; margin: 24px; }

/* ==========================================================
   RESPONSIVE — TABLET (≤ 767px)
   ========================================================== */
@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;
    clip-path: none !important;
    border-radius: 16px 16px 0 0 !important;
    padding: 10px 16px !important;
    width: 100% !important;
    min-height: unset !important;
    height: 72px !important;
  }
  .pill-btn  { padding: 4px 8px !important; }
  .pill-icon { width: 38px !important; height: 38px !important; }
  .pill-icon svg { width: 20px !important; height: 20px !important; }
  .pill-label { font-size: 0.58rem !important; }
  .pill-battery { display: none !important; }
}

/* ==========================================================
   RESPONSIVE — MÓVIL (≤ 575px)
   ========================================================== */
@media (max-width: 575px) {
  .pill-nav { padding: 8px 12px !important; height: 64px !important; }
  .pill-icon { width: 32px !important; height: 32px !important; }
  .pill-icon svg { width: 17px !important; height: 17px !important; }
  .pill-label { display: none !important; }
  .pill-battery { display: none !important; }
}