/* Tipografía */
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@300;400;500;600;700&display=swap');
@import url("https://code.highcharts.com/css/highcharts.css");
@import url("https://code.highcharts.com/dashboards/css/datagrid.css");
@import url("https://code.highcharts.com/dashboards/css/dashboards.css");
@import url("https://fonts.googleapis.com/css2?family=PT+Sans+Narrow&display=swap");
/* Fuente para el reloj digital */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@500;700&display=swap');

:root {
  --color-default: #181820;
  --color-second: #222230;
  --color-white: #F5F5F5;
  --color-body: #0B0B0F;
  --color-light: #B0B0C0;
  --color-accent1: #A445FF;
  --color-accent2: #00F0FF;
  --color-green: #4CAF50;
  --color-red: #F44336;

  /* Highcharts integration */
  --highcharts-color-0: #A445FF;
  --highcharts-color-1: #00F0FF;
  --highcharts-color-2: #4CAF50;
  --highcharts-color-3: #F44336;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif !important;
}

/* --- CORRECCIÓN MÓVIL (Linea Blanca y Scroll) --- */
html, body {
  height: 100%;
  height: 100dvh; /* Altura dinámica real */
  margin: 0;
  padding: 0;
  background-color: var(--color-body); /* Evita fondo blanco al rebotar */
  color: var(--color-white);
  overflow: hidden; /* Scroll delegado a home-section */
  overscroll-behavior: none; /* Bloquea el rebote elástico */
}

/* CONTENIDO PRINCIPAL */
.home-section {
  position: relative;
  background-color: var(--color-body);
  height: 100%;
  height: 100dvh;
  width: 100%; 
  overflow-y: auto; /* Scroll interno */
  -webkit-overflow-scrolling: touch; /* Scroll suave en iOS */
  padding: 90px 20px 100px 20px; /* Padding inferior extra para móvil */
}

.content-area {
  max-width: 1280px;
  margin: 0 auto;
}

/* CAJAS / WIDGETS */
.box {
  background-color: var(--color-default);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: #F5F5F5;
}
.box:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}
.box h5 {
  font-size: 1.1em;
  font-weight: 600;
  color: #F5F5F5 !important;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* FECHA/HORA ACTUAL */
#fechaActual {
  font-size: 1.2em;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--color-accent2);
  text-align: center;
  border: 1px solid var(--color-accent1);
  border-radius: 5px;
  padding: 10px;
  background-color: #1a1a25;
}

/* GLOBO 3D Y MODELO 3D */
#cansat3D {
  width: 100%;
  height: 400px;
}
#globeViz {
  width: 100%;
  height: 500px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  background-color: #181820;
}

/* Asegura que los controles del globo queden encima */
#globeViz .globe-controls {
    z-index: 1000 !important;
}

/* BOTONES GLOBO (Estilos Legados - Se mantienen por seguridad) */
#globeNav {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1a2030;
  border: 1px solid #252e45;
  border-radius: 100px;
  display: flex;
  flex-wrap: wrap;
  z-index: 10;
  padding: 5px;
}
/* ... (resto de estilos legados de globeNav si se usan) ... */

/* ALTITUD Y PARACAÍDAS */
.altitud-box {
  background-color: #181820;
  border-radius: 6px;
  padding: 10px 15px;
  margin-bottom: 20px;
}
#altitudeBullet {
  height: 100px;
}

#paracaidasEstado {
  font-size: 1.2em;
  font-weight: bold;
  text-align: center;
  color: var(--color-white);
  background-color: #1a1a25;
  padding: 15px;
  border-radius: 6px;
  border: 2px solid var(--color-accent1);
}
#paracaidasEstado.activo {
  background-color: var(--color-green);
  color: #fff;
}
#paracaidasEstado.inactivo {
  background-color: var(--color-red);
  color: #fff;
}

.status-box {
  color: #F5F5F5;
}

/* GRÁFICA DE CALIDAD DEL AIRE (HIGHCHARTS) */
#eco2tvocChart {
  width: 100% !important;
  height: 400px !important;
  background: transparent;
  border-radius: 8px;
  position: relative;
}

.highcharts-container {
  font-family: 'Poppins', sans-serif !important;
}

.highcharts-background {
  fill: #181820 !important;
}

.highcharts-title {
  fill: #F5F5F5 !important;
  font-weight: 600 !important;
}

.highcharts-subtitle {
  fill: #B0B0C0 !important;
}

.highcharts-axis-labels text {
  fill: #B0B0C0 !important;
}

.highcharts-axis-title {
  fill: #F5F5F5 !important;
}

.highcharts-grid-line {
  stroke: #2d2d4d !important;
  stroke-width: 1 !important;
}

.highcharts-legend-item text {
  fill: #F5F5F5 !important;
}

.highcharts-legend-item:hover text {
  fill: #00F0FF !important;
}

.highcharts-tooltip-box {
  fill: rgba(26, 26, 46, 0.95) !important;
  stroke: #A445FF !important;
}

.highcharts-label text {
  fill: #F5F5F5 !important;
}

/* ANÁLISIS BOXES */
.analisis-box {
  background: rgba(26, 32, 48, 0.9);
  border-left: 4px solid #A445FF;
  padding: 15px;
  margin: 10px 0;
  border-radius: 5px;
  color: #F5F5F5;
  font-size: 0.9em;
  line-height: 1.4;
}

.analisis-box.uv {
  border-left-color: #FF9800;
  background: rgba(255, 152, 0, 0.1);
}

.analisis-box.aire {
  border-left-color: #4CAF50;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
}

.analisis-box strong {
  font-weight: 600;
}

/* HIGHCHARTS DASHBOARD */
.highcharts-dashboards-wrapper {
  background-color: var(--color-second);
  border-radius: 8px;
  padding: 10px;
}
.highcharts-dashboards-cell > .highcharts-dashboards-component {
  border-radius: 10px;
  padding: 10px;
  background-color: var(--color-default);
}
.highcharts-dashboards-component-title {
  font-size: 1em;
  color: var(--color-accent1);
  margin-bottom: 5px;
}
.highcharts-description {
  color: var(--color-light);
  padding: 0 20px;
  font-size: 0.9em;
}

/* HIGHCHARTS DATAGRID */
#instances-table .highcharts-datagrid-row {
  cursor: pointer;
}
#instances-table .highcharts-datagrid-row.current {
  background-color: var(--color-second);
  pointer-events: none;
}
#instances-table .highcharts-datagrid-hovered-row {
  background-color: var(--color-accent1);
  color: var(--color-white);
}
#instances-table .highcharts-datagrid-table th {
  height: 35px;
  color: var(--color-accent2);
  font-weight: 600;
}
#instances-table {
  height: 400px;
}

/* RESPONSIVE GENERAL */
@media (max-width: 992px) {
  /* Ajustes tablet */
}

@media (max-width: 768px) {
  .home-section { 
    margin-left: 0 !important; 
    padding: 60px 10px 120px 10px; /* Padding inferior generoso */
  }
  .box { 
    padding: 15px; 
    margin-bottom: 15px; 
  }
  #cansat3D { 
    height: 250px; 
  }
  #combinedChart { 
    height: 300px !important; 
  }
  #globeViz { 
    height: 350px; 
  }
  #eco2tvocChart { 
    height: 300px !important; 
  }
  .analisis-box.aire { 
    font-size: 0.85em; 
    padding: 10px; 
  }
}

@media (max-width: 576px) {
  #eco2tvocChart { 
    height: 250px !important; 
  }
}

/* ===============================================
   ESTILOS CORREGIDOS: GRAFICA DE ALTURA AVANZADA
   =============================================== */

.telemetry-card {
    width: 100%;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    position: relative;
    overflow: hidden; /* Evita que elementos hijos rompan el ancho */
}

.telemetry-header {
    padding: 20px;
    background: radial-gradient(circle at top right, rgba(164, 69, 255, 0.05), transparent 40%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.bullet-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.bullet-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(245, 245, 245, 0.6);
    flex-wrap: wrap;
    gap: 5px;
}

.bullet-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-white);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.unit {
    font-size: 0.7rem;
    opacity: 0.5;
    font-weight: 400;
    margin-left: 2px;
}

.tech-bar-bg {
    height: 8px;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    position: relative;
    overflow: visible;
}

.tech-bar-fill {
    height: 100%;
    width: 0%;
    position: relative;
    border-radius: 4px;
    transition: width 1s linear;
    min-width: 2px;
}

.fill-cyan {
    background-color: var(--color-accent2);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.fill-purple {
    background-color: var(--color-accent1);
    box-shadow: 0 0 10px rgba(164, 69, 255, 0.4);
}

.btn-zero {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid var(--color-accent2);
    color: var(--color-accent2);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 3px;
    outline: none;
    white-space: nowrap;
}

.btn-zero:hover {
    background: var(--color-accent2);
    color: var(--color-body);
    box-shadow: 0 0 15px var(--color-accent2);
}

/* Tooltip corregido */
#chart-floating-tooltip {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    top: 0;
    left: 0;
    transform: translate(-50%, -100%);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
}

.glass-tooltip-style {
    background: rgba(20, 20, 25, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    color: var(--color-white);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.7rem;
    white-space: nowrap;
}

.glass-tooltip-style span {
    color: var(--color-accent2);
    font-weight: 700;
    margin-left: 3px;
}

#chart-floating-tooltip.visible {
    opacity: 1;
    transform: translate(-50%, -120%);
}

.target-marker {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: rgba(255, 255, 255, 0.5);
    z-index: 10;
    cursor: help;
    transition: background 0.3s;
}

.target-marker:hover {
    background: #fff;
}

.meta-tooltip {
    position: absolute;
    bottom: 100%;
    right: 0;
    transform: translate(50%, -5px);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.target-marker:hover .meta-tooltip {
    opacity: 1;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    overflow: hidden;
}

.chart-overlay-title {
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    z-index: 10;
    font-family: 'Chakra Petch', sans-serif;
    letter-spacing: 1px;
}

#chartdivAltitude {
    width: 100%;
    height: 100%;
}

/* RESPONSIVE ALTURA */
@media (max-width: 768px) {
    .telemetry-header {
        grid-template-columns: 1fr;
        gap: 25px;
        padding: 15px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .bullet-label {
        font-size: 0.75rem;
    }
    
    .bullet-value {
        font-size: 1.1rem;
    }
}

/* ===============================================
   DYNAMIC ISLAND (ULTRA SLOW & FLUID)
   =============================================== */

:root {
    /* Curva muy suave para arranque y frenado */
    --bezier-island: cubic-bezier(0.25, 1, 0.5, 1); 
}

.dynamic-island {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    
    /* Estado Final (Default) */
    width: 140px;
    min-height: 40px;
    max-height: 40px;
    padding: 0; 
    
    background-color: #000;
    border-radius: 50px;
    z-index: 10050;

    /* --- CAMBIO NUCLEAR: BLANCO CON !important --- */
    border: 2px solid #ffffff !important; 
    
    box-shadow: 
        0 0 15px rgba(255, 255, 255, 0.8) !important, /* Resplandor fuerte */
        0 6px 20px rgba(0, 0, 0, 0.8) !important;
    /* --------------------------------------------- */
    
    transition: 
        width 1.5s cubic-bezier(0.25, 1, 0.5, 1),
        min-width 1.5s cubic-bezier(0.25, 1, 0.5, 1),
        max-height 1.5s cubic-bezier(0.25, 1, 0.5, 1),
        border-radius 1.5s cubic-bezier(0.25, 1, 0.5, 1),
        background-color 1s ease,
        padding 1.5s cubic-bezier(0.25, 1, 0.5, 1),
        border-color 0.5s ease,
        box-shadow 0.5s ease;
        
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    overflow: hidden; 
}

/* --- MODO BIENVENIDA (ABIERTO) --- */
.dynamic-island.welcome-mode {
    width: fit-content !important;
    min-width: 140px;
    max-width: 95vw;
    max-height: 150px !important; 
    
    /* Padding grande cuando está abierto */
    padding: 10px 30px; 
    
    border-radius: 25px; 
    justify-content: center;
    cursor: default;
}

/* --- ESTADO DE CONTRACCIÓN (EL SECRETO) --- */
/* Esta clase fuerza a la isla a perder su padding MIENTRAS el texto se borra */
.dynamic-island.contracting {
    padding: 0 !important;       /* Volver a 0 suavemente */
    min-width: 140px !important; /* Asegura que no se encoja de más */
    border-radius: 50px !important; /* Volver a ser redondo */
    /* max-height bajará solo cuando quitemos welcome-mode al final */
}

/* --- TEXTO --- */
.welcome-text {
    color: #fff;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 500;
    font-size: clamp(10px, 3.2vw, 15px); 
    text-align: center;
    white-space: normal;
    line-height: 1.3;
    
    width: 100%;
    display: block;
    
    opacity: 1;
    max-width: 600px; 
    transform: scale(1);
    margin: 0;
    
    /* Sincronizado con la isla (1.5s) */
    transition: 
        opacity 0.8s ease, /* Desaparece un poco antes */
        max-width 1.5s var(--bezier-island), 
        transform 1.5s var(--bezier-island);
}

/* Clase para colapsar texto */
.welcome-text.hiding {
    opacity: 0;
    max-width: 0px; 
    margin: 0;
    transform: scale(0.8);
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: #00F0FF;
    margin-left: 1px;
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
    margin-bottom: -2px;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.dynamic-island.welcome-mode .island-content { display: none; }

/* --- ESTADOS NORMALES --- */
.dynamic-island.expanded {
    width: 300px; max-height: 60px; height: 60px;
    border-radius: 70px; border-color: rgba(0, 240, 255, 0.3);
}
.dynamic-island.scrolled {
    top: 5px; left: auto; right: 20px; transform: none;
    width: 60px; max-height: 60px; height: 60px; border-radius: 50%;
}
.dynamic-island.scrolled.expanded {
    width: 260px; max-height: 60px; height: 60px; border-radius: 70px;
}

/* CONTENIDO INTERNO */
.island-content {
    opacity: 0; transform: scale(0);
    height: 100%; width: 100%;
    display: flex; padding: 0 20px;
    justify-content: space-between; align-items: center;
    transition: all 0.5s ease; pointer-events: none;
}
.dynamic-island.expanded .island-content { opacity: 1; transform: scale(1); pointer-events: auto; }
.dynamic-island.scrolled .island-content { opacity: 0; transform: scale(0); pointer-events: none; }
.dynamic-island.scrolled.expanded .island-content { opacity: 1; transform: scale(1); pointer-events: auto; }

.island-icon {
    color: #fff; font-size: 1.5em; transition: all 0.3s ease;
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%; cursor: pointer; pointer-events: auto;
}
.island-icon:hover { color: #00F0FF; transform: scale(1.1); }
.dynamic-island.scrolled .island-icon { font-size: 1.2em; }

@media (max-width: 480px) {
    .welcome-text { font-size: 11px !important; letter-spacing: -0.3px; }
    .dynamic-island.welcome-mode { padding: 10px 15px; max-width: 96vw; }
}

/* BATERIA ICONO */
.battery-icon {
    position: fixed;
    top: 25px;
    right: 30px;
    font-size: 2.2em;
    color: #00f2ff;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 10px #00f2ff);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* MODAL BATERIA */
.modal-bateria-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.42, 0, 0.58, 1), 
            visibility 0.4s cubic-bezier(0.42, 0, 0.58, 1);
}

.modal-bateria-overlay.activo {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-contenido {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.42, 0, 0.58, 1), 
            opacity 0.4s cubic-bezier(0.42, 0, 0.58, 1);
}

.modal-bateria-overlay.activo .modal-contenido {
    transform: scale(1);
    opacity: 1;
}

.modal-contenido::before {
    content: '';
    position: absolute;
    width: 240px;
    height: 240px;
    background: linear-gradient(#f3f5f5, #9c27b0);
    border-radius: 50%;
    transform: translate(-150px,-100px);
    z-index: 0;
}

.modal-contenido::after {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    background: linear-gradient(#ff2871, rgba(255,40,113,0.2));
    border-radius: 50%;
    transform: translate(150px,100px);
    z-index: 0;
}

.box-bateria {
    position: relative;
    width: 240px;
    height: 320px;
    background: rgba(255,255,255,0.1);
    z-index: 1;
    box-shadow: 0 25px 45px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.1);
    border-right: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(25px);
    border-radius: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.content-bateria {
   display: flex;
   justify-content: center;
   align-items: center;
   flex-direction: column;
   text-align: center;
}

.box-bateria h3 {
    color: #fff;
    font-weight: 500;
    font-size: 1.2em;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.batteryShape {
    position: relative;
    width: 140px;
    height: 65px;
    margin: 20px 0;
    border: 3px solid #333;
    border-radius: 10px;
}

.batteryShape::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -12px;
    transform: translateY(-50%);
    width: 7px;
    height: 16px;
    background: #333;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.level {
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255,255,255,0.1);
}

.percentage {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 50%;
    border-radius: 4px;
    background: linear-gradient(90deg, #9c28af, #fd2c72);
    transition: width 0.8s cubic-bezier(0.42, 0, 0.58, 1);
}

.percent {
    color: #fe3177;
    font-size: 2em;
    font-weight: 700;
    margin: 10px 0;
}

.battery-info {
    color: #00f2ff;
    font-size: 0.9em;
    margin-top: 10px;
}

.boton-cerrar {
    background: linear-gradient(90deg, #00f2ff 0%, #bc13fe 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.5);
    font-weight: 500;
    z-index: 1;
}

.boton-cerrar:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(188, 19, 254, 0.7);
}

/* MODAL RELOJ & SWITCH */
.modal-reloj-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.42, 0, 0.58, 1), visibility 0.4s cubic-bezier(0.42, 0, 0.58, 1);
}

.modal-reloj-overlay.activo {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.container-reloj {
    position: relative;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.42, 0, 0.58, 1);
}

.modal-reloj-overlay.activo .container-reloj {
    transform: scale(1);
}

.container-reloj .circle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: 2s ease-in infinite alternate;
}

.container-reloj .circle:nth-child(1) {
    width: 180px;
    height: 180px;
    top: -60px;
    left: -60px;
    background: linear-gradient(#e524c3, #8626b2);
    animation-name: move-up;
}

@keyframes move-up {
    to { transform: translateY(-10px); }
}

.container-reloj .circle:nth-child(2) {
    width: 120px;
    height: 120px;
    bottom: -20px;
    right: -20px;
    background: linear-gradient(#d64612, #e48307);
    animation-name: move-down;
}

@keyframes move-down {
    to { transform: translateY(10px); }
}

/* Contenedor interno del modal para organizar switch y reloj */
.reloj-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    position: relative;
    z-index: 10;
}

/* --- TOGGLE SWITCH --- */
.toggle-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 15px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.toggle-label {
    color: var(--color-light);
    font-size: 0.8rem;
    font-family: 'Chakra Petch', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: none;
    transition: color 0.3s ease;
}

.toggle-label.active {
    color: var(--color-accent2); /* Cyan */
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #222230;
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Cuando está activado (Digital) */
input:checked + .slider {
    background-color: var(--color-accent1); /* Purple */
    border-color: var(--color-accent1);
}

input:checked + .slider:before {
    transform: translateX(24px);
    background-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* --- RELOJ ANALÓGICO --- */
.clock {
    width: 350px;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, .1);
    border-radius: 50%;
    backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, .05);
    box-shadow: 0 0 30px rgba(0, 0, 0, .2);
    transition: all 0.5s ease;
}

.clock.hidden {
    display: none;
}
.clock.visible {
    display: flex;
    animation: fadeIn 0.5s ease;
}

.clock .clock-bg img {
    width: 100%;
    height: 100%;
}

.clock::before {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    background: #fff;
    border-radius: 50%;
    z-index: 15;
}

.clock .hour,
.clock .minute,
.clock .second {
    position: absolute;
}

.clock .hour,
.clock .hour .hr {
    width: 160px;
    height: 160px;
}

.clock .minute,
.clock .minute .min {
    width: 190px;
    height: 190px;
}

.clock .second,
.clock .second .sec {
    width: 230px;
    height: 230px;
}

.clock .hour .hr,
.clock .minute .min,
.clock .second .sec {
    display: flex;
    justify-content: center;
    position: absolute;
    border-radius: 50%;
}

.clock .hour .hr::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 80px;
    background: #ff3d68;
    z-index: 10;
    border-radius: 10px;
}

.clock .minute .min::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 90px;
    background: #39a2db;
    z-index: 11;
    border-radius: 8px;
}

.clock .second .sec::before {
    content: '';
    position: absolute;
    width: 3px;
    height: 140px;
    background: #fff;
    z-index: 12;
    border-radius: 2px;
}

/* --- RELOJ DIGITAL --- */
.digital-clock-container {
    display: none; /* Oculto por defecto */
    width: 380px;
    background-color: rgba(255, 255, 255, 0.06);
    padding: 40px 20px;
    border: 1.5px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 25px 30px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.digital-clock-container.visible {
    display: block;
}

.digital-clock-container * {
    color: #ffffff;
    font-family: "Roboto Mono", monospace !important;
}

#day-digital {
    position: relative;
    font-size: 18px;
    text-transform: uppercase;
    color: var(--color-accent2); /* Cyan */
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.time-wrapper {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 10px;
}

#time-digital {
    font-size: 60px;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

#midday-digital {
    font-size: 25px;
    color: var(--color-accent1); /* Purple */
    font-weight: 600;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* MODAL PDF (LOADER LIQUIDO) */
.modal-pdf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.42, 0, 0.58, 1), 
                visibility 0.5s cubic-bezier(0.42, 0, 0.58, 1);
}

.modal-pdf-overlay.activo {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-contenido-pdf {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.42, 0, 0.58, 1), 
                opacity 0.5s cubic-bezier(0.42, 0, 0.58, 1);
}

.modal-pdf-overlay.activo .modal-contenido-pdf {
    transform: scale(1);
    opacity: 1;
}

.circle-pdf {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: floatCircle 3s ease-in-out infinite alternate;
}

.circle-pdf:nth-child(1) {
    width: 200px;
    height: 200px;
    top: -50px;
    left: -50px;
    background: linear-gradient(#00c6ff, #0072ff);
    z-index: 0;
}

.circle-pdf:nth-child(2) {
    width: 150px;
    height: 150px;
    bottom: -30px;
    right: -30px;
    background: linear-gradient(#4facfe, #00f2fe);
    z-index: 0;
    animation-delay: -1.5s;
}

@keyframes floatCircle {
    from { transform: translateY(0); }
    to { transform: translateY(-15px); }
}

.box-pdf {
    position: relative;
    width: 300px;
    height: 350px;
    background: rgba(255,255,255,0.05);
    z-index: 1;
    box-shadow: 0 25px 45px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-top: 1px solid rgba(255,255,255,0.2);
    border-left: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(25px);
    border-radius: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.content-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.loader-liquid-container {
    position: relative;
    width: 180px;
    height: 180px;
    animation: rotate 4s ease-out infinite;
    filter: url("#gooey"); 
}

@keyframes rotate {
  0% { transform: rotate(360deg); }
  50% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

.loader-liquid-container .liquid {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(45deg, #c7eeff, #03a9f4);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  --ani_dur: 4s;
}

.loader-liquid-container .liquid:nth-child(1) {
  top: 0;
  animation: animate1 var(--ani_dur) linear infinite;
}
.loader-liquid-container .liquid:nth-child(2) {
  left: 0;
  animation: animate2 var(--ani_dur) linear infinite;
}
.loader-liquid-container .liquid:nth-child(3) {
  left: 100%;
  animation: animate3 var(--ani_dur) linear infinite;
}
.loader-liquid-container .liquid:nth-child(4) {
  top: 100%;
  animation: animate4 var(--ani_dur) linear infinite;
}

@keyframes animate1 {
  0% { top: 0; }
  50% { top: 100%; }
  100% { top: 100%; }
}
@keyframes animate2 {
  0% { left: 0; }
  50% { left: 100%; }
  100% { left: 100%; }
}
@keyframes animate3 {
  0% { left: 100%; }
  50% { left: 0; }
  100% { left: 0; }
}
@keyframes animate4 {
  0% { top: 100%; }
  50% { top: 0; }
  100% { top: 0; }
}

/* Responsive para el reloj y switch */
@media (max-width: 768px) {
    .clock {
        width: 280px;
        height: 280px;
    }
    .clock .hour, .clock .hour .hr { width: 130px; height: 130px; }
    .clock .minute, .clock .minute .min { width: 150px; height: 150px; }
    .clock .second, .clock .second .sec { width: 180px; height: 180px; }
    .clock .hour .hr::before { height: 65px; }
    .clock .minute .min::before { height: 75px; }
    .clock .second .sec::before { height: 110px; }
    
    .digital-clock-container { width: 300px; }
    #time-digital { font-size: 45px; }
    
    /* Dynamic Island */
    .dynamic-island { top: 0px; width: 120px; height: 35px; }
    .dynamic-island.expanded { width: 260px; height: 50px; }
    .dynamic-island.scrolled { top: 3px; width: 50px; height: 50px; }
    .dynamic-island.scrolled.expanded { width: 220px; height: 50px; }
}
/* ===============================================
   ESTILOS: MENSAJE DE BIENVENIDA (Dynamic Island)
   =============================================== */

/* Estado de bienvenida */
.dynamic-island.welcome-mode {
    width: auto !important; /* Ancho automático según el texto */
    min-width: 140px;
    max-width: 90vw; /* No salirse de la pantalla en móviles */
    padding: 0 25px;
    height: 40px; /* Altura base */
    justify-content: center;
    cursor: default;
}

/* Texto de bienvenida */
.welcome-text {
    color: #fff;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    display: flex;
    align-items: center;
}

/* Cursor parpadeante tipo máquina de escribir */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: #00F0FF;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Ocultar contenido normal durante la bienvenida */
.dynamic-island.welcome-mode .island-content {
    display: none;
}

/* --- 1. ESTADO CRÍTICO (BATERÍA BAJA) - ROJO PULSANTE --- */
.dynamic-island.status-critical {
    border-color: #ff003c !important; 
    /* Solo un !important al final de la lista de sombras */
    box-shadow: 
        0 0 20px rgba(255, 0, 60, 0.8), 
        0 0 40px rgba(255, 0, 60, 0.4) !important;
    animation: criticalPulse 1s infinite alternate ease-in-out;
}

@keyframes criticalPulse {
    0% { box-shadow: 0 0 10px rgba(255, 0, 60, 0.5) !important; }
    100% { 
        /* Aquí también corregido: solo un !important al final */
        box-shadow: 
            0 0 25px rgba(255, 0, 60, 1), 
            0 0 5px #fff !important; 
    }
}

/* --- 2. ESTADO CAÍDA LIBRE - NARANJA --- */
.dynamic-island.status-falling {
    border-color: #ff9100 !important; 
    /* Corregido aquí también */
    box-shadow: 
        0 0 20px rgba(255, 145, 0, 0.8),
        0 0 10px rgba(255, 145, 0, 1) !important;
    transition: all 0.2s ease !important; 
}

@media (max-width: 768px) {
    .welcome-text {
        font-size: 0.8rem; /* Texto más pequeño en móvil */
    }
    .dynamic-island.welcome-mode {
        height: 35px;
    }
}