/**
 * @file auth.css
 * @description Estilos para el sistema de autenticación de AutoSecurity
 * @author Sistema AutoSecurity
 * @date 2026-01-06
 *
 * Paleta de colores:
 * - Azul Marino: #003366
 * - Azul Medio: #004080
 * - Azul Claro: #0066CC
 * - Blanco: #FFFFFF
 * - Gris Claro: #F5F7FA
 * - Gris Medio: #E8EBF0
 * - Gris Oscuro: #6B7280
 */

:root {
    /* Colores principales AutoSecurity */
    --auto-azul-marino: #003366;
    --auto-azul-medio: #004080;
    --auto-azul-claro: #0066CC;
    --auto-blanco: #FFFFFF;
    --auto-gris-claro: #F5F7FA;
    --auto-gris-medio: #E8EBF0;
    --auto-gris-oscuro: #6B7280;
    --auto-verde: #10B981;
    --auto-rojo: #EF4444;
    --auto-amarillo: #F59E0B;
}

/* ===== ESTILOS GENERALES ===== */
body {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    color: #1F2937;
}

/* Clases de color AutoSecurity */
.text-auto-marino {
    color: var(--auto-azul-marino) !important;
}

.text-auto-medio {
    color: var(--auto-azul-medio) !important;
}

.text-auto-claro {
    color: var(--auto-azul-claro) !important;
}

.bg-auto-marino {
    background-color: var(--auto-azul-marino) !important;
}

.bg-auto-medio {
    background-color: var(--auto-azul-medio) !important;
}

.bg-auto-gris {
    background-color: var(--auto-gris-claro) !important;
}

/* Botones institucionales */
.btn-auto-primary {
    background-color: var(--auto-azul-marino);
    color: white;
    border: none;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', 'Arial', sans-serif;
}

.btn-auto-primary:hover {
    background-color: var(--auto-azul-medio);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.btn-auto-secondary {
    background-color: var(--auto-gris-medio);
    color: var(--auto-azul-marino);
    border: none;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-auto-secondary:hover {
    background-color: var(--auto-gris-oscuro);
    color: white;
}

.btn-outline-auto {
    border: 2px solid var(--auto-azul-marino);
    color: var(--auto-azul-marino);
    font-weight: 500;
    background: transparent;
    border-radius: 8px;
    padding: 0.75rem 2rem;
    transition: all 0.3s ease;
}

.btn-outline-auto:hover {
    background-color: var(--auto-azul-marino);
    color: white;
    border-color: var(--auto-azul-marino);
}

/* ===== PÁGINA DE LOGIN ===== */
.login-layout {
    display: flex;
    height: 100vh;
    min-height: 600px;
    overflow: hidden;
}

/* Panel izquierdo - Información */
.login-info-panel {
    flex: 1;
    background: linear-gradient(135deg,
        var(--auto-azul-marino) 0%,
        var(--auto-azul-medio) 50%,
        var(--auto-azul-claro) 100%);
    color: white;
    padding: 60px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-width: 480px;
}

.login-info-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.3;
    pointer-events: none;
}

.login-logo {
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.login-logo img {
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.login-info-content {
    max-width: 500px;
    position: relative;
    z-index: 1;
}

.login-info-title {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 24px;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 40px 0;
}

.login-feature-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.login-feature-icon {
    margin-right: 12px;
    color: var(--auto-verde);
    flex-shrink: 0;
    font-size: 1.3rem;
    margin-top: 2px;
}

/* Panel derecho - Formulario */
.login-form-panel {
    flex: 1;
    background-color: var(--auto-blanco);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    min-width: 350px;
    overflow-y: auto;
}

.login-form-container {
    width: 100%;
    max-width: 420px;
    padding: 20px 0;
}

.login-form-title {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--auto-azul-marino);
    margin-bottom: 8px;
}

.login-form-subtitle {
    color: var(--auto-gris-oscuro);
    margin-bottom: 32px;
    font-size: 0.95rem;
}

/* Formulario */
.form-group-auto {
    margin-bottom: 24px;
}

.form-label-auto {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--auto-azul-marino);
    font-size: 0.9rem;
}

.form-input-auto {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--auto-gris-medio);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: var(--auto-blanco);
    box-sizing: border-box;
}

.form-input-auto:focus {
    outline: none;
    border-color: var(--auto-azul-marino);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
    background-color: white;
}

.form-input-auto.is-invalid {
    border-color: var(--auto-rojo);
}

.form-input-auto.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.invalid-feedback {
    color: var(--auto-rojo);
    font-size: 0.85rem;
    margin-top: 6px;
    display: none;
}

.form-input-auto.is-invalid ~ .invalid-feedback {
    display: block;
}

.btn-login-auto {
    width: 100%;
    padding: 14px;
    background-color: var(--auto-azul-marino);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.btn-login-auto:hover:not(:disabled) {
    background-color: var(--auto-azul-medio);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 51, 102, 0.25);
}

.btn-login-auto:disabled {
    background-color: var(--auto-gris-medio);
    cursor: not-allowed;
}

.login-links {
    text-align: center;
    margin: 20px 0;
}

.login-link {
    color: var(--auto-azul-medio);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.login-link:hover {
    color: var(--auto-azul-claro);
    text-decoration: underline;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 28px 0;
    color: var(--auto-gris-oscuro);
    font-size: 0.9rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--auto-gris-medio);
}

.divider span {
    padding: 0 16px;
}

/* Alert Messages */
.alert-auto {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-auto-success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #10B981;
}

.alert-auto-error {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #EF4444;
}

.alert-auto-info {
    background-color: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #3B82F6;
}

.alert-auto-warning {
    background-color: #FEF3C7;
    color: #92400E;
    border: 1px solid #F59E0B;
}

/* Checkbox personalizado */
.form-check-auto {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.form-check-auto input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--auto-azul-marino);
}

.form-check-auto label {
    cursor: pointer;
    user-select: none;
    color: var(--auto-gris-oscuro);
    font-size: 0.9rem;
}

/* Loading Spinner */
.spinner-auto {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Animaciones */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 992px) {
    .login-layout {
        flex-direction: column;
    }

    .login-info-panel {
        min-width: 100%;
        min-height: 300px;
        padding: 40px 30px;
    }

    .login-info-title {
        font-size: 1.5rem;
    }

    .login-features-list {
        margin-bottom: 20px;
    }

    .login-feature-item {
        font-size: 0.85rem;
        margin-bottom: 14px;
    }

    .login-form-panel {
        min-width: 100%;
        padding: 30px 20px;
    }

    .login-form-container {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .login-info-panel {
        padding: 30px 20px;
    }

    .login-form-title {
        font-size: 1.5rem;
    }

    .form-input-auto {
        padding: 12px 14px;
    }

    .btn-login-auto {
        padding: 12px;
    }
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 8px;
    height: 4px;
    background-color: var(--auto-gris-medio);
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.password-strength-weak {
    width: 33%;
    background-color: var(--auto-rojo);
}

.password-strength-medium {
    width: 66%;
    background-color: var(--auto-amarillo);
}

.password-strength-strong {
    width: 100%;
    background-color: var(--auto-verde);
}

.password-strength-text {
    font-size: 0.8rem;
    margin-top: 4px;
    color: var(--auto-gris-oscuro);
}

/* 2FA Code Input */
.code-input-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0;
}

.code-input {
    width: 50px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid var(--auto-gris-medio);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.code-input:focus {
    outline: none;
    border-color: var(--auto-azul-marino);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

/* Success Checkmark Animation */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.success-checkmark .check-icon {
    width: 80px;
    height: 80px;
    position: relative;
    border-radius: 50%;
    box-sizing: content-box;
    border: 4px solid var(--auto-verde);
}

.success-checkmark .check-icon::before {
    top: 3px;
    left: -2px;
    width: 30px;
    transform-origin: 100% 50%;
    border-radius: 100px 0 0 100px;
}

.success-checkmark .check-icon::after {
    top: 0;
    left: 30px;
    width: 60px;
    transform-origin: 0 50%;
    border-radius: 0 100px 100px 0;
    animation: rotate-circle 4.25s ease-in;
}

.success-checkmark .check-icon::before,
.success-checkmark .check-icon::after {
    content: '';
    height: 100px;
    position: absolute;
    background: var(--auto-blanco);
    transform: rotate(-45deg);
}

.success-checkmark .icon-line {
    height: 5px;
    background-color: var(--auto-verde);
    display: block;
    border-radius: 2px;
    position: absolute;
    z-index: 10;
}

.success-checkmark .icon-line.line-tip {
    top: 46px;
    left: 14px;
    width: 25px;
    transform: rotate(45deg);
    animation: icon-line-tip 0.75s;
}

.success-checkmark .icon-line.line-long {
    top: 38px;
    right: 8px;
    width: 47px;
    transform: rotate(-45deg);
    animation: icon-line-long 0.75s;
}

@keyframes rotate-circle {
    0% {
        transform: rotate(-45deg);
    }
    5% {
        transform: rotate(-45deg);
    }
    12% {
        transform: rotate(-405deg);
    }
    100% {
        transform: rotate(-405deg);
    }
}

@keyframes icon-line-tip {
    0% {
        width: 0;
        left: 1px;
        top: 19px;
    }
    54% {
        width: 0;
        left: 1px;
        top: 19px;
    }
    70% {
        width: 50px;
        left: -8px;
        top: 37px;
    }
    84% {
        width: 17px;
        left: 21px;
        top: 48px;
    }
    100% {
        width: 25px;
        left: 14px;
        top: 45px;
    }
}

@keyframes icon-line-long {
    0% {
        width: 0;
        right: 46px;
        top: 54px;
    }
    65% {
        width: 0;
        right: 46px;
        top: 54px;
    }
    84% {
        width: 55px;
        right: 0px;
        top: 35px;
    }
    100% {
        width: 47px;
        right: 8px;
        top: 38px;
    }
}
