/* Main Design System - Rainify Premium */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    /* Paleta Rural Refinada */
    --primary-green: #34d399;
    /* Esmeralda más vivo */
    --primary-blue: #3b82f6;
    /* Azul más moderno */
    --accent-ochre: #d97706;
    /* Ámbar */
    --rain-blue: #60a5fa;

    /* Colores Sistema (Deep Space Dark) */
    --bg-dark: #020617;
    --bg-card: rgba(15, 23, 42, 0.6);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Glassmorphism Refinado */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(20px);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.82);

    /* Espaciado y Bordes (Más finos) */
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --nav-height: 65px;
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);

    /* ===== FASE 1: FOUNDATION ===== */
    
    /* Sistema de Elevación (5 niveles) */
    --elevation-0: none;
    
    --elevation-1: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.2);
    
    --elevation-2: 
        0 4px 16px rgba(0, 0, 0, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    
    --elevation-3: 
        0 12px 32px rgba(0, 0, 0, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    
    --elevation-4: 
        0 16px 48px rgba(0, 0, 0, 0.6),
        0 8px 16px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);

    /* Variables de Animación */
    --timing-fast: 0.2s;
    --timing-base: 0.3s;
    --timing-slow: 0.5s;
    --timing-slower: 0.8s;
    
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Efectos */
    --glow-green: 0 0 20px rgba(52, 211, 153, 0.4);
    --glow-blue: 0 0 20px rgba(59, 130, 246, 0.4);
    --glow-orange: 0 0 20px rgba(217, 119, 6, 0.4);
    
    --ripple-duration: 0.6s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100dvh;
    width: 100vw;
    font-weight: 300;
}

.app-container {
    position: relative;
    height: 100%;
    width: 100%;
    background-image:
        radial-gradient(circle at 0% 0%, rgba(52, 211, 153, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
}

#main-content {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.module-container {
    height: 100%;
    width: 100%;
    position: relative;
}

/* Clase para páginas con scroll (Social, Perfil, Pronóstico) */
.scrollable-content {
    height: 100%;
    overflow-y: auto;
    padding-bottom: calc(var(--nav-height) + var(--safe-area-inset-bottom) + 30px);
    -webkit-overflow-scrolling: touch;
}

.map-page {
    overflow: hidden;
}




/* Scrollbar invisible pero funcional */
#main-content::-webkit-scrollbar {
    width: 0;
    display: none;
}

/* Barra de Navegación Estilo Dock Flotante */
.bottom-nav {
    position: fixed;
    bottom: calc(15px + var(--safe-area-inset-bottom));
    left: 20px;
    right: 20px;
    height: var(--nav-height);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    z-index: 2000;
    box-shadow: var(--elevation-4); /* ✨ APLICANDO ELEVACIÓN */
    transition: transform var(--timing-base) var(--ease-smooth); /* ✨ USANDO NUEVAS VARIABLES */
}

.nav-item {
    text-decoration: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all var(--timing-base) var(--ease-smooth); /* ✨ MEJORADO */
    flex: 1;
    position: relative;
}

.nav-item i {
    font-size: 1.2rem;
    transition: all var(--timing-base) var(--ease-spring); /* ✨ SPRING EASING */
}

.nav-item span {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.6;
    transition: opacity var(--timing-base) var(--ease-smooth); /* ✨ MEJORADO */
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-item.active i {
    color: var(--primary-green);
    transform: translateY(-2px);
    filter: drop-shadow(var(--glow-green)); /* ✨ USANDO GLOW */
}

.nav-item.active span {
    opacity: 1;
}

/* Badge de notificaciones en nav */
.nav-item {
    position: relative; /* Para que el badge se posicione bien */
}

/* ==================== BADGE DE NOTIFICACIONES (Responsive) ==================== */

.nav-item {
    position: relative !important;
}

.nav-notification-badge {
    position: absolute !important;
    top: 0px !important;
    left: 50% !important;  /* Centrar en el nav-item */
    transform: translateX(10px) !important;  /* Mover desde el centro hacia la derecha */
    right: auto !important;
    width: 18px !important;
    height: 18px !important;
    background: #ef4444 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    color: white !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5) !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Si tiene 2 dígitos, se convierte en píldora */
.nav-notification-badge:not(:empty) {
    width: auto !important;
    min-width: 18px !important;
    padding: 0 5px !important;
    border-radius: 10px !important;
}


/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--elevation-1); /* ✨ USANDO SISTEMA DE ELEVACIÓN */
    transition: all var(--timing-base) var(--ease-smooth); /* ✨ MEJORADO */
}

.glass-panel:hover {
    box-shadow: var(--elevation-2); /* ✨ ELEVACIÓN EN HOVER */
    transform: translateY(-2px);
}

/* Animaciones de Entrada */
.fade-in {
    animation: fadeInSlide 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== FASE 1: NUEVAS ANIMACIONES ===== */

/* Shimmer Effect - Para loading states */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.0) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* Glow Pulse - Para elementos destacados */
@keyframes glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(52, 211, 153, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(52, 211, 153, 0.6));
    }
}

.glow-pulse {
    animation: glow-pulse 2s ease-in-out infinite;
}

/* Spring In - Entrada con rebote sutil */
@keyframes spring-in {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    50% {
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.spring-in {
    animation: spring-in var(--timing-slow) var(--ease-spring);
}

/* Ripple Effect - Feedback de click */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(52, 211, 153, 0.5);
    pointer-events: none;
    transform: scale(0);
    animation: ripple var(--ripple-duration) ease-out;
}

/* Tipografía */
h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -0.5px;
}

p {
    line-height: 1.5;
    color: var(--text-secondary);
}

strong {
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== FASE 2: COMPONENTS ===== */

/* ========================================
   1. CARDS PREMIUM
   ======================================== */

/* Card premium base */
.card-premium {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.04) 0%, 
        rgba(255, 255, 255, 0.01) 100%
    );
    backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: var(--elevation-1);
    position: relative;
    overflow: hidden;
    transition: all var(--timing-base) var(--ease-smooth);
}

/* Borde superior brillante */
.card-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
    );
}

/* Hover state */
.card-premium:hover {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.06) 0%, 
        rgba(255, 255, 255, 0.02) 100%
    );
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: var(--elevation-2);
}

/* Card con acento de color izquierdo */
.card-premium.has-accent {
    border-left: 3px solid var(--primary-green);
}

.card-premium.has-accent-blue {
    border-left: 3px solid var(--primary-blue);
}

.card-premium.has-accent-orange {
    border-left: 3px solid var(--accent-ochre);
}

/* Card con gradiente de acento */
.card-premium.accent-rain::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(
        180deg,
        rgba(96, 165, 250, 0.8),
        rgba(96, 165, 250, 0.2)
    );
}

/* Card sizes */
.card-premium.compact {
    padding: 16px;
}

.card-premium.normal {
    padding: 20px;
}

.card-premium.large {
    padding: 30px;
}

/* ========================================
   2. BOTONES MULTI-ESTADO
   ======================================== */

/* Botón base */
.btn {
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all var(--timing-base) var(--ease-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Botón Primary */
.btn-primary {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    color: white;
    box-shadow: 
        0 4px 12px rgba(52, 211, 153, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover:not(:disabled):not(.loading) {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(52, 211, 153, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:active:not(:disabled):not(.loading) {
    transform: scale(0.96);
}

/* Botón Secondary (ghost) */
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled):not(.loading) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* Botón Danger */
.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 
        0 4px 12px rgba(239, 68, 68, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-danger:hover:not(:disabled):not(.loading) {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(239, 68, 68, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Estado Loading */
.btn.loading {
    pointer-events: none;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Estado Success */
.btn.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    pointer-events: none;
}

.btn.success::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 1.2rem;
    color: white;
    animation: checkmarkPop 0.5s ease forwards;
}

@keyframes checkmarkPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Estado Disabled */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Tamaños de botones */
.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
}

/* Botón con icono */
.btn i {
    font-size: 1em;
}

/* ========================================
   3. INPUTS MEJORADOS
   ======================================== */

/* Input base */
.input-premium {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid transparent;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all var(--timing-base) var(--ease-smooth);
    outline: none;
}

.input-premium::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Focus state mejorado */
.input-premium:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary-green);
    box-shadow: 
        0 0 0 4px rgba(52, 211, 153, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

/* Input con error */
.input-premium.error {
    border-color: #ef4444;
}

.input-premium.error:focus {
    border-color: #ef4444;
    box-shadow: 
        0 0 0 4px rgba(239, 68, 68, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Input con éxito */
.input-premium.success {
    border-color: var(--primary-green);
}

/* Input disabled */
.input-premium:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Input group con icono */
.input-group {
    position: relative;
    width: 100%;
}

.input-group .input-premium {
    padding-left: 48px;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: all var(--timing-base) var(--ease-smooth);
    pointer-events: none;
}

.input-group .input-premium:focus + i {
    color: var(--primary-green);
    transform: translateY(-50%) scale(1.1);
}

/* Search Input específico */
.search-input {
    position: relative;
    width: 100%;
}

.search-input input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid transparent;
    border-radius: 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all var(--timing-base) var(--ease-smooth);
    outline: none;
}

.search-input input::placeholder {
    color: var(--text-muted);
}

.search-input input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary-green);
    box-shadow: 
        0 0 0 4px rgba(52, 211, 153, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.search-input i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: all var(--timing-base) var(--ease-smooth);
}

.search-input input:focus ~ i {
    color: var(--primary-green);
    transform: translateY(-50%) scale(1.1);
}

.search-input.loading i {
    animation: searchPulse 1s ease-in-out infinite;
}

@keyframes searchPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Textarea */
.textarea-premium {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid transparent;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all var(--timing-base) var(--ease-smooth);
    outline: none;
    resize: vertical;
    min-height: 100px;
}

.textarea-premium::placeholder {
    color: var(--text-muted);
}

.textarea-premium:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary-green);
    box-shadow: 
        0 0 0 4px rgba(52, 211, 153, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ========================================
   4. AVATARES CON GRADIENTES
   ======================================== */

/* Avatar base */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* Gradientes de avatar (5 variaciones) */
.avatar[data-color="1"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.avatar[data-color="2"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.avatar[data-color="3"] {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.avatar[data-color="4"] {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.avatar[data-color="5"] {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* Avatar con imagen */
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

/* Avatar con borde si está online */
.avatar.online::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 14px;
    padding: 2px;
    background: linear-gradient(135deg, #34d399, #3b82f6);
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* Indicador online */
.avatar.online::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--primary-green);
    border: 2px solid var(--bg-dark);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary-green);
}

/* Tamaños de avatar */
.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.7rem;
    border-radius: 8px;
}

.avatar-sm.online::after {
    width: 8px;
    height: 8px;
}

.avatar-lg {
    width: 60px;
    height: 60px;
    font-size: 1.1rem;
    border-radius: 16px;
}

.avatar-lg.online::after {
    width: 14px;
    height: 14px;
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 1.5rem;
    border-radius: 20px;
}

.avatar-xl.online::after {
    width: 16px;
    height: 16px;
}

/* Avatar circular */
.avatar-circle,
.avatar-circle img {
    border-radius: 50%;
}

.avatar-circle.online::before {
    border-radius: 50%;
}

/* ===== FASE 3: NAVIGATION & HEADERS ===== */

/* ========================================
   1. BOTTOM NAV MEJORADA
   ======================================== */

/* Mejoras aplicadas directamente a las clases existentes */
.bottom-nav {
    /* Las variables de elevation-4 ya están aplicadas */
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        var(--elevation-4),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-item {
    border-radius: 20px;
    padding: 8px;
}

/* Hover state para nav items */
.nav-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

/* Background activo animado */
.nav-item.active::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(52, 211, 153, 0.15),
        rgba(59, 130, 246, 0.15)
    );
    border-radius: 20px;
    z-index: -1;
    animation: activeGlow 3s ease-in-out infinite;
}

@keyframes activeGlow {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Indicador superior activo */
.nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--primary-green),
        transparent
    );
    border-radius: 2px;
    box-shadow: 0 0 8px var(--primary-green);
}

/* Mejorar iconos activos */
.nav-item.active i {
    transform: scale(1.1);
    filter: 
        drop-shadow(var(--glow-green))
        drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ========================================
   2. HEADERS CON PERSONALIDAD
   ======================================== */

/* Page header container */
.page-header {
    margin-bottom: 24px;
    padding: 20px;
}

/* Title con gradiente */
.page-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(
        135deg,
        #f8fafc 0%,
        #cbd5e1 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    letter-spacing: -1px;
    margin-bottom: 8px;
    display: inline-block;
    width: fit-content;
}

/* Title tamaños */
.page-title.large {
    font-size: 2.5rem;
}

.page-title.small {
    font-size: 1.5rem;
}

/* Title con color específico */
.page-title.green {
    background: linear-gradient(
        135deg,
        var(--primary-green) 0%,
        #10b981 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.page-title.blue {
    background: linear-gradient(
        135deg,
        var(--primary-blue) 0%,
        #2563eb 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}



/* Subtitle con icono *//* Subtitle con icono */
.page-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.page-subtitle i {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0); 
    }
    50% { 
        transform: translateY(-4px); 
    }
}

/* ========================================
   3. BADGES Y NOTIFICACIONES
   ======================================== */

/* Badge de notificación (contador) */
.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 2px solid var(--bg-dark);
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgePop var(--timing-base) var(--ease-bounce);
    z-index: 10;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Badge con pulso */
.badge.pulse::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.4);
    animation: badgePulse 2s ease-out infinite;
    z-index: -1;
}

@keyframes badgePulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Stats badge */
.stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-green);
}

.stats-badge.blue {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--primary-blue);
}

.stats-badge.orange {
    background: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.2);
    color: var(--accent-ochre);
}

.stats-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.5; 
    }
}

/* Status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.online {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.status-badge.offline {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

.status-badge.away {
    background: rgba(217, 119, 6, 0.15);
    color: var(--accent-ochre);
}

.status-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.online .dot {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   4. SECTION DIVIDERS
   ======================================== */

/* Divider simple */
.section-divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    margin: 24px 0;
}

/* Divider con texto */
.section-divider-text {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.section-divider-text::before,
.section-divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
}

.section-divider-text::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 100%
    );
}

.section-divider-text::after {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 100%
    );
}

.section-divider-text span {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Divider con icono */
.section-divider-icon {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.section-divider-icon::before,
.section-divider-icon::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.section-divider-icon i {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Divider con gradiente */
.section-divider.gradient {
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--primary-green) 50%,
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.3);
}

/* ========================================
   5. FLOATING ACTION BUTTON (FAB)
   ======================================== */

.fab {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-area-inset-bottom) + 30px);
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-green) 0%, #10b981 100%);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--elevation-4);
    transition: all var(--timing-base) var(--ease-smooth);
    z-index: 1999;
}

.fab:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 30px rgba(52, 211, 153, 0.4);
}

.fab:active {
    transform: translateY(-2px) scale(1);
}

/* FAB con badge */
.fab .badge {
    top: -6px;
    right: -6px;
}

/* ===== FASE 4: POLISH FINAL ===== */

/* ========================================
   1. LOADING STATES MEJORADOS
   ======================================== */

/* Spinner Premium (doble anillo) */
.spinner-premium {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    position: relative;
}

.spinner-premium::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 4px solid transparent;
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1.2s linear infinite reverse;
}

.spinner-premium.small {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

.spinner-premium.small::after {
    inset: -3px;
    border-width: 3px;
}

.spinner-premium.large {
    width: 64px;
    height: 64px;
    border-width: 5px;
}

.spinner-premium.large::after {
    inset: -5px;
    border-width: 5px;
}

/* Dots Loading Premium */
.dots-loading-premium {
    display: inline-flex;
    gap: 10px;
    align-items: center;
}

.dots-loading-premium span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-green);
    animation: dotsBounceSmooth 1.4s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
}

.dots-loading-premium span:nth-child(1) {
    animation-delay: 0s;
}

.dots-loading-premium span:nth-child(2) {
    animation-delay: 0.2s;
    background: var(--primary-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.dots-loading-premium span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotsBounceSmooth {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-12px) scale(1.1);
        opacity: 1;
    }
}

/* Skeleton mejorado */
.skeleton-premium {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.skeleton-premium::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    animation: skeletonShine 2s ease-in-out infinite;
}

@keyframes skeletonShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Skeleton variants */
.skeleton-text {
    height: 16px;
    width: 100%;
    margin-bottom: 10px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 15px;
}

.skeleton-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
}

.skeleton-card {
    padding: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    margin-bottom: 15px;
}

.skeleton-card-image {
    width: 100%;
    height: 180px;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
}

/* Progress Bar Premium */
.progress-bar-premium {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--primary-green) 0%,
        var(--primary-blue) 100%
    );
    border-radius: 5px;
    transition: width var(--timing-base) var(--ease-smooth);
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-bar-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-bar-percentage {
    font-weight: 600;
    color: var(--primary-green);
}

/* ========================================
   2. TOOLTIPS
   ======================================== */

.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: all var(--timing-base) var(--ease-smooth);
    z-index: 9999;
    box-shadow: var(--elevation-3);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.95);
}

.tooltip-container:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px);
}

/* Tooltip positions */
.tooltip.top {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
}

.tooltip.bottom {
    top: 100%;
    bottom: auto;
    transform: translateX(-50%) translateY(8px);
}

.tooltip.bottom::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: rgba(15, 23, 42, 0.95);
}

.tooltip.left {
    bottom: auto;
    top: 50%;
    left: auto;
    right: 100%;
    transform: translateY(-50%) translateX(-8px);
}

.tooltip.left::after {
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border-left-color: rgba(15, 23, 42, 0.95);
    border-top-color: transparent;
}

.tooltip.right {
    bottom: auto;
    top: 50%;
    left: 100%;
    transform: translateY(-50%) translateX(8px);
}

.tooltip.right::after {
    top: 50%;
    right: 100%;
    left: auto;
    transform: translateY(-50%);
    border-right-color: rgba(15, 23, 42, 0.95);
    border-top-color: transparent;
}

.tooltip-container:hover .tooltip.bottom {
    transform: translateX(-50%) translateY(12px);
}

.tooltip-container:hover .tooltip.left {
    transform: translateY(-50%) translateX(-12px);
}

.tooltip-container:hover .tooltip.right {
    transform: translateY(-50%) translateX(12px);
}

/* ========================================
   3. EMPTY STATES MEJORADOS
   ======================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--text-muted);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-message {
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   4. SMOOTH SCROLLBAR
   ======================================== */

.smooth-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.smooth-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.smooth-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.smooth-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: background var(--timing-base) var(--ease-smooth);
}

.smooth-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   5. UTILITY CLASSES
   ======================================== */

/* Text utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-green), var(--primary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

.text-glow {
    text-shadow: 0 0 20px currentColor;
}

/* Hover effects */
.hover-lift {
    transition: transform var(--timing-base) var(--ease-smooth);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-glow {
    transition: filter var(--timing-base) var(--ease-smooth);
}

.hover-glow:hover {
    filter: drop-shadow(0 0 20px currentColor);
}

/* Interactive states */
.interactive {
    cursor: pointer;
    transition: all var(--timing-base) var(--ease-smooth);
}

.interactive:hover {
    transform: scale(1.02);
}

.interactive:active {
    transform: scale(0.98);
}

/* Glass effect enhanced */
.glass-enhanced {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--elevation-2);
}

/* Focus states mejorados */
.focus-ring:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.2);
    border-color: var(--primary-green);
}

/* Disabled state universal */
.disabled,
[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Visually hidden (accessible) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Truncate text */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2; /* Estándar (soporte limitado aún) */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3; /* Estándar (soporte limitado aún) */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Fix scroll con bottom nav */
.module-container {
    padding-bottom: 90px;
}

.forecast-page {
    padding-bottom: 220px;
}

body.light-mode .bottom-nav {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    /* Sombra MÁS SUAVE en light mode */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 
                0 2px 4px rgba(0, 0, 0, 0.04);
}

body.light-mode .nav-item {
    color: var(--text-secondary);
}

body.light-mode .nav-item.active {
    color: var(--primary-green);
}