/* ===== FORMULARIO DE INSCRIPCIÓN - CSS LIMPIO ===== */

/* ===== ESTILOS GENERALES ===== */
.ces-required {
    color: #d63638 !important;
    font-weight: bold;
}

.ces-label .ces-required {
    color: #d63638 !important;
    font-weight: bold;
}

/* ===== MEJORAS DE CONTRASTE PARA ACCESIBILIDAD ===== */
.ces-input,
.ces-textarea {
    width: 100%;
    padding: 15px;
    border: 3px solid #ABA7A7 !important;
    border-radius: 6px;
    font-size: 18px !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

/* Sin transición en bordes para evitar cambios graduales de color */
.ces-input.ces-error,
.ces-input.ces-error:focus,
.ces-select.ces-error,
.ces-select.ces-error:focus,
.ces-textarea.ces-error,
.ces-textarea.ces-error:focus,
.ces-form-group.has-error .ces-input,
.ces-form-group.has-error .ces-input:focus,
.ces-form-group.has-error .ces-select,
.ces-form-group.has-error .ces-select:focus,
.ces-form-group.has-error .ces-textarea,
.ces-form-group.has-error .ces-textarea:focus {
    transition: none !important;
}

.ces-select {
    width: 100% !important;
    min-width: 100% !important;
    padding: 18px 25px 18px 18px !important;
    border: 3px solid #ABA7A7 !important;
    border-radius: 6px;
    font-size: 18px !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
    height: auto !important;
    min-height: 60px !important;
    line-height: 1.4 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    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='%23ABA7A7' 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") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    background-size: 20px !important;
    padding-right: 50px !important;
}

/* ===== ESTILOS DE ERROR (BORDE ROJO) - ALTA PRIORIDAD ===== */
.ces-input.ces-error,
.ces-select.ces-error,
.ces-textarea.ces-error,
.ces-form-group.has-error .ces-input,
.ces-form-group.has-error .ces-select,
.ces-form-group.has-error .ces-textarea {
    border-color: #d63638 !important;
    border-width: 3px !important;
    box-shadow: 0 0 0 4px rgba(214,54,56,0.2) !important;
    background-color: #fff5f5 !important;
}

.ces-input.ces-error:focus,
.ces-select.ces-error:focus,
.ces-textarea.ces-error:focus,
.ces-form-group.has-error .ces-input:focus,
.ces-form-group.has-error .ces-select:focus,
.ces-form-group.has-error .ces-textarea:focus {
    border-color: #d63638 !important;
    box-shadow: 0 0 0 4px rgba(214,54,56,0.3) !important;
    outline: none !important;
}

/* ===== ESTILOS DE FOCUS (SOLO SI NO HAY ERROR) ===== */
.ces-input:focus:not(.ces-error),
.ces-select:focus:not(.ces-error),
.ces-textarea:focus:not(.ces-error),
.ces-form-group:not(.has-error) .ces-input:focus,
.ces-form-group:not(.has-error) .ces-select:focus,
.ces-form-group:not(.has-error) .ces-textarea:focus {
    border-color: #0073aa !important;
    box-shadow: 0 0 0 4px rgba(0,115,170,0.3) !important;
    outline: none !important;
}

.ces-error-message {
    color: #d63638 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    margin-top: 5px;
    display: block;
}

.ces-error-message.active {
    display: block !important;
}

/* ===== RESALTAR CAMPOS CON ERROR EN EL CONTENEDOR ===== */
.ces-form-group.has-error {
    animation: shake 0.3s ease-in-out;
}

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

/* ===== ESTILO PARA CHECKBOX CON ERROR ===== */
.ces-form-group.has-error input[type="checkbox"] {
    outline: 2px solid #d63638 !important;
    outline-offset: 2px;
}

/* ===== ESTILOS ESPECÍFICOS PARA SELECT ===== */
.ces-select option {
    padding: 15px 20px !important;
    font-size: 18px !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    min-height: 50px !important;
}

.ces-select option:hover {
    background: #f8f9fa !important;
}

.ces-select option:checked,
.ces-select option:selected {
    background: #0073aa !important;
    color: #ffffff !important;
}

/* Mejorar el contenedor del select */
.ces-form-group {
    margin-bottom: 25px;
    width: 100%;
}

.ces-form-group .ces-select {
    display: block;
    width: 100% !important;
}

.ces-label {
    font-weight: 700 !important;
    color: #ABA7A7 !important;
    margin-bottom: 10px;
    display: block;
    font-size: 16px !important;
}

/* **[SECCIÓN CORREGIDA Y LIMPIA PARA ALINEACIÓN DEL CHECKBOX]** */

/* Checkbox términos en una sola línea (Usamos la clase más específica) */
.ces-checkbox-label.ces-terminos-label {
    /* 1. Usar Flexbox para alinear el tilde y el texto */
    display: flex !important; 
    align-items: center !important; /* CENTRADO VERTICAL (Más seguro) */
    justify-content: flex-start !important; /* Alinea a la IZQUIERDA */
    gap: 8px !important; /* Espacio entre el tilde y el texto */
    
    /* 2. Reglas de reinicio de caja */
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important; /* MUY IMPORTANTE: Evita que el contenedor ocupe 100% y se centre */
    text-align: left !important;
    line-height: 1.4 !important;
    
    /* 3. Fuente */
    font-weight: 500 !important;
    color: #333333 !important;
    cursor: pointer;
}

.ces-checkbox-label.ces-terminos-label input[type="checkbox"] {
    /* Tilde (input): Aseguramos que no tenga márgenes que lo muevan */
    margin: 0 !important; 
    padding: 0 !important;
    flex-shrink: 0 !important; 
    position: static !important;
    vertical-align: middle !important;
    height: 18px; 
    width: 18px;
}

/* Contenedor del texto (la nueva clase) */
.ces-terminos-text {
    display: block !important; 
    flex-grow: 1 !important; 
    line-height: 1.4 !important;
    font-size: 16px;
    margin: 0 !important;
    padding: 0 !important;
}
/* **[FIN DE SECCIÓN CORREGIDA Y LIMPIA PARA ALINEACIÓN DEL CHECKBOX]** */

/* ===== BOTONES ===== */
.ces-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #0073aa;
    color: #ffffff;
    min-height: 48px;
    line-height: 1.4;
}

.ces-btn:hover {
    background: #005a87;
    color: #ffffff;
    text-decoration: none;
}

.ces-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.ces-btn:disabled {
    background: #6c757d;
    color: #ffffff;
    cursor: not-allowed;
    opacity: 0.6;
}

.ces-btn-primary {
    background: #0073aa;
    color: #ffffff;
    border-color: #0073aa;
}

.ces-btn-primary:hover {
    background: #005a87;
    border-color: #005a87;
}

.ces-btn-loader {
    display: none;
}

.ces-btn-loader.active {
    display: inline-block;
}

.ces-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.ces-form-group {
    margin-bottom: 20px;
}

.ces-form-section {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.ces-section-title {
    color: #ABA7A7 !important;
    font-weight: 700 !important;
    font-size: 20px !important;
    margin-bottom: 20px;
    border-bottom: 3px solid #0073aa;
    padding-bottom: 10px;
}

/* ===== LAYOUT RESPONSIVE MEJORADO ===== */
@media (max-width: 900px) {
    .ces-formulario-inscripcion-wrapper {
        padding: 10px;
    }
    
    .ces-form-row,
    .ces-form-row.dynamic {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .ces-form-group.span-1,
    .ces-form-group.span-2,
    .ces-form-group.span-3,
    .ces-col-12,
    .ces-col-8,
    .ces-col-6,
    .ces-col-4 {
        grid-column: span 1 !important;
        width: 100% !important;
    }
    
    .ces-form-section {
        margin-bottom: 25px;
        padding: 15px;
    }
    
    .ces-section-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
}

@media (max-width: 768px) {
    .ces-formulario-inscripcion-wrapper {
        padding: 5px;
    }
    
    .ces-form-row,
    .ces-form-row.dynamic {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    
    .ces-form-group.span-1,
    .ces-form-group.span-2,
    .ces-form-group.span-3,
    .ces-col-12,
    .ces-col-8,
    .ces-col-6,
    .ces-col-4 {
        grid-column: span 1 !important;
        width: 100% !important;
    }
    
    .ces-form-section {
        margin-bottom: 20px;
        padding: 12px;
    }
    
    .ces-section-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .ces-input,
    .ces-select,
    .ces-textarea {
        font-size: 16px; /* Evitar zoom en iOS */
        padding: 12px;
    }
    
    .ces-form-actions {
        margin-top: 20px;
    }
    
    .ces-btn {
        width: 100%;
        padding: 15px;
        font-size: 16px;
        margin-bottom: 10px;
    }

    /* Ajuste de fuente para el checkbox en móvil */
    .ces-checkbox-label {
        font-size: 16px !important; 
        line-height: 1.4 !important;
    }
}

@media (max-width: 480px) {
    .ces-formulario-inscripcion-wrapper {
        padding: 0;
    }
    
    .ces-form-section {
        margin-bottom: 15px;
        padding: 10px;
    }
    
    .ces-section-title {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .ces-input,
    .ces-select,
    .ces-textarea {
        font-size: 16px;
        padding: 10px;
    }
    
    .ces-btn {
        padding: 12px;
        font-size: 15px;
    }
    
    /* Botones de Analítico y Diploma en móvil */
    .ces-upload-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .ces-upload-buttons .ces-btn {
        width: 100%;
        margin-bottom: 0;
    }
}

/* ===== DOCUMENTACIÓN MÓVIL - SOLO LO NECESARIO ===== */
@media (max-width: 768px) {
    /* 1. OCULTAR OPCIONES DE SUBIR ARCHIVO (excepto cuando hay error de cámara) */
    .ces-section-documentacion .ces-file-option.upload:not(.show-on-error),
    .ces-section-documentacion .ces-btn-upload:not(.show-on-error) {
        display: none !important;
    }
    
    /* Mostrar cuando hay error de cámara */
    .ces-section-documentacion .ces-file-option.upload.show-on-error {
        display: flex !important;
    }
    
    /* 2. MEJORAR BOTÓN TOMAR FOTO */
    .ces-section-documentacion .ces-file-option.camera,
    .ces-section-documentacion .ces-btn-camera {
        background-color: #2c3e50 !important;
        color: #ffffff !important;
        border: 2px solid #34495e !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        padding: 12px 20px !important;
        border-radius: 8px !important;
        width: 100% !important;
        text-align: center !important;
    }
    
    /* 3. OCULTAR EMOJIS Y REEMPLAZAR TEXTO */
    .ces-section-documentacion .ces-info-icon {
        display: none !important;
    }
    
    .ces-section-documentacion .ces-info-text {
        font-size: 0 !important;
    }
    
    .ces-section-documentacion .ces-info-text::before {
        content: "Para completar tu inscripción, necesitas subir las siguientes fotos usando tu celular:" !important;
        font-size: 14px !important;
        color: #666666 !important;
        display: block !important;
    }
    
    /* 4. OCULTAR EMOJIS DE LABELS Y REEMPLAZAR */
    .ces-section-documentacion .ces-label {
        font-size: 0 !important;
    }
    
    /* Labels específicos por posición */
    .ces-section-documentacion .ces-form-row:nth-child(1) .ces-label::before {
        content: "Foto de Perfil" !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        color: #333333 !important;
        display: block !important;
    }
    
    .ces-section-documentacion .ces-form-row:nth-child(2) .ces-form-group:first-child .ces-label::before {
        content: "DNI Frente" !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        color: #333333 !important;
        display: block !important;
    }
    
    .ces-section-documentacion .ces-form-row:nth-child(2) .ces-form-group:last-child .ces-label::before {
        content: "DNI Dorso" !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        color: #333333 !important;
        display: block !important;
    }
    
    
    
    /* 5. LAYOUT RESPONSIVE Y BOTÓN FOTO DE PERFIL */
    .ces-section-documentacion .ces-form-row {
        grid-template-columns: 1fr !important;
    }
    
    .ces-section-documentacion .ces-form-group {
        grid-column: span 1 !important;
        width: 100% !important;
    }
    
    /* Personalizar primer botón - Foto de Perfil */
    .ces-section-documentacion .ces-form-row:nth-child(1) .ces-file-option.camera,
    .ces-section-documentacion .ces-form-row:nth-child(1) .ces-btn-camera {
        background-color: #2c3e50 !important;
        color: #ffffff !important;
        border: 2px solid #34495e !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        padding: 12px 20px !important;
        border-radius: 8px !important;
        width: 100% !important;
        text-align: center !important;
    }
    
    /* Estilos para explicaciones de campos */
    .ces-field-explanation {
        margin-top: 12px;
        padding: 12px 16px;
        background: #f8f9fa;
        border-radius: 6px;
        border-left: 4px solid #0073aa;
    }
    
    .ces-field-explanation p {
        font-size: 14px;
        color: #333333;
        line-height: 1.5;
        margin: 0;
        font-weight: 400;
    }
    
    .ces-field-explanation small {
        font-size: 12px;
        color: #666666;
        font-style: italic;
        display: block;
    }
    
    /* Estilos para botones de Analítico y Diploma */
    .ces-upload-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }
    
    .ces-upload-buttons .ces-btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 6px;
        border: 2px solid #dee2e6;
        background: #fff;
        color: #333;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .ces-upload-buttons .ces-btn-camera {
        border-color: #28a745;
        color: #28a745;
    }
    
    .ces-upload-buttons .ces-btn-camera:hover {
        background: #d4edda;
    }
    
    .ces-upload-buttons .ces-btn-upload {
        border-color: #0073aa;
        color: #0073aa;
    }
    
    .ces-upload-buttons .ces-btn-upload:hover {
        background: #d1ecf1;
    }
    
    .ces-upload-preview {
        margin-top: 10px;
        text-align: center;
    }
    
    .ces-upload-preview img {
        max-width: 100%;
        max-height: 200px;
        border-radius: 6px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .ces-remove-file {
        position: absolute;
        top: 5px;
        right: 5px;
        background: rgba(0,0,0,0.7);
        color: #fff;
        border: none;
        border-radius: 50%;
        width: 24px;
        height: 24px;
        cursor: pointer;
        font-size: 14px;
    }
}

/* ===== MODAL DE ÉXITO ===== */
.ces-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ces-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.ces-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.ces-modal-success {
    border-top: 4px solid #28a745;
}

.ces-modal-icon {
    margin-bottom: 20px;
}

.ces-success-checkmark {
    display: inline-block;
    width: 60px;
    height: 60px;
    background: #28a745;
    color: #fff;
    border-radius: 50%;
    font-size: 30px;
    line-height: 60px;
    font-weight: bold;
}

.ces-modal-content h3 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 24px;
}

.ces-modal-content p {
    color: #666;
    margin: 0 0 25px 0;
    line-height: 1.5;
    font-size: 16px;
}

.ces-modal-content .ces-btn {
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 6px;
}

@media (max-width: 480px) {
    .ces-modal-content {
        padding: 20px;
        margin: 20px;
    }
    
    .ces-modal-content h3 {
        font-size: 20px;
    }
    
    .ces-modal-content p {
        font-size: 14px;
    }
}