/* Treatment Plan Builder page styles.
   Theme, form controls and Select2 styling live in ../../assets/site.css and ../toolkit.css */

.smart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.smart-pass {
    background-color: rgba(22, 163, 74, 0.2);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.5);
}

.smart-miss {
    background-color: rgba(128, 128, 128, 0.15);
    opacity: 0.6;
}

.smart-helper-box {
    background-color: rgba(59, 130, 246, 0.06);
}

.objective-card {
    background-color: rgba(128, 128, 128, 0.04);
}

.archive-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background-color: rgba(22, 163, 74, 0.18);
    color: var(--success);
}

.apa-citation {
    padding-left: 2em;
    text-indent: -2em;
    text-align: left;
    line-height: 1.6;
}

/* Preview Document Styles */
.tp-document .tp-header {
    border-bottom: 2px solid currentColor;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.tp-document .tp-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 0.4rem 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(128, 128, 128, 0.3);
    font-size: 0.9rem;
}

.tp-document .tp-section {
    margin-bottom: 1.25rem;
}

.tp-document .tp-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(128, 128, 128, 0.4);
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
}

.tp-document .tp-goal-box {
    border: 1px solid rgba(128, 128, 128, 0.45);
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.tp-document .tp-goal-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(128, 128, 128, 0.25);
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
}

.tp-document .tp-sub ol {
    list-style-type: decimal;
    margin-left: 1.25rem;
}

.tp-document .tp-sub ul {
    list-style-type: disc;
    margin-left: 1.25rem;
}

.tp-document .tp-signatures {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(128, 128, 128, 0.5);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
}
/* Live plan preview looks like a printed page in both themes */
.plan-paper {
    padding: 22px 26px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #fff;
    color: #111;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 14px;
    line-height: 1.5;
}
.plan-paper .tp-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
}
.plan-paper h2,
.plan-paper h3 {
    color: #111 !important;
}
/* Where each suggested intervention comes from */
.int-tag {
    display: inline-block;
    margin-right: 4px;
    padding: 0 6px;
    border-radius: 99px;
    font-size: 0.85em;
    font-weight: 700;
}
.int-approach { background-color: var(--badge-bg); color: var(--badge-color); }
.int-diagnosis { background-color: rgba(74, 222, 128, 0.15); color: var(--success); }
.int-saved { background-color: rgba(251, 191, 36, 0.18); color: var(--warning); }

/* Long blanks (____) and signature lines wrap on phones instead of pushing the page sideways */
.tp-document .tp-meta-grid > div,
.tp-document .tp-signatures > div {
    min-width: 0;
    overflow-wrap: anywhere;
}
.tp-document .tp-signatures {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
}

/* Narrow screens: let the recommendation filter row wrap, and let long
   Select2 choices (e.g. "Acceptance and Commitment Therapy (ACT)") wrap
   instead of pushing the page sideways. */
@media (max-width: 640px) {
    #dxRecFilterSelect { max-width: 100%; min-width: 0; }
    .flex:has(#dxRecFilterSelect) { flex-wrap: wrap; }
    .select2-container { max-width: 100% !important; }
    .select2-container .select2-selection__choice {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .select2-container .select2-selection__choice__display { white-space: normal; }
}
