/* ── Registro Nacional de Formación — Trabajadores de la Construcción ── */

/* Variables */
:root {
    --primary: #16a34a;
    --primary-dark: #15803d;
    --primary-light: #4ade80;
    --primary-tint: #f0fdf4;
    --white: #ffffff;
    --dark: #1e293b;
    --light: #f1f5f9;
    --light-border: #e2e8f0;
    --border: #d0d5dd;
    --text-muted: #64748b;
    --danger: #dc2626;
    --transition: all 0.2s ease;
    --wrap-max: 760px;
    --page-pad: 16px;
}

/* ── Base ── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body.inces-public,
body.inces-public * {
    font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
}

body.inces-public {
    background: linear-gradient(160deg, #f0f7ff 0%, #f8fafc 40%, #eef6f1 100%);
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

/* ── Banner / cintillo ── */
.inces-banner {
    width: 100%;
    max-height: 280px;
    overflow: hidden;
    background: #0f3d2e;
    margin: 0 auto;
    display: block;
}

.inces-banner img {
    width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* ── Layout ── */
.inces-wrap {
    width: 100%;
    max-width: var(--wrap-max);
    margin: 0 auto;
    padding: 24px var(--page-pad) 48px;
}

.inces-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
    padding: 28px 24px 32px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    width: 100%;
}

/* ── Header ── */
.inces-logo {
    width: 72px;
    height: auto;
    margin-bottom: 12px;
}

.inces-header h1 {
    margin: 0 0 18px;
    font-size: clamp(1.1rem, 4vw, 1.45rem);
    color: #0f3d2e;
    line-height: 1.3;
    word-wrap: break-word;
}

.inces-header p.form-sub {
    margin: 0 0 18px;
    color: #475569;
    font-size: 0.88rem;
}

/* ── Formulario ── */
.inces-form .field-group {
    margin-bottom: 16px;
    min-width: 0;
}

.inces-form .field-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: #1e293b;
}

.inces-form .field-input,
.inces-form .field-textarea,
.inces-form select.field-input {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    min-height: 44px;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
}

.inces-form select.field-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.4 0L6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.inces-form .field-input:focus,
.inces-form select.field-input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-color: var(--primary);
}

.inces-form .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.inces-form .grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* ── Utilidades ── */
.inces-hint {
    font-size: 0.82rem;
    color: #64748b;
    margin: 4px 0 0;
    line-height: 1.4;
}

.ppl-intro {
    margin-bottom: 12px;
}

.inces-hidden {
    display: none !important;
}

.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.required-star {
    color: #dc2626;
}

.section-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 20px 0 16px;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin: 0 0 12px;
}

/* ── Acciones y mensajes ── */
.inces-actions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inces-msg {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    display: none;
    word-wrap: break-word;
    font-size: 0.92rem;
    line-height: 1.4;
}

.inces-msg.ok {
    display: block;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.inces-msg.err {
    display: block;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ── Botones ── */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    letter-spacing: 0.01em;
    min-height: 48px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--white);
    color: var(--dark);
    border: 1px solid var(--light-border);
}

.btn-secondary:hover {
    background: var(--light);
    border-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 36px;
}

/* ── Email split ── */
.email-split {
    display: flex;
    align-items: stretch;
    gap: 6px;
    width: 100%;
}

.email-split .email-local {
    flex: 1 1 0;
    min-width: 0;
}

.email-split .at-sign {
    font-weight: 700;
    color: #475569;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 2px;
}

.email-split .email-domain {
    flex: 1 1 0;
    min-width: 0;
}

#email_domain_custom {
    margin-top: 8px;
}

/* ── Documento split ── */
.doc-split {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 320px;
    align-items: stretch;
}

.doc-split .doc-tipo#tipo_documento,
.doc-split select.doc-tipo {
    flex: 0 0 64px;
    width: 64px;
    min-width: 64px;
    padding-left: 8px;
    padding-right: 28px;
    text-align: center;
}

.doc-split #cedula,
.doc-split input.doc-tipo,
.doc-split .doc-num {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}

/* ── Teléfono split ── */
.tel-split {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: stretch;
}

.tel-split .tel-codigo#tel_codigo,
.tel-split select.tel-codigo {
    flex: 0 1 42%;
    min-width: 0;
    width: auto;
}

.tel-split #tel_numero,
.tel-split input.tel-codigo,
.tel-split .tel-numero {
    flex: 1 1 58%;
    min-width: 0;
    width: auto;
}

/* ── Mapa ── */
.map-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

#incesMapPreview {
    display: none;
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    height: 220px;
}

#incesMapPreview iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ── Chips y UC ── */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.filter-chip .chip-close {
    cursor: pointer;
    color: #64748b;
    font-size: 16px;
    line-height: 1;
}

.filter-chip .chip-close:hover {
    color: var(--danger);
}

.filter-chip-active {
    background: var(--primary);
    color: var(--white);
}

.filter-chip-active .chip-close {
    color: var(--white);
}

.filter-chip-active .chip-close:hover {
    color: #bbf7d0;
}

.uc-inces-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    min-height: 0;
}

.uc-inces-search-wrap {
    position: relative;
}

.uc-inces-dropdown {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 240px;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.uc-inces-option {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--dark);
    cursor: pointer;
}

.uc-inces-option:hover {
    background: #f1f5f9;
}

.uc-inces-option.muted {
    cursor: default;
    color: var(--text-muted);
}

.uc-inces-perfiles {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    font-size: 13px;
    color: var(--dark);
}

.uc-inces-perfil-list {
    margin: 0;
    padding-left: 18px;
}

.uc-inces-perfil-list li {
    margin: 4px 0;
}

/* ── UC badge de límite ── */
.uc-limit-badge {
    display: inline-block;
    font-size: 0.8rem;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 2px 8px;
    margin-left: 8px;
    font-weight: 500;
}

.uc-limit-badge.full {
    background: #fef3c7;
    color: #92400e;
}

/* ── PPL Checkboxes ── */
.ppl-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ppl-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--light-border);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.88rem;
    color: var(--dark);
    line-height: 1.4;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.ppl-option span {
    word-break: break-word;
    hyphens: auto;
}

.ppl-option:hover {
    border-color: var(--primary);
    background: var(--primary-tint);
}

.ppl-option input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.ppl-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-tint);
    font-weight: 600;
}

/* Fallback sin :has() — clase opcional vía JS no requerida; navegadores modernos OK */
.ppl-option input[type="checkbox"]:checked+span {
    font-weight: 600;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

/* Tablet */
@media (max-width: 768px) {
    .inces-banner {
        max-width: 100%;
        max-height: 200px;
        border-radius: 0;
    }

    .inces-banner img {
        max-height: 200px;
    }

    .inces-wrap {
        padding: 16px 12px 40px;
    }

    .inces-card {
        padding: 20px 16px 24px;
        border-radius: 12px;
    }

    .inces-form .grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .inces-form .grid-3 .field-group:last-child {
        grid-column: 1 / -1;
    }
}

/* Móvil */
@media (max-width: 640px) {
    :root {
        --page-pad: 12px;
    }

    .inces-banner {
        max-height: 140px;
    }

    .inces-banner img {
        max-height: 140px;
    }

    .inces-wrap {
        padding: 12px var(--page-pad) 32px;
    }

    .inces-card {
        padding: 16px 14px 20px;
        border-radius: 10px;
        box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    }

    .inces-header h1 {
        margin-bottom: 14px;
        font-size: 1.1rem;
    }

    .inces-form .grid-2,
    .inces-form .grid-3 {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .inces-form .grid-3 .field-group:last-child {
        grid-column: auto;
    }

    .inces-form .field-label {
        font-size: 0.85rem;
    }

    .section-title {
        font-size: 0.75rem;
    }

    /* Email: apilar en pantallas estrechas */
    .email-split {
        flex-wrap: wrap;
    }

    .email-split .email-local {
        flex: 1 1 calc(100% - 28px);
    }

    .email-split .at-sign {
        flex: 0 0 20px;
        justify-content: center;
    }

    .email-split .email-domain {
        flex: 1 1 100%;
        margin-top: 6px;
    }

    .doc-split {
        max-width: 100%;
    }

    .tel-split {
        flex-direction: column;
        gap: 8px;
    }

    .tel-split .tel-codigo#tel_codigo,
    .tel-split select.tel-codigo,
    .tel-split #tel_numero,
    .tel-split input.tel-codigo,
    .tel-split .tel-numero {
        flex: 1 1 auto;
        width: 100%;
    }

    .ppl-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ppl-option {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .inces-actions {
        margin-top: 18px;
    }

    .inces-actions .btn {
        width: 100%;
    }

    .section-divider {
        margin: 16px 0 12px;
    }
}

/* Móvil muy pequeño */
@media (max-width: 380px) {
    .inces-banner {
        max-height: 110px;
    }

    .inces-banner img {
        max-height: 110px;
    }

    .inces-card {
        padding: 14px 12px 18px;
    }

    .inces-header h1 {
        font-size: 1rem;
    }

    .doc-split select.doc-tipo {
        flex: 0 0 56px;
        width: 56px;
        min-width: 56px;
    }
}

/* Preferencia de menos movimiento */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none;
    }
}

/*
.imagen-full {
    background-image: url('banner.jpg');
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.7);
}
*/