/* Participant Disposition — layout + sidebar styles.
   Auto-served by Dash from /assets/. Mirrors visit_intervals.css. */

/* === Height plumbing (desktop only; see adherence.css for rationale) === */
@media (min-width: 992px) {
    #page-content-wrapper:has(.pd-page) {
        display: flex;
        flex-direction: column;
    }
    #page-content-wrapper:has(.pd-page) > div {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    #_pages_content:has(.pd-page) {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    .pd-page {
        flex: 1;
        min-height: 0;
    }
    .pd-layout {
        flex: 1;
        min-height: 0;
    }
}

.pd-page {
    width: 100%;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
}

.pd-layout {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

/* === Sidebar =========================================================== */
.pd-sidebar {
    flex: 0 0 240px;
    width: 240px;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 1rem 1rem 1.5rem 1rem;
    overflow-y: auto;
}

.pd-sidebar-header {
    font-weight: 600;
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.pd-label {
    display: block;
    font-weight: 500;
    font-size: 0.8rem;
    color: #495057;
    margin-bottom: 0.25rem;
    margin-top: 0.5rem;
}

.pd-sep {
    border-top: 1px solid #dee2e6;
    margin: 1rem 0 0.5rem 0;
}

.pd-check-list,
.pd-radio {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.pd-check-input,
.pd-radio-input {
    margin-right: 0.4rem;
}

.pd-check-label,
.pd-radio-label {
    font-size: 0.85rem;
    color: #212529;
    cursor: pointer;
}

.pd-dropdown {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

/* === Content =========================================================== */
.pd-content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1rem 1.25rem 2rem 1.25rem;
    overflow-y: auto;
}

.pd-message {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    min-height: 1rem;
}

/* === KPI bar =========================================================== */
.pd-kpi-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pd-kpi {
    flex: 1 1 0;
    min-width: 120px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    text-align: center;
}

.pd-kpi-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
    line-height: 1.1;
}

.pd-kpi-label {
    font-size: 0.72rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.25rem;
}

/* === Sections / graphs ================================================= */
.pd-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 1rem 0 0.4rem 0;
}

/* Section header row: title on the left, Expand/Collapse button on the right. */
.pd-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.pd-toggle-btn {
    border: 1px solid #ced4da;
    background-color: #ffffff;
    color: #495057;
    border-radius: 4px;
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}
.pd-toggle-btn:hover {
    background-color: #f1f3f5;
    border-color: #adb5bd;
}

/* Caption under a section title (e.g. "Of the randomized cohort"). */
.pd-subnote {
    font-size: 0.78rem;
    color: #868e96;
    margin: 0.2rem 0 0.3rem 0;
}

.pd-graph {
    border: 1px solid #e9ecef;
    border-radius: 4px;
    background-color: #ffffff;
    min-height: 240px;
}

/* Disposition funnel expand/collapse animation.
   - the container height eases between the 3-milestone and per-visit sizes
   - the contents do a soft fade + slide-in on each toggle. Two equivalent
     animation classes are alternated by a clientside callback so the keyframe
     re-fires every time (a CSS animation only restarts when the class changes). */
#pd-funnel-wrap .pd-graph {
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pdFunnelReveal {
    from { opacity: 0.3; transform: translateY(6px); }
    to   { opacity: 1;   transform: translateY(0); }
}

.pd-funnel-anim-1,
.pd-funnel-anim-2 {
    animation: pdFunnelReveal 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
    #pd-funnel-wrap .pd-graph { transition: none; }
    .pd-funnel-anim-1,
    .pd-funnel-anim-2 { animation: none; }
}

/* === Mobile (< lg) ===================================================== */
@media (max-width: 991.98px) {
    .pd-layout {
        flex-direction: column;
    }
    .pd-sidebar {
        flex: 0 0 auto;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        padding: 0.75rem 1rem;
        overflow-y: visible;
    }
    .pd-content {
        padding: 0.75rem 1rem 2rem 1rem;
        overflow-y: visible;
    }
    .pd-kpi {
        flex: 1 1 40%;
    }
}

@media (max-width: 575.98px) {
    .pd-sidebar {
        padding: 0.5rem 0.75rem;
    }
    .pd-content {
        padding: 0.5rem 0.75rem 1.5rem 0.75rem;
    }
}
