/**
 * Estilos Corporativos para Login - Delafiber CRM
 * Archivo: public/css/auth/login-corporativo.css
 */

html,
body {
    height: 100%;
}

:root {
    /* Colores Corporativos Delafiber - Versión Suave para CRM */
    --primary-purple: #4A1A6B;    /* Persian Indigo suavizado (más claro) */
    --secondary-purple: #32005A;  /* Persian Indigo original (acentos) */
    --accent-pink: #E85D9A;       /* Folly suavizado (menos vibrante) */
    --light-pink: #FFE5F0;        /* Rosa muy claro para fondos */
    --dark-purple: #2A0045;       /* Morado muy oscuro para contraste */
    --soft-purple: #F5E6FF;       /* Morado muy claro para fondos */
    
    /* Colores complementarios suaves */
    --success-green: #28A745;     /* Verde para éxito */
    --warning-orange: #FF6B35;    /* Naranja para alertas */
    --text-dark: #2C3E50;         /* Texto principal */
    --text-muted: #6C757D;        /* Texto secundario */
    --white: #FFFFFF;             /* Blanco corporativo */
    --light-gray: #F8F9FA;        /* Gris muy claro */
}

.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--dark-purple) 0%, var(--primary-purple) 50%, var(--secondary-purple) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Patrón de fondo tecnológico con toque rosa */
.auth-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(90deg, rgba(232, 93, 154, 0.05) 0px, transparent 1px, transparent 40px),
        repeating-linear-gradient(0deg, rgba(232, 93, 154, 0.05) 0px, transparent 1px, transparent 40px);
    pointer-events: none;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 100px rgba(232, 93, 154, 0.25),
        0 0 0 1px rgba(232, 93, 154, 0.1);
    overflow: hidden;
    max-width: 420px; /* Aumentado de 380px */
    width: 100%;
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
    max-height: 90vh;
    margin: 0 auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--secondary-purple) 70%, var(--accent-pink) 100%);
    padding: 2.5rem 2rem; /* Ajuste de padding para mejor centrado */
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Efecto de onda en el header */
.login-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 40px;
    background: white;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    z-index: -1;
}

.company-logo {
    max-height: 70px;
    margin-bottom: 1rem;
    filter: brightness(0) invert(1); /* Logo en blanco */
    transition: transform 0.3s ease;
    display: inline-block;
    margin-left: -20px;
}

.company-logo:hover {
    transform: scale(1.05);
}

.login-header h3 {
    margin: 0.5rem 0 0.25rem;
    font-weight: 600;
    font-size: 1.75rem;
    letter-spacing: 0.5px;
    width: 100%;
    text-align: center;
}

.login-header p {
    margin: 0;
    opacity: 0.95;
    font-size: 1rem;
    font-weight: 300;
    width: 100%;
    text-align: center;
    line-height: 1.5;
}

.login-header .tagline {
    display: block;
    margin: 0.5rem auto 0;
    font-size: 0.95rem;
    opacity: 0.95;
    font-style: italic;
    color: rgba(255, 182, 213, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    max-width: 90%;
}

.login-body {
    padding: 2.5rem 2.5rem 2rem; /* Aumentado el padding horizontal */
}

/* Etiquetas de formulario */
.form-group label {
    color: var(--text-dark);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    display: block;
    padding-left: 0.5rem;
}

/* Campos de entrada */
.form-control {
    border-radius: 10px;
    padding: 1rem 1.5rem;
    border: 2px solid #E0E6ED;
    transition: all 0.3s ease;
    font-size: 1rem;
    background-color: var(--light-gray);
    width: 100%;
    box-sizing: border-box; /* Asegura que el padding no afecte el ancho */
}

.form-control:focus {
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 0.25rem rgba(232, 93, 154, 0.15);
    background-color: white;
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Iconos en inputs */
.input-group-icon {
    position: relative;
}

.input-group-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.input-group-icon .form-control {
    padding-left: 50px;
    width: 100%;
}

.btn-login {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--secondary-purple) 70%, var(--accent-pink) 100%);
    border: none;
    border-radius: 10px;
    padding: 0.9rem 2rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 
        0 4px 15px rgba(74, 26, 107, 0.35),
        0 0 20px rgba(232, 93, 154, 0.15);
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.5s ease;
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(74, 26, 107, 0.45),
        0 0 30px rgba(232, 93, 154, 0.3);
    color: white;
}

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

.btn-login i {
    margin-right: 8px;
}

.form-check-input:checked {
    background-color: var(--accent-pink);
    border-color: var(--accent-pink);
}

.form-check-label {
    color: var(--text-dark);
    font-size: 0.9rem;
}

a {
    color: var(--accent-pink);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-purple);
    text-decoration: underline;
}

/*  ALERTAS*/
.alert {
    border-radius: 10px;
    border: none;
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.alert-danger {
    background-color: #FFE5E5;
    color: #C92A2A;
    border-left: 4px solid #C92A2A;
}

.alert-success {
    background-color: #E6F9EE;
    color: var(--success-green);
    border-left: 4px solid var(--success-green);
}

.alert-info {
    background-color: var(--soft-purple);
    color: var(--primary-purple);
    border-left: 4px solid var(--primary-purple);
}

/* ============================================
   FOOTER INFORMATIVO
   ============================================ */
.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #E0E6ED;
}

.login-footer small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #F8F9FA 0%, rgba(255, 229, 240, 0.3) 100%);
    border: 1px solid rgba(232, 93, 154, 0.1);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.security-badge i {
    color: var(--accent-pink);
}

/* ============================================
   CREDENCIALES DE DEMO
   ============================================ */
.demo-credentials {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    animation: fadeIn 1s ease-out 0.5s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.demo-credentials .card {
    border: 2px solid var(--accent-pink);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 300px;
}

.demo-credentials .card-header {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--accent-pink) 100%);
    color: white;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    padding: 0.75rem 1rem;
}

.demo-credentials .card-body {
    background: white;
    padding: 1rem 1.25rem;
    line-height: 1.8;
}

.demo-credentials .card-body strong {
    color: var(--primary-purple);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.25rem;
}

.demo-credentials .card-body code {
    background-color: var(--soft-purple);
    color: var(--primary-purple);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    display: inline-block;
    margin: 0.15rem 0;
}

.demo-credentials .card-body hr {
    border-color: rgba(232, 93, 154, 0.2);
    margin: 0.75rem 0;
}

.demo-credentials .card-body i {
    margin-right: 0.25rem;
}

/* En pantallas con buena altura, ocultar el scroll vertical global en el login corporativo */
@media (min-height: 720px) {
    body.auth-page {
        overflow-y: hidden;
    }
}

/* ========== MEDIA QUERIES ========== */

/* Tabletas pequeñas y móviles grandes */
@media (max-width: 991px) {
    .login-card {
        max-width: 90%;
    }
    
    .login-header {
        padding: 2rem 2rem 3rem;
    }
    
    .login-body {
        padding: 2rem 1.5rem;
    }
}

/* Móviles medianos */
@media (max-width: 768px) {
    .auth-wrapper {
        padding: 15px;
    }
    
    .login-header h3 {
        font-size: 1.5rem;
    }
    
    .login-header p {
        font-size: 0.9rem;
    }
    
    .company-logo {
        max-height: 60px;
        margin-bottom: 0.75rem;
    }
}

/* Móviles pequeños */
@media (max-width: 576px) {
    .login-card {
        margin: 10px auto;
        border-radius: 15px;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .login-header {
        padding: 1.75rem 1.5rem 2.5rem;
    }
    
    .login-body {
        padding: 1.75rem 1.25rem 2rem;
    }
    
    .form-control {
        padding: 0.85rem 1.25rem;
        font-size: 16px; /* Evita zoom automático en iOS */
    }
    
    .btn-login {
        padding: 0.85rem 1.5rem;
        min-height: 50px; /* Tamaño mínimo para mejor toque */
    }
    
    .form-check-label, .forgot-password {
        font-size: 0.9rem;
    }
    
    .input-group-icon .form-control {
        padding-left: 45px;
    }
    
    .input-group-icon i {
        left: 12px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 400px) {
    .login-header {
        padding: 1.5rem 1.25rem 2.25rem;
    }
    
    .login-body {
        padding: 1.5rem 1rem 1.75rem;
    }
    
    .company-logo {
        max-height: 50px;
        margin-bottom: 0.5rem;
    }
    
    .login-header h3 {
        font-size: 1.35rem;
    }
    
    .form-control {
        padding: 0.75rem 1.1rem;
    }
    
    .btn-login {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
}

/* Manejo de teclado en móviles */
@media (max-height: 700px) {
    .auth-wrapper {
        align-items: flex-start;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .login-card {
        margin: 1rem auto;
        max-height: none;
    }
    
    .login-header {
        padding-top: 1.5rem;
        padding-bottom: 2rem;
    }
}

/* Ajustes para pantallas en modo horizontal */
@media (max-width: 991px) and (orientation: landscape) {
    .auth-wrapper {
        padding: 10px 0;
    }
    
    .login-card {
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .login-header {
        padding: 1.25rem 1.5rem 1.75rem;
    }
    
    .login-body {
        padding: 1.25rem 1.25rem 1.5rem;
    }
    
    .company-logo {
        max-height: 50px;
        margin-bottom: 0.5rem;
    }
}
    
    .login-header {
        padding: 2rem 1.5rem;
    }
    
    .login-body {
        padding: 2rem 1.5rem;
    }
    
    .company-logo {
        max-height: 50px;
    }
    
    .login-header h3 {
        font-size: 1.5rem;
    }
    
    .demo-credentials {
        display: none; /* Ocultar en móvil */
    }

/* ============================================
   ANIMACIONES ADICIONALES
   ============================================ */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Loading spinner */
.btn-login.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.form-control.is-invalid {
    border-color: #C92A2A;
    background-color: #FFE5E5;
}

.form-control.is-invalid:focus {
    border-color: #C92A2A;
    box-shadow: 0 0 0 0.25rem rgba(201, 42, 42, 0.15);
}

.invalid-feedback {
    display: none;
    color: #C92A2A;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding-left: 0.5rem;
}

.invalid-feedback i {
    margin-right: 5px;
}

.input-group-icon.password-field {
    position: relative;
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.password-toggle-btn:hover {
    color: var(--accent-pink);
    background-color: rgba(232, 93, 154, 0.1);
}

.password-toggle-btn:focus {
    outline: none;
    color: var(--primary-purple);
    background-color: rgba(74, 26, 107, 0.1);
}

.password-toggle-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.password-toggle-btn i {
    font-size: 1.3rem;
    pointer-events: none;
}

/* Ajustar padding del input cuando tiene toggle */
.input-group-icon.password-field .form-control {
    padding-right: 50px;
}
