/**
 * @fileoverview lumina.css — Sistema de Diseño Cupertino Premium v5.4
 * Acabado de alta fidelidad basado en micro-interacciones, Glassmorphism y SF Pro.
 * Incorporación de flechas de PC, selectores de sistema y caja filantrópica de PayPal.
 * @author MTMartin Software
 */

:root {
    --font-text: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    
    --bg-viewport: #010103;
    --bg-sheet: rgba(22, 22, 26, 0.75);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-inner: rgba(255, 255, 255, 0.04);
    
    --text-title: #ffffff;
    --text-body: #eedec9;
    --text-muted: #86868b;
    
    --color-low: #30d158;    
    --color-high: #ff453a;   
    --color-neutral: #ff9f0a;
    --color-accent: #0a84ff; 
    
    --glass-blur: blur(24px) saturate(190%);
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

body[data-theme="light"] {
    --bg-viewport: #f5f5f7;
    --bg-sheet: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(0, 0, 0, 0.06);
    --border-inner: rgba(0, 0, 0, 0.03);
    
    --text-title: #1d1d1f;
    --text-body: #424245;
    --text-muted: #86868b;
    
    --color-low: #34c759;
    --color-high: #ff3b30;
    --color-neutral: #ff9500;
    --color-accent: #007aff;
    
    --glass-blur: blur(24px) saturate(180%);
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-text);
    background-color: var(--bg-viewport);
    color: var(--text-body);
    overflow-x: hidden;
    transition: background-color 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.lumina-viewport {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 440px; 
    margin: 0 auto;
    padding: 2rem 1.25rem env(safe-area-inset-bottom) 1.25rem;
    position: relative;
    z-index: 2;
}

.lumina-ambient-glow {
    position: fixed;
    top: -10%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(circle, rgba(10, 132, 255, 0.08) 0%, rgba(0,0,0,0) 70%);
    z-index: 1;
    pointer-events: none;
    transition: all 0.5s ease;
}
body[data-theme="light"] .lumina-ambient-glow {
    background: radial-gradient(circle, rgba(0, 122, 255, 0.04) 0%, rgba(0,0,0,0) 70%);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.brand-name {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-title);
}

.live-tag {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.15rem;
}

.dot-blink {
    width: 6px;
    height: 6px;
    background-color: var(--color-low);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-low);
}

.tabs-navigation {
    margin-bottom: 1.5rem;
}

.segmented-control {
    background: var(--border-inner);
    border: 1px solid var(--border-glass);
    padding: 2px;
    border-radius: 12px;
    display: flex;
    position: relative;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.tab-trigger {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.6rem 0;
    border-radius: 10px;
    cursor: pointer;
    z-index: 3;
    transition: color 0.25s ease;
}

.tab-trigger.active {
    color: var(--text-title);
}

.glider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(33.333% - 2px); /* Ajustado para el balance de 3 pestañas */
    height: calc(100% - 4px);
    background: var(--bg-sheet);
    border: 1px solid var(--border-glass);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    border-radius: 10px;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* 🌟 INTEGRACIÓN DE FLECHAS EN MÓDULO DE HORAS PARA PC */
.carousel-container-wrapper {
    position: relative;
    width: 100%;
}

.horizontal-scroll {
    display: flex;
    gap: 0.65rem;
    overflow-x: auto;
    scrollbar-width: none; 
    padding: 0.25rem 0.5rem;
    scroll-behavior: smooth;
}
.horizontal-scroll::-webkit-scrollbar { display: none; }

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: rgba(30, 30, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-radius: 50%;
    font-size: 1.1rem;
    display: none; /* Ocultas en móvil táctil por defecto */
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}
body[data-theme="light"] .nav-arrow {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
}

/* Media Query exclusiva para PCs con ratón para desplegar flechas */
@media (hover: hover) {
    .nav-arrow { display: flex; }
    .arrow-left { left: -12px; }
    .arrow-right { right: -12px; }
    .nav-arrow:hover { transform: translateY(-50%) scale(1.1); background: var(--text-title); color: var(--bg-viewport); }
}

.apple-notification-banner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: rgba(30, 30, 35, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.85rem 1.1rem;
    border-radius: 18px;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    animation: slideBannerIn 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}
body[data-theme="light"] .apple-notification-banner {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0,0,0,0.08);
}

@keyframes slideBannerIn {
    0% { transform: translateY(-15px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.notification-icon { font-size: 1.3rem; }
.notification-content h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-title);
    letter-spacing: -0.01em;
}
.notification-content p {
    font-size: 0.72rem;
    color: var(--text-body);
    line-height: 1.35;
    margin-top: 0.1rem;
}

.main-price-card, .chart-glass-box, .carousel-section, .appliances-section, .service-shelf-card, .settings-glass-box {
    background: var(--bg-sheet);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-premium);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.main-price-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.card-subtitle {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.08em;
}

.main-price-display {
    display: flex;
    align-items: baseline;
    margin: 0.5rem 0;
}

.currency-symbol {
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-title);
    margin-right: 0.25rem;
}

#hero-price {
    font-family: var(--font-mono);
    font-size: 3.4rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    color: var(--text-title);
}

.kwh-badge {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.price-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    margin-bottom: 1.2rem;
}

.price-status-badge.status-low { background: rgba(48, 209, 88, 0.15); color: var(--color-low); }
.price-status-badge.status-high { background: rgba(255, 69, 58, 0.15); color: var(--color-high); }
.price-status-badge.status-neutral { background: rgba(255, 159, 10, 0.15); color: var(--color-neutral); }

.day-extremes-row {
    display: flex;
    width: 100%;
    background: var(--border-inner);
    padding: 0.75rem 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
}

.extreme-node {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.node-min { text-align: left; }
.node-max { text-align: right; }

.extreme-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
}
.extreme-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
}
.node-min .extreme-value { color: var(--color-low); }
.node-max .extreme-value { color: var(--color-high); }

.extreme-divider {
    width: 1px;
    background: var(--border-glass);
    margin: 0 1rem;
}

.renewable-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-body);
    text-align: left;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.chart-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-title);
}

.mono-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chart-wrapper {
    height: 150px;
    width: 100%;
    overflow: hidden;
}

svg {
    width: 100%;
    height: 100%;
}

.grid-line {
    stroke: var(--border-glass);
    stroke-width: 1px;
    stroke-dasharray: 4 4;
}

.curve-stroke {
    stroke-width: 2.5px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.current-dot {
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    0% { r: 4.5; opacity: 0.8; }
    100% { r: 7; opacity: 1; }
}

.chart-timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.time-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
}

.panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-title);
    margin-bottom: 1rem;
}

.hour-node {
    min-width: 52px;
    background: var(--border-inner);
    border: 1px solid var(--border-glass);
    padding: 0.6rem 0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.hour-node.active-hour {
    background: var(--text-title);
    border-color: var(--text-title);
}

.node-time {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
}
.active-hour .node-time { color: var(--bg-viewport); }

.node-price {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-title);
}
.active-hour .node-price { color: var(--bg-viewport); font-weight: 700; }

.node-bar {
    width: 14px;
    height: 3px;
    border-radius: 99px;
}

.appliances-grid {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.device-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--border-inner);
    border: 1px solid var(--border-glass);
    padding: 0.85rem 1rem;
    border-radius: 14px;
}

.device-card.continuous-glow {
    border-left: 3px solid var(--color-accent);
    background: linear-gradient(90deg, rgba(10, 132, 255, 0.02) 0%, rgba(0, 0, 0, 0) 100%);
}

.device-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-title);
}

.device-specs {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    display: block;
}

.device-cost {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-title);
}

.app-page { display: none; }
.app-page.active { display: block; }

.page-intro {
    margin-bottom: 1.5rem;
    padding: 0 0.25rem;
}

.page-intro h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-title);
    letter-spacing: -0.02em;
}

.page-intro p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.4;
}

.services-shelf {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.service-shelf-card {
    width: 100%;
    display: flex;
    align-items: center;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}
.service-shelf-card:active { transform: scale(0.98); }

.shelf-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
}

.shelf-meta { flex: 1; }
.shelf-meta h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-title);
}
.shelf-meta p {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.shelf-arrow {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

/* 🌟 SECCIÓN ESTILOS DEL MÓDULO DE AJUSTES */
.settings-panel-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.85rem;
}

.settings-list {
    display: flex;
    flex-direction: column;
    background: var(--border-inner);
    border-radius: 14px;
    overflow: hidden;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.9rem;
    color: var(--text-title);
}
.settings-row:last-child { border-bottom: none; }

.settings-label-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.settings-label-block small { font-size: 0.7rem; color: var(--text-muted); }

.settings-select, .settings-time-input {
    background: transparent;
    border: none;
    color: var(--color-accent);
    font-family: var(--font-text);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: right;
    outline: none;
    cursor: pointer;
}
.settings-time-input { font-family: var(--font-mono); }

/* Interruptor nativo estilo iOS */
.apple-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 26px;
}
.apple-switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-glass);
    transition: .3s cubic-bezier(0.25, 1, 0.5, 1);
    border-radius: 34px;
}
.switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.25, 1, 0.5, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .switch-slider { background-color: var(--color-low); }
input:checked + .switch-slider:before { transform: translateX(18px); }

/* TARJETA DE DONACIÓN PAYPAL EXCLUSIVA */
.donation-premium-card {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.07) 0%, rgba(22, 22, 26, 0.75) 100%);
    border: 1px solid rgba(10, 132, 255, 0.25);
    border-radius: 24px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-premium);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.donation-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}
.donation-icon { font-size: 1.4rem; }
.donation-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-title); letter-spacing: -0.01em; }

.donation-text {
    font-size: 0.8rem;
    color: var(--text-body);
    line-height: 1.45;
    margin-bottom: 0.65rem;
}
.donation-text.text-subtle { color: var(--text-muted); font-size: 0.74rem; margin-bottom: 1.4rem; }

.paypal-form-center { display: flex; justify-content: center; width: 100%; }

.paypal-premium-btn {
    width: 100%;
    background: #ffffff;
    color: #003087; /* Azul corporativo PayPal */
    border: none;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(255,255,255,0.1);
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}
.paypal-premium-btn:hover { background: #f5f5f7; transform: scale(1.02); }
.paypal-premium-btn:active { transform: scale(0.99); }
.paypal-svg-icon { width: 16px; height: 16px; }

.sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.sheet-overlay.active { opacity: 1; pointer-events: auto; }

.apple-sheet {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 100%);
    width: 100%;
    max-width: 440px;
    height: 84vh;
    background: var(--bg-sheet);
    border-top: 1px solid var(--border-glass);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 1rem 1.5rem env(safe-area-inset-bottom) 1.5rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.sheet-overlay.active .apple-sheet.active { transform: translate(-50%, 0); }
.sheet-header { display: flex; flex-direction: column; align-items: center; margin-bottom: 1.25rem; }
.sheet-handle { width: 36px; height: 5px; background: var(--border-glass); border-radius: 99px; margin-bottom: 1rem; }
.sheet-title-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.sheet-title-row h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-title); }

.close-sheet-btn {
    background: var(--border-glass);
    border: none;
    color: var(--color-accent);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    cursor: pointer;
}

.sheet-body { flex: 1; overflow-y: auto; padding-bottom: 2rem; }
.sheet-instruction { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 1.5rem; }
.input-block { margin-bottom: 1.25rem; }
.input-block label { font-size: 0.75rem; font-weight: 600; color: var(--text-title); margin-bottom: 0.5rem; display: block; }

.range-wrapper { display: flex; align-items: center; gap: 1rem; }

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none; 
    background: var(--border-glass);
    height: 4px;
    border-radius: 99px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none; 
    background: #ffffff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}

.range-indicator { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 600; color: var(--text-title); min-width: 65px; text-align: right; }

.premium-select {
    width: 100%;
    background: var(--border-inner);
    border: 1px solid var(--border-glass);
    color: var(--text-title);
    padding: 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    outline: none;
    -webkit-appearance: none;
    appearance: none; 
}

.live-result-pane { background: var(--border-inner); border: 1px solid var(--border-glass); padding: 1rem; border-radius: 16px; margin-top: 1.5rem; }
.live-result-pane h5 { font-size: 0.85rem; font-weight: 700; color: var(--text-title); margin-bottom: 0.35rem; }
.live-result-pane p { font-size: 0.75rem; color: var(--text-body); line-height: 1.4; }

.live-result-pane.result-success { border-color: rgba(48, 209, 88, 0.3); background: rgba(48, 209, 88, 0.03); }
.live-result-pane.result-alert { border-color: rgba(255, 69, 58, 0.3); background: rgba(255, 69, 58, 0.03); }

.app-footer { margin-top: auto; padding: 2rem 0 1rem 0; text-align: center; display: flex; flex-direction: column; gap: 0.35rem; }
.copy-text { font-size: 0.65rem; color: var(--text-muted); }
.footer-links { display: flex; justify-content: center; gap: 1rem; }
.footer-links a { font-size: 0.65rem; color: var(--text-muted); text-decoration: none; }

.splash-wrapper { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #010103; z-index: 9999; display: flex; justify-content: center; align-items: center; transition: opacity 0.5s ease, pointer-events 0.5s ease; }
.splash-wrapper.fade-out { opacity: 0; pointer-events: none; }
.splash-title { font-size: 2.2rem; font-weight: 700; letter-spacing: 0.15em; color: #ffffff; text-indent: 0.15em; }

.pulse-accent { color: var(--color-accent); }