/* ==========================================================================
 * wsp_account_menu.css — The header-right account dropdown chrome (identity
 *                        strap, submenus, settings table). Markup is built in
 *                        layout.py::_render_account_menu (classes only).
 * Loaded on: EVERY page.   @see STYLE_GUIDE.md
 *
 * INJECTED BY : layout.py  (a <link> to this file). Shares the :root { --wsp-* }
 *               values emitted by shared.py :: build_header_vars_block().
 * VALUES FROM : app.toml  [account_menu] / [header_menu].  Edit knobs THERE.
 *               Static CSS does NOT hot-reload — restart after editing rules.
 * ========================================================================== */

/* ─── Account menu (.wsp-account-*) ──────────────────────────────────
   Inherits the canonical `.wsp-header-menu` chrome (white surface,
   navy stripe, scrollbars, item paddings); only adds: identity strap
   on top, narrower row paddings for action items, compact info-pane
   styling for the three submenus, and tight key/value layouts.
   Submenus open to the LEFT (anchor=top start, self=top end) so the
   centered main menu doesn't push them past the right viewport edge. */
.wsp-account-trigger {
    box-sizing: border-box;
    width: 40px;
    min-width: 40px;
    height: 40px;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}
.wsp-account-trigger:hover,
.wsp-account-trigger:focus,
.wsp-account-trigger:active {
    background: transparent !important;
}
/* Quasar paints a faint white-tinted overlay on q-btn hover via
   `.q-focus-helper` and the `::before` pseudo. Suppress both so the
   only hover signal is the underline. */
.wsp-account-trigger .q-focus-helper,
.wsp-account-trigger::before {
    display: none !important;
    background: transparent !important;
    opacity: 0 !important;
}
.wsp-account-trigger:hover .q-focus-helper,
.wsp-account-trigger:focus .q-focus-helper {
    background: transparent !important;
    opacity: 0 !important;
}
/* Red underline matches the icon width (not the button width) so it
   visually hugs the avatar glyph. Applied to .q-icon's parent
   `.q-btn__content` because the icon itself uses border for its glyph
   metrics — drawing on the wrapper sidesteps that. */
.wsp-account-trigger .q-btn__content {
    border-bottom: var(--wsp-header-btn-underline-px) solid transparent !important;
    padding-bottom: 1px !important;
    transition: border-color 120ms ease !important;
}
.wsp-account-trigger:hover .q-btn__content {
    border-bottom-color: var(--wsp-header-btn-underline-color) !important;
}
.wsp-account-trigger .q-icon {
    font-size: var(--wsp-acct-menu-trigger-icon-size-px) !important;
    color: #ffffff !important;
}
.q-menu.wsp-account-menu {
    min-width: var(--wsp-acct-menu-min-width-px);
}
.wsp-account-menu .wsp-account-list {
    padding: 0 !important;
    background: var(--wsp-hm-bg) !important;
    color: var(--wsp-hm-fg) !important;
}
/* Identity strap — solid black band so the email + role read as a
   distinct identity zone above the action items. */
.wsp-account-menu .wsp-account-id {
    padding: 8px 12px 6px 12px;
    background: #000000;
    color: #ffffff;
}
.wsp-account-menu .wsp-account-email {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    word-break: break-all;
    color: #ffffff;
}
.wsp-account-menu .wsp-account-role {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.80;
    margin-top: 2px;
    color: #ffffff;
}
.wsp-account-menu .wsp-account-divider {
    height: 1px;
    background: var(--wsp-hm-border);
    margin: 0;
}
/* Specificity boost: three class selectors so this beats the
   `.wsp-header-menu .q-item` rule above which has the same priority
   and ships with `padding: 4px 14px 4px 16px !important`. Padding
   itself comes from `[account_menu] item-padding` in app.toml — bump
   the LEFT value there to push icons rightward, or zero it to make
   them flush against the menu's inner border. */
.q-menu.wsp-account-menu .wsp-account-item {
    min-height: 30px !important;
    padding: var(--wsp-acct-menu-item-padding) !important;
    font-size: 12px;
    color: var(--wsp-hm-fg) !important;
    justify-content: flex-start !important;
    text-align: left !important;
}
.wsp-account-menu .wsp-account-item:hover {
    background: var(--wsp-hm-hover-bg) !important;
}
.wsp-account-menu .wsp-account-item .material-icons {
    font-size: 16px;
    color: #1a3d7c;
}
.wsp-account-menu .wsp-account-submenu-item .q-item__section--side
    .material-icons {
    color: #6b7280;
    font-size: 16px;
}
/* Icon column — fixed width so labels align across rows. Width +
   right gap are tunable via [account_menu] `avatar-width-px` /
   `avatar-gap-px` in app.toml. Quasar adds its own inline padding to
   q-item-sections; we explicitly zero it. */
.q-menu.wsp-account-menu .q-item .q-item__section--avatar {
    min-width: var(--wsp-acct-menu-avatar-width-px) !important;
    width: var(--wsp-acct-menu-avatar-width-px) !important;
    padding: 0 var(--wsp-acct-menu-avatar-gap-px) 0 0 !important;
    margin: 0 !important;
    justify-content: flex-start !important;
    align-self: center !important;
}
/* Label column — no left padding either; the avatar's right padding
   is the only gap between icon and label. */
.q-menu.wsp-account-menu .q-item .q-item__section--main {
    padding-left: 0 !important;
    margin-left: 0 !important;
}
/* Label section grows to fill space so the chevron lands flush right.
   Labels themselves stay left-aligned. */
.wsp-account-menu .q-item__section--main {
    flex: 1 1 auto !important;
    text-align: left !important;
    align-items: flex-start !important;
}
.wsp-account-menu .q-item__section--main .q-item__label {
    text-align: left !important;
}
/* Chevron column — pinned right. Pad-left tunable via
   [account_menu] `chevron-pad-left-px` in app.toml. */
.wsp-account-menu .q-item__section--side {
    min-width: 16px !important;
    padding-left: var(--wsp-acct-menu-chevron-pad-left-px) !important;
    margin-left: auto;
}

/* ─── Submenu pane (info-only content) ──────────────────────────────
   Inherits .wsp-header-menu shell. Pane gets its own padding cap so
   tables fit horizontally without spilling, and a max-height so long
   "My settings" lists scroll instead of pushing the menu off-screen. */
.q-menu.wsp-account-submenu {
    max-height: 70vh;
    overflow: auto;
}
.wsp-account-pane {
    padding: 8px 10px;
    min-width: 280px;
    max-width: 540px;
    color: var(--wsp-hm-fg, #111418);
}
.wsp-account-pane .wsp-account-empty {
    color: #6b7280;
    font-style: italic;
    padding: 4px 2px;
    font-size: 11px;
}
/* Two-column key/value lattice for "My access". Narrow key column,
   wrapping value column. */
.wsp-account-pane .wsp-account-kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 3px 10px;
    font-size: 11.5px;
}
.wsp-account-pane .wsp-account-k {
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
    align-self: center;
}
.wsp-account-pane .wsp-account-v {
    color: var(--wsp-hm-fg, #111418);
    word-break: break-word;
}
/* Compact info table (Last synced + per-page settings).
   `table-layout: auto` so columns size to content; `white-space:
   nowrap` keeps timestamps single-line; the pane's max-width caps the
   overall width. */
.wsp-account-pane .wsp-account-tbl {
    width: 100%;
    border-collapse: collapse;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 10.5px;
    margin: 2px 0;
}
.wsp-account-pane .wsp-account-tbl th {
    text-align: left;
    background: #f4f6fa;
    color: #1a3d7c;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    padding: 3px 6px;
    white-space: nowrap;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.wsp-account-pane .wsp-account-tbl td {
    padding: 2px 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    vertical-align: top;
    white-space: nowrap;
}
/* Long settings values: allow wrap so we don't truncate visually
   while still keeping nowrap on the timestamp table. */
.wsp-account-pane .wsp-account-settings .wsp-account-tbl td {
    white-space: normal;
    word-break: break-word;
}
.wsp-account-pane .wsp-account-grp {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 9px;
    font-weight: 700;
    color: #6b7280;
    margin: 4px 0 1px 0;
}
.wsp-account-pane .wsp-account-settings {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
/* My Settings — formatted table. Key column is a muted label, value
   column is the actual setting. No mono font (was reading like a
   debug dump); regular system font matches the rest of the menu. */
.wsp-account-pane .wsp-settings-tbl {
    font-family: inherit;
    font-size: 11.5px;
    border-collapse: collapse;
    width: 100%;
}
.wsp-account-pane .wsp-settings-tbl tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.wsp-account-pane .wsp-settings-tbl tr:last-child {
    border-bottom: 0;
}
.wsp-account-pane .wsp-settings-tbl td.wsp-settings-k {
    padding: 3px 10px 3px 4px;
    color: #4b5563;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: top;
    width: 1%;
}
.wsp-account-pane .wsp-settings-tbl td.wsp-settings-v {
    padding: 3px 4px;
    color: #111418;
    white-space: normal;
    word-break: break-word;
}
/* Group banner (Inventory / Map / etc.) — a small caps strap above
   each settings sub-table. Pull-up so it sits close to the first
   row of its group. */
.wsp-account-pane .wsp-account-settings .wsp-account-grp {
    background: #f4f6fa;
    color: #1a3d7c;
    padding: 3px 6px;
    border-radius: 2px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.10);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0 0 2px 0;
}
.wsp-account-pane code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0 3px;
    border-radius: 2px;
    font-size: 10px;
}

/* ─── Responsive header — progressive disclosure ────────────────────
   Groups in the header carry a priority class; CSS hides them in
   ascending order as the viewport narrows so the bar never wraps to
   a second row. Order matters — keep this strictly priority-ascending.
     P1 = page extras (basemap / options / legend etc.) — first to go
     P2 = nav links   (Map / Schedule / Inventory / …)  — JS also hides
          this group whenever its measured labels no longer fit
   Account icon (no priority class) is always visible. */
@media (max-width: 1100px) {
    .wsp-header-priority-1 { display: none !important; }
}
@media (max-width: 660px) {
    .wsp-header-priority-2 { display: none !important; }
}
@media (max-width: 520px) {
    .wsp-header-selector-divider,
    .wsp-header-selector-link { display: none !important; }
}
