/* Feedback dashboard (TLP-048) - layout only, design tokens, gap-only spacing.
   Colours/sizes come from the components (KPICard, ChartBar, Badge); this file
   only stacks the sections. No hardcoded colours, no external margins. */

/* Department fan-out (TLP-112) with no restaurants to select: the empty state. */
.feedback-view {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* The pinned chrome above the one panel: restaurant selector left (department
   mode), the three sub-tabs right; alone, the sub-tabs sit left. One row while
   both fit; when they do not, the sub-tabs drop to a second row rather than the
   restaurant strip clipping its last name -- the same wrap PoliciesRules' pinned
   header does with its nav and actions. The strip itself scrolls sideways only
   when the restaurants ALONE outgrow the row (house rule: a wide pill row scrolls
   inside its row, never wraps its pills). The stack's gap owns the space below;
   the panel underneath is the stack's last child, so the one-panel rule
   (Panel.css) gives it the rest of the tab and only its body scrolls. No margins
   here, and nothing about fill. */
.feedback-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    row-gap: var(--space-2);
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.feedback-entity-tabs {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
}

/* TLP-1323: which survey, left of the venue strip when more than one reports here.
   It keeps its natural width and, like the venue strip, scrolls sideways rather
   than pushing anything off the row. */
.feedback-survey-tabs {
    flex: 0 1 auto;
    min-width: 0;
    overflow-x: auto;
}

.feedback-sub-tabs {
    flex: 0 0 auto;
}

/* The fill chain (ui-patterns, "Layout, spacing & scroll"): panel body -> results
   section -> stack -> the trend. Every link is a flex column with flex:1 and
   min-height:0, so the ONE section that grows (the trend, below) is handed the
   height the numbers, the split and the topics leave over. The other sections keep
   their content height -- a flex item never shrinks below min-height:auto -- and
   when the whole is taller than the body, the body scrolls as before. */
[data-section="feedback-results"] {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.feedback-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    flex: 1;
    min-height: 0;
}

.feedback-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.feedback-section-title {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.feedback-overall {
    font-weight: 600;
}

.feedback-muted {
    color: var(--text-tertiary);
}

/* TLP-993: said when the comparison window holds no feedback, so the screen never
   shows a delta measured against nothing. */
.feedback-note {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* TLP-830: expanded response detail (per-guest ratings + full comment). */
.feedback-response-detail {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.feedback-response-comment {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ===== TLP-1003/1004/1005: the three sub-tabs ===== */

/* Overview -- how the window splits by sentiment. Three cells on one row, and each
   cell is itself ONE ROW -- count, sentiment, share on a shared baseline -- so the
   split costs the height of a line, not of a card, and the trend below it stays on
   the first screen. */
.feedback-split {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.feedback-split-cell {
    flex: 1 1 var(--space-32);
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: var(--border-width-1) solid var(--border-default);
    border-left-width: var(--border-width-2);
    border-radius: var(--radius-md);
    background: var(--bg-layer-2);
}

.feedback-split-cell[data-variant="error"] { border-left-color: var(--color-error); }
.feedback-split-cell[data-variant="warning"] { border-left-color: var(--color-warning); }
.feedback-split-cell[data-variant="success"] { border-left-color: var(--color-success); }

.feedback-split-count {
    font-size: var(--text-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    line-height: 1.1;
}

.feedback-split-label { flex: 1 1 auto; font-size: var(--text-sm); color: var(--text-secondary); }
.feedback-split-share { font-size: var(--text-xs); color: var(--text-muted); }

/* The one canvas on the page: a line over time, which a token-styled bar cannot
   draw. The trend section is the one that grows, between a floor (so it can never
   collapse inside the column) and a ceiling (so a tall screen does not turn a
   line into a wall). The canvas is out of flow on purpose: Chart.js sizes it to
   this box, and an in-flow canvas would feed its own height back into the box's
   intrinsic size and ratchet the section taller on every resize. */
.feedback-trend-section {
    flex: 1 1 auto;
}

.feedback-trend {
    position: relative;
    flex: 1 1 var(--space-32);
    min-height: var(--space-32);
    max-height: var(--space-96);
}

.feedback-trend canvas {
    position: absolute;
    inset: 0;
}

/* Questions -- one block per question, in the survey's own order. */
.feedback-question-block + .feedback-question-block {
    border-top: var(--border-width-1) solid var(--border-subtle);
    padding-top: var(--space-3);
}

.feedback-q-topic {
    margin-left: var(--space-2);
    padding: 0 var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    background: var(--bg-layer-3);
    border-radius: var(--radius-pill);
}

.feedback-q-meta,
.feedback-q-note {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 0 0 var(--space-2);
}

.feedback-text-answers {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.feedback-text-answer {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-layer-2);
    border-radius: var(--radius-sm);
}

.feedback-text-score {
    flex: 0 0 auto;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.feedback-text-body { flex: 1 1 auto; min-width: 0; color: var(--text-body); font-size: var(--text-sm); }
.feedback-text-meta { flex: 0 0 auto; font-size: var(--text-xs); color: var(--text-muted); }

/* Responses -- the weakest topic on the collapsed row, and the follow-up
   answers in the expanded one. */
.feedback-worst-topic {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    white-space: nowrap;
}

.feedback-attention-count { color: var(--color-error); font-weight: var(--font-weight-medium); }

.feedback-answer-row {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-1) 0;
}

.feedback-answer-label {
    flex: 0 0 var(--space-40);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.feedback-answer-value { flex: 1 1 auto; min-width: 0; font-size: var(--text-sm); color: var(--text-primary); }
