/* assets/components/market-selector.css — 7-market selector widget (P3 Phase 1A).
 *
 * Companion to assets/components/market-selector.js. Pure widget: page
 * injects regions, regionToCountries mapping, current value, onChange.
 *
 * STRUCTURE:
 *   Flat grid of region rows. Each region row is a checkbox + label. When
 *   a region with >1 country is checked, its country sub-grid renders
 *   INLINE below the region row. Unchecking the region removes the sub-
 *   grid and clears its countries. No accordion, no expand/collapse — the
 *   country detail's presence is driven entirely by the region checkbox.
 *
 *   Multilateral region (zero countries in config): single checkbox row,
 *   no sub-grid. Vendor IDs for multilateral bodies live in the wizard's
 *   Step 4 code-fields section, NOT in this widget.
 *
 * Used by: trial-setup.html Step 3, profile-update.html, future
 * subscriber-portal.html. Data source-of-truth: bidclarity_regions.py.
 *
 * Palette per CLAUDE.md: accent #00D4AA (selected state); F0F6FF body;
 * 9BBBD8 secondary; 7A9CC0 muted.
 */

/* ── Container ─────────────────────────────────────────────────── */
.market-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: 'DM Sans', sans-serif;
}

/* ── Region row ────────────────────────────────────────────────── */
.market-selector__region {
    background: #172440;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    overflow: hidden;
}

.market-selector__region.is-selected {
    border-color: rgba(0, 212, 170, 0.55);
    background: #131F35;
}

.market-selector__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    /* 48px tap target via padding around the 18px checkbox */
    min-height: 48px;
    cursor: pointer;
    user-select: none;
}

.market-selector__checkbox {
    width: 18px;
    height: 18px;
    accent-color: #00D4AA;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.market-selector__label {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: #F0F6FF;
    letter-spacing: -0.01em;
}

.market-selector__region.is-selected .market-selector__label {
    color: #00D4AA;
}

/* ── Country sub-grid (inline reveal when region is selected) ─── */
.market-selector__countries {
    padding: 4px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.market-selector__countries-hint {
    font-size: 0.78rem;
    color: #7A9CC0;
    margin: 10px 0 12px;
    line-height: 1.5;
}

.market-selector__countries-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 14px;
}

/* ── Country row ─────────────────────────────────────────────── */
.market-selector__country {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    cursor: pointer;
    padding: 4px 0;
}

.market-selector__country input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #00D4AA;
    flex-shrink: 0;
    cursor: pointer;
    margin: 0;
}

.market-selector__country-label {
    font-size: 0.85rem;
    color: #9BBBD8;
    line-height: 1.35;
}

.market-selector__country input[type="checkbox"]:checked
    + .market-selector__country-label {
    color: #F0F6FF;
}

/* ── Focus rings — js-mouse-user pattern (canonical) ──────────── */
body.js-mouse-user .market-selector__row:focus,
body.js-mouse-user .market-selector__country:focus {
    outline: none;
}

.market-selector__row:focus-visible,
.market-selector__country:focus-visible {
    outline: 2px solid #00D4AA;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Mobile-first: single column @ <600px ──────────────────────── */
@media (max-width: 600px) {
    .market-selector__countries-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .market-selector__label {
        font-size: 1rem;
    }

    .market-selector__country {
        min-height: 44px;
        padding: 6px 0;
    }

    .market-selector__country-label {
        font-size: 0.92rem;
    }
}
