/* ==========================================================================
   main_survey_quality.css
   Styles for Survey Data Quality & Scrubbing Lab (survey-quality-lab)
   Inherits house tokens from shared/css/main.css
   ========================================================================== */

/* Data Source Chooser Defensive Sizing & Scenario Metadata */
#data-source-chooser .dsc-panel,
#data-source-chooser .dsc-panel__body,
#data-source-chooser .scenario-controls__input {
    min-width: 0;
}

#scenario-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    text-overflow: ellipsis;
}

.sq-scenario-meta {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    line-height: 1.3;
}

.sq-scenario-lookfor {
    margin: 0.75rem 0 0;
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    border-left: 3px solid var(--app-accent, #2a7de1);
    border-radius: 6px;
    font-size: 0.88rem;
    color: var(--app-text, #1f2a37);
}

.sq-scenario-lookfor strong {
    color: #1e3a8a;
}

/* KPI Summary Cards */
.sq-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 0.9rem;
    margin: 1rem 0 1.25rem;
}

.sq-kpi-card {
    background: var(--app-card-bg, #ffffff);
    border: 1px solid var(--app-border, #d6dfea);
    border-left: 4px solid var(--app-accent, #2a7de1);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.sq-kpi-card.tone-sound {
    border-left-color: #009E73;
}

.sq-kpi-card.tone-caution {
    border-left-color: #E69F00;
}

.sq-kpi-card.tone-unreliable {
    border-left-color: #D55E00;
}

.sq-kpi-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    margin-bottom: 0.25rem;
}

.sq-kpi-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.sq-kpi-sub {
    font-size: 0.8rem;
    color: #475569;
    margin-top: 0.25rem;
}

/* Qualtrics Structure Detection Banner */
.sq-qualtrics-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-radius: 10px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0c4a6e;
    margin-top: 0.9rem;
    font-size: 0.9rem;
}

.sq-qualtrics-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.sq-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.3;
}

.sq-pill--info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #7dd3fc;
}

.sq-pill--sound {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.sq-pill--caution {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.sq-pill--unreliable {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Student Coaching Guide (uses canonical .callout-note container) */
.sq-coaching-callout {
    margin-bottom: 1.15rem;
}

.sq-coaching-callout h4 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
    color: var(--app-text, #1f2a37);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.sq-coaching-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.85rem;
    margin-top: 0.65rem;
}

.sq-coaching-tip {
    background: #ffffff;
    border: 1px solid var(--app-border, #d6dfea);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--app-text, #1f2a37);
}

.sq-coaching-tip strong {
    color: #1e3a8a;
    display: block;
    margin-bottom: 0.2rem;
}

/* Live Negative-Correlation Coaching Alert */
.sq-live-coach-alert {
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-left: 4px solid #D55E00;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0 0;
    font-size: 0.88rem;
    color: #7c2d12;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.sq-coach-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sq-mini-btn {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.sq-mini-btn:hover {
    background: #f1f5f9;
    border-color: #64748b;
}

.sq-mini-btn--primary {
    background: #1d4ed8;
    color: #ffffff;
    border-color: #1e40af;
}

.sq-mini-btn--primary:hover {
    background: #1e40af;
    color: #ffffff;
}

/* Column Role Workbench Table */
.sq-workbench-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.sq-workbench-toolbar h3 {
    margin: 0;
}

.sq-workbench-scroll {
    max-height: 440px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.sq-workbench-scroll--unbounded {
    max-height: none;
    margin-top: 0.9rem;
}

.sq-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.sq-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #1e293b;
    font-weight: 700;
    text-align: left;
    padding: 0.65rem 0.75rem;
    border-bottom: 2px solid #cbd5e1;
    z-index: 2;
}

.sq-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
    color: #1e293b;
}

.sq-table tr:hover td {
    background: #f8fafc;
}

.sq-col-id { width: 14%; }
.sq-col-wording { width: 34%; }
.sq-col-dist { width: 20%; }
.sq-col-role { width: 18%; }
.sq-col-sub { width: 14%; }

.sq-role-select,
.sq-sub-select,
.sq-target-input {
    font-size: 0.82rem;
    padding: 0.32rem 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #0f172a;
}

.sq-block-id-input {
    width: 95px;
}

.sq-item-rest-note {
    margin-top: 0.25rem;
    font-size: 0.78rem;
}

.sq-imc-pass-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: #991b1b;
    margin-bottom: 0.2rem;
}

.sq-cue-row {
    margin-top: 0.25rem;
}

/* Scrubbing Rules Controls & Block Severity Cards */
.sq-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.sq-controls-grid .control-group select,
.sq-controls-grid .control-group input[type="range"] {
    width: 100%;
}

.sq-section-subhead {
    margin-top: 1.25rem;
}

.sq-block-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.sq-block-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.15rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.sq-block-card.tier-low {
    border-top: 4px solid #E69F00;
}

.sq-block-card.tier-moderate {
    border-top: 4px solid #56B4E9;
}

.sq-block-card.tier-high {
    border-top: 4px solid #D55E00;
}

.sq-block-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.sq-block-card__title {
    margin: 0;
}

.sq-block-card__tier {
    margin: 0.45rem 0;
    font-weight: 700;
    font-size: 0.86rem;
    color: #0f172a;
}

.sq-block-card__stats {
    font-size: 0.83rem;
    color: #334155;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    margin-bottom: 0.6rem;
}

.sq-block-card__note {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #475569;
    background: #f8fafc;
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* Visual Diagnostic Section & Chart Cards */
.sq-visual-section {
    margin: 1.5rem 0;
}

.sq-visual-heading {
    margin: 0 0 1rem;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    color: var(--app-text, #1f2a37);
}

.sq-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.25rem;
}

.sq-chart-card {
    margin: 0;
}

.sq-chart-card--spaced {
    margin-top: 1.25rem;
}

.sq-chart-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.sq-chart-header h3 {
    margin: 0;
}

.sq-chart-header .section-subtitle {
    margin: 0.2rem 0 0;
}

.sq-chart-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.sq-plot-box {
    width: 100%;
    min-height: 360px;
}

.sq-plot-box--tall {
    min-height: 390px;
}

.sq-plot-box--med {
    min-height: 340px;
}

.sq-empty-plot-msg {
    padding: 1rem;
    color: var(--app-muted, #5f6b7a);
}

.sq-row-recommended td {
    background: #f0fdf4;
    font-weight: 600;
}

.sq-tvd-note {
    font-size: 0.78rem;
    color: #475569;
    margin-top: 0.2rem;
}

.sq-no-flags {
    color: #64748b;
}

.sq-apa-box {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-left: 4px solid var(--app-accent, #2a7de1);
    border-radius: 8px;
    padding: 0.95rem 1.15rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #0f172a;
    margin: 0.9rem 0;
}

.sq-export-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}

.sq-audit-inspector-wrap {
    margin-top: 1.5rem;
}

@media (max-width: 640px) {
    .sq-charts-grid {
        grid-template-columns: 1fr;
    }
}
