/* LUB Shakthi — the member top bar: global search and the account menu. */

/* Inside the bar's left zone it is brand | search, and search takes the
   slack. The brand is capped so a long chapter name cannot squeeze the box
   off a phone. */
/* The wordmark is the one thing in a phone header that must not be cut off:
   "LUB Sh…" is not a name. It was capped at 46% to leave room for a search
   box that collapses to an icon at this width anyway. */
.mbrand { flex: none; max-width: none; min-width: 0; }

/* ─────────────────────────────────────────────── global search */

.gsearch { position: relative; flex: 1; min-width: 0; margin: 0; }

/* `flex: 1` is load-bearing. `.gsearch` is itself made a flex container on
   the desktop header (lub.css, `.mbrand, .mtop-l > .gsearch`), which turns
   this box into a flex *item* — and a flex item's default `flex: 0 1 auto`
   sizes it to its content, not to its parent. The box sat at 208px inside a
   502px column and the input inside it at 158px, so the placeholder read
   "Search members, produ…": a field that looks broken before it is used.
   `min-width: 0` so a long value can still shrink it rather than push the
   header wide. */
.gsearch-box {
    display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
    background: var(--bg); border: 1px solid transparent; border-radius: 999px;
    padding: 0 6px 0 14px; transition: background .16s, border-color .16s, box-shadow .16s;
}
.gsearch-box:focus-within {
    background: #fff; border-color: var(--brand-200);
    box-shadow: 0 0 0 3px rgba(249,115,22,.14);
}
.gsearch-box > .material-symbols-outlined { font-size: 20px; color: var(--ink-3); flex: none; }
.gsearch input {
    flex: 1; min-width: 0; border: 0; background: transparent; min-height: 0;
    padding: 10px 0; font-size: 14px; font-family: inherit;
}
.gsearch input:focus { outline: 0; }
.gsearch input::-webkit-search-cancel-button { display: none; }

/* On a wide screen the box is always there, so neither toggle is needed. */
.gsearch-open, .gsearch-close { display: none; }

.gsearch-sheet {
    /* Clear of the whole header, including the row of tabs that sits below
       the bar at tablet width — a menu that starts halfway down the tabs
       reads as a mistake even though it is painted correctly on top. */
    position: absolute; left: 0; right: 0; z-index: 70;
    top: calc(100% + 8px + var(--mtabs-h, 0px));
    background: #fff; border: 1px solid var(--line-2); border-radius: 14px;
    box-shadow: 0 16px 40px rgba(17,24,39,.17); overflow: hidden; padding: 6px;
    max-height: 64vh; overflow-y: auto;
    animation: sheetIn .18s cubic-bezier(.22,1,.36,1);
}
.gs-group {
    font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink-3); padding: 9px 10px 5px;
}
.gs-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: 10px; color: inherit; transition: background .13s;
}
.gs-item:hover, .gs-item.is-active { background: var(--bg); }
.gs-item .grow { flex: 1; min-width: 0; }
.gs-item .t {
    display: block; font-size: 13.5px; font-weight: 600; line-height: 1.35;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gs-item .d {
    display: block; font-size: 11.5px; color: var(--ink-3);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gs-ico {
    width: 34px; height: 34px; flex: none; border-radius: 10px;
    display: grid; place-items: center; background: var(--bg); color: var(--ink-2);
}
.gs-ico .material-symbols-outlined { font-size: 18px; }
.gs-ico.requirement { background: #EFF6FF; color: #1D4ED8; }
.gs-ico.offer { background: #ECFDF5; color: #047857; }
.gs-all {
    display: block; text-align: center; margin-top: 4px; padding: 10px;
    border-top: 1px solid var(--line); font-size: 12.5px; font-weight: 700;
    color: var(--brand-deep);
}
.gs-all:hover { background: var(--brand-50); }
.gs-empty { padding: 20px 12px; text-align: center; font-size: 13px; color: var(--ink-3); }

/* ─────────────────────────────────────────────── account menu */

.me { position: relative; flex: none; }
.me summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 2px;
    padding: 3px 4px 3px 3px; border-radius: 999px;
    transition: background .15s;
}
.me summary::-webkit-details-marker { display: none; }
.me summary:hover { background: var(--bg); }
.me[open] summary { background: var(--brand-50); }
.me .caret { font-size: 18px; color: var(--ink-3); transition: transform .18s; }
.me[open] .caret { transform: rotate(180deg); }

/* Hung off the control itself rather than off a measured distance from the
   top of the bar: the bar is 62px on a phone and 58px on a desktop, and a
   fixed `top: 50px` was right in neither. */
.me-sheet {
    position: absolute; right: 0; z-index: 70; width: 268px;
    top: calc(100% + 6px + var(--mtabs-h, 0px));
    background: #fff; border: 1px solid var(--line-2); border-radius: 16px;
    box-shadow: 0 16px 44px rgba(17,24,39,.18); overflow: hidden; padding: 6px;
    animation: sheetIn .18s cubic-bezier(.22,1,.36,1);
}

.me-card {
    display: flex; align-items: center; gap: 11px; padding: 11px 10px;
    border-radius: 12px; color: inherit; transition: background .14s;
}
.me-card:hover { background: var(--bg); }
.me-card.is-plain { cursor: default; }
.me-card.is-plain:hover { background: 0; }
.me-card .grow { flex: 1; min-width: 0; }
.me-card .n {
    display: block; font-size: 14px; font-weight: 700; letter-spacing: -.01em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-card .d {
    display: block; font-size: 11.5px; color: var(--ink-3);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.me-items { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.me-out { border-top: 1px solid var(--line); margin: 4px 0 0; padding-top: 4px; }

.me-item {
    display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
    background: 0; border: 0; cursor: pointer; font-family: inherit;
    font-size: 13.5px; font-weight: 600; color: var(--ink-2);
    padding: 10px 11px; border-radius: 10px; transition: background .14s, color .14s;
}
.me-item:hover { background: var(--bg); color: var(--ink); }
.me-item .material-symbols-outlined { font-size: 19px; }
.me-out .me-item:hover { background: var(--red-bg); color: var(--red); }
.me-count {
    margin-left: auto; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px;
    background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 800;
    display: grid; place-items: center;
}

/* ─────────────────────────────────────────────── search results page */

.result {
    display: flex; align-items: center; gap: 12px; padding: 13px 18px;
    border-bottom: 1px solid var(--line); color: inherit; transition: background .14s;
}
.result:last-child { border-bottom: 0; }
.result:hover { background: var(--bg); }
.result .grow { flex: 1; min-width: 0; }
.result .t { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.result .d { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.result-chips { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.result .go { color: var(--ink-3); flex: none; font-size: 20px; }

/* ─────────────────────────────────────────────── narrow screens */

@media (max-width: 720px) {
    /* A permanent search box would leave nothing else room, so it becomes an
     * icon that expands over the whole bar when tapped. */
    .gsearch { position: static; flex: none; }
    .gsearch-open {
        display: grid; place-items: center; width: 40px; height: 40px;
        border: 0; background: 0; border-radius: 50%; cursor: pointer; color: var(--ink-2);
        transition: background .15s;
    }
    .gsearch-open:hover { background: var(--bg); }
    .gsearch-open .material-symbols-outlined { font-size: 23px; }

    .gsearch-box {
        position: absolute; inset: 0 14px; z-index: 80; margin: auto 0; height: 44px;
        background: #fff; border-color: var(--line-2); display: none;
    }
    .gsearch-close {
        display: grid; place-items: center; width: 32px; height: 32px; flex: none;
        border: 0; background: var(--bg); border-radius: 50%; cursor: pointer; color: var(--ink-2);
    }
    .gsearch-close .material-symbols-outlined { font-size: 18px; }

    .gsearch.is-open .gsearch-box { display: flex; }
    .gsearch.is-open .gsearch-open { visibility: hidden; }
    .gsearch-sheet { left: 14px; right: 14px; top: 58px; }
}

@media (max-width: 400px) {
    .me .caret { display: none; }
    .mbrand-txt small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .gsearch-sheet, .me-sheet { animation: none; }
    .me .caret { transition: none; }
}
