/**
 * FUERZA OPERATIVA - FO (TM)
 * Estilos de Autenticación
 * Login, Registro, Recuperación
 */

/* ============================================
   AUTH PAGE LAYOUT
   ============================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================
   BACKGROUND EFFECTS
   ============================================ */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.auth-bg-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.auth-bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: pulse 8s ease-in-out infinite;
}

.auth-bg-glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.auth-bg-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.3) 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
    animation-delay: -2s;
}

.auth-bg-glow-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -4s;
}

/* ============================================
   AUTH CONTAINER
   ============================================ */
.auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-height: 100vh;
    height: auto;
}

@media (max-width: 1024px) {
    .auth-container {
        grid-template-columns: 1fr;
        min-height: auto;
    }
}

/* ============================================
   BRANDING SIDE
   ============================================ */
.auth-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    position: relative;
    overflow: hidden;
}

@media (max-width: 1024px) {
    .auth-branding {
        display: none;
    }
}

.auth-branding::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 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='%233b82f6' fill-opacity='0.03'%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.5;
}

.auth-branding-content {
    position: relative;
    z-index: 1;
    max-width: 480px;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.auth-logo-icon {
    width: 70px;
    height: 70px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-glow);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.auth-logo-icon svg {
    width: 40px;
    height: 40px;
}

.auth-logo-text h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.auth-logo-text p {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

.auth-branding-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
}

.auth-branding-desc {
    font-size: 1.125rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: var(--space-2xl);
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.auth-feature:hover {
    border-color: var(--glass-border-hover);
    transform: translateX(5px);
}

.auth-feature-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.auth-feature-icon svg {
    width: 22px;
    height: 22px;
}

.auth-feature span {
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================
   FORM SIDE
   ============================================ */
.auth-form-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

.auth-form-container {
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.6s ease;
}

/* Asegurar que los inputs ocupen todo el ancho */
.auth-form .form-group {
    width: 100%;
}

.auth-form .form-icon-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
}

.auth-form .form-input,
.auth-form .form-select {
    width: 100%;
    flex: 1;
}

.auth-form-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.auth-form-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.auth-form-header p {
    color: var(--text-muted);
}

.auth-form {
    margin-bottom: var(--space-xl);
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: color var(--transition-fast);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.password-toggle:hover {
    color: var(--text-primary);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

/* Form Options */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
}

.forgot-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-primary-light);
}

.forgot-link:hover {
    color: var(--color-primary);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: var(--space-xl) 0;
    color: var(--text-muted);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.auth-divider span {
    padding: 0 var(--space-md);
    font-size: 0.875rem;
}

/* Register Section */
.auth-register {
    text-align: center;
}

.auth-register p {
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

/* Help Section */
.auth-help {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.auth-help p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-help svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   REGISTER FORM SPECIFIC
   ============================================ */
.register-steps {
    display: flex;
    justify-content: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xl);
}

.register-step {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--glass-bg-light);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.register-step.active {
    background: var(--gradient-primary);
    color: white;
}

.register-step.completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-secondary-light);
}

.register-step-number {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.register-step.completed .register-step-number {
    background: var(--color-secondary);
}

.register-step-content {
    display: none;
}

.register-step-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.register-nav {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.register-nav .btn {
    flex: 1;
}

/* File Upload */
.file-upload {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-xl);
    background: var(--glass-bg-light);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.file-upload:hover {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.05);
}

.file-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.file-upload-text {
    text-align: center;
}

.file-upload-text strong {
    color: var(--color-primary-light);
}

.file-upload-text span {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* Avatar Preview */
.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--color-primary);
    margin: 0 auto var(--space-lg);
}

/* ============================================
   FORGOT PASSWORD
   ============================================ */
.forgot-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-xl);
    color: white;
    box-shadow: var(--shadow-glow);
}

.forgot-icon svg {
    width: 40px;
    height: 40px;
}

.forgot-success {
    text-align: center;
}

.forgot-success-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-xl);
    color: white;
    box-shadow: var(--shadow-glow-success);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .auth-form-wrapper {
        padding: var(--space-lg);
    }
    
    .auth-form-header h2 {
        font-size: 1.5rem;
    }
    
    .form-options {
        flex-direction: column;
        gap: var(--space-md);
        align-items: flex-start;
    }
    
    .register-steps {
        flex-direction: column;
    }
    
    .register-nav {
        flex-direction: column;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   LOADING STATES
   ============================================ */
.btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ============================================
   ERROR STATES
   ============================================ */
.form-input-error {
    border-color: var(--color-danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* Fix para iconos SVG en formularios */
.form-icon-wrapper svg,
.form-icon svg,
.auth-form svg {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    flex-shrink: 0;
}

.password-toggle svg {
    width: 18px !important;
    height: 18px !important;
}

.auth-feature-icon svg {
    width: 24px !important;
    height: 24px !important;
}

.auth-logo-icon svg {
    width: 40px !important;
    height: 40px !important;
}

/* Asegurar que los SVGs no se desborden */
svg {
    max-width: 100%;
    max-height: 100%;
}

.form-error {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
    font-size: 0.8125rem;
    color: var(--color-danger);
}

.form-error::before {
    content: '⚠️';
}
