/* 
=================================================================
RESILIO - ESTILOS CSS
=================================================================

Este archivo contiene TODOS los estilos de la aplicación.
CSS (Cascading Style Sheets) sirve para dar estilo (colores, 
fuentes, márgenes, etc.) a nuestra página web.

¿CÓMO SE LEE ESTE ARCHIVO?
---------------------------
- Los bloques que empiezan con .nombre son CLASES
- Los bloques que empiezan con #nombre son IDs (únicos)
- Las propiedades se ponen entre llaves { }
- Las propiedades van en formato: nombre: valor;

VARIABLES CSS (al principio)
----------------------------
:root nos permite crear variables que podemos reutilizar
en todo el archivo. Si quieres cambiar el color verde,
solo lo cambias aquí y se cambia en toda la página.

*/

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

/* =============================================
   VARIABLES DE COLOR - MODO OSCURO (POR DEFECTO)
   ============================================= */
:root, [data-theme="dark"] {
    --bg-color: #0d0d0d;
    --card-bg: #1a1a1a;
    --card-hover: #222222;
    --neon-green: #49f3be;
    --neon-green-dim: rgba(73, 243, 190, 0.15);
    --coral-red: #f34949;
    --coral-red-dim: rgba(243, 73, 73, 0.15);
    --yellow: #f3c949;
    --yellow-dim: rgba(243, 201, 73, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --border-color: rgba(255, 255, 255, 0.08);
    --sidebar-width: 260px;
    --input-bg: #111111;
    --input-border: #2a2a2a;
}

/* Por defecto el body tiene el fondo oscuro */
body, .dashboard-body {
    background: linear-gradient(-45deg, #0a0a0a, #111111, #0f1a15, #0a0a0a) !important;
    color: var(--text-primary);
}

/* =============================================
   MODO CLARO
   ============================================= */
[data-theme="light"] {
    --bg-color: #f5f5f7;
    --card-bg: #ffffff;
    --card-hover: #f0f0f0;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: rgba(0, 0, 0, 0.08);
    --input-bg: #f5f5f7;
    --input-border: #dddddd;
}

[data-theme="light"] body, 
[data-theme="light"] .dashboard-body {
    background: linear-gradient(-45deg, #f0f0f2, #e8e8ea, #f5f5f7, #f0f0f2) !important;
}

[data-theme="light"] .sidebar {
    background: var(--card-bg) !important;
    border-right: 1px solid var(--border-color) !important;
}

[data-theme="light"] .logo {
    color: var(--neon-green) !important;
}

[data-theme="light"] .sidebar ul li a {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .sidebar ul li a:hover,
[data-theme="light"] .sidebar ul li a.active {
    color: var(--text-primary) !important;
}

[data-theme="light"] .top-bar {
    border-bottom-color: var(--border-color) !important;
}

[data-theme="light"] .welcome-section h1,
[data-theme="light"] .header-title,
[data-theme="light"] .result-card h2,
[data-theme="light"] .stat-card .stat-value,
[data-theme="light"] .setting-title,
[data-theme="light"] .stat-card h3 {
    color: var(--text-primary) !important;
}

[data-theme="light"] .welcome-section p,
[data-theme="light"] .stat-card .stat-label,
[data-theme="light"] .result-card p,
[data-theme="light"] .setting-desc,
[data-theme="light"] .dimension-bar .label span:first-child {
    color: var(--text-secondary) !important;
}

[data-theme="light"] .input-icon-wrapper input {
    background: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .input-icon-wrapper input:focus {
    background: #ffffff !important;
}

[data-theme="light"] .input-icon-wrapper input::placeholder {
    color: #999 !important;
}

[data-theme="light"] .progress-bg {
    background: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .Badge {
    background: var(--neon-green-dim) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .login-card,
[data-theme="light"] .register-card,
[data-theme="light"] .stat-card,
[data-theme="light"] .result-card,
[data-theme="light"] .settings-section,
[data-theme="light"] .history-card {
    background: var(--card-bg) !important;
    border-color: var(--border-color) !important;
}

[data-theme="light"] .language-select {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
}

/* Valores por defecto para el body en modo oscuro */
body {
    color: var(--text-color);
    background: linear-gradient(-45deg, #0a0a0a, #111111, #0f1a15, #0a0a0a);
}

/* Modo Claro - usar :root para sobrescribir */
:root[data-theme="light"] {
    --dark-bg: #f5f5f7;
    --card-bg: #ffffff;
    --card-hover: #f0f0f0;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-color: #1a1a1a;
    --card-text: #1a1a1a;
}

:root[data-theme="light"] body,
:root[data-theme="light"] .dashboard-body {
    background: linear-gradient(-45deg, #f0f0f2, #e8e8ea, #f5f5f7, #f0f0f2) !important;
}

:root[data-theme="light"] .sidebar {
    background: #ffffff !important;
    border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
}

:root[data-theme="light"] .sidebar .logo,
:root[data-theme="light"] .sidebar ul li a:hover,
:root[data-theme="light"] .sidebar ul li a.active {
    color: #1a1a1a !important;
}

:root[data-theme="light"] .sidebar ul li a {
    color: #666666 !important;
}

:root[data-theme="light"] .top-bar {
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

:root[data-theme="light"] .header-title,
:root[data-theme="light"] .welcome-section h1,
:root[data-theme="light"] .result-card h2,
:root[data-theme="light"] .stat-card .stat-value,
:root[data-theme="light"] .setting-title {
    color: #1a1a1a !important;
}

:root[data-theme="light"] .logo {
    color: #49f3be !important;
}

:root[data-theme="light"] .welcome-section p,
:root[data-theme="light"] .stat-card .stat-label,
:root[data-theme="light"] .stat-card h3,
:root[data-theme="light"] .result-card p,
:root[data-theme="light"] .setting-desc,
:root[data-theme="light"] .dimension-bar .label span:first-child {
    color: #666666 !important;
}

:root[data-theme="light"] .input-icon-wrapper input {
    background: #f5f5f7 !important;
    border-color: #ddd !important;
    color: #1a1a1a !important;
}

:root[data-theme="light"] .input-icon-wrapper input:focus {
    background: #ffffff !important;
}

:root[data-theme="light"] .input-icon-wrapper input::placeholder {
    color: #999 !important;
}

:root[data-theme="light"] .progress-bg,
:root[data-theme="light"] .progress-track {
    background: rgba(0, 0, 0, 0.1) !important;
}

:root[data-theme="light"] .badge {
    background: rgba(73, 243, 190, 0.2) !important;
    color: #1a1a1a !important;
}

:root[data-theme="light"] .login-card,
:root[data-theme="light"] .register-card,
:root[data-theme="light"] .stat-card,
:root[data-theme="light"] .result-card,
:root[data-theme="light"] .settings-section {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}

:root[data-theme="light"] .history-card {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}

:root[data-theme="light"] .language-select {
    background: #f5f5f7 !important;
    color: #1a1a1a !important;
}

/* =============================================
   ESTILOS GENERALES
   ============================================= */

* {
    /* Reset básico: elimina márgenes y padding por defecto */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Fuente principal de la aplicación */
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    /* Fondo con degradado animado */
    background: linear-gradient(-45deg, #0a0a0a, #111111, #0f1a15, #0a0a0a);
    background-size: 400% 400%;
    animation: respiracionFondo 15s ease infinite;
    color: var(--text-primary);
    min-height: 100vh;  /* Minimum height = 100% del viewport */
}

/* Animación del fondo (efecto respiración) */
@keyframes respiracionFondo {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}


/* =============================================
   ESTILOS PARA LOGIN Y REGISTER
   (Páginas de autenticación)
   ============================================= */

/* body específico para páginas de auth */
body.auth-page {
    display: flex;
    justify-content: center;  /* Centrar horizontalmente */
    align-items: center;       /* Centrar verticalmente */
    height: 100vh;
}

.login-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 20px;
}

/* Tarjeta principal del login/register */
.login-card, .register-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 420px;          /* Ancho máximo */
    padding: 45px 40px;
    border-radius: 20px;       /* Bordes redondeados */
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);  /* Sombra */
}

/* Contenedor del logo */
.logo-container {
    text-align: center;
    margin-bottom: 35px;
}

/* Imagen del logo */
.main-logo {
    width: 160px;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 20px rgba(73, 243, 190, 0.3));  /* Efecto brillo */
}

/* Texto debajo del logo */
.tagline {
    color: var(--text-secondary);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    font-weight: 400;
}


/* =============================================
   CAMPOS DE FORMULARIO
   ============================================= */

.input-field {
    margin-bottom: 22px;
}

.input-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Contenedor del input con icono */
.input-icon-wrapper {
    position: relative;         /* Para posicionar el icono */
    display: flex;
    align-items: center;
}

/* Icono dentro del input */
.input-icon-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--neon-green);
    font-size: 0.9rem;
}

/* Input de texto */
.input-icon-wrapper input {
    width: 100%;
    background: #111111;
    border: 1px solid #2a2a2a;
    padding: 14px 14px 14px 45px;  /* Padding izquierdo para el icono */
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

/* Input cuando tiene el foco (se hace click) */
.input-icon-wrapper input:focus {
    outline: none;              /* Quitar el borde azul por defecto */
    border-color: var(--neon-green);
    box-shadow: 0 0 20px rgba(73, 243, 190, 0.15);
    background: #151515;
}

/* Placeholder (texto de ejemplo) */
.input-icon-wrapper input::placeholder {
    color: #444;
}


/* =============================================
   CHECKBOX Y RECORDAR
   ============================================= */

.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Cambiar color del checkbox cuando se marca */
.checkbox-wrapper input {
    accent-color: var(--neon-green);
}

.help-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.help-link:hover {
    color: var(--neon-green);
}


/* =============================================
   BOTONES
   ============================================= */

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(90deg, var(--neon-green), #3dd9a0);
    border: none;
    border-radius: 12px;
    color: #0a0a0a;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;            /* Cambia el cursor a mano */
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    transform: translateY(-2px);  /* Mover arriba ligeramente */
    box-shadow: 0 10px 30px rgba(73, 243, 190, 0.3);
    background-position: right center;
}

.btn-primary:active {
    transform: translateY(0);
}

/* Botón secundario (outline) */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: transparent;
    border: 1px solid var(--neon-green);
    border-radius: 10px;
    color: var(--neon-green);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--neon-green);
    color: #0a0a0a;
}

.btn-action {
    margin-top: 30px;
}


/* =============================================
   MENSAJES DE ALERTA (FLASH MESSAGES)
   ============================================= */

.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 22px;
    font-size: 0.85rem;
    border: 1px solid;
}

.alert-error {
    background: var(--coral-red-dim);
    color: var(--coral-red);
    border-color: var(--coral-red);
}

.alert-success {
    background: var(--neon-green-dim);
    color: var(--neon-green);
    border-color: var(--neon-green);
}


/* =============================================
   FORMULARIO DE REGISTRO (footer)
   ============================================= */

.form-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-footer a {
    color: var(--neon-green);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

.form-footer a:hover {
    opacity: 0.8;
}


/* =============================================
   LAYOUT DEL DASHBOARD
   (Menú lateral y contenido)
   ============================================= */

.dashboard-body {
    display: flex;
    min-height: 100vh;
    background: transparent;
    animation: none;  /* El dashboard no tiene fondo animado */
}

/* Sidebar (menú lateral) */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 30px 0;
    display: flex;
    flex-direction: column;
    position: fixed;     /* Se queda fijo al hacer scroll */
    height: 100vh;
    z-index: 100;
}

.sidebar .logo {
    padding: 0 30px;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--neon-green);
    margin-bottom: 50px;
    letter-spacing: -0.5px;
}

.sidebar ul {
    list-style: none;   /* Quitar viñetas */
}

.sidebar ul li {
    margin-bottom: 5px;
}

.sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 30px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar ul li a:hover,
.sidebar ul li a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-left-color: var(--neon-green);  /* Borde verde cuando activo */
}

.sidebar ul li a i {
    width: 20px;
    text-align: center;
}

/* Área de contenido principal */
.content {
    margin-left: var(--sidebar-width);  /* Margen igual al ancho del sidebar */
    flex: 1;
    padding: 30px 40px;
}

/* Barra superior */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.top-bar span {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Badge (etiqueta de empresa) */
.badge {
    background: var(--neon-green-dim);
    color: var(--neon-green);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Contenido dinámico */
.dynamic-content {
    animation: fadeIn 0.4s ease;
}

/* Animación de aparición */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* =============================================
   TARJETAS DE ESTADÍSTICAS
   ============================================= */

.stats-grid {
    display: grid;
    /* grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
       Crea columnas automáticamente que ocupan al menos 250px */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: var(--card-hover);
    transform: translateY(-4px);    /* Se eleva al pasar el ratón */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

/* Icono dentro de las tarjetas */
.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 20px;
}

.stat-card .stat-icon.green {
    background: var(--neon-green-dim);
    color: var(--neon-green);
}

.stat-card .stat-icon.red {
    background: var(--coral-red-dim);
    color: var(--coral-red);
}

.stat-card .stat-icon.yellow {
    background: var(--yellow-dim);
    color: var(--yellow);
}

.stat-card h3 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}


/* =============================================
   SECCIÓN DE RESULTADOS
   ============================================= */

.results-section {
    display: grid;
    grid-template-columns: 1fr 1fr;  /* Dos columnas iguales */
    gap: 24px;
}

.result-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
}

.result-card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}


/* =============================================
   BARRAS DE PROGRESO
   ============================================= */

.dimension-bar {
    margin-bottom: 20px;
}

.dimension-bar .label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.dimension-bar .label span:first-child {
    color: var(--text-secondary);
}

.dimension-bar .label span:last-child {
    font-weight: 600;
}

/* Fondo de la barra de progreso */
.progress-bg {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

/* Relleno de la barra */
.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;  /* Animación suave */
}

.progress-fill.green { background: var(--neon-green); }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.red { background: var(--coral-red); }


/* =============================================
   CÍRCULO DE PUNTUACIÓN
   ============================================= */

.score-display {
    text-align: center;
    padding: 20px;
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;           /* Hace que sea redondo */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    border: 4px solid;
}

.score-circle.low { border-color: var(--neon-green); }
.score-circle.medium { border-color: var(--yellow); }
.score-circle.high { border-color: var(--coral-red); }

.score-circle .score-value {
    font-size: 2.5rem;
    font-weight: 800;
}

.score-circle .score-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}


/* =============================================
   NIVELES DE RIESGO (BADGES)
   ============================================= */

.risk-level {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.risk-level.low { background: var(--neon-green-dim); color: var(--neon-green); }
.risk-level.medium { background: var(--yellow-dim); color: var(--yellow); }
.risk-level.high { background: var(--coral-red-dim); color: var(--coral-red); }


/* =============================================
   DISEÑO RESPONSIVE (MÓVILES)
   ============================================= */

@media (max-width: 768px) {
    /* En pantallas pequeñas, el sidebar se hace más estrecho */
    .sidebar {
        width: 70px;
        padding: 20px 0;
    }
    
    .sidebar .logo {
        font-size: 1.2rem;
        padding: 0 20px;
        margin-bottom: 30px;
    }
    
    /* Ocultar texto de los enlaces, solo mostrar iconos */
    .sidebar ul li a {
        padding: 14px 20px;
        justify-content: center;
    }
    
    .sidebar ul li a span {
        display: none;
    }
    
    .content {
        margin-left: 70px;
        padding: 20px;
    }
    
    /* Las secciones de resultados pasan a una columna */
    .results-section {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
