/* ==============================
   FORMS
============================== */

.form-card {
    background: #ffffff;
    border: 1px solid #e5e5e7;
    border-radius: 26px;
    padding: 34px;
}

.form-section {
    margin-bottom: 36px;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.full-width {
    grid-column: span 2;
}

label {
    display: block;
    margin: 18px 0 7px 0;
    color: #6e6e73;
    font-size: 13px;
    font-weight: 400;
}

.form-grid label {
    margin-top: 0;
}

input,
textarea {
    width: 100%;
    border: 1px solid #d2d2d7;
    border-radius: 14px;
    background: #fbfbfd;
    color: #1d1d1f;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input {
    height: 46px;
    padding: 0 14px;
}

textarea {
    min-height: 110px;
    padding: 14px;
    resize: vertical;
    line-height: 1.55;
}

input:focus,
textarea:focus {
    background: #ffffff;
    border-color: #86868b;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.04);
}

.button-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}


/* ==============================
   eUCCAP STRUCTURED FORM + DETAIL
============================== */

.form-section h2 {
    border-left: 4px solid #5b6fcf;
    padding-left: 14px;
}

.form-section {
    scroll-margin-top: 96px;
    border-top: 1px solid #eeeeef;
    padding-top: 30px;
}

.form-section:first-of-type {
    border-top: none;
    padding-top: 0;
}

.uccap-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 34px;
    align-items: start;
}

.uccap-main-content {
    min-width: 0;
}

.uccap-side-menu {
    position: sticky;
    top: 92px;
    align-self: start;
    max-height: calc(100vh - 112px);
    overflow: auto;
    order: 2;
}

.uccap-side-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e5e5e7;
    border-radius: 22px;
    padding: 18px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.05);
}

.uccap-side-title {
    margin: 0 0 12px 0;
    color: #6e6e73;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.uccap-side-section,
.uccap-side-submenu a {
    display: block;
    text-decoration: none;
    border-radius: 12px;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.uccap-side-section {
    margin-top: 8px;
    padding: 9px 10px;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 600;
}

.uccap-side-submenu {
    margin: 2px 0 8px 0;
    padding-left: 10px;
    border-left: 2px solid #e5e5e7;
}

.uccap-side-submenu a {
    padding: 7px 10px;
    color: #6e6e73;
    font-size: 13px;
    line-height: 1.25;
}

.uccap-side-section:hover,
.uccap-side-submenu a:hover {
    background: #f5f5f7;
    color: #3154c9;
    transform: translateX(2px);
}

.uccap-group,
.clinical-section,
.field-block {
    scroll-margin-top: 96px;
}

.uccap-group {
    border: 1px solid #e5e5e7;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 28px;
    background: #ffffff;
}

.uccap-group legend {
    padding: 0 10px;
    font-weight: 600;
    color: #1d1d1f;
    font-size: 15px;
}

.form-field {
    width: 100%;
}

.form-field select {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #d2d2d7;
    border-radius: 14px;
    background: #fbfbfd;
    color: #1d1d1f;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-field select:focus {
    background: #ffffff;
    border-color: #86868b;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.04);
}

.radio-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 18px !important;
    min-height: 38px !important;
    padding: 2px 0 !important;
}

.radio-option {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: auto !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 14px !important;
    color: #1d1d1f !important;
    line-height: 1.2 !important;
    cursor: pointer;
}

.form-card input[type="radio"],
.form-card input[type="checkbox"],
.radio-row input[type="radio"],
.radio-row input[type="checkbox"],
.radio-input {
    appearance: auto !important;
    -webkit-appearance: radio !important;
    width: 14px !important;
    height: 14px !important;
    min-width: 14px !important;
    min-height: 14px !important;
    max-width: 14px !important;
    max-height: 14px !important;
    display: inline-block !important;
    padding: 0 !important;
    margin: 0 7px 0 0 !important;
    border-radius: 50% !important;
    border: initial !important;
    background: initial !important;
    box-shadow: none !important;
    flex: 0 0 14px !important;
    cursor: pointer;
    accent-color: #1d1d1f;
}

.radio-option span {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.detail-item {
    background: #fbfbfd;
    border: 1px solid #eeeeef;
    border-radius: 16px;
    padding: 16px;
}

.detail-item span {
    display: block;
    color: #6e6e73;
    font-size: 12px;
    margin-bottom: 8px;
}

.detail-item p {
    margin: 0;
    color: #1d1d1f;
    font-size: 14px;
}

.detail-full {
    grid-column: span 2;
}

.empty-group-message {
    margin: 0;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fbfbfd;
    border: 1px dashed #d2d2d7;
    color: #8a8a8e;
    font-size: 13px;
}

.empty-section-message {
    margin: 0;
    padding: 18px 20px;
    border-radius: 16px;
    background: #fbfbfd;
    border: 1px dashed #d2d2d7;
    color: #6e6e73;
    font-size: 14px;
}

@media (max-width: 1100px) {
    .uccap-layout {
        grid-template-columns: 1fr;
    }

    .uccap-side-menu {
        position: static;
        order: -1;
        max-height: none;
    }

    .uccap-side-card {
        padding: 14px;
    }

    .uccap-side-submenu {
        display: none;
    }
}

@media (max-width: 900px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-full {
        grid-column: span 1;
    }
}


/* ==============================
   FOLLOW-UP VISITS
============================== */

.followup-visits {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.followup-visit-card {
    border: 1px solid #eeeeef;
    border-radius: 18px;
    background: #fbfbfd;
    padding: 18px;
}

.followup-visit-card[hidden],
.followup-visit-card.is-hidden {
    display: none;
}

.followup-visit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.followup-visit-title {
    margin: 0;
    color: #1d1d1f;
    font-size: 15px;
    font-weight: 600;
}

.followup-visit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.followup-visit-grid .full-width {
    grid-column: span 2;
}

.followup-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.followup-add-visit,
.followup-remove-visit {
    min-height: 36px;
    padding: 0 14px;
    font-size: 13px;
}

.followup-add-visit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.followup-status {
    margin: 0;
    color: #6e6e73;
    font-size: 13px;
}

.followup-summary-grid {
    margin-top: 20px;
}

@media (max-width: 900px) {
    .followup-visit-grid {
        grid-template-columns: 1fr;
    }

    .followup-visit-grid .full-width {
        grid-column: span 1;
    }
}

/* ==============================
   FORM VALIDATION
============================== */

.required-help {
    margin: 0 0 18px 0;
    color: #6e6e73;
    font-size: 13px;
}

.required-mark {
    color: #c62828;
    font-weight: 700;
}

.form-error-summary {
    margin-bottom: 24px;
    padding: 18px 20px;
    border: 1px solid #f0b8b8;
    border-radius: 18px;
    background: #fff5f5;
    color: #5f1717;
}

.form-error-summary h2 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #8b1e1e;
}

.form-error-summary p {
    margin: 0 0 12px 0;
    color: #7a2a2a;
}

.form-error-summary ul {
    margin: 0;
    padding-left: 20px;
}

.form-error-summary li + li {
    margin-top: 6px;
}

.form-error-summary a {
    color: #9f1f1f;
    font-weight: 600;
}

.form-field.has-error label {
    color: #9f1f1f;
    font-weight: 600;
}

.form-field.has-error input,
.form-field.has-error textarea,
.form-field.has-error select {
    border-color: #d92d20;
    background: #fff8f8;
    box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.08);
}

.form-field.has-error .radio-row {
    border: 1px solid #d92d20;
    border-radius: 14px;
    padding: 10px 12px !important;
    background: #fff8f8;
}

.field-error {
    margin: 7px 0 0 0;
    color: #b42318;
    font-size: 13px;
    line-height: 1.35;
}

.uccap-group.has-errors {
    border-color: #f0b8b8;
    box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.04);
}

.group-error-label,
.nav-error-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    border-radius: 999px;
    background: #fee4e2;
    color: #b42318;
    font-size: 12px;
    font-weight: 600;
}

.group-error-label {
    padding: 3px 8px;
}

.nav-error-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
}

.uccap-side-submenu a.has-group-errors {
    color: #b42318;
    font-weight: 600;
}

.followup-visit-card.has-errors {
    border-color: #f0b8b8;
    box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.04);
}

.followup-detail-list {
    display: grid;
    gap: 16px;
}

.followup-detail-card {
    display: block;
}

.followup-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 10px;
}

.followup-detail-field strong {
    display: block;
    color: #6e6e73;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.followup-detail-field p {
    margin: 0;
}

.followup-summary-detail {
    margin-top: 16px;
}

@media (max-width: 900px) {
    .followup-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ==============================
   DYNAMIC PATIENT SECTIONS
============================== */

[data-uccap-section].is-hidden,
[data-uccap-section][hidden] {
    display: none !important;
}

[data-uccap-section]:not(.is-hidden) {
    animation: uccap-section-enter 0.22s ease-out;
}

@keyframes uccap-section-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

[data-uccap-dynamic] .uccap-side-section.is-active,
[data-uccap-dynamic] .uccap-side-submenu a.is-active {
    background: #edf0ff;
    color: #3154c9;
    font-weight: 700;
}

[data-uccap-dynamic] .uccap-side-section.is-active {
    box-shadow: inset 3px 0 0 #5b6fcf;
}

[data-uccap-dynamic] .uccap-side-submenu a.is-active {
    box-shadow: inset 2px 0 0 #5b6fcf;
}

[data-uccap-dynamic] .uccap-side-submenu.is-open {
    border-left-color: #cfd6ff;
}

[data-uccap-group]:target,
[data-uccap-section]:target {
    outline: 3px solid rgba(91, 111, 207, 0.18);
    outline-offset: 4px;
}

@media (max-width: 1100px) {
    [data-uccap-dynamic] .uccap-side-menu {
        position: sticky;
        top: 72px;
        z-index: 4;
        max-height: 48vh;
    }

    [data-uccap-dynamic] .uccap-side-submenu {
        display: block;
    }
}

.uccap-side-section.is-disabled {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #8d8d92;
    background: #f5f5f7;
    border: 1px dashed #d9d9de;
    cursor: not-allowed;
    pointer-events: none;
}

.uccap-side-section.is-disabled:hover {
    color: #8d8d92;
    background: #f5f5f7;
    transform: none;
    box-shadow: none;
}

.uccap-side-section-note {
    flex-shrink: 0;
    color: #8d8d92;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
