/* ================================================
   VARIABLES CSS
   ================================================ */
:root {
    /* Colores del gradiente (inyectados dinámicamente desde JS) */
    --bg-color-1: #00A7E1;
    --bg-color-2: #0066CC;
    --bg-color-3: #004C99;

    /* Color primario personalizable */
    --primary-color: #00A7E1;

    /* Efectos Glass */
    --glass-bg: rgba(255, 255, 255, 0.35);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-shadow: rgba(0, 0, 0, 0.1);

    /* Colores de texto */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-disabled: rgba(255, 255, 255, 0.5);

    /* Estados de validación */
    --color-success: #4CAF50;
    --color-error: #f44336;
    --color-warning: #ff9800;

    /* Espaciado (8px grid system) */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 32px;
    --space-xl: 40px;

    /* Bordes */
    --border-radius: 12px;
    --border-radius-sm: 8px;

    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Gradientes para modal */
    --modal-glass-bg: rgba(255, 255, 255, 0.85);

    --error-color-inline: rgba(61, 61, 61, 0.5);
    --modal-soporte-txt: rgba(61, 61, 61, 0.5);
    --text-white: #FFFFFF;
}

/* ================================================
   ESTILOS BASE
   ================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
            var(--bg-color-1) 0%,
            var(--bg-color-2) 50%,
            var(--bg-color-3) 100%);
    background-attachment: fixed;
    position: relative;
    overflow: hidden;
}

/* ================================================
   CONTENEDOR PRINCIPAL - Efecto Glassmorphism
   ================================================ */
.glass-container {
    width: 400px;
    height: 580px;
    padding: var(--space-xl);
    border-radius: 25px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 -8px 16px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;

    /* Animación de entrada */
    animation: fadeSlideUp 0.6s ease-out;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================
   HEADER DEL LOGIN
   ================================================ */
.login-header {
    text-align: center;
    margin-bottom: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}


.login-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-white);
    letter-spacing: 2px;

    /* Animación de entrada con delay */
    animation: fadeSlideUp 0.6s ease-out 0.2s both;
}

.service-title {
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
    animation: fadeSlideUp 0.6s ease forwards;
    animation-delay: 0.1s;
    opacity: 0;
}

.service-logo {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
    animation: fadeSlideUp 0.6s ease forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

/* ================================================
   FORMULARIO
   ================================================ */
.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    flex: 1;
}

/* ================================================
   GRUPOS DE INPUT
   ================================================ */
.input-group {
    position: relative;

    /* Animación secuencial */
    animation: fadeSlideUp 0.6s ease-out both;
}

.input-group:nth-child(1) {
    animation-delay: 0.3s;
}

.input-group:nth-child(2) {
    animation-delay: 0.4s;
}

.input-icon {
    color: rgba(255, 255, 255, 0.8);
    /* Gris muy claro */
    position: absolute;
    left: var(--space-sm);
    top: 35%;
    transform: translateY(-50%);
    font-size: 16px;
    z-index: 2;
    pointer-events: none;
}

.input-group input {
    color: rgba(255, 255, 255, 0.9);
    /* Casi blanco */
    width: 100%;
    padding: 15px 20px;
    padding-left: 48px;
    padding-right: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    transition: var(--transition-fast);
    outline: none;
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    /* Placeholder más sutil */
}

.input-group input:hover {
    border-color: var(--glass-border-hover);
}

.input-group input:focus {
    border-color: var(--glass-border-hover);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

/* Estados de validación */
.input-group input.valid {
    border-color: var(--success-color);
}

.input-group input.invalid {
    border-color: var(--error-color-inline);
}

/* Icono toggle password */
.toggle-password {
    position: absolute;
    left: var(--space-sm);
    top: 68%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 2;
}

.toggle-password:hover {
    color: rgba(255, 255, 255, 1);
}

/* Mensajes de error */
.error-message {
    display: block;
    font-size: 17px;
    font-weight: 500;
    color: var(--error-color-inline);
    margin-top: 6px;
    padding-left: var(--space-xs);
    min-height: 18px;
    opacity: 0;
    transform: translateY(-5px);
    transition: var(--transition-fast);
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* ================================================
   CHECKBOX PERSONALIZADO - Recordarme
   ================================================ */
.remember-group {
    animation: fadeSlideUp 0.6s ease-out 0.5s both;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-white-80);
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    margin-right: var(--space-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.checkbox-container:hover .checkmark {
    border-color: var(--glass-border-hover);
}

.checkbox-container input:checked~.checkmark {
    background: linear-gradient(135deg, var(--btn-gradient-1), var(--btn-gradient-2));
    border-color: transparent;
}

.checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: var(--transition-fast);
}

.checkbox-container input:checked~.checkmark::after {
    transform: rotate(45deg) scale(1);
}

/* ================================================
   BOTÓN DE LOGIN
   ================================================ */
.btn-login {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--bg-color-2) 100%);
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    color: var(--text-white);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(94, 151, 255, 0.3);
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
    margin-top: auto;

    /* Animación de entrada */
    animation: fadeSlideUp 0.6s ease-out 0.6s both;
}

.btn-login:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 25px rgba(94, 151, 255, 0.4);
    background: linear-gradient(135deg, var(--bg-color-2) 0%, var(--bg-color-3) 100%);
}

.btn-login:active {
    transform: scale(0.98);
}

/* Efecto de onda (ripple) */
.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    pointer-events: none;
}

.btn-ripple.animate {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */

/* Tablet */
@media (max-width: 768px) {
    .glass-container {
        width: 70%;
        max-width: 400px;
        height: auto;
        min-height: 525px;
        padding: var(--space-lg);
    }
}

/* Mobile */
@media (max-width: 480px) {
    .glass-container {
        width: 90%;
        border-radius: 20px;
        padding: var(--space-md);
        min-height: 525px;
    }

    .login-header i {
        font-size: 50px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .input-group input {
        padding: 12px 16px;
        padding-left: 44px;
        padding-right: 44px;
        font-size: 14px;
    }

    .btn-login {
        padding: 12px 32px;
        font-size: 14px;
    }

    /* Ajustar burbujas para móvil */
    .shape-1 {
        width: 100px;
        height: 100px;
    }

    .shape-3 {
        width: 80px;
        height: 80px;
    }
}

/* ================================================
   ACCESIBILIDAD - Focus visible
   ================================================ */
.btn-login:focus-visible,
.checkbox-container input:focus-visible~.checkmark {
    outline: 2px solid var(--text-white);
    outline-offset: 2px;
}

/* ================================================
   MODAL - Glassmorphism
   ================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    width: 90%;
    max-width: 400px;
    padding: var(--space-xl);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.40);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    position: relative;
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

/* Variantes de borde según tipo */
.modal-container.success {
    border-color: var(--modal-border-success);
    box-shadow:
        0 8px 32px rgba(74, 222, 128, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.modal-container.error {
    border-color: var(--modal-border-error);
    box-shadow:
        0 8px 32px rgba(248, 113, 113, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: shake 0.5s ease;
}

/* Botón cerrar (X) */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-white-80);
    font-size: 18px;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
}

/* Icono del modal */
.modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-md);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.modal-icon.success {
    background: rgba(74, 222, 128, 0.2);
    color: var(--icon-success);
}

.modal-icon.error {
    background: rgba(248, 113, 113, 0.2);
    color: var(--icon-error);
}

/* Animación checkmark */
.modal-icon.success i {
    animation: checkDraw 0.5s ease 0.2s both;
}

@keyframes checkDraw {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Título y mensaje del modal */
.modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: var(--space-sm);
}

.modal-message {
    font-size: 16px;
    color: var(--text-white-80);
    line-height: 1.5;
}

/* Animación shake para errores */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0) scale(1);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px) scale(1);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px) scale(1);
    }
}

/* ================================================
   LOADER/SPINNER EN BOTÓN
   ================================================ */
.btn-login.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-login .btn-text {
    display: inline-block;
}

.btn-login .btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--text-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-login.loading .btn-text {
    display: none;
}

.btn-login.loading .btn-spinner {
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================================
   BOTÓN FLOTANTE DE SOPORTE
   ================================================ */
.support-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    /* Fondo semi-transparente */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeSlideUp 0.6s ease-out 0.8s both;
}

.support-btn:hover {
    transform: scale(1.1);
    box-shadow:
        0 12px 40px rgba(241, 242, 243, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    border-color: var(--glass-border-hover);
}

.support-btn:active {
    transform: scale(0.95);
}

.support-btn i {
    color: azure;
    pointer-events: none;
}

/* ================================================
   MODAL DE SOPORTE
   ================================================ */
.modal-container.support {
    max-width: 450px;
    /* Más ancho para el contenido */
    background: rgba(255, 255, 255, 0.40);
    /* Mismo que modal base */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 8px 32px rgba(0, 167, 225, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.modal-icon.support {
    background: rgba(0, 167, 225, 0.2);
    color: #00A7E1;
}

.support-content {
    margin-top: var(--space-lg);
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: var(--space-xs);
}

.support-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.05);
    /* Fondo sutil */
}

.support-item.clickable {
    color: var(--modal-soporte-txt);
    cursor: pointer;
}

.support-item.clickable:hover {
    background: rgba(255, 255, 255, 0.15);
    /* Hover más visible */
    color: #ffffff;
    transform: translateX(5px);
    /* Efecto de desplazamiento */
}

.support-item.clickable:hover .support-item-icon {
    transform: scale(1.1);
}

.support-item-icon {
    font-size: 20px;
    color: #00A7E1;
    min-width: 24px;
    transition: var(--transition-fast);
}

.support-item-text {
    color: var(--modal-soporte-txt);
    font-size: 15px;
    color: inherit;
    flex: 1;
}

/* Separador entre items */
.support-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: var(--space-xs) 0;
}

/* Sección de contacto */
.contact-section {
    margin-bottom: var(--space-md);
}

.contact-section-title {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-sm);
}

/* Iconos de redes sociales con colores específicos */
.whatsapp-icon {
    color: #25D366 !important;
}

.facebook-icon {
    color: #1877F2 !important;
}

.instagram-icon {
    background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF, #515BD4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Responsive soporte */
@media (max-width: 480px) {
    .support-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 20px;
        right: 20px;
    }

    .modal-container.support {
        max-width: 90%;
    }

    .support-item {
        padding: 12px;
    }

    .support-item-text {
        font-size: 14px;
    }
}