/* ==========================================
   MODAL DE AUTENTICACIÓN PROFESIONAL
   ========================================== */

/* Botón de usuario en navbar */
.nav-user {
    margin-left: auto;
    padding-left: 20px;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.user-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.user-btn i {
    font-size: 20px;
}

.user-btn.authenticated {
    background: #34a853;
}

.user-btn.authenticated:hover {
    background: #2d9148;
}

/* Modal principal */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.auth-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.auth-modal-container {
    position: relative;
    width: 90%;
    max-width: 480px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Botón de cerrar */
.auth-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.auth-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.auth-modal-close i {
    font-size: 18px;
    color: #666;
}

/* Pestañas */
.auth-tabs {
    display: flex;
    background: #f8f9fa;
    padding: 8px;
    gap: 8px;
}

.auth-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-tab:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.auth-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.auth-tab i {
    font-size: 16px;
}

/* Paneles */
.auth-panel {
    display: none;
    padding: 40px 32px;
}

.auth-panel.active {
    display: block;
    animation: fadeSlide 0.4s ease;
}

.auth-panel-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-panel-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.auth-panel-header p {
    font-size: 15px;
    color: #666;
}

/* Selector de Tipo de Usuario */
.user-type-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.user-type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-type-btn i {
    font-size: 28px;
    color: #999;
    transition: all 0.3s ease;
}

.user-type-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-2px);
}

.user-type-btn:hover i {
    color: #667eea;
}

.user-type-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
}

.user-type-btn.active i {
    color: #667eea;
}

/* Botón de Google */
.auth-google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 24px;
}

.auth-google-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.google-icon {
    width: 20px;
    height: 20px;
}

/* Divisor */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #999;
    font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.auth-divider span {
    padding: 0 16px;
}

/* Formularios */
.auth-form-modal {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group-modal {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-modal label {
    font-size: 14px;
    font-weight: 600;
    color: #444;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group-modal label i {
    color: #667eea;
    font-size: 16px;
}

.form-group-modal input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.form-group-modal input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-group-modal input::placeholder {
    color: #999;
}

/* Opciones del formulario */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -8px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.forgot-password {
    font-size: 14px;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.forgot-password:hover {
    text-decoration: underline;
}

/* Indicador de fortaleza de contraseña */
.password-strength {
    margin-top: 8px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    background: #e0e0e0;
}

.strength-bar.weak {
    width: 33%;
    background: #f44336;
}

.strength-bar.medium {
    width: 66%;
    background: #ff9800;
}

.strength-bar.strong {
    width: 100%;
    background: #4caf50;
}

/* Botón de submit */
.auth-submit-btn {
    width: 100%;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

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

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Mensajes */
.auth-modal-message {
    display: none;
    padding: 16px 32px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    animation: slideDown 0.3s ease;
}

.auth-modal-message.show {
    display: block;
}

.auth-modal-message.success {
    background: #d4edda;
    color: #155724;
}

.auth-modal-message.error {
    background: #f8d7da;
    color: #721c24;
}

.auth-modal-message.info {
    background: #d1ecf1;
    color: #0c5460;
}

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

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

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Responsive */
@media (max-width: 768px) {
    .auth-modal-container {
        width: 95%;
        max-width: none;
        margin: 20px;
    }

    .auth-panel {
        padding: 32px 24px;
    }

    .auth-panel-header h2 {
        font-size: 24px;
    }

    .user-btn span {
        display: none;
    }

    .user-btn {
        padding: 10px 16px;
    }

    .nav-user {
        padding-left: 10px;
    }
}

@media (max-width: 480px) {
    .auth-panel {
        padding: 24px 20px;
    }

    .auth-modal-container {
        border-radius: 20px;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* CAPTCHA matemático */
.captcha-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.captcha-question {
    font-weight: 700;
    color: var(--primary-color, #6366f1);
    font-size: 1rem;
    background: rgba(99, 102, 241, 0.08);
    padding: 2px 10px;
    border-radius: 8px;
    letter-spacing: 0.5px;
}
.captcha-hint {
    font-size: 0.78rem;
    margin-top: 4px;
    display: block;
    min-height: 16px;
}
.captcha-hint.error {
    color: #ef4444;
    font-weight: 600;
}
