/* pick_quick_fa.css — Quick Fatty Acid picker pop-up. */

/* Header icon (matches --primary-hover). */
.pqfa-title-icon { color: var(--primary-hover); }

.pqfa-card {
    width: 92vw;
    max-width: 720px;
    height: 80vh;
    max-height: 720px;
}
.pqfa-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* ── Search ────────────────────────────────────────────────────── */
.pqfa-search-wrap {
    position: relative;
    padding: 0.85rem 1rem 0.7rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pqfa-search-icon {
    position: absolute;
    left: 1.6rem;
    color: var(--text-muted);
    pointer-events: none;
}
.pqfa-search {
    flex: 1;
    padding: 0.55rem 0.85rem 0.55rem 2.2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    background: var(--bg-surface-2);
    transition: border-color 0.12s, background 0.12s;
}
.pqfa-search:focus {
    border-color: var(--primary-color);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.pqfa-count {
    color: var(--text-muted);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ── Type filter chips ─────────────────────────────────────────── */
.pqfa-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}
.pqfa-types:empty {
    display: none;
}
.pqfa-type-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-surface-2);
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.pqfa-type-chip:hover {
    background: var(--primary-row-hover);
    border-color: var(--primary-color);
    color: var(--accent-primary);
}
.pqfa-type-chip.is-active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--on-accent);
}
.pqfa-type-chip.is-empty {
    opacity: 0.45;
}
.pqfa-type-count {
    font-variant-numeric: tabular-nums;
    font-size: 0.82em;
    padding: 0.02rem 0.4rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
}
.pqfa-type-chip.is-active .pqfa-type-count {
    background: rgba(255, 255, 255, 0.25);
}

/* ── List ──────────────────────────────────────────────────────── */
.pqfa-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: var(--bg-card);
    padding: 0 0 0.6rem;
}

/* ── Group sections (Recents, Saturated, Polyunsaturated, …) ───── */
.pqfa-group {
    border-bottom: 1px solid var(--border-color);
}
.pqfa-group:last-child { border-bottom: none; }

.pqfa-group-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem 0.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg-surface-2);
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    position: sticky;
    top: 0;
    z-index: 1;
}
.pqfa-group-header--link { color: var(--primary-color); cursor: pointer; }
.pqfa-group-header--link:hover {
    background: var(--primary-row-hover);
    color: var(--accent-primary);
}
.pqfa-group-header--link:hover .pqfa-group-arrow {
    transform: translateX(2px);
    opacity: 1;
}
.pqfa-group-arrow {
    margin-left: auto;
    opacity: 0.5;
    transition: transform 0.15s, opacity 0.15s;
}
.pqfa-group-header--recent {
    color: var(--nav2);
    background: var(--bg-surface-2);
    border-bottom-color: var(--border-color);
}
.pqfa-group-header--recent i {
    color: var(--nav2);
}
/* The star in the "Recent & Bookmarked" header keeps the bookmark gold, so the
   header names both halves of the section in the colours the rows use. */
.pqfa-group-header--recent .pqfa-group-header-star {
    color: var(--accent-omega6);
    margin-left: -0.15rem;
}
.pqfa-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}
.pqfa-row:hover,
.pqfa-row:focus {
    background: var(--primary-row-hover);
    outline: none;
}
.pqfa-row.is-active {
    background: var(--focus-ring);
}
.pqfa-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.55rem;
}
.pqfa-row-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
    transition: text-decoration-color 0.15s ease;
}
.pqfa-row-abbrv {
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    flex-shrink: 0;
}
.pqfa-row-notation {
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    padding: 0.05rem 0.4rem;
    background: var(--bg-surface-2);
    border-radius: 4px;
    flex-shrink: 0;
    min-width: 3.2rem;
    text-align: center;
}
.pqfa-tags {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
    align-items: center;
}
.pqfa-tag {
    font-weight: 600;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    line-height: 1.1;
    white-space: nowrap;
    border: 1px solid transparent;
}
.pqfa-tag-omega {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}
.pqfa-tag-omega-3 { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.pqfa-tag-omega-6 { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.pqfa-tag-omega-9 { background: #ecfccb; color: #3f6212; border-color: #d9f99d; }
.pqfa-tag-trans {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

/* ── First column: the .badgeCombo pill (type · notation · omega) ──
   Styling of the pill itself lives in assets_ui/css/badges.css (.badgeCombo). */
.pqfa-row-combo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    min-width: 7.5rem;
}

/* ── Badge columns (bookmark, trans) ───────────────────────────── */
.pqfa-col {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pqfa-col-trans { min-width: 3.6rem; }

.pqfa-col-fav {
    width: 1.1rem;
    min-width: 1.1rem;
}
.pqfa-fav-star {
    color: var(--accent-omega6);
    font-size: var(--fs-xs);
    line-height: 1;
}

/* Row hover → underline the common name (transitioned via decoration color). */
.pqfa-row:hover .pqfa-row-name,
.pqfa-row:focus .pqfa-row-name {
    text-decoration-color: currentColor;
}

/* Group-header hover → underline the header text. */
.pqfa-group-header-text {
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
    transition: text-decoration-color 0.15s ease;
}
.pqfa-group-header--link:hover .pqfa-group-header-text {
    text-decoration-color: currentColor;
}

/* ── The mobile type <select> ─────────────────────────────────────────────── */
.pqfa-type-select { display: none; }


/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — the picker below 820px
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 820px) {

    #pick-quick-fa.p2-overlay { padding: 0; }

    /* Full-bleed. The overlay's padding and the card's rounding are what make
       it read as a dialog; both go. 100dvh, not 100vh: on mobile Safari and
       Chrome 100vh is the tallest the viewport ever gets, so the last row of
       the list would sit permanently under the browser's own toolbar. */
    .p2-overlay .pqfa-card {
        width: 100%;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border: none;
        border-radius: 0;
    }

    /* The row keeps its place but changes job: filter + count, no search. */
    .pqfa-search,
    .pqfa-search-icon { display: none; }

    .pqfa-search-wrap { padding: 0.6rem 0.75rem; }

    .pqfa-type-select {
        display: block;
        flex: 1;
        min-width: 0;
        padding: 0.5rem 0.6rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--bg-card);
        color: var(--text-main);
        font-family: inherit;
        font-size: var(--fs-md);
    }

    .pqfa-types { display: none; }

    /* Rows: combo · star · name. */
    .pqfa-col-trans { display: none; }

    .pqfa-row {
        gap: 0.45rem;
        padding: 0.6rem 0.75rem;
    }
    .pqfa-row-combo { min-width: 6.5rem; }

    .pqfa-group-header { padding: 0.45rem 0.75rem 0.35rem; }
}


/* ── Dark mode ────────────────────────────────────────────────────────────── */
body.dark-mode .pqfa-tag-omega   { background: #14532d; color: #bbf7d0; border-color: #166534; }
body.dark-mode .pqfa-tag-omega-3 { background: #1e3a8a; color: #bfdbfe; border-color: #1d4ed8; }
body.dark-mode .pqfa-tag-omega-6 { background: #78350f; color: #fde68a; border-color: #92400e; }
body.dark-mode .pqfa-tag-omega-9 { background: #365314; color: #d9f99d; border-color: #4d7c0f; }
body.dark-mode .pqfa-tag-trans   { background: #7f1d1d; color: #fecaca; border-color: #991b1b; }

body.dark-mode .pqfa-type-count { background: rgba(255, 255, 255, 0.12); }
body.dark-mode .pqfa-type-chip.is-active .pqfa-type-count { background: rgba(0, 0, 0, 0.28); }
