/* =====================================================================
   FORMULARIO POR PASOS - SISTEMA DE REGISTRO MADERA LEGAL CR
   =====================================================================
   
   Este archivo contiene todos los estilos específicos para el formulario
   de registro por pasos. Está organizado en secciones lógicas para
   facilitar el mantenimiento y las modificaciones futuras.
   
   Estructura:
   1. Variables CSS (Colores, espaciados, transiciones)
   2. Layout principal del formulario
   3. Sistema de progreso visual
   4. Estilos de campos y validaciones
   5. Animaciones y transiciones
   6. Responsive design
   ===================================================================== */

/* =====================================================================
   1. VARIABLES CSS PERSONALIZADAS
   ===================================================================== */
   :root {
    /* Colores principales del sistema */
    --primary-color: #28a745;
    --primary-dark: #1e7e34;
    --accent-color: #20c997;
    --background-light: #f8f9fa;
    --border-color: #dee2e6;
    --text-muted: #6c757d;
    
    /* Colores de estado para validaciones */
    --color-exito: #28a745;
    --color-error: #dc3545;
    --color-advertencia: #ffc107;
    --color-info: #17a2b8;
    
    /* Espaciados consistentes - COMPACTADOS */
    --espacio-pequeno: 0.25rem;
    --espacio-normal: 0.75rem;
    --espacio-grande: 1rem;
    --espacio-xl: 1.25rem;
    --espacio-xxl: 1.5rem;
    
    /* Transiciones suaves para mejor UX */
    --transition-rapida: all 0.2s ease;
    --transition-normal: all 0.3s ease;
    --transition-suave: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-rebote: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Sombras para profundidad visual */
    --sombra-suave: 0 2px 10px rgba(0, 0, 0, 0.1);
    --sombra-media: 0 4px 20px rgba(0, 0, 0, 0.15);
    --sombra-fuerte: 0 10px 40px rgba(0, 0, 0, 0.2);
    
    /* Bordes redondeados */
    --radio-pequeno: 4px;
    --radio-normal: 8px;
    --radio-grande: 12px;
    --radio-circular: 50%;
}

/* =====================================================================
   2. CONTENEDOR PRINCIPAL DEL FORMULARIO
   ===================================================================== */
.form-wizard {
    background: white;
    border-radius: var(--radio-grande);
    box-shadow: var(--sombra-fuerte);
    overflow: hidden;
    margin: var(--espacio-normal) auto;
    max-width: 800px;
    width: 95%;
    position: relative;
    
    /* Transición suave para cambios de estado */
    transition: var(--transition-suave);
}

.form-wizard:hover {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* =====================================================================
   3. HEADER DEL WIZARD CON GRADIENTE ATRACTIVO
   ===================================================================== */
.wizard-header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: var(--espacio-normal) var(--espacio-grande);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Efecto de ondas en el header */
.wizard-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: var(--transition-suave);
}

.wizard-header:hover::before {
    left: 100%;
}

.wizard-header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wizard-header p {
    margin: var(--espacio-pequeno) 0 0 0;
    opacity: 0.9;
    font-size: 1rem;
}

/* =====================================================================
   4. SISTEMA DE PROGRESO VISUAL
   ===================================================================== */
.wizard-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: var(--espacio-xl) 0 var(--espacio-normal);
    position: relative;
    padding: 0 var(--espacio-normal);
}

/* Indicadores de paso individuales */
.progress-step {
    width: 40px;
    height: 40px;
    border-radius: var(--radio-circular);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    position: relative;
    z-index: 2;
    transition: var(--transition-rebote);
    border: 3px solid transparent;
    cursor: pointer;
}

/* Estados de los indicadores de progreso */
.progress-step.completed {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.progress-step.active {
    background: white;
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.2);
    animation: pulso-suave 2s infinite;
}

.progress-step.inactive {
    background: var(--background-light);
    color: var(--text-muted);
    border-color: var(--border-color);
}

/* Animación de pulso para el paso activo */
@keyframes pulso-suave {
    0%, 100% { box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(40, 167, 69, 0.1); }
}

/* Conectores entre pasos */
.progress-connector {
    height: 3px;
    background: var(--border-color);
    flex: 1;
    margin: 0 10px;
    border-radius: 2px;
    transition: var(--transition-suave);
    position: relative;
    overflow: hidden;
}

.progress-connector.completed {
    background: var(--primary-color);
}

/* Efecto de carga animada en conectores */
.progress-connector.completed::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: brillo-conector 2s ease-in-out;
}

@keyframes brillo-conector {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* =====================================================================
   5. CONTENIDO DE LOS PASOS
   ===================================================================== */
.step-content {
    padding: var(--espacio-xxl) var(--espacio-xl) var(--espacio-xl);
    min-height: 400px;
    position: relative;
}

/* Paneles individuales de cada paso */
.step-panel {
    display: none;
    animation: entrada-lateral 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-panel.active {
    display: block !important;
}

/* Animación de entrada suave */
@keyframes entrada-lateral {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Títulos y descripciones de pasos */
.step-title {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--espacio-pequeno);
    display: flex;
    align-items: center;
    gap: var(--espacio-pequeno);
}

.step-description {
    color: var(--text-muted);
    margin-bottom: var(--espacio-xl);
    line-height: 1.6;
    font-size: 1rem;
}

/* =====================================================================
   6. CAMPOS DE FORMULARIO MEJORADOS
   ===================================================================== */
.form-group-enhanced {
    margin-bottom: var(--espacio-grande);
    position: relative;
}

.form-control-enhanced {
    padding: 0.75rem var(--espacio-normal);
    border: 2px solid var(--border-color);
    border-radius: var(--radio-normal);
    transition: var(--transition-suave);
    font-size: 1rem;
    width: 100%;
    background: white;
    position: relative;
}

/* Estados de enfoque y interacción */
.form-control-enhanced:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.1);
    outline: none;
    transform: translateY(-1px);
}

/* Estados de validación visual */
.form-control-enhanced.is-valid {
    border-color: var(--color-exito);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.98-.97-.97-.97 1.95-2.23L2.3.54l-1.95 2.23L.34 2.8l.98.97-.97.97.98.97z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

.form-control-enhanced.is-invalid {
    border-color: var(--color-error);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3e%3cpath fill='%23dc3545' d='M6 0a6 6 0 1 0 0 12A6 6 0 0 0 6 0zM3.75 3.75L4.5 3l1.5 1.5L7.5 3l.75.75L6.75 5.25 8.25 6.75 7.5 7.5 6 6 4.5 7.5 3.75 6.75 5.25 5.25 3.75 3.75z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

/* =====================================================================
   7. SISTEMA DE VALIDACIÓN VISUAL
   ===================================================================== */
.field-validation {
    font-size: 0.875rem;
    margin-top: var(--espacio-pequeno);
    padding: 0.25rem var(--espacio-pequeno);
    border-radius: var(--radio-pequeno);
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition-suave);
}

.field-validation.show {
    opacity: 1;
    transform: translateY(0);
}

.field-validation.valid {
    color: var(--color-exito);
    background: rgba(40, 167, 69, 0.1);
}

.field-validation.invalid {
    color: var(--color-error);
    background: rgba(220, 53, 69, 0.1);
}

/* =====================================================================
   8. CHECKBOXES MEJORADOS PARA TIPO DE USUARIO
   ===================================================================== */
.checkbox-enhanced {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: var(--espacio-normal);
    border: 2px solid var(--border-color);
    border-radius: var(--radio-normal);
    cursor: pointer;
    transition: var(--transition-suave);
    margin-bottom: var(--espacio-normal);
    background: white;
}

.checkbox-enhanced:hover {
    border-color: var(--primary-color);
    background: rgba(40, 167, 69, 0.05);
    transform: translateY(-1px);
    box-shadow: var(--sombra-suave);
}

.checkbox-enhanced.selected {
    border-color: var(--primary-color);
    background: rgba(40, 167, 69, 0.1);
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.1);
}

/* =====================================================================
   9. CAMPOS CONDICIONALES CON ANIMACIÓN
   ===================================================================== */
.conditional-fields {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.conditional-fields.show {
    opacity: 1;
    max-height: 300px;
    margin-top: var(--espacio-grande);
}

/* =====================================================================
   10. ACCIONES DEL WIZARD (BOTONES)
   ===================================================================== */
.wizard-actions {
    padding: var(--espacio-xl);
    background: var(--background-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
}

.btn-wizard {
    padding: 0.75rem var(--espacio-xl);
    border-radius: var(--radio-normal);
    font-weight: 600;
    transition: var(--transition-suave);
    border: none;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--espacio-pequeno);
}

.btn-wizard-primary {
    background: var(--primary-color);
    color: white;
}

.btn-wizard-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.btn-wizard-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 2px solid var(--border-color);
}

.btn-wizard-secondary:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* =====================================================================
   11. OVERLAY DE CARGA
   ===================================================================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: var(--radio-normal);
    z-index: 1000;
}

.loading-overlay.show {
    display: flex;
}

/* Defensa adicional para ambientes con JS: si algo deja el overlay visible por error, forzamos ocultarlo */
.loading-overlay {
    display: none !important;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: var(--radio-circular);
    animation: giro-spinner 1s linear infinite;
}

@keyframes giro-spinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =====================================================================
   12. TARJETA DE RESUMEN FINAL
   ===================================================================== */
.summary-card {
    background: var(--background-light);
    border: 2px solid var(--border-color);
    border-radius: var(--radio-normal);
    padding: var(--espacio-grande);
    margin-bottom: var(--espacio-normal);
}

.summary-section {
    margin-bottom: var(--espacio-grande);
}

.summary-section:last-child {
    margin-bottom: 0;
}

.summary-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--espacio-pequeno);
    display: flex;
    align-items: center;
    gap: var(--espacio-pequeno);
}

.summary-content {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
}

/* =====================================================================
   13. INDICADOR DE FORTALEZA DE CONTRASEÑA
   ===================================================================== */
.password-strength {
    margin-top: var(--espacio-pequeno);
}

.strength-bar {
    height: 4px;
    background: var(--background-light);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--espacio-pequeno);
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: var(--transition-suave);
    border-radius: 2px;
}

.strength-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =====================================================================
   14. DISEÑO RESPONSIVO PARA DISPOSITIVOS MÓVILES
   ===================================================================== */
@media (max-width: 768px) {
    .form-wizard {
        margin: var(--espacio-normal);
        border-radius: var(--radio-normal);
    }

    .wizard-header {
        padding: var(--espacio-grande) var(--espacio-normal);
    }

    .wizard-header h1 {
        font-size: 1.5rem;
    }

    .step-content {
        padding: var(--espacio-xl) var(--espacio-normal);
        min-height: 350px;
    }

    .wizard-actions {
        padding: var(--espacio-grande) var(--espacio-normal);
        flex-direction: column;
        gap: var(--espacio-normal);
    }

    .wizard-actions .btn-wizard {
        width: 100%;
        justify-content: center;
    }

    .progress-step {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }

    .step-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .wizard-progress {
        margin: var(--espacio-normal) 0;
    }

    .progress-step {
        width: 30px;
        height: 30px;
        font-size: 10px;
    }

    .progress-connector {
        margin: 0 5px;
    }
}

/* =====================================================================
   15. UTILIDADES Y CLASES ADICIONALES
   ===================================================================== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }
.text-danger { color: var(--color-error); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--espacio-pequeno); }
.mb-2 { margin-bottom: var(--espacio-normal); }
.mb-3 { margin-bottom: var(--espacio-grande); }

.fade-in {
    animation: aparecer 0.5s ease-in-out;
}

@keyframes aparecer {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =====================================================================
   16. CONTENIDO Y NAVEGACIÓN DEL WIZARD (COMPACTO Y RESPONSIVE)
   ===================================================================== */

/* Contenido de los pasos más compacto */
.step-content {
    padding: var(--espacio-grande) var(--espacio-xl);
    min-height: 400px;
}

/* Navegación de botones - Diseño mejorado y responsive */
.wizard-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* Contenedor de botones derecha */
.wizard-navigation .ms-auto {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-left: auto !important;
}

/* Botones del wizard más compactos */
.wizard-navigation .btn {
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
    white-space: nowrap;
    border-radius: var(--radio-normal);
    transition: var(--transition-rapida);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: center;
}

.wizard-navigation .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--sombra-suave);
}

.wizard-navigation .btn i {
    font-size: 0.85rem;
}

/* Títulos de paso más compactos */
.step-title {
    font-size: 1.5rem;
    margin-bottom: var(--espacio-normal);
    color: var(--primary-color);
    font-weight: 600;
}

.step-description {
    color: var(--text-muted);
    margin-bottom: var(--espacio-grande);
    font-size: 0.9rem;
}

/* Espaciado de campos más compacto */
.form-label {
    margin-bottom: var(--espacio-pequeno);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control, .form-select {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

/* Ajustes para filas de campos */
.row.g-3 {
    --bs-gutter-y: 0.75rem;
}

/* Checkbox enhanced más compacto */
.checkbox-enhanced {
    padding: 0.75rem;
}

/* =====================================================================
   17. RESPONSIVE DESIGN
   ===================================================================== */

/* Tablets y dispositivos medianos */
@media (max-width: 768px) {
    .form-wizard {
        max-width: 100%;
        width: 100%;
        margin: 0;
        border-radius: 0;
    }
    
    .step-content {
        padding: var(--espacio-normal);
        min-height: 300px;
    }
    
    .wizard-navigation {
        padding: 0.75rem 1rem;
        gap: 1rem;
    }
    
    .wizard-navigation .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        min-width: 100px;
    }
    
    .wizard-navigation .ms-auto {
        gap: 0.75rem;
    }
    
    .step-title {
        font-size: 1.25rem;
    }
    
    /* En móviles, botones en columna si son muchos */
    .wizard-navigation .ms-auto {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Móviles pequeños */
@media (max-width: 576px) {
    .wizard-header {
        padding: var(--espacio-normal);
    }
    
    .wizard-header h1 {
        font-size: 1.25rem;
    }
    
    .wizard-header p {
        font-size: 0.85rem;
    }
    
    .step-content {
        padding: var(--espacio-pequeno) var(--espacio-normal);
    }
    
    .wizard-navigation {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .wizard-navigation .btn {
        width: 100%;
        justify-content: center;
        padding: 0.65rem 1rem;
        min-width: auto;
    }
    
    .wizard-navigation .ms-auto {
        width: 100%;
        flex-direction: column-reverse;
        gap: 0.5rem;
        margin-left: 0 !important;
    }
    
    /* Progreso más compacto en móviles */
    .wizard-progress {
        padding: var(--espacio-normal);
    }
    
    .progress-step {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .progress-connector {
        height: 2px;
    }
}