/* forms.css - Estilos unificados para el formulario de registro */

/* ===== VARIABLES CSS ===== */
:root {
    --primary-color: #111d3d;
    --secondary-color: #030e47;
    --success-color: #4cc9f0;
    --danger-color: #626362;
    --warning-color: #f8961e;
    --info-color: #4895ef;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --gray-light: #c5c5c5;
    --border-radius: 12px;
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* ===== RESET Y ESTILOS BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #929597 0%, #c5c5c5 100%);
    /* background: linear-gradient(100deg, rgb(5, 4, 56) 0%, rgb(18, 19, 26) 100%); */
    /* background-image: url("../img/fondologo.webp"); */
    min-height: 100vh;
    overflow-x: hidden;
    padding: 0;
}


/* ===== HEADER CON IMAGEN COMPLETA ===== */
.form-header {
    width: 100vw;
    margin: 0;
    padding: 0;
    background: #f8f9fa;
    border-bottom: 3px solid #f8f9fa;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.header-image {
    width: 100%;
    min-width: 100%;
    height: auto;
    display: block;
    margin: 0;
    padding: 0;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.form-container {
    max-width: 1000px;
    margin: 30px auto;
    background: #fff;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

/* ===== TIPOGRAFÍA ===== */
h2 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: bold
}

/* ===== ESTRUCTURA DEL FORMULARIO ===== */
fieldset {
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 25px;
    background-color: #f9f9f9;
}

legend {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    padding: 0 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

legend i {
    margin-right: 10px;
    color: var(--primary-color);
}

/* ===== GRUPOS DE FORMULARIO ===== */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
    min-width: 250px;
}

/* ===== CONTROLES DE FORMULARIO ===== */
.input-wrapper {
    position: relative;
    width: 100%;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
    background-color: #fff;
    font-family: inherit;
}

input[type="text"] {
    text-transform: uppercase;
}

input[type="file"] {
    padding: 10px 15px;
    border: 1px dashed #ddd;
    background-color: #f9f9f9;
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===== ESTADOS DE LOS CONTROLES ===== */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 31, 105, 0.2);
}

input:invalid:not(:focus):not(:placeholder-shown),
select:invalid:not(:focus),
textarea:invalid:not(:focus):not(:placeholder-shown) {
    border-color: var(--danger-color);
}

/* ===== ETIQUETAS ===== */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
}

/* ===== BOTONES ===== */
.btn-nuevo {
    background-color: #101f69;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
    margin-bottom: 15px;
}

.btn-nuevo:hover {
    background-color: #102694;
    transform: translateY(-2px);
}

.btn-nuevo i {
    margin-right: 8px;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.btn-enviar,
.btn-limpiar {
    padding: 15px 30px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 150px;
}

.btn-enviar {
    background-color: #0f631d;
    color: white;
}

.btn-enviar:hover {
    background-color: #0c5318;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(15, 99, 29, 0.3);
}

.btn-limpiar {
    background-color: #525151;
    color: white;
}

.btn-limpiar:hover {
    background-color: #414141;
    transform: translateY(-2px);
}

/* ===== SECCIONES DINÁMICAS ===== */
.dynamic-group {
    background-color: #fff;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
    position: relative;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.remove-btn:hover {
    background: #d1144a;
    transform: scale(1.1);
}

/* ===== VALIDACIÓN ===== */
.is-invalid {
    border-color: #e74c3c !important;
}

.invalid-feedback {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

input:invalid:not(:focus):not(:placeholder-shown) ~ .invalid-feedback,
select:invalid:not(:focus) ~ .invalid-feedback,
textarea:invalid:not(:focus):not(:placeholder-shown) ~ .invalid-feedback {
    display: block;
}

/* ===== BOTONES ADICIONALES ===== */
.btn-guardar,
.btn-cancelar,
.btn-eliminar,
.btn-editar {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn-guardar {
    background-color: #3498db;
    color: white;
}

.btn-guardar:hover {
    background-color: #2980b9;
}

.btn-cancelar {
    background-color: #95a5a6;
    color: white;
}

.btn-cancelar:hover {
    background-color: #7f8c8d;
}

.btn-eliminar {
    background-color: #e74c3c;
    color: white;
}

.btn-eliminar:hover {
    background-color: #c0392b;
}

.btn-editar {
    background-color: #f39c12;
    color: white;
}

.btn-editar:hover {
    background-color: #d35400;
}

/* ===== MODALES - ESTILOS CORREGIDOS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
    opacity: 1;
    visibility: visible;
    overflow-y: auto;
    padding: 20px;
}

.modal-overlay.active {
    display: flex !important;
}

.modal {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 10000;
    margin: auto;
    opacity: 1;
    visibility: visible;
    display: block;
    transform: translateY(0);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 2px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: white;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
    background-color: white;
    color: #333;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background-color: #f9f9f9;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    position: sticky;
    bottom: 0;
}

/* Estilos para campos dentro del modal */
.modal input,
.modal select,
.modal textarea {
    background-color: white !important;
    color: #333 !important;
    border: 2px solid var(--gray-light) !important;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(16, 31, 105, 0.2) !important;
}

.modal label {
    color: #444 !important;
}

/* ===== REGISTROS GUARDADOS ===== */
.registro-guardado {
    background-color: #f8f9fa;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
    position: relative;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.registro-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.registro-titulo {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 5px;
}

.registro-subtitulo {
    color: var(--gray-color);
    font-size: 14px;
}

.registro-acciones {
    display: flex;
    gap: 10px;
}

.registro-descripcion {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--gray-light);
    color: #555;
}

.registro-item {
    margin: 5px 0;
    font-size: 14px;
}

.registro-item strong {
    color: #333;
    min-width: 120px;
    display: inline-block;
}

/* ===== CONFIRMACIÓN DE ELIMINACIÓN ===== */
.modal-confirmacion {
    max-width: 500px;
    width: 90% !important;
}

.modal-confirmacion .modal-body {
    text-align: center;
    padding: 40px 25px;
}

.modal-confirmacion .icono-confirmacion {
    font-size: 48px;
    color: var(--danger-color);
    margin-bottom: 20px;
}

.modal-confirmacion p {
    font-size: 18px;
    margin-bottom: 25px;
    color: #333;
    line-height: 1.5;
}

.modal-confirmacion .modal-footer {
    justify-content: center;
    gap: 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .form-container {
        margin: 20px 15px;
        padding: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-row .form-group {
        min-width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-enviar,
    .btn-limpiar {
        width: 100%;
        margin-bottom: 15px;
    }
    
    fieldset {
        padding: 20px;
    }
    
    h2 {
        font-size: 24px;
    }
    
    /* Responsive para modales */
    .modal {
        width: 95%;
        max-height: 85vh;
        margin: 10px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-wrap: wrap;
    }
    
    .registro-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .registro-acciones {
        align-self: flex-end;
    }
    
    .modal-confirmacion {
        width: 95% !important;
    }
}

@media (max-width: 480px) {
    .form-container {
        margin: 15px 10px;
        padding: 15px;
    }
    
    .form-header {
        border-bottom: 2px solid var(--primary-color);
    }
    
    h2 {
        font-size: 20px;
    }
    
    legend {
        font-size: 16px;
    }
    
    fieldset {
        padding: 15px;
    }
    
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    select,
    textarea {
        padding: 10px 12px;
    }
    
    .btn-enviar,
    .btn-limpiar {
        font-size: 16px;
        padding: 12px 20px;
    }
    
    .modal {
        width: 98%;
        margin: 5px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .registro-acciones {
        flex-direction: column;
        width: 100%;
    }
    
    .registro-acciones button {
        width: 100%;
        margin-bottom: 5px;
    }
}

/* ===== ANIMACIONES ===== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ===== CLASES DE UTILIDAD ===== */
.is-valid {
    border-color: #28a745 !important;
}

.text-uppercase {
    text-transform: uppercase;
}

.text-center {
    text-align: center;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mt-20 {
    margin-top: 20px;
}

/* ===== ESTILOS PARA MENSAJES ===== */
.form-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    z-index: 10000;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.form-message.error {
    background: #dc3545;
}

.form-message.info {
    background: #17a2b8;
}

.form-message.success {
    background: #28a745;
}

/* ===== ESTILOS DE CENTRADO FORZADO PARA MODALES ===== */
.modal-overlay-center {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ===== ESTILOS ESPECÍFICOS PARA EVITAR OCULTAMIENTO ===== */
body.modal-open {
    overflow: hidden;
}

.modal * {
    box-sizing: border-box;
}

.modal .form-group {
    margin-bottom: 15px;
}

.modal .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.modal .form-row .form-group {
    flex: 1;
    min-width: 200px;
}

/* Estilos para la sección de autorización */
.autorizacion-container {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.autorizacion-texto {
    margin-bottom: 20px;
}

.autorizacion-texto ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.autorizacion-texto li {
    margin-bottom: 8px;
}

.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #ced4da;
}

.checkbox-wrapper input[type="checkbox"] {
    margin-top: 4px;
}

.checkbox-wrapper label {
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-custom {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #007bff;
    border-radius: 4px;
    position: relative;
}

.checkbox-wrapper input[type="checkbox"]:checked + label .checkbox-custom::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #007bff;
    font-weight: bold;
}

.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

/* Estilos para contadores y límites */
.btn-nuevo {
    position: relative;
}

.btn-nuevo:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Estilos para modales de error */
.modal-error .icono-error {
    text-align: center;
    font-size: 48px;
    color: #dc3545;
    margin-bottom: 20px;
}

.modal-error .modal-body p {
    text-align: center;
    margin-bottom: 10px;
}

/* Estilos para referencias */
.registro-subtitulo i {
    margin-right: 5px;
    color: #6c757d;
}

/* Indicadores de contador */
.contador-info {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

/* Validación de límites */
input:disabled, select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Estilos para mensajes de sección requerida */
.section-required:after {
    content: " *";
    color: #dc3545;
}

.section-error {
    color: #dc3545;
    font-size: 14px;
    margin-top: 10px;
    display: none;
    text-align: center;
    padding: 10px;
    background: #f8d7da;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
}

.registros-container:empty + .section-error {
    display: block;
}

/* Estilo para mostrar que una sección está vacía */
#seccion-formacion:has(#formacionContainer:empty),
#seccion-experiencia:has(#experienciaContainer:empty),
#seccion-capacitacion:has(#capacitacionContainer:empty),
#seccion-referencia:has(#referenciaContainer:empty) {
    border-color: #ffc107;
    background-color: #fff8e1;
}

/* Estilo para sección completa */
#seccion-formacion:not(:has(#formacionContainer:empty)),
#seccion-experiencia:not(:has(#experienciaContainer:empty)),
#seccion-capacitacion:not(:has(#capacitacionContainer:empty)),
#seccion-referencia:not(:has(#referenciaContainer:empty)) {
    border-color: #28a745;
    background-color: #f8fff9;
}

