/* ============================================================
   EPF — Edit Participant Form Design System
   Palette: #FCFAFA bg · #EDE9E2 fields · #F6E3D8 banner
            #4D4D4A dark · #B30E1C accent
   ============================================================ */

:root {
    --epf-bg:          #FCFAFA;
    --epf-field:       #EDE9E2;
    --epf-banner:      #F6E3D8;
    --epf-dark:        #4D4D4A;
    --epf-dark2:       #333330;
    --epf-placeholder: #a09890;
    --epf-border:      #e0dbd4;
    --epf-radius-pill: 999px;
    --epf-radius-sm:   10px;
    --epf-radius-md:   14px;
    --epf-section-gap: 1.25rem;
    --epf-row-gap:     .55rem;
    --epf-label-mb:    .28rem;
    --epf-input-h:     38px;
    --epf-shadow:      0 1px 3px rgba(0,0,0,.06), 0 4px 18px rgba(0,0,0,.05);
}

/* ════════════════════════════════════════════════════════════
   FORM WRAPPER
   ════════════════════════════════════════════════════════════ */
.epf-form {
    font-size: .85rem;
    color: var(--epf-dark);
    font-family: "FoundersGrotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ════════════════════════════════════════════════════════════
   BANNER INFORMATIVO
   ════════════════════════════════════════════════════════════ */
.epf-banner {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    background: var(--epf-banner);
    border-radius: var(--epf-radius-sm);
    padding: .65rem .9rem;
    margin-bottom: 1rem;
    font-size: .77rem;
    line-height: 1.45;
    color: #5a3a2a;
    flex-wrap: wrap;
}
.epf-banner__icon {
    font-size: .9rem;
    color: #a0532a;
    flex-shrink: 0;
    margin-top: .1rem;
}
.epf-banner__text {
    flex: 1;
    min-width: 0;
}
.epf-banner__link {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    background: var(--epf-dark);
    color: #fff !important;
    border-radius: var(--epf-radius-pill);
    padding: .28rem .8rem;
    font-size: .74rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .18s;
    flex-shrink: 0;
}
.epf-banner__link:hover {
    background: var(--epf-dark2);
    color: #fff !important;
    text-decoration: none;
}

/* ════════════════════════════════════════════════════════════
   SECCIONES
   ════════════════════════════════════════════════════════════ */
.epf-section {
    padding: 1rem 0 var(--epf-section-gap);
    border-top: 1px solid #e8e3dc;
}
.epf-section:first-of-type {
    border-top: none;
    padding-top: .15rem;
}
.epf-section--last {
    padding-bottom: .35rem;
}

/* Cabecera de sección */
.epf-section__head {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .7rem;
}
.epf-section__icon {
    font-size: .95rem;
    color: var(--epf-dark);
    flex-shrink: 0;
    opacity: .7;
}
.epf-section__title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--epf-dark);
    letter-spacing: .01em;
}

/* ════════════════════════════════════════════════════════════
   LABELS
   ════════════════════════════════════════════════════════════ */
.epf-label {
    display: block;
    font-size: .73rem;
    font-weight: 600;
    color: var(--epf-dark);
    margin-bottom: var(--epf-label-mb);
    letter-spacing: .005em;
    line-height: 1.3;
}
.epf-required {
    color: #B30E1C;
    margin-left: .1rem;
}

/* ════════════════════════════════════════════════════════════
   INPUTS / SELECTS / TEXTAREAS — BASE
   ════════════════════════════════════════════════════════════ */
.epf-input {
    display: block;
    width: 100%;
    height: var(--epf-input-h);
    padding: 0 .85rem;
    font-size: .82rem;
    font-family: inherit;
    color: var(--epf-dark);
    background: var(--epf-field);
    border: 1.5px solid transparent;
    border-radius: var(--epf-radius-pill);
    outline: none;
    transition: border-color .18s, background .18s, box-shadow .18s;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    line-height: 1;
}
.epf-input::placeholder {
    color: var(--epf-placeholder);
    font-size: .78rem;
}
.epf-input:focus {
    background: #f6f3ef;
    border-color: var(--epf-dark);
    box-shadow: 0 0 0 3px rgba(77,77,74,.09);
}
.epf-input[readonly] {
    opacity: .7;
    cursor: default;
}
.epf-input[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

/* Date input — keep icon visible */
.epf-input-wrap {
    position: relative;
}
.epf-input--date {
    padding-right: 2rem;
    cursor: pointer;
}
.epf-input-icon {
    position: absolute;
    right: .85rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .8rem;
    color: var(--epf-placeholder);
    pointer-events: none;
}

/* ════════════════════════════════════════════════════════════
   SELECTS
   ════════════════════════════════════════════════════════════ */
.epf-select-wrap {
    position: relative;
}
.epf-select {
    padding-right: 2.2rem;
    cursor: pointer;
}
.epf-select-arrow {
    position: absolute;
    right: .85rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .75rem;
    color: var(--epf-placeholder);
    pointer-events: none;
}
/* Remove default native arrow */
.epf-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* ════════════════════════════════════════════════════════════
   TEXTAREAS
   ════════════════════════════════════════════════════════════ */
.epf-textarea {
    display: block;
    width: 100%;
    padding: .55rem .9rem;
    font-size: .78rem;
    font-family: inherit;
    color: var(--epf-dark);
    background: var(--epf-field);
    border: 1.5px solid transparent;
    border-radius: var(--epf-radius-md);
    outline: none;
    resize: vertical;
    min-height: 58px;
    transition: border-color .18s, background .18s, box-shadow .18s;
    box-sizing: border-box;
    line-height: 1.45;
}
.epf-textarea::placeholder {
    color: var(--epf-placeholder);
    font-size: .74rem;
}
.epf-textarea:focus {
    background: #f6f3ef;
    border-color: var(--epf-dark);
    box-shadow: 0 0 0 3px rgba(77,77,74,.09);
}

/* ════════════════════════════════════════════════════════════
   TOGGLES / RADIO PILLS (Sí / No)
   ════════════════════════════════════════════════════════════ */
.epf-toggle-group {
    display: flex;
    flex-direction: column;
    gap: var(--epf-label-mb);
}
.epf-health-toggle-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--epf-gap, 1rem);
    row-gap: var(--epf-gap, 1rem);
    align-items: stretch;
}
.epf-health-toggle-grid > .epf-toggle-group--health {
    display: grid;
    grid-template-rows: 1fr auto auto;
    row-gap: var(--epf-label-mb);
    align-items: start;
}
@media (max-width: 767.98px) {
    .epf-health-toggle-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 479.98px) {
    .epf-health-toggle-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
.epf-toggle-label {
    font-size: .73rem;
    font-weight: 600;
    color: var(--epf-dark);
    line-height: 1.3;
    letter-spacing: .005em;
    align-self: start;
}
.epf-toggle-row {
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
    gap: .25rem;
    align-self: start;
    padding: .25rem;
    border-radius: var(--epf-radius-pill);
    background: var(--epf-field);
    border: .09375rem solid rgba(77,77,74,.08);
}

/* Pill radio label */
.epf-radio-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-inline-size: 3rem;
    min-block-size: 2rem;
    padding: 0 .85rem;
    background: transparent;
    border: .09375rem solid transparent;
    border-radius: var(--epf-radius-pill);
    font-size: .78rem;
    font-weight: 600;
    color: var(--epf-placeholder);
    cursor: pointer;
    transition: background .18s, border-color .18s, color .18s;
    user-select: none;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}
.epf-radio-pill input[type="radio"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.epf-radio-pill:hover {
    background: rgba(255,255,255,.65);
    color: var(--epf-dark);
}
.epf-radio-pill:focus-within {
    box-shadow: 0 0 0 .18rem rgba(77,77,74,.16);
}
.epf-radio-pill--active {
    background: var(--epf-dark);
    border-color: var(--epf-dark);
    color: #fff;
}
.epf-radio-pill--active:hover {
    background: var(--epf-dark2);
    color: #fff;
}

.epf-radio-pill:first-child::before {
    content: '';
    inline-size: 2.25rem;
    block-size: 1.1rem;
    border-radius: var(--epf-radius-pill);
    background: rgba(77,77,74,.16);
    margin-right: .45rem;
    box-shadow: inset 0 0 0 .08rem rgba(77,77,74,.08);
}
.epf-radio-pill:first-child::after {
    content: '';
    position: absolute;
    left: .72rem;
    inline-size: .85rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 .08rem .22rem rgba(0,0,0,.18);
    transition: transform .18s, background .18s;
}
.epf-radio-pill:first-child.epf-radio-pill--active::before {
    background: rgba(255,255,255,.24);
}
.epf-radio-pill:first-child.epf-radio-pill--active::after {
    transform: translateX(1.05rem);
}


/* Description field reveal */
.epf-desc-field {
    margin-top: .4rem;
    animation: epfReveal .18s ease-out forwards;
}
@keyframes epfReveal {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════════════════════════
   FOOTER / SAVE BUTTON
   ════════════════════════════════════════════════════════════ */
.epf-footer {
    display: flex;
    justify-content: flex-end;
    padding: .85rem 0 .2rem;
    border-top: 1px solid #e8e3dc;
    margin-top: .35rem;
}
.epf-save-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: var(--epf-dark);
    color: #fff;
    border: none;
    border-radius: var(--epf-radius-sm);
    padding: .5rem 1.5rem;
    font-size: .82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .18s, box-shadow .18s, transform .1s;
    box-shadow: 0 2px 8px rgba(77,77,74,.18);
    line-height: 1.35;
    white-space: nowrap;
    min-height: 38px;
}
.epf-save-btn:hover {
    background: var(--epf-dark2);
    box-shadow: 0 4px 12px rgba(77,77,74,.28);
    transform: translateY(-1px);
}
.epf-save-btn:active {
    transform: translateY(0);
}

#user-modal .epf-save-btn:disabled,
#user-modal .epf-save-btn[aria-disabled="true"] {
    background: #8d8982;
    box-shadow: none;
    cursor: not-allowed;
    opacity: .62;
    transform: none;
}

#user-modal .epf-save-btn:disabled:hover,
#user-modal .epf-save-btn[aria-disabled="true"]:hover {
    background: #8d8982;
    box-shadow: none;
    transform: none;
}

/* ════════════════════════════════════════════════════════════
   MODAL OVERRIDES — when used inside Bootstrap modal
   ════════════════════════════════════════════════════════════ */

/* When a modal wraps the edit-participant form, soften the bg */
/* Constrain to a balanced vertical proportion — not too wide */
.modal-epf .modal-dialog {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}
.modal-epf .modal-content {
    background: var(--epf-bg);
    border-radius: 18px;
    box-shadow: var(--epf-shadow);
    border: none;
    overflow: hidden;
}
.modal-epf .modal-header {
    border-bottom: 1px solid #e8e3dc;
    padding: .8rem 1.25rem;
    background: var(--epf-bg);
}
.modal-epf .modal-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--epf-dark);
}
.modal-epf .modal-body {
    padding: .9rem 1.25rem .4rem;
    background: var(--epf-bg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(90vh - 60px);
}
/* The epf-form provides its own footer — hide Bootstrap's modal-footer if present */
.modal-epf .modal-footer {
    display: none;
}

/* ════════════════════════════════════════════════════════════
   UAM — Add Participant Modal (user-modal)
   Same design system as EPF; scoped under .uam-* to avoid
   collisions while sharing all epf-* component classes.
   ════════════════════════════════════════════════════════════ */

/* Divider between "related participants" block and new form */
.uam-divider {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: .85rem 0 1rem;
    color: var(--epf-placeholder);
    font-size: .73rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.uam-divider::before,
.uam-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e8e3dc;
}

/* Checkbox list for related participants */
.uam-check-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.uam-check-list .form-check {
    display: flex;
    align-items: center;
    gap: .7rem;
    background: var(--epf-field);
    border-radius: var(--epf-radius-sm);
    padding: .6rem .85rem;
    margin: 0;
    cursor: pointer;
    transition: background .15s;
    /* kill Bootstrap’s default form-check left-padding that causes overlap */
    padding-left: .85rem;
}
.uam-check-list .form-check:hover {
    background: #e0dbd4;
}
.uam-check-list .form-check-input {
    /* reset Bootstrap’s absolute positioning — keep in normal flex flow */
    position: static;
    float: none;
    margin: 0;
    width: 16px;
    height: 16px;
    min-width: 16px;
    flex-shrink: 0;
    accent-color: var(--epf-dark);
    cursor: pointer;
    border-radius: 4px;
    vertical-align: middle;
}
.uam-check-list .form-check-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--epf-dark);
    cursor: pointer;
    line-height: 1.35;
    margin: 0;
    padding-left: 0;
    /* prevent label from wrapping under checkbox */
    flex: 1;
    min-width: 0;
}
.uam-empty-note {
    font-size: .78rem;
    color: var(--epf-placeholder);
    margin: 0;
    padding: .4rem .1rem;
}

/* Legal note */
.uam-legal-note {
    font-size: .73rem;
    color: var(--epf-placeholder);
    line-height: 1.5;
    margin-top: .85rem;
    margin-bottom: 0;
}
.uam-legal-link {
    color: var(--epf-dark);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(77,77,74,.25);
    transition: border-color .15s;
}
.uam-legal-link:hover {
    border-bottom-color: var(--epf-dark);
    text-decoration: none;
    color: var(--epf-dark);
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — mobile-first
   ════════════════════════════════════════════════════════════ */

/* ── ≤ 575px: true mobile ── */
@media (max-width: 575.98px) {
    :root {
        --epf-input-h:     42px;
        --epf-section-gap: 1rem;
        --epf-label-mb:    .3rem;
    }

    .modal-epf .modal-dialog {
        max-width: 100%;
        margin: .5rem;
    }
    .modal-epf .modal-content {
        border-radius: 14px;
    }
    .modal-epf .modal-body {
        padding: .85rem 1rem .4rem;
        max-height: calc(95vh - 56px);
    }
    .modal-epf .modal-header {
        padding: .7rem 1rem;
    }

    .epf-banner {
        font-size: .75rem;
        padding: .6rem .8rem;
        gap: .5rem;
        margin-bottom: .85rem;
    }
    .epf-banner__link {
        width: 100%;
        justify-content: center;
        margin-top: .15rem;
    }

    .epf-section {
        padding: .85rem 0 var(--epf-section-gap);
    }
    .epf-section:first-of-type {
        padding-top: .1rem;
    }
    .epf-section__head {
        margin-bottom: .6rem;
    }
    .epf-section__title {
        font-size: .8rem;
    }

    .epf-input,
    .epf-select {
        font-size: .84rem;
        padding: 0 .8rem;
    }
    .epf-input--date {
        padding-right: 1.8rem;
    }

    .epf-radio-pill {
        flex: 1;
        height: 40px;
        font-size: .8rem;
        justify-content: center;
        min-width: 0;
    }
    .epf-toggle-row {
        gap: .4rem;
    }
    .epf-toggle-label {
        font-size: .75rem;
    }

    .epf-textarea {
        min-height: 60px;
        font-size: .8rem;
    }

    .epf-footer {
        padding: .8rem 0 .15rem;
    }
    .epf-save-btn {
        width: 100%;
        justify-content: center;
        font-size: .84rem;
        min-height: 42px;
    }
    .epf-footer {
        justify-content: stretch;
    }

    /* UAM mobile */
    .uam-divider {
        margin: .7rem 0 .85rem;
    }
}
@media (min-width: 576px) and (max-width: 767.98px) {
    :root {
        --epf-input-h:     40px;
        --epf-section-gap: 1.1rem;
    }

    .modal-epf .modal-dialog {
        max-width: 520px;
    }
    .modal-epf .modal-body {
        padding: .9rem 1.15rem .4rem;
        max-height: calc(92vh - 58px);
    }

    .epf-save-btn {
        width: 100%;
        justify-content: center;
    }
    .epf-footer {
        justify-content: stretch;
    }
    .epf-radio-pill {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
}

/* ── 768px+: tablet & desktop ── */
@media (min-width: 768px) {
    .modal-epf .modal-body {
        max-height: calc(88vh - 60px);
    }
}
