/* ==========================================================================
   JS PowerWebLite - UI Engine (Estilo Analítica de Negocios / Nicepage)
   Versión 2.0 - Clean Corporate & Business Analytics Theme

   ========================================================================== */

:root {
    /* Paleta Inspirada en Nicepage Business Analytics */
    --bg-app: #f4f6f9;               /* Fondo general gris muy claro */
    --surface: #ffffff;              /* Blanco para tarjetas y contenedores */
    --surface-hover: #f8fafc;        /* Hover suave para elementos */
    --border-color: #e2e8f0;         /* Bordes delgados y limpios */
    
    /* Colores Principales / Acentos */
    --primary: #1952a2;              /* Azul corporativo fuerte */
    --primary-hover: #3c639e;        /* Azul oscuro al hacer hover */
    --secondary-blue: #1879aa;       /* Azul cyan/analítica */
    --dark-navy: #0e2b70;            /* Azul marino profundo para headers y textos principales */
    
    /* Texto */
    --text-main: #1e293b;            /* Texto oscuro principal */
    --text-muted: #64748b;           /* Texto secundario / gris */
    --text-light: #f8fafc;           /* Texto claro para fondos oscuros */
    
    /* Estados */
    --danger: #e13636c4;
    --success: #44a685;
    --warning: #db9c2ef7;

    /* Geometría y Sombras */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Adaptación a Áreas Seguras */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Soporte de Modo Oscuro Alternativo */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-app: #0b0f19;
        --surface: #1e293b;
        --surface-hover: #334155;
        --border-color: #334155;
        --text-main: #f8fafc;
        --text-muted: #94a3b8;
        --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

/* ==========================================================================
   RESET GLOBAL
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

p, span, input, textarea, h1, h2, h3, h4, h5, h6, code {
    user-select: text;
}

html, body {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

body {
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

/* ==========================================================================
   CONTENEDORES
   ========================================================================== */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
}

.container-fluid {
    width: 100%;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
}

/* ==========================================================================
   SISTEMA DE GRID
   ========================================================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
    width: calc(100% + 1.5rem);
    box-sizing: border-box;
}

.row > [class*="col-"] {
    box-sizing: border-box;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
}

/* Columnas Base */
.col-12 { flex: 0 0 100%; width: 100%; }
.col-11 { flex: 0 0 91.666667%; width: 91.666667%; }
.col-10 { flex: 0 0 83.333333%; width: 83.333333%; }
.col-9  { flex: 0 0 75%; width: 75%; }
.col-8  { flex: 0 0 66.666667%; width: 66.666667%; }
.col-7  { flex: 0 0 58.333333%; width: 58.333333%; }
.col-6  { flex: 0 0 50%; width: 50%; }
.col-5  { flex: 0 0 41.666667%; width: 41.666667%; }
.col-4  { flex: 0 0 33.333333%; width: 33.333333%; }
.col-3  { flex: 0 0 25%; width: 25%; }
.col-2  { flex: 0 0 16.666667%; width: 16.666667%; }
.col-1  { flex: 0 0 8.333333%; width: 8.333333%; }

/* Media Queries Responsivas */
@media (min-width: 576px) {
    .col-sm-12 { flex: 0 0 100%; width: 100%; }
    .col-sm-6  { flex: 0 0 50%; width: 50%; }
    .col-sm-4  { flex: 0 0 33.333333%; width: 33.333333%; }
    .col-sm-3  { flex: 0 0 25%; width: 25%; }
}

@media (min-width: 768px) {
    .col-md-12 { flex: 0 0 100%; width: 100%; }
    .col-md-8  { flex: 0 0 66.666667%; width: 66.666667%; }
    .col-md-6  { flex: 0 0 50%; width: 50%; }
    .col-md-4  { flex: 0 0 33.333333%; width: 33.333333%; }
    .col-md-3  { flex: 0 0 25%; width: 25%; }
}

@media (min-width: 992px) {
    .col-lg-12 { flex: 0 0 100%; width: 100%; }
    .col-lg-8  { flex: 0 0 66.666667%; width: 66.666667%; }
    .col-lg-6  { flex: 0 0 50%; width: 50%; }
    .col-lg-4  { flex: 0 0 33.333333%; width: 33.333333%; }
    .col-lg-3  { flex: 0 0 25%; width: 25%; }
}

/* ==========================================================================
   NAVEGACIÓN Y TOP BAR
   ========================================================================== */
.nav-lite {
    height: 90px;
    background: var(--dark-navy);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.nav-container {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 1 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: auto;
}

.nav-lite .brand {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: -0.02em;
    margin-left: 20px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-left: 20px;
}

.nav-links a {
    color: #bfcee1;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a.active, 
.nav-links a:hover {
    color: #ffffff;
}

/* Botón Hamburguesa */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    align-self: right;
    margin-left: auto;
    margin-right: 20px;
}

.hamburger-btn span {
    width: 100%;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

/* ==========================================================================
   TARJETAS Y MÓDULOS DE ANALÍTICA
   ========================================================================== */
.card, .card-lite {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    position: relative;
    width: 100%;
    margin-bottom: 1.5rem;
}

.card:hover, .card-lite:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
    border-color: rgba(16, 106, 234, 0.3);
}

.card-lite.energy-card {
    background: linear-gradient(135deg, var(--dark-navy) 0%, #1e293b 100%);
    color: #ffffff;
    border: none;
}

.card-lite.energy-card h2, 
.card-lite.energy-card h3,
.card-lite.energy-card p {
    color: #ffffff;
}

.card-lite h2, .card-lite h3, .card-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.card-lite .metric-value {
    font-size: 1rem;
    font-weight: 500;
    color: white;
    margin: 0.5rem 0;
    letter-spacing: -0.03em;
}

.card-lite p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==========================================================================
   FORMULARIOS E INPUTS
   ========================================================================== */
.input-group {
    margin-bottom: 1.25rem;
}

.input-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.input-lite {
    width: 100%;
    height: 46px;
    padding: 0 1rem;
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.input-lite:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 106, 234, 0.15);
}






/* ==========================================================================
   BOTONES ESTILIZADOS
   ========================================================================== */
.btn {
    border: none; 
    color: #ffffff; 
    padding: 12px 24px; 
    cursor: pointer; 
    border-radius: var(--radius-sm); 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.btn:active {
    transform: translateY(0);
}

.primary { background-color: var(--primary); } 
.primary:hover { background-color: var(--primary-hover); }

.secondary { background-color: #093d86; } 
.secondary:hover { background-color: #475569; }

.success { background-color: var(--success); } 
.success:hover { background-color: #059669; }

.warning { background-color: var(--warning); color: #000; } 
.warning:hover { background-color: #d97706; }

.danger { background-color: var(--danger); } 
.danger:hover { background-color: #dc2626; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(16, 106, 234, 0.04);
}

/* ==========================================================================
   BADGES & ESTADOS
   ========================================================================== */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }

/* ==========================================================================
   UTILIDADES Y RESPONSIVE
   ========================================================================== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-primary { color: var(--primary); }
.text-muted   { color: var(--text-muted); }

@media (max-width: 768px) {
    .hamburger-btn { display: flex; }

    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: var(--dark-navy);
        flex-direction: column;
        padding: 1rem 0;
        display: none !important;
    }

    .nav-links[data-state="open"] {
        display: flex !important;
    }

    .nav-links a {
        padding: 0.8rem 1.5rem;
        width: 100%;
    }
}

/* ==========================================================================
   TOASTS (NOTIFICACIONES)
   ========================================================================== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--surface);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-float);
    border-left: 4px solid var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Utilidad global para ocultar elementos */
.hidden {
    display: none !important;
}

/* Fondo oscuro / Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

/* Caja de contenido del Modal */
.modal-content {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.modal-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ==========================================================================
   COMPONENTES ADICIONALES PARA DASHBOARD & ANALÍTICA
   ========================================================================== */
.metric-number {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0.2rem 0;
    letter-spacing: -0.02em;
}

/* Barras de Progreso Limpias */
.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.5s ease-in-out;
}

/* Lista de Categorías / Items Flexibles */
.stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.stat-item:last-child {
    border-bottom: none;
}

/* ==========================================================================
   REGLAS ADICIONALES PARA EL BLOG
   ========================================================================== */
.container {
    max-width: 100%; /* Ajuste para centrar el blog en pantallas anchas */
}

footer {
    background: var(--dark-navy);
    color: #bfcee1;
    padding: 2.5rem 0;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}