/* AuDHD staging additions — audhd-modi
   Loaded after app.css; overrides apply.
   Lives in web-staging only; never deployed to prod.

   T2.7.A — replace "empty" debug-leak with calm Standaardgedrag explainer
   T2.7.B — section reorder handled in Modes.js template
   T2.7.C — 1-line action summaries in mode rows (instead of "—")
   T2.7.D — relative-time chip per calendar entry, ticked by clock.now
   T2.7.E — Verwijder behind ⋯ overflow with inline confirmation
   T2.7.F — primary CTA "+ Plan een nieuwe periode" promoted next to title
*/

/* ---------- T2.7.A: calm explainer line under "Standaardgedrag" ---------- */

.mode-status-explainer {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary, #97a3b6);
}

/* ---------- T2.7.C: action summary line on Modi rows ---------- */

.mode-summary {
    color: var(--text-secondary, #97a3b6);
    font-size: 13px;
    line-height: 1.4;
}

.mode-summary--empty {
    font-style: italic;
    opacity: 0.75;
}

/* ---------- T2.7.D: relative-time chip on Kalender rows ---------- */

.mode-calendar-when {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    font-size: 12px;
    line-height: 1.3;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    white-space: nowrap;
}

.mode-calendar-when--future {
    color: #b8d4ff;
    background: rgba(106, 169, 255, 0.12);
    border-color: rgba(106, 169, 255, 0.35);
}

.mode-calendar-when--active {
    color: #b9f2c9;
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.35);
}

/* Past variant: solid muted text + visible border instead of stacked
   opacity. Reads as quiet historical context, still legible. */
.mode-calendar-when--past {
    color: var(--color-text-soft);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Light theme: dark-tuned text colors above are invisible on white tints;
   use semantic text-color tokens with darker peer rgba. */
[data-theme="light"] .mode-calendar-when--future {
    color: var(--color-info);
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.45);
}

[data-theme="light"] .mode-calendar-when--active {
    color: var(--color-success-text);
    background: rgba(5, 150, 105, 0.12);
    border-color: rgba(5, 150, 105, 0.45);
}

[data-theme="light"] .mode-calendar-when--past {
    color: var(--color-text-soft);
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.12);
}

/* ---------- T2.7.E: ⋯ overflow menu with inline confirmation ---------- */

.row-overflow {
    position: relative;
    display: inline-block;
}

.row-overflow-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    color: var(--text-secondary, #97a3b6);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
    font-family: inherit;
}

.row-overflow-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--text-primary, #e8eef7);
}

.row-overflow-toggle:focus-visible {
    outline: 2px solid var(--color-focus-outline);
    outline-offset: 2px;
}

.row-overflow-toggle.is-open {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #e8eef7);
}

.row-overflow-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    min-width: 220px;
    padding: 6px;
    background: var(--surface-1, #16202c);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.row-overflow-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
    color: var(--text-primary, #e8eef7);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}

.row-overflow-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.row-overflow-item--danger {
    color: #ff8888;
}

.row-overflow-item--danger:hover {
    background: rgba(255, 100, 100, 0.10);
    color: #ffb3b3;
}

.row-overflow-confirm {
    padding: 8px 10px;
}

.row-overflow-confirm-text {
    margin: 0 0 8px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary, #97a3b6);
}

.row-overflow-confirm-actions {
    display: flex;
    gap: 6px;
}

.row-overflow-confirm-actions .btn {
    flex: 1;
}

/* ---------- T2.7.F: primary CTA "+ Plan een nieuwe periode" ---------- */

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.section-header-row .section-header {
    margin: 0;
}

/* The promoted CTA reuses .btn .btn-primary tokens from app.css — same
   amber gradient as the Verblijven page Bereken button. No new colours. */
.mode-calendar-cta {
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────
   T2.7.G — De-blur pass: hero status block + timeline-band Kalender
   Cures the "all four cards stack identically" problem by breaking the
   shared .card chrome on the status section and replacing the calendar
   list's row-grammar with phase-tinted bands distinct from the editor
   list's rows.
   ───────────────────────────────────────────────────────────────────── */

.mode-hero {
    position: relative;
    padding: 28px 28px 24px 36px;
    border-radius: var(--radius-2xl, 24px);
    background:
        radial-gradient(circle at 88% 12%, color-mix(in srgb, var(--color-warning) 18%, transparent), transparent 38%),
        var(--color-bg-alt);
    border: 1px solid var(--color-line);
    overflow: hidden;
    isolation: isolate;
}
.mode-hero::before {
    content: '';
    position: absolute;
    left: 0; top: 14px; bottom: 14px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--color-warning);
}
.mode-hero--fallback::before { background: var(--color-text-faint); }

.mode-hero-eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    color: var(--color-text-muted);
    text-transform: uppercase;
}
.mode-hero-name {
    margin: 6px 0 0;
    font-family: 'Sora', 'Manrope', system-ui, sans-serif;
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--color-text);
}
.mode-hero-state {
    margin-top: 6px;
    color: var(--color-text-muted);
    font-size: 0.92rem;
}
.mode-hero-source { color: var(--color-text-soft); font-weight: 600; }
.mode-hero-since { font-variant-numeric: tabular-nums; }
.mode-hero-explainer {
    margin-top: 8px;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--color-text-muted);
    max-width: 60ch;
}
.mode-hero-chips {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.mode-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-pill, 999px);
    background: var(--color-bg-soft);
    border: 1px solid var(--color-line);
    color: var(--color-text-soft);
    font-size: 0.88rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.mode-hero-chip-icon { font-size: 0.95rem; line-height: 1; }
.mode-hero-chip--empty {
    color: var(--color-text-muted);
    font-style: italic;
    font-weight: 400;
}

/* ── Timeline bands ─────────────────────────────────────────────────── */

.mode-calendar-bands {
    list-style: none;
    padding: 0;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mode-calendar-band {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    padding: 14px 16px 14px 22px;
    border-radius: var(--radius-lg, 12px);
    background: var(--color-bg-soft);
    border: 1px solid var(--color-line);
    transition: background 140ms ease, border-color 140ms ease;
}
.mode-calendar-band:hover {
    background: color-mix(in srgb, var(--color-bg-soft) 70%, var(--color-bg-alt));
    border-color: var(--color-line-strong);
}
.mode-calendar-band-rail {
    position: absolute;
    left: 0; top: 10px; bottom: 10px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--color-line-strong);
}
.mode-calendar-band--active {
    background: color-mix(in srgb, var(--color-warning-soft) 60%, var(--color-bg-alt));
    border-color: color-mix(in srgb, var(--color-warning) 40%, var(--color-line-strong));
}
.mode-calendar-band--active .mode-calendar-band-rail { background: var(--color-warning); }
.mode-calendar-band--future .mode-calendar-band-rail { background: var(--color-water); }
/* Past entries stay full-contrast — rail color alone communicates phase.
   Don't stack opacity on the band; it makes historical records hard to
   read for no signal gain. */
.mode-calendar-band--past .mode-calendar-band-rail { background: var(--color-text-faint); }

.mode-calendar-band-dates {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-soft);
    font-variant-numeric: tabular-nums;
}
.mode-calendar-band-day { font-weight: 600; color: var(--color-text); font-size: 0.95rem; }
.mode-calendar-band-arrow { color: var(--color-text-muted); font-size: 0.95rem; }

/* Body lays mode name + relative-time chip on a single line; wraps below
   only when truly narrow. Inline pill is autism-safe (single visual chunk
   instead of two stacked pieces). */
.mode-calendar-band-body {
    min-width: 0;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    row-gap: 4px;
}
.mode-calendar-band-mode {
    font-weight: 600;
    color: var(--color-text);
    font-size: 1rem;
}

.mode-calendar-band-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .mode-hero {
        padding: 22px 20px 20px 26px;
    }
    .mode-hero-name {
        font-size: 1.65rem;
    }
    .mode-calendar-band {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 10px;
        padding: 14px 14px 14px 20px;
    }
    .mode-calendar-band-actions {
        display: grid;
        grid-template-columns: 1fr auto;
    }
    .mode-calendar-band-actions .btn { width: 100%; }
}

/* ─────────────────────────────────────────────────────────────────────
   T2.7.H — Modusbibliotheek as unframed chip strip
   "Configured once, then quiet" — drop the .card frame entirely. Section
   becomes a slim label + wrapping chip strip. Each chip = tap-to-edit,
   always-visible ⋯ (NOT hover-only — long-press on touch is undiscoverable
   and motor-control unfriendly for AuDHD users). Standaard mode marked
   inline with ★, no pill badge.
   ───────────────────────────────────────────────────────────────────── */

.mode-library {
    margin-top: 4px;
}
.mode-library-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}
.mode-library-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}
.mode-library-count {
    font-size: 0.75rem;
    color: var(--color-text-faint);
    font-variant-numeric: tabular-nums;
}
.mode-library-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.mode-library-chip {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    border-radius: 999px;
    background: var(--color-bg-soft);
    border: 1px solid var(--color-line);
    overflow: visible;
    transition: border-color 140ms ease, background 140ms ease;
}
.mode-library-chip:hover {
    border-color: var(--color-line-strong);
    background: color-mix(in srgb, var(--color-bg-soft) 70%, var(--color-bg-alt));
}
.mode-library-chip--default {
    border-color: color-mix(in srgb, var(--color-warning) 45%, var(--color-line-strong));
}

.mode-library-chip-body {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px 6px 12px;
    background: transparent;
    border: none;
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
}
.mode-library-chip-body:focus-visible {
    outline: 2px solid var(--color-focus-outline);
    outline-offset: 2px;
    border-radius: 999px;
}
.mode-library-chip-star {
    color: var(--color-warning);
    font-size: 0.85rem;
    line-height: 1;
}
.mode-library-chip-name { white-space: nowrap; }

.mode-library-chip-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    padding: 0 8px 0 4px;
    margin-left: 2px;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    border-radius: 0 999px 999px 0;
    transition: color 120ms ease, background 120ms ease;
}
.mode-library-chip-more:hover,
.mode-library-chip-more.is-open {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .mode-library-chip-more:hover,
[data-theme="light"] .mode-library-chip-more.is-open {
    background: rgba(0, 0, 0, 0.04);
}
.mode-library-chip-more:focus-visible {
    outline: 2px solid var(--color-focus-outline);
    outline-offset: 2px;
}

.mode-library-chip-menu {
    top: calc(100% + 4px);
}

.mode-library-add {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: transparent;
    border: 1px dashed var(--color-line-strong);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 140ms ease, color 140ms ease;
}
.mode-library-add:hover {
    border-color: var(--color-warning);
    color: var(--color-text);
}
.mode-library-add:focus-visible {
    outline: 2px solid var(--color-focus-outline);
    outline-offset: 2px;
}
