/* Variables CSS para consistencia */
:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --primary-light: #e3f2fd;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-600: #6c757d;
    --gray-800: #343a40;
    --border-radius: 15px;
    --border-radius-lg: 20px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.2);
    --shadow-xl: 0 12px 24px rgba(0,0,0,0.25);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mejoras generales */
body {
    background: #f8f9fa;
    min-height: 100vh;
}

.card {
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    border: none;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

/* Header mejorado */
.card-header {
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    position: relative;
    overflow: hidden;
}

.card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.header-icon-wrapper {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
}

.header-icon-wrapper i {
    font-size: 24px;
    color: white;
}

/* Secciones */
.section-wrapper {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.section-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-light);
}

.section-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    box-shadow: var(--shadow-sm);
}

.section-icon i {
    color: white;
    font-size: 20px;
}

.section-title {
    color: var(--gray-800);
    font-weight: 700;
    margin: 0;
    font-size: 1.25rem;
}

/* Form Floating mejorado */
.form-floating {
    position: relative;
    margin-bottom: 1rem;
}

.form-floating .form-control {
    height: 60px;
    border-radius: 12px;
    border: 2px solid var(--gray-200);
    background: white;
    transition: var(--transition);
    font-size: 16px;
    padding: 1rem 1rem 0.5rem;
}

.form-floating .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    transform: translateY(-1px);
}

/* Estilos para campos con error/faltantes */
.form-control.border-danger {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Efecto de pulso para campos faltantes */
.form-control.border-danger:focus {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* Estilos para contenedores de formulario con error */
.form-floating.border-danger {
    border: 2px solid #dc3545 !important;
    border-radius: 12px;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    animation: shake 0.5s ease-in-out;
}

/* Mejorar la visibilidad del label cuando hay error */
.form-floating.border-danger label {
    color: #dc3545 !important;
    font-weight: 600;
}

/* Estilos personalizados para SweetAlert */
.swal-custom-popup {
    border-radius: 15px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2) !important;
}

.swal-custom-title {
    color: #495057 !important;
    font-weight: 700 !important;
    font-size: 1.5rem !important;
}

.swal-custom-html {
    text-align: left !important;
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
}

.swal-custom-html .badge {
    font-size: 0.8rem !important;
    padding: 0.4rem 0.6rem !important;
    border-radius: 8px !important;
}

.form-floating label {
    color: var(--gray-600);
    font-weight: 500;
    padding: 1rem 1rem 0.5rem;
}

.form-floating .form-control:focus + label,
.form-floating .form-control:not(:placeholder-shown) + label {
    color: var(--primary-color);
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* Select personalizado */
.form-floating select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
    padding-right: 3rem;
}

/* File Upload personalizado */
.file-upload-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.file-upload-label {
    display: block;
    width: 100%;
    height: 120px;
    border: 3px dashed var(--primary-color);
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-light) 0%, white 100%);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--primary-color);
    font-weight: 600;
}

.file-upload-label:hover {
    border-color: var(--primary-dark);
    background: linear-gradient(135deg, white 0%, var(--primary-light) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Estilos para campos de archivo de documentos */
.custom-file-upload {
    position: relative;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    border: 2px dashed #dee2e6;
    transition: all 0.3s ease;
}

.file-input-wrapper:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.file-input-wrapper input[type=file] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-input-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: #6c757d;
    transition: all 0.3s ease;
}

.file-input-wrapper:hover .file-input-overlay {
    color: var(--primary-color);
}

.file-input-overlay i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.file-input-overlay.file-selected {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
    color: white;
}

.file-input-overlay.file-selected span {
    font-weight: 600;
    font-size: 0.9em;
    text-align: center;
    word-break: break-word;
    max-width: 90%;
}

.file-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.file-upload-content i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.file-upload-content span {
    font-size: 1.1rem;
    font-weight: 600;
}

.file-upload-content small {
    color: var(--gray-600);
    font-weight: 400;
}

.file-upload-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Radio Groups personalizados */
.radio-group-wrapper {
    margin-bottom: 1rem;
}

.radio-group-label {
    display: block;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.radio-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.radio-item {
    flex: 1;
    min-width: 120px;
}

.radio-input {
    display: none;
}

.radio-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    font-weight: 500;
    color: var(--gray-600);
}

.radio-label:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.radio-input:checked + .radio-label {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.radio-circle {
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-radius: 50%;
    margin-right: 0.75rem;
    position: relative;
    transition: var(--transition);
}

.radio-input:checked + .radio-label .radio-circle {
    background: white;
    border-color: white;
}

.radio-input:checked + .radio-label .radio-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
}

.radio-text {
    font-weight: 600;
}

/* Botón principal mejorado */
.btn-xl {
    padding: 1.25rem 3rem;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 50px;
    transition: var(--transition);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.btn-xl::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-xl:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(135deg, var(--primary-dark) 0%, #004085 100%);
}

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

/* Modales mejorados */
.modal-content {
    border-radius: var(--border-radius-lg);
    border: none;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-bottom: none;
    padding: 1.5rem;
}

.modal-header .modal-title {
    color: white;
    font-weight: 700;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: 1.5rem;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.section-wrapper {
    animation: fadeInUp 0.6s ease-out;
}

.section-wrapper:nth-child(even) {
    animation: slideInRight 0.6s ease-out;
}

/* Estados de validación */
.form-control.is-valid {
    border-color: var(--success-color);
    box-shadow: 0 0 0 0.2rem rgba(40,167,69,0.25);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 0.2rem rgba(220,53,69,0.25);
}

/* Responsive mejorado */
@media (max-width: 768px) {
    .container-fluid {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .section-wrapper {
        padding: 1.5rem;
    }
    
    .btn-xl {
        width: 100%;
        margin-top: 1rem;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    .radio-item {
        min-width: auto;
    }
}

/* Efectos de scroll */
.section-wrapper {
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
}

.section-wrapper.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Texto de ayuda */
.form-text {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--gray-100);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

/* Iconos */
.fas {
    color: var(--primary-color);
}

.radio-input:checked + .radio-label .fas {
    color: white;
}
