/* ============================================
   Variables Globales y Configuración Base
   ============================================ */
:root {
    /* Colores principales */
    --primary-color: #0b7dda;
    --secondary-color: #1e88e5;
    --accent-color: #00bcd4;
    
    /* Colores de estado */
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    
    /* Colores neutros */
    --dark-color: #263238;
    --light-color: #eceff1;
    --white: #ffffff;
    
    /* Colores de texto */
    --text-primary: #37474f;
    --text-secondary: #78909c;
    
    /* Sombras */
    --shadow-light: rgba(0, 188, 212, 0.15);
    --shadow-medium: rgba(11, 125, 218, 0.25);
    --shadow-dark: rgba(38, 50, 56, 0.3);
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-accent: linear-gradient(135deg, var(--accent-color), #26c6da);
    
    /* Variables de diseño */
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Estilos base del cuerpo */
body {
    font-family: 'Inter', sans-serif;
    background: var(--gradient-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ============================================
   Selector de Temas y Personalizador
   ============================================ */

/* Botón de activación del personalizador */
.tema-toggle-btn {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(11, 125, 218, 0.3);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    animation: pulse-personalizar 2s infinite;
}

.tema-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(11, 125, 218, 0.4);
}

/* Tooltip del botón */
.tema-toggle-btn .tooltip {
    position: absolute;
    right: 60px;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tema-toggle-btn:hover .tooltip {
    opacity: 1;
}

/* Animación del botón */
@keyframes pulse-personalizar {
    0% { box-shadow: 0 0 0 0 rgba(207, 212, 216, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(163, 189, 211, 0); }
    100% { box-shadow: 0 0 0 0 rgba(146, 165, 180, 0); }
}

/* Contenedor del personalizador */
.tema-selector-contenedor {
    position: fixed;
    top: 45px;
    right: 60px;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Personalizador de temas */
.tema-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--white);
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 10px 30px var(--shadow-medium);
    transition: var(--transition);
    width: 320px;
    max-height: 90vh;
    overflow: hidden;
    transform-origin: top right;
}

/* Encabezado del personalizador */
.tema-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--gradient-primary);
    color: white;
}

.tema-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

/* Pestañas del personalizador */
.tema-pestañas {
    display: flex;
    border-bottom: 1px solid var(--light-color);
}

.tema-pestaña {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.tema-pestaña.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tema-pestaña:hover:not(.active) {
    color: var(--text-primary);
}

/* Contenido del personalizador */
.tema-contenido {
    padding: 15px;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

.pestaña-contenido {
    display: none;
}

.pestaña-contenido.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Opciones de colores preestablecidos */
.color-preestablecido {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.color-opcion {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.color-opcion::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(0,0,0,0.1));
    border-radius: 6px;
}

.color-opcion:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.color-opcion.active {
    border-color: var(--white);
    box-shadow: 0 0 0 3px var(--primary-color), 0 5px 15px rgba(0,0,0,0.2);
}

.color-opcion.active::before {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    z-index: 2;
}

/* Definición de colores preestablecidos */
.color-opcion.dark-blue { background: linear-gradient(135deg, #0d47a1, #1976d2); }
.color-opcion.pink { background: linear-gradient(135deg, #e91e63, #f06292); }
.color-opcion.cyan { background: linear-gradient(135deg, #00bcd4, #4dd0e1); }
.color-opcion.indigo { background: linear-gradient(135deg, #3f51b5, #7986cb); }
.color-opcion.amber { background: linear-gradient(135deg, #ffa000, #ffca28); }
.color-opcion.blue { background: linear-gradient(135deg, #0b7dda, #1e88e5); }
.color-opcion.green { background: linear-gradient(135deg, #4caf50, #66bb6a); }
.color-opcion.purple { background: linear-gradient(135deg, #9c27b0, #ba68c8); }
.color-opcion.orange { background: linear-gradient(135deg, #ff9800, #ffb74d); }
.color-opcion.teal { background: linear-gradient(135deg, #009688, #4db6ac); }
.color-opcion.red { background: linear-gradient(135deg, #f44336, #ef5350); }

/* Selector de modo claro/oscuro */
.tema-modo-toggle {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.modo-btn {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: 2px solid var(--light-color);
    background: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.modo-btn.active {
    border-color: var(--primary-color);
    background: rgba(11, 125, 218, 0.1);
    color: var(--primary-color);
}

.modo-btn i {
    font-size: 14px;
}

/* Pestaña de personalización avanzada */
.color-selector-contenedor {
    margin-bottom: 20px;
    text-align: center;
}

.color-selector-contenedor input[type="color"] {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.color-selector-contenedor input[type="color"]:hover {
    transform: scale(1.1);
}

.color-selector-contenedor label {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Controles deslizantes */
.color-deslizante {
    margin: 20px 0;
}

.deslizante-grupo {
    margin-bottom: 15px;
}

.deslizante-grupo label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.deslizante-grupo input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--light-color);
    -webkit-appearance: none;
    outline: none;
}

.deslizante-grupo input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Botón de aplicar cambios */
.aplicar-btn-personalizado {
    width: 100%;
    padding: 10px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.aplicar-btn-personalizado:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-light);
}

/* Pestaña de configuración avanzada */
.controles-avanzados {
    margin-bottom: 20px;
}

.grupo-control {
    margin-bottom: 15px;
}

.grupo-control label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.grupo-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--light-color);
    -webkit-appearance: none;
    outline: none;
}

.grupo-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.grupo-control select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--light-color);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-primary);
    background: var(--white);
}

/* Botones de acción */
.tema-acciones {
    display: flex;
    gap: 10px;
}

.resetear-btn, .guardar-tema-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.resetear-btn {
    background: none;
    border: 2px solid var(--error-color);
    color: var(--error-color);
}

.resetear-btn:hover {
    background: rgba(244, 67, 54, 0.1);
}

.guardar-tema-btn {
    background: var(--success-color);
    color: white;
    border: none;
}

.guardar-tema-btn:hover {
    background: #66bb6a;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

/* ============================================
   Modo Oscuro
   ============================================ */

body.dark-mode {
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --light-color: #424242;
    --white: #121212;
    --shadow-medium: rgba(0, 0, 0, 0.4);
}

body.dark-mode .tema-selector {
    background: #1e1e1e;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

body.dark-mode .tema-pestaña {
    color: #b0b0b0;
}

body.dark-mode .tema-pestaña.active {
    color: var(--primary-color);
}

body.dark-mode .grupo-control select {
    background: #2d2d2d;
    color: #e0e0e0;
    border-color: #424242;
}

/* ============================================
   Animaciones de Fondo
   ============================================ */

.bg-animacion {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Burbujas flotantes */
.burbujas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.burbuja {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

/* Posiciones y tamaños de burbujas */
.burbuja:nth-child(1) { width: 80px; height: 80px; left: 10%; animation-delay: 0s; }
.burbuja:nth-child(2) { width: 120px; height: 120px; left: 20%; animation-delay: 2s; }
.burbuja:nth-child(3) { width: 60px; height: 60px; left: 35%; animation-delay: 4s; }
.burbuja:nth-child(4) { width: 100px; height: 100px; left: 50%; animation-delay: 0s; }
.burbuja:nth-child(5) { width: 70px; height: 70px; left: 65%; animation-delay: 3s; }
.burbuja:nth-child(6) { width: 90px; height: 90px; left: 80%; animation-delay: 1s; }
.burbuja:nth-child(7) { width: 50px; height: 50px; left: 15%; animation-delay: 5s; }
.burbuja:nth-child(8) { width: 110px; height: 110px; left: 75%; animation-delay: 4s; }
.burbuja:nth-child(9) { width: 40px; height: 40px; left: 45%; animation-delay: 2s; }
.burbuja:nth-child(10) { width: 85px; height: 85px; left: 90%; animation-delay: 6s; }

@keyframes float {
    0%, 100% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    50% { transform: translateY(-100px) rotate(180deg); }
}

/* Elementos flotantes médicos */
.elementos-flotantes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.elemento-flotante {
    position: absolute;
    color: rgba(255, 255, 255, 0.15);
    font-size: 40px;
    animation: medica-float 8s ease-in-out infinite;
}

/* Posiciones de elementos médicos */
.jeringa { top: 20%; left: 15%; animation-delay: 0s; }
.herraamienta-medica { top: 70%; left: 80%; animation-delay: 2s; }
.bacteria { top: 40%; left: 5%; animation-delay: 4s; }
.escudo { top: 60%; left: 90%; animation-delay: 6s; }

/* Iconos de Font Awesome */
.jeringa::before { content: '\f48e'; font-family: 'Font Awesome 5 Free'; font-weight: 900; }
.herraamienta-medica::before { content: '\f7d9'; font-family: 'Font Awesome 5 Free'; font-weight: 900; }
.bacteria::before { content: '\f672'; font-family: 'Font Awesome 5 Free'; font-weight: 900; }
.escudo::before { content: '\f3ed'; font-family: 'Font Awesome 5 Free'; font-weight: 900; }

@keyframes medica-float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* ============================================
   Contenedor del Formulario de Login
   ============================================ */

.container-center {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 
        0 20px 60px var(--shadow-medium),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
}

/* Encabezado del login */
.login-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 10px;
    background: var(--gradient-primary);
    box-shadow: 0 10px 30px var(--shadow-light);
}

.logo-text h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    margin-top: 5px;
}

/* Indicador de estado */
.pulse-circulo {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.90); box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(76, 175, 80, 0) !important; }
    100% { transform: scale(0.90); box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

/* ============================================
   Estilos del Formulario
   ============================================ */

.login-form {
    margin-bottom: 30px;
}

/* Grupos de formulario */
.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group label i {
    color: var(--primary-color);
    margin-right: 8px;
}

.form-group input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--light-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    color: var(--text-primary);
    background: var(--white);
    transition: var(--transition);
    position: relative;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px #f5f5f5;
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

/* Efecto de resaltado en focus */
.input-highlight {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--gradient-accent);
    transition: var(--transition);
    border-radius: 2px;
}

.form-group input:focus + .input-highlight {
    width: 100%;
}

/* Botón para mostrar/ocultar contraseña */
.toggle-password {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
}

.toggle-password:hover {
    color: var(--primary-color);
}

/* Opciones del formulario */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 10px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.remember-me label {
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.forgot-password:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Botón de login */
.login-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px #e2dfdf;
}

.login-btn:active {
    transform: translateY(0);
}

/* Efecto de brillo al pasar el mouse */
.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition);
}

.login-btn:hover::before {
    left: 100%;
}

/* Loader para el botón */
.btn-loader {
    display: none;
    gap: 5px;
}

.loader-dot {
    width: 8px;
    height: 8px;
    background: var(--white);
    border-radius: 50%;
    animation: loader 1.4s ease-in-out infinite both;
}

.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loader {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ============================================
   Pie de Página
   ============================================ */

.footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--light-color);
}

.essalud-logo {
    width: 80px;
    height: auto;
    margin-bottom: 15px;
    opacity: 0.8;
}

.copyright {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 5px;
}

.version {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    background: var(--light-color);
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
}

/* ============================================
   Estilos Responsivos
   ============================================ */

@media (max-width: 768px) {
    .container-center {
        padding: 15px;
    }

    .login-container {
        padding: 30px 25px;
        border-radius: 15px;
    }

    .logo-container {
        flex-direction: column;
        gap: 10px;
    }

    .logo-text h1 {
        font-size: 24px;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Ocultar algunas animaciones en móviles */
    .burbuja {
        display: none;
    }

    .elemento-flotante {
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 25px 20px;
    }

    .logo-text h1 {
        font-size: 20px;
    }

    .subtitle {
        font-size: 12px;
    }

    .form-group input {
        padding: 12px 15px;
        font-size: 14px;
    }

    .login-btn {
        padding: 14px;
        font-size: 14px;
    }
}

/* ============================================
   Estados del Formulario
   ============================================ */

/* Estado de carga */
.login-btn.loading .btn-text {
    display: none;
}

.login-btn.loading .btn-loader {
    display: flex;
}

/* Estado de éxito */
@keyframes success {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background: var(--success-color); }
    100% { transform: scale(1); }
}

.login-btn.success {
    animation: success 0.6s ease-in-out;
}























