/* ============================================
   ?? DISEÑO INSPIRADO EN LA IMAGEN DE REFERENCIA
   ============================================ */
:root {
    --login-purple: #7c3aed;
    --login-purple-dark: #6d28d9;
    --login-purple-light: #a78bfa;
    --login-white: #ffffff;
    --login-gray: #64748b;
    --login-gray-light: #94a3b8;
    --login-border: #e2e8f0;
    --login-bg-purple: #9333ea;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================
   ?? FONDO VIOLETA (como en la imagen)
   ============================================ */
#login-page-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #a855f7 0%, var(--login-bg-purple) 50%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* Formas decorativas de fondo */
#login-page-wrapper::before,
#login-page-wrapper::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 20s ease-in-out infinite;
}

#login-page-wrapper::before {
    width: 400px;
    height: 400px;
    top: -10%;
    left: -5%;
}

#login-page-wrapper::after {
    width: 300px;
    height: 300px;
    bottom: -10%;
    right: -5%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, 20px) scale(1.1); }
}

/* ============================================
   ?? TARJETA BLANCA PRINCIPAL (como en la imagen)
   ============================================ */
#login-container {
    background: var(--login-white);
    border-radius: 3rem;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 10;
    max-width: 1100px;
    width: 100%;
    animation: slideIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   ?? BOTONES CIRCULARES (esquina superior derecha)
   ============================================ */
#login-action-buttons {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: flex;
    gap: 0.75rem;
    z-index: 20;
}

.login-icon-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--login-purple);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    transition: all 0.3s ease;
}

.login-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
    background: var(--login-purple-dark);
}

/* ============================================
   ?? LAYOUT DE DOS COLUMNAS (Logo + Formulario)
   ============================================ */
#login-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    min-height: 500px;
}

/* ============================================
   ?? COLUMNA IZQUIERDA: Logo IEI
   ============================================ */
#login-left-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2rem;
}

#login-logo-iei {
    text-align: center;
    position: relative;
    z-index: 2;
}

#iei-text {
    font-size: 8rem;
    font-weight: 900;
    color: var(--login-purple);
    margin: 0;
    line-height: 1;
    letter-spacing: 0.1em;
    text-shadow: 
        0 4px 20px rgba(124, 58, 237, 0.3),
        0 8px 40px rgba(124, 58, 237, 0.2);
    animation: logoFloat 3s ease-in-out infinite;
}

#iei-subtitle {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--login-gray);
    margin: 1rem 0 0 0;
    letter-spacing: 0.05em;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Decoraciones alrededor del logo */
.login-decoration {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.decoration-circle {
    position: absolute;
    border-radius: 50%;
    background: var(--login-purple);
    opacity: 0.15;
}

.decoration-circle-1 {
    width: 80px;
    height: 80px;
    top: 10%;
    left: 15%;
    animation: pulse 3s ease-in-out infinite;
}

.decoration-circle-2 {
    width: 60px;
    height: 60px;
    bottom: 20%;
    right: 10%;
    animation: pulse 3s ease-in-out infinite 1.5s;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.15; }
    50% { transform: scale(1.2); opacity: 0.25; }
}

.decoration-shape {
    position: absolute;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: linear-gradient(135deg, var(--login-purple-light), var(--login-purple));
    opacity: 0.1;
}

.decoration-shape-1 {
    width: 120px;
    height: 120px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================
   ?? COLUMNA DERECHA: Formulario
   ============================================ */
#login-right-section {
    padding: 2rem 1.5rem;
}

#login-header {
    margin-bottom: 2.5rem;
}

#login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

/* ============================================
   ?? FORMULARIO
   ============================================ */
#login-form-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-form-group {
    margin-bottom: 0;
}

.login-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--login-gray);
    margin-bottom: 0.5rem;
}

.login-input-wrapper {
    position: relative;
}

.login-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--login-purple);
    z-index: 1;
}

.login-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1rem;
    border: 2px solid var(--login-border);
    border-radius: 0.75rem;
    background: var(--login-white);
    color: #1e293b;
    transition: all 0.3s ease;
    outline: none;
}

.login-input:focus {
    border-color: var(--login-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.login-input::placeholder {
    color: var(--login-gray-light);
}

/* ============================================
   ?? MENSAJE DE ERROR
   ============================================ */
.login-error-message {
    padding: 0.875rem 1rem;
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    border-radius: 0.5rem;
    color: #991b1b;
    font-size: 0.875rem;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ============================================
   ?? ENLACES (Contraseña olvidada + Registro)
   ============================================ */
#login-links-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.login-link {
    font-size: 0.875rem;
    color: var(--login-gray);
    text-decoration: none;
    transition: color 0.3s;
}

.login-link:hover {
    color: var(--login-purple);
    text-decoration: underline;
}

#login-register-link {
    font-weight: 600;
    color: var(--login-purple);
}

#login-register-link:hover {
    color: var(--login-purple-dark);
}

/* ============================================
   ?? BOTÓN PRIMARIO
   ============================================ */
.login-btn-primary {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--login-purple);
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
    margin-top: 1rem;
}

.login-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
    background: var(--login-purple-dark);
}

.login-btn-primary:active {
    transform: translateY(0);
}

.login-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   ? SPINNER
   ============================================ */
.login-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   ?? OFFCANVAS DE SOPORTE
   ============================================ */
#login-offcanvas-header {
    background: var(--login-purple);
    color: white;
    padding: 2rem 1.5rem;
}

.login-offcanvas-icon {
    width: 24px;
    height: 24px;
    margin-right: 0.75rem;
}

#loginSupportOffcanvasLabel {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 700;
}

#login-offcanvas-header .btn-close {
    filter: brightness(0) invert(1);
}

#login-offcanvas-body {
    padding: 2rem 1.5rem;
    background: #f8fafc;
}

.login-support-intro {
    text-align: center;
    color: var(--login-gray);
    margin-bottom: 1.5rem;
}

.login-support-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-support-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.login-support-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

.login-support-icon {
    width: 48px;
    height: 48px;
    padding: 12px;
    background: var(--login-purple);
    border-radius: 50%;
    color: white;
    flex-shrink: 0;
}

.login-support-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.25rem 0;
}

.login-support-detail {
    font-size: 0.9375rem;
    color: var(--login-gray);
    margin: 0;
}

/* ============================================
   ?? RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    #login-content-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    #login-left-section {
        display: none; /* Ocultar logo grande en tablets */
    }

    #iei-text {
        font-size: 6rem;
    }
}

@media (max-width: 768px) {
    #login-container {
        padding: 2rem;
        border-radius: 2rem;
    }

    #login-action-buttons {
        top: 1.5rem;
        right: 1.5rem;
    }

    .login-icon-btn {
        width: 42px;
        height: 42px;
    }

    #login-title {
        font-size: 1.5rem;
    }

    /* MOSTRAR LOGO IEI PEQUEÑO EN MÓVIL */
    #login-left-section {
        display: block !important;
        position: absolute;
        top: 1.5rem;
        left: 1.5rem;
        padding: 0;
        z-index: 15;
    }

    #login-logo-iei {
        text-align: left;
    }

    #iei-text {
        font-size: 2.5rem; /* Pequeño para móvil */
        margin: 0;
        text-shadow: 
            0 2px 10px rgba(124, 58, 237, 0.3),
            0 4px 20px rgba(124, 58, 237, 0.2);
    }

    #iei-subtitle {
        font-size: 0.75rem;
        margin: 0.25rem 0 0 0;
    }

    /* Ocultar decoraciones en móvil */
    .login-decoration {
        display: none;
    }

    /* Ajustar header del formulario para dar espacio al logo */
    #login-header {
        margin-top: 3.5rem;
    }
}

@media (max-width: 480px) {
    #login-page-wrapper {
        padding: 1rem;
    }

    #login-container {
        padding: 1.5rem;
    }

    #login-right-section {
        padding: 1rem 0.5rem;
    }

    #login-title {
        font-size: 1.25rem;
    }

    /* Logo IEI aún más pequeño en pantallas muy pequeñas */
    #iei-text {
        font-size: 2rem;
    }

    #iei-subtitle {
        font-size: 0.65rem;
    }

    #login-left-section {
        top: 1rem;
        left: 1rem;
    }
}

/* ============================================
   ? OPTIMIZACIONES
   ============================================ */
#login-container,
.login-icon-btn,
.login-btn-primary,
#iei-text {
    will-change: transform;
    backface-visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
