/* Cockpit density chip — top-right control + popover menu.
 *
 * Plain-language: styles the small chip that lives in the topbar
 * and the popover menu it opens. The chip is intentionally quiet
 * (matches the existing topbar buttons in tone) and gets brighter
 * on hover. The popover sketches a tiny preview of each density
 * mode so a manager who has never seen the choice understands what
 * "Simple" vs "Standard" actually changes. Theme-aware: every colour
 * is bound to an existing Cockpit CSS var so dark and light modes
 * inherit the right palette.
 */

.cockpit-density-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 12px;
    font-family: var(--font);
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    /* WHY: stays out of the way visually but readable. The chip is a
       commitment to symmetry (manager sees what rep sees), so it must
       be findable on every page without hijacking the eye. */
}

.cockpit-density-chip:hover {
    background: var(--card-hover);
    color: var(--text-bright);
    border-color: var(--border-light);
}

.cockpit-density-chip-icon {
    font-size: 14px;
    line-height: 1;
}

.cockpit-density-chip-label {
    letter-spacing: 0.2px;
}

.cockpit-density-chip-caret {
    font-size: 10px;
    opacity: 0.7;
    margin-left: 2px;
}

/* Mode-specific border tint so the chip carries a tiny visual cue
   matching its current value. Subtle — the label still does the
   heavy lifting. */
/* Wave 1.a : mode tint reads from a dedicated token so it does
   not collide with --accent (which the active sidebar link also
   uses). See styles.css :root block for the fallback / color-mix
   pair. */
.cockpit-density-chip[data-value="simple"]   { border-left: 2px solid var(--green); }
.cockpit-density-chip[data-value="standard"] { border-left: 2px solid var(--density-mode-accent); }
.cockpit-density-chip[data-value="expert"]   { border-left: 2px solid var(--yellow); }

/* ---- Popover menu ---- */

.cockpit-density-menu {
    position: fixed;
    z-index: 10500;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 6px;
    min-width: 280px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* WHY: max-width keeps the live preview readable even on narrow
       viewports; min-width prevents the option titles from wrapping
       awkwardly when the only label is "Simple". */
}

.cockpit-density-menu-item {
    text-align: left;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 13px;
    transition: background 0.1s ease, border-color 0.1s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cockpit-density-menu-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
}

.cockpit-density-menu-item.is-current {
    background: var(--bg-tertiary);
    border-color: var(--accent-dim);
}

.cockpit-density-menu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cockpit-density-menu-title {
    font-weight: 600;
    color: var(--text-bright);
}

.cockpit-density-menu-current {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    text-transform: lowercase;
    letter-spacing: 0.3px;
}

.cockpit-density-menu-hint {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Tiny preview sketches — different shape per density. */
.cockpit-density-menu-preview {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px;
    height: 56px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    /* WHY: the preview is intentionally not interactive. It's a
       sketch, not a real-time view. Decorative aria-hidden is set
       in the JS that generates it. */
}

.cdm-bar {
    background: var(--bg-tertiary);
    border-radius: 3px;
    height: 12px;
}
.cdm-bar-1 { width: 70%; }
.cdm-bar-2 { width: 90%; }
.cdm-bar-3 { width: 60%; }

.cdm-row {
    background: var(--bg-tertiary);
    height: 5px;
    border-radius: 2px;
    width: 100%;
}

.cdm-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    flex: 1;
}
.cdm-grid > span {
    background: var(--bg-tertiary);
    border-radius: 2px;
    height: 10px;
}

/* Density chip slot helper — when the chip is added directly to
   the topbar-actions group it picks up flex spacing automatically. */
.topbar-actions .cockpit-density-chip {
    margin-left: 4px;
}
