/* ===== Reset y Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f0f0f0;
    color: #333;
}

/* ===== Formulario Público ===== */
.formulario-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background-color: #f0f0f0;
}

.formulario-container {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 680px;
    width: 100%;
    overflow: hidden;
}

/* ===== Header ===== */
.formulario-header {
    background: linear-gradient(135deg, #D2691E 30%, #6c757d 70%);
    padding: 2.5rem 2rem;
    text-align: center;
}

.formulario-header .logo-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    display: inline-block;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.formulario-header .logo-box img {
    max-width: 100%;
    max-height: 70px;
    object-fit: contain;
}

.formulario-header .logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: #D2691E;
    letter-spacing: 0.15rem;
}

.formulario-header h1 {
    color: #ffffff;
    font-size: 1.6rem;
    margin: 0 0 0.4rem 0;
    font-weight: 600;
}

.formulario-header p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.95rem;
    font-weight: 400;
}

/* ===== Form Body ===== */
.formulario-body {
    padding: 2rem 2.5rem 2.5rem;
}

/* ===== Alertas ===== */
.alert {
    padding: 0.85rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.2rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert ul {
    margin: 0.3rem 0 0 1.2rem;
    padding: 0;
}

/* ===== Form Grid ===== */
.form-postulacion {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.2rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: #333;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group label .required {
    color: #D2691E;
    margin-left: 2px;
}

/* ===== Inputs y Selects ===== */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #f9f9f9;
    color: #333;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #D2691E;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(210, 105, 30, 0.1);
}

.form-group input::placeholder {
    color: #b0b0b0;
}

/* ===== Selector de cargos con búsqueda ===== */
.cargos-select-wrapper {
    position: relative;
}

.cargos-buscar {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.cargos-buscar:focus {
    outline: none;
    border-color: #D2691E;
    box-shadow: 0 0 0 3px rgba(210,105,30,0.1);
}

.cargos-dropdown {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: #fff;
    display: none;
}
.cargos-dropdown.open {
    display: block;
}

.cargos-area-group {
    border-bottom: 1px solid #f0f0f0;
}
.cargos-area-group:last-child {
    border-bottom: none;
}
.cargos-area-group.hidden {
    display: none;
}

.cargos-area-titulo {
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #D2691E;
    background: #fdf6f0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.cargo-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem 0.45rem 1.2rem;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.cargo-option.hidden {
    display: none;
}

.cargo-option:hover {
    background: #fdf6f0;
}

.cargo-option input[type="checkbox"] {
    accent-color: #D2691E;
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.cargo-option span {
    font-size: 0.85rem;
    color: #333;
}

.cargo-option input[type="checkbox"]:checked + span {
    color: #D2691E;
    font-weight: 600;
}

.cargos-seleccionados {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
    min-height: 0;
}
.cargos-seleccionados:empty {
    display: none;
}

.cargo-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    background: #D2691E12;
    border: 1px solid #D2691E44;
    border-radius: 20px;
    font-size: 0.78rem;
    color: #D2691E;
    font-weight: 500;
}
.cargo-tag-remove {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.cargo-tag-remove:hover {
    opacity: 1;
}

/* ===== Radio buttons Sí/No ===== */
.radio-si-no {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.2rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
    min-width: 70px;
    justify-content: center;
}

.radio-option:hover {
    border-color: #D2691E;
    background: #fdf6f0;
}

.radio-option input[type="radio"] {
    accent-color: #D2691E;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.radio-option span {
    font-size: 0.9rem;
    color: #333;
}

.radio-option input[type="radio"]:checked + span {
    color: #D2691E;
    font-weight: 500;
}

/* ===== Separador de sección ===== */
.form-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #D2691E;
    margin: 0.8rem 0 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #f0e0d0;
    grid-column: 1 / -1;
}

/* ===== Upload de archivo ===== */
.file-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.2rem;
    border: 2px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #f9f9f9;
    color: #555;
    font-size: 0.9rem;
    justify-content: center;
}

.file-upload-btn:hover {
    border-color: #D2691E;
    background: #fdf6f0;
    color: #D2691E;
}

.file-upload-btn.has-file {
    border-color: #D2691E;
    background: #fdf6f0;
    color: #D2691E;
    border-style: solid;
}

.file-upload-btn svg {
    flex-shrink: 0;
}

.file-hint {
    color: #999;
    font-size: 0.8rem;
    text-align: center;
}

/* ===== Sección info adicional centrada ===== */
.info-adicional {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info-adicional .form-group {
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.info-adicional .form-group > label {
    text-align: center;
}

.info-adicional .radio-si-no {
    justify-content: center;
}

/* ===== Botón Enviar ===== */
.btn-enviar {
    width: 100%;
    padding: 0.9rem;
    background: #D2691E;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03rem;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 0.5rem;
    text-transform: uppercase;
}

.btn-enviar:hover {
    background: #C56528;
}

.btn-enviar:active {
    background: #B3591F;
}

.btn-enviar:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .formulario-container {
        border-radius: 12px;
        max-width: 100%;
    }

    .formulario-header {
        padding: 1.8rem 1.2rem;
    }

    .formulario-header .logo-box {
        padding: 1rem 1.2rem;
        margin-bottom: 1rem;
    }

    .formulario-header .logo-box img {
        max-height: 55px;
    }

    .formulario-header h1 {
        font-size: 1.3rem;
    }

    .formulario-header p {
        font-size: 0.88rem;
    }

    .formulario-body {
        padding: 1.5rem 1.2rem 2rem;
    }

    /* Stack columns on mobile */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .radio-si-no {
        gap: 0.5rem;
    }

    .radio-option {
        padding: 0.5rem 0.8rem;
        flex: 1;
    }

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="tel"],
    .form-group select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 380px) {
    .formulario-body {
        padding: 1.2rem 1rem 1.5rem;
    }

    .formulario-header {
        padding: 1.5rem 1rem;
    }
}

/* ===== Checkbox Autorización Datos ===== */
.autorizacion-group {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.checkbox-autorizacion {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.88rem;
    color: #444;
    line-height: 1.5;
}

.checkbox-autorizacion input[type="checkbox"] {
    accent-color: #D2691E;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-autorizacion input[type="checkbox"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.autorizacion-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.78rem;
    color: #D2691E;
    font-style: italic;
}

.link-autorizacion {
    color: #D2691E;
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.link-autorizacion:hover {
    color: #B3591F;
}

/* ===== Modal Autorización ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: #fff;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #D2691E;
    margin: 0;
    line-height: 1.4;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #999;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
    transition: color 0.2s;
    flex-shrink: 0;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.2rem 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-body p {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.65;
    margin-bottom: 1rem;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-body p strong {
    color: #333;
}

.modal-body a {
    color: #D2691E;
    text-decoration: underline;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    text-align: center;
}

.btn-modal-cerrar {
    background: #D2691E;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.7rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-modal-cerrar:hover {
    background: #C56528;
}

@media (max-width: 600px) {
    .modal-container {
        border-radius: 12px;
        max-height: 90vh;
    }

    .modal-header {
        padding: 1.2rem 1.2rem 0.8rem;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 1rem 1.2rem;
    }

    .modal-footer {
        padding: 0.8rem 1.2rem;
    }
}
