@import url('tokens.css');

:root {
    --mp-primary: #1a237e;
    --mp-accent: #00c9a7;
    --mp-bg: #f5f6fa;
    --mp-card-bg: #ffffff;
    --mp-text: #2d3748;
    --mp-text-secondary: #718096;
    --mp-text-muted: #a0aec0;
    --mp-border: #e2e8f0;
    --mp-radius: 14px;
    --mp-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background: var(--mp-bg);
    color: var(--mp-text);
    min-height: 100vh;
}

/* ============================
   Hero / Header
   ============================ */
.mp-hero {
    background: linear-gradient(135deg, var(--mp-primary) 0%, #0d47a1 100%);
    color: #fff;
    text-align: center;
    padding: 32px 20px 28px;
}

.mp-hero h1 {
    font-size: clamp(22px, 4.4vw, 34px);
    font-weight: 800;
    margin-bottom: 6px;
}

.mp-hero p {
    font-size: 14px;
    opacity: 0.85;
    max-width: 500px;
    margin: 0 auto 20px;
}

@media (max-width: 640px) {
    .mp-hero { padding: 22px 16px 20px; }
    .mp-hero p { display: none; }        /* compact mobile — subtitle hidden */
    .mp-hero-nav { display: none; }      /* keep hero focused on search */
}

/* Search bar */
.mp-search-bar {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
}

.mp-search-input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    background: rgba(255,255,255,0.95);
    color: var(--mp-text);
    outline: none;
}

.mp-search-input::placeholder { color: var(--mp-text-muted); }

.mp-search-btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    background: var(--mp-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mp-search-btn:hover { background: #00b394; }

/* ============================
   Main Content
   ============================ */
.mp-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

/* ============================
   Filters
   ============================ */
/* App-like toolbar: sticky horizontal chip scroller + floating filter button. */
.mp-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    position: sticky;
    top: var(--topbar-h, 0);
    background: var(--mp-bg, #f7fafc);
    z-index: 20;
    backdrop-filter: saturate(1.2) blur(6px);
    border-block-end: 1px solid var(--mp-border, #e2e8f0);
    margin-block-end: 4px;
}
.mp-chip-scroller {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}
.mp-chip-scroller::-webkit-scrollbar { display: none; }
.mp-chip-scroller { cursor: grab; }
.mp-chip-scroller.is-dragging { cursor: grabbing; user-select: none; }
.mp-chip-scroller.is-dragging .mp-filter-chip { pointer-events: none; }
.mp-filters {
    display: flex;
    gap: 8px;
    padding: 4px 16px;
    /* single-row horizontal scroll — no wrap */
    flex-wrap: nowrap;
    width: max-content;
}

/* Floating filter button (visible always — opens the sidebar/sheet). */
.mp-filter-fab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--mp-border, #e2e8f0);
    border-radius: 999px;
    background: #fff;
    color: var(--mp-text, #2d3748);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
}
.mp-filter-fab:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.mp-filter-fab i { color: var(--mp-primary, #1f8feb); }
.mp-filter-count {
    background: var(--mp-primary, #1f8feb);
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.mp-filter-chip {
    padding: 8px 18px;
    border: 1px solid var(--mp-border);
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    color: var(--mp-text-secondary);
    background: var(--mp-card-bg);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.mp-filter-chip:hover {
    border-color: var(--mp-primary);
    color: var(--mp-primary);
}

.mp-filter-chip.active {
    background: var(--mp-primary);
    border-color: var(--mp-primary);
    color: #fff;
}

/* Skeleton loader cards — shown for ~200–800ms while /api/marketplace
   responds. Uses a subtle shimmer so users perceive progress. */
.mp-skel-card {
    background: var(--mp-card-bg, #fff);
    border: 1px solid var(--mp-border, #e2e8f0);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.mp-skel-cover {
    height: 140px;
    background: linear-gradient(90deg, #edf2f7 0%, #f7fafc 40%, #edf2f7 80%);
    background-size: 400% 100%;
    animation: mpSkelShimmer 1.6s ease-in-out infinite;
}
.mp-skel-body { padding: 14px 16px; }
.mp-skel-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #edf2f7 0%, #f7fafc 40%, #edf2f7 80%);
    background-size: 400% 100%;
    animation: mpSkelShimmer 1.6s ease-in-out infinite;
    margin-block-end: 10px;
}
.mp-skel-line--title { width: 65%; height: 14px; }
.mp-skel-line--sub   { width: 45%; height: 10px; }
.mp-skel-line--meta  { width: 80%; height: 10px; margin-block-end: 0; }
@keyframes mpSkelShimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
@media (prefers-color-scheme: dark) {
    .mp-skel-cover, .mp-skel-line {
        background: linear-gradient(90deg, #1e293b 0%, #334155 40%, #1e293b 80%);
        background-size: 400% 100%;
    }
}

.mp-filter-select {
    padding: 8px 16px;
    border: 1px solid var(--mp-border);
    border-radius: 24px;
    font-size: 13px;
    color: var(--mp-text-secondary);
    background: var(--mp-card-bg);
    cursor: pointer;
    outline: none;
}

/* ============================
   Featured Section
   ============================ */
.mp-featured {
    margin-bottom: 36px;
}

.mp-section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--mp-text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mp-section-title i { color: var(--mp-accent); }

.mp-featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

/* ============================
   Store Cards
   ============================ */
.mp-store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

/* Business type badge (rendered inside the card body under the cover). */
.mp-card-type-row { margin-block: 4px 6px; }
.mp-card-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: color-mix(in oklab, var(--mp-primary, #1f8feb) 12%, transparent);
    color: var(--mp-primary, #1f8feb);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

@media (max-width: 640px) {
    .mp-featured-grid, .mp-store-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
@media (min-width: 641px) and (max-width: 900px) {
    .mp-featured-grid, .mp-store-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.mp-store-card {
    background: var(--mp-card-bg);
    border-radius: var(--mp-radius);
    overflow: hidden;
    box-shadow: var(--mp-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
    /* content-visibility skips layout+paint for off-screen cards → covers
       (CSS background-image), logos, badges all lazy-render for free.
       contain-intrinsic-size reserves space so scroll doesn't jump. */
    content-visibility: auto;
    contain-intrinsic-size: 340px;
}

.mp-store-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.mp-card-cover {
    height: 120px;
    background:
        radial-gradient(circle at 20% 100%, rgba(255,255,255,0.15), transparent 40%),
        linear-gradient(135deg, var(--mp-primary, #1f8feb), #0d47a1);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}
/* Decorative pattern that softens the plain blue cover on cards without an
   uploaded cover image. Adds subtle "app card" texture. */
.mp-card-cover::after {
    content: '';
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.08) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
    opacity: 0.6;
    pointer-events: none;
}

.mp-card-logo {
    position: absolute;
    bottom: -22px;
    inset-inline-start: 16px;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 3px solid var(--mp-card-bg);
    object-fit: cover;
    background: var(--mp-card-bg);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mp-card-logo-placeholder {
    position: absolute;
    bottom: -22px;
    inset-inline-start: 16px;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 3px solid var(--mp-card-bg);
    background: linear-gradient(135deg, var(--mp-primary), var(--mp-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-weight: 700;
}

.mp-card-pro-badge {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    background: var(--mp-accent, #10b981);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
[dir="rtl"] .mp-card-pro-badge { right: auto; inset-inline-end: 10px; }

.mp-card-body {
    padding: 30px 16px 16px;
}

.mp-card-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--mp-text);
    margin-bottom: 4px;
}

.mp-card-location {
    font-size: 13px;
    color: var(--mp-text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mp-card-desc {
    font-size: 13px;
    color: var(--mp-text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mp-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--mp-text-secondary);
}

.mp-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: var(--mp-text);
}

.mp-card-rating i { color: #f59e0b; font-size: 12px; }

.mp-card-reviews { color: var(--mp-text-muted); }

.mp-card-services {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mp-card-services i { font-size: 12px; }

/* ============================
   Empty State
   ============================ */
.mp-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--mp-text-muted, #64748b);
    background: linear-gradient(180deg, #f8fafc 0%, transparent 100%);
    border-radius: 16px;
}
.mp-empty-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    background: color-mix(in oklab, var(--mp-primary, #1f8feb) 12%, transparent);
    color: var(--mp-primary, #1f8feb);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}
.mp-empty h3 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px;
}
.mp-empty p {
    color: #64748b;
    margin: 0 0 24px;
}
.mp-empty-btn {
    padding: 12px 24px;
    background: var(--mp-primary, #1f8feb);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px -4px color-mix(in oklab, var(--mp-primary, #1f8feb) 60%, transparent);
}
.mp-empty-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -4px color-mix(in oklab, var(--mp-primary, #1f8feb) 60%, transparent); }
.mp-empty-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 12px 0 6px;
}
.mp-empty-remove {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    color: var(--mp-text);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
}
.mp-empty-remove:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}
.mp-empty-remove i { font-size: 10px; opacity: 0.7; }
@media (prefers-color-scheme: dark) {
    .mp-empty-remove { background: #1e293b; border-color: #334155; color: #e2e8f0; }
    .mp-empty-remove:hover { background: #7f1d1d; border-color: #ef4444; color: #fff; }
}

/* ============================
   Pagination
   ============================ */
.mp-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
}

.mp-page-btn {
    padding: 8px 16px;
    border: 1px solid var(--mp-border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--mp-text-secondary);
    background: var(--mp-card-bg);
    cursor: pointer;
    transition: all 0.2s;
}

.mp-page-btn:hover {
    border-color: var(--mp-primary);
    color: var(--mp-primary);
}

.mp-page-btn.active {
    background: var(--mp-primary);
    border-color: var(--mp-primary);
    color: #fff;
}

.mp-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mp-page-info {
    font-size: 13px;
    color: var(--mp-text-muted);
    padding: 0 8px;
}

/* ============================
   Loading
   ============================ */
.mp-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--mp-text-muted);
}

.mp-loading i {
    font-size: 28px;
    margin-bottom: 10px;
    display: block;
}

/* ============================
   Footer CTA
   ============================ */
.mp-cta {
    text-align: center;
    padding: 48px 24px;
    background: var(--mp-card-bg);
    border-top: 1px solid var(--mp-border);
    margin-top: 48px;
}

.mp-cta h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--mp-text);
    margin-bottom: 8px;
}

.mp-cta p {
    font-size: 15px;
    color: var(--mp-text-secondary);
    margin-bottom: 20px;
}

.mp-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--mp-accent);
    color: #fff;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.mp-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 201, 167, 0.4);
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 768px) {
    .mp-hero { padding: 40px 16px 36px; }
    .mp-hero h1 { font-size: 26px; }
    .mp-search-bar { flex-direction: column; }
    .mp-main { padding: 0 16px 40px; }
    .mp-featured-grid { grid-template-columns: 1fr; }
    .mp-store-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .mp-filters { gap: 6px; }
    .mp-filter-chip { padding: 6px 14px; font-size: 12px; }
}

/* ============================================================
   Doctoralia-style redesign additions
   ============================================================ */

/* Hero 3-field search */
.mp-hero-search {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: rgba(255,255,255,0.12);
    padding: 8px;
    border-radius: 16px;
}
.mp-hero-field {
    flex: 1 1 200px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 12px;
    padding: 0 14px;
}
.mp-hero-field i { color: var(--mp-primary); font-size: 14px; }
.mp-hero-field input {
    flex: 1;
    border: none;
    outline: none;
    padding: 14px 0;
    font-size: 15px;
    background: transparent;
    color: var(--mp-text);
}
.mp-hero-mode {
    display: flex;
    background: #fff;
    border-radius: 12px;
    padding: 4px;
    gap: 2px;
}
.mp-mode-opt {
    border: none;
    background: transparent;
    padding: 10px 14px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--mp-text-secondary);
    cursor: pointer;
    white-space: nowrap;
}
.mp-mode-opt.active { background: var(--mp-primary); color: #fff; }

/* Toolbar: type chips + result tabs */
.mp-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.mp-result-tabs {
    display: inline-flex;
    background: var(--mp-card-bg);
    border: 1px solid var(--mp-border);
    border-radius: 999px;
    padding: 4px;
    margin: 8px 0;
    position: sticky;
    top: calc(var(--topbar-h, 0) + 56px);
    z-index: 15;
}
.mp-tab {
    border: none;
    background: transparent;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--mp-text-secondary);
    cursor: pointer;
}
.mp-tab.active { background: var(--mp-accent); color: #fff; }

/* Layout: sidebar + results */
/* Full-width results on both breakpoints; filters live in an overlay panel
   (bottom sheet on mobile, right/left drawer on desktop) opened by the FAB. */
.mp-layout {
    display: block;
    margin-top: 8px;
}

/* Compact spacing between the tabs and the results grid. */
.mp-results-head {
    padding-block-start: 4px;
}
.mp-featured {
    margin-block-start: 8px;
}
.mp-featured .mp-section-title,
.mp-results-head .mp-section-title {
    font-size: 16px;
    margin-block-end: 12px;
}

/* Overlay behind the drawer (also acts as the click-to-close target). */
.mp-sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 60;
    opacity: 0;
    transition: opacity 0.25s;
}
.mp-sidebar-overlay.is-open {
    opacity: 1;
}
.mp-sidebar-overlay:not(.is-open) {
    pointer-events: none;
}

/* The drawer: bottom sheet on mobile, side drawer on desktop.
   Solid white background — no transparency — so labels & selects never
   look "muted" from the overlay behind. */
.mp-sidebar {
    position: fixed;
    inset-block-end: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    max-height: 88vh;
    background: #ffffff;
    color: #0f172a;
    border-start-start-radius: 20px;
    border-start-end-radius: 20px;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.25);
    z-index: 70;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
    display: flex;
    flex-direction: column;
    opacity: 1 !important;
    filter: none !important;
    backdrop-filter: none !important;
}
.mp-sidebar.is-open { transform: translateY(0); }

.mp-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 8px;
    border-block-end: 1px solid var(--mp-border, #e2e8f0);
    position: relative;
}
.mp-sidebar-header::before {
    content: '';
    position: absolute;
    top: 6px; left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 4px;
    background: #cbd5e0;
    border-radius: 999px;
}
.mp-sidebar-title { font-size: 17px; font-weight: 700; color: var(--mp-text, #2d3748); }
.mp-sidebar-close {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
}
.mp-sidebar-close:hover { background: #f1f5f9; }

.mp-sidebar > .mp-filter-group,
.mp-sidebar .mp-filter-group {
    padding: 0 20px;
    margin-bottom: 18px;
    background: #ffffff;
}
.mp-sidebar > .mp-filter-group:first-of-type { padding-top: 16px; }
.mp-sidebar-body-scroll { background: #ffffff !important; }

.mp-sidebar-actions {
    display: flex;
    gap: 10px;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
    border-block-start: 1px solid #e2e8f0;
    background: #ffffff;
}
.mp-sidebar > .mp-filter-group { overflow-y: visible; }
.mp-sidebar > .mp-filter-group:last-of-type { margin-bottom: 8px; }
.mp-sidebar {
    overflow: hidden;
}
.mp-sidebar .mp-filter-group ~ .mp-filter-group {
    /* nothing — but wrapper below scrolls */
}
/* Scrollable body zone between header and footer actions. */
.mp-sidebar > .mp-filter-group:first-of-type { margin-top: 4px; }
.mp-sidebar-body-scroll { flex: 1 1 auto; overflow-y: auto; padding-block-end: 8px; }

.mp-sidebar .mp-filter-label,
.mp-filter-label {
    display: block;
    font-size: 14px;
    font-weight: 800;
    color: #0f172a !important;
    margin-bottom: 8px;
    letter-spacing: 0.1px;
    opacity: 1 !important;
}
.mp-sidebar .mp-select,
.mp-select {
    width: 100%;
    border: 2px solid #94a3b8 !important;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    background: #ffffff !important;
    color: #0f172a !important;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='3'><polyline points='6 9 12 15 18 9'/></svg>") !important;
    background-repeat: no-repeat !important;
    /* Arrow on the inline-END side of the field (right in LTR, left in RTL).
       Padding reserves 44 px on the SAME side so the value never sits under
       the arrow. Using calc(100% - X) + logical padding keeps LTR/RTL
       symmetric without two separate rules. */
    background-position-y: center !important;
    background-position-x: calc(100% - 14px) !important;
    padding-block: 14px !important;
    padding-inline-start: 16px !important;
    padding-inline-end: 44px !important;
    cursor: pointer;
    opacity: 1 !important;
}
[dir="rtl"] .mp-select {
    background-position-x: 14px !important;
    direction: rtl !important;
    text-align: right !important;
}
.mp-select option {
    background: #ffffff !important;
    color: #0f172a !important;
    padding: 8px;
    font-weight: 500;
}
[dir="rtl"] .mp-select option { direction: rtl; text-align: right; }
.mp-select:hover { border-color: #2563eb !important; }
.mp-select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25) !important;
}
.mp-range { width: 100%; accent-color: var(--mp-accent); height: 32px; }
.mp-checklist { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.mp-check {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--mp-text-secondary); cursor: pointer;
}
.mp-clear-btn, .mp-apply-btn {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    flex: 1;
}
.mp-clear-btn {
    border: 1.5px solid var(--mp-border, #e2e8f0);
    background: transparent;
    color: var(--mp-text-secondary, #64748b);
}
.mp-clear-btn:hover { border-color: var(--mp-primary); color: var(--mp-primary); }
.mp-apply-btn {
    border: none;
    background: linear-gradient(135deg, var(--mp-primary, #1f8feb), #0d6efd);
    color: #fff;
    box-shadow: 0 4px 14px -4px color-mix(in oklab, var(--mp-primary, #1f8feb) 60%, transparent);
    flex: 2;
}
.mp-apply-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -4px color-mix(in oklab, var(--mp-primary, #1f8feb) 60%, transparent); }

@media (min-width: 900px) {
    /* Desktop: drawer slides in from the inline-end side instead of bottom. */
    .mp-sidebar {
        inset-block: 0;
        inset-inline-start: auto;
        inset-inline-end: 0;
        width: 380px;
        max-width: 90vw;
        max-height: 100vh;
        border-radius: 0;
        border-start-start-radius: 20px;
        border-end-start-radius: 20px;
        transform: translateX(100%);
    }
    [dir="rtl"] .mp-sidebar { transform: translateX(-100%); }
    .mp-sidebar.is-open { transform: translateX(0); }
    .mp-sidebar-header::before { display: none; }
    .mp-sidebar-header { padding-top: 20px; }
}

/* Cards: link wrapper so slots stay clickable separately */
.mp-card-link { text-decoration: none; color: inherit; display: block; }

/* Specialty tags */
.mp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mp-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 12px;
    background: rgba(26,35,126,0.08);
    color: var(--mp-primary);
}

/* Price */
.mp-price { font-weight: 700; color: var(--mp-accent); font-size: 13px; }

/* Inline slots */
.mp-card-slots { padding: 0 20px 18px; }
.mp-slots-title { font-size: 12px; font-weight: 600; color: var(--mp-text-muted); display: block; margin-bottom: 8px; }
.mp-slots { display: flex; flex-direction: column; gap: 8px; }
.mp-slot-day { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mp-slot-daylabel { font-size: 11px; color: var(--mp-text-muted); min-width: 54px; }
.mp-slot {
    border: 1px solid var(--mp-border);
    background: var(--mp-card-bg);
    color: var(--mp-primary);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.mp-slot:hover { background: var(--mp-primary); color: #fff; border-color: var(--mp-primary); }
.mp-slots-empty { font-size: 12px; color: var(--mp-text-muted); font-style: italic; }

/* Professional card */
.mp-pro-card .mp-pro-head { display: flex; gap: 14px; padding: 18px 20px 4px; }
.mp-pro-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.mp-pro-avatar-ph {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--mp-primary), var(--mp-accent));
    color: #fff; font-size: 24px; font-weight: 700;
}
.mp-pro-info { flex: 1; min-width: 0; }
.mp-pro-card .mp-card-location,
.mp-pro-card .mp-card-desc { padding: 0 20px; }
.mp-pro-card .mp-card-desc { margin: 8px 0 12px; }

/* Legacy rule removed (2026-07-19): forced .mp-sidebar back to position:
   static on ≤900px, which turned the drawer overlay into an inline block
   that filled the results area with the collapsed filter list — that's
   what created the big empty space + the "filter appears from behind"
   look, since the drawer/overlay pair were being clipped by legacy
   stacking. The new drawer stays fixed at every breakpoint. */
@media (max-width: 900px) {
    .mp-layout { display: block; }
}

/* ============================================================
   Doctoralia-gap features: near-me, map, insurance, favorites
   ============================================================ */
.mp-near-btn { padding: 14px 18px; border: none; border-radius: 12px; background: #fff; color: var(--mp-primary); font-weight: 600; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.mp-near-btn.active { background: var(--mp-accent); color: #fff; }
.mp-hero-nav { display: flex; justify-content: center; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.mp-hero-nav a { color: #fff; text-decoration: none; font-size: 14px; opacity: .9; display: inline-flex; align-items: center; gap: 6px; }
.mp-hero-nav a:hover, .mp-hero-nav a.active { opacity: 1; text-decoration: underline; }
.mp-results-head { display: flex; justify-content: space-between; align-items: center; }
.mp-view-toggle { display: inline-flex; background: var(--mp-card-bg); border: 1px solid var(--mp-border); border-radius: 10px; overflow: hidden; }
.mp-view-opt { border: none; background: transparent; padding: 8px 12px; cursor: pointer; color: var(--mp-text-secondary); }
.mp-view-opt.active { background: var(--mp-primary); color: #fff; }
.mp-map { height: 520px; border-radius: var(--mp-radius); overflow: hidden; margin-bottom: 20px; z-index: 0; }
.mp-subline { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0; align-items: center; }
.mp-dist { font-size: 12px; font-weight: 600; color: var(--mp-accent); }
.mp-ins { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: rgba(0,201,167,.12); color: var(--mp-accent); }
.mp-store-card { position: relative; }
.mp-fav-btn { position: absolute; top: 10px; left: 10px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(255,255,255,.92); color: #cbd5e1; cursor: pointer; font-size: 15px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.mp-fav-btn:hover { color: #ef4444; }
.mp-fav-btn.faved { color: #ef4444; }
[dir="rtl"] .mp-fav-btn { left: auto; right: 10px; }

/* "Open store home" mini-button on each card — a second CTA next to the
   favorite heart. Lets visitors jump directly to the tenant's own
   /home.html app without having to open the marketplace-facing storefront
   first. */
.mp-card-homebtn {
    position: absolute;
    top: 10px;
    left: 52px;                    /* right of the fav heart (10 + 34 + 8) */
    z-index: 2;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(31, 143, 235, 0.92);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.mp-card-homebtn:hover {
    background: #1f8feb;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(31, 143, 235, 0.4);
}
[dir="rtl"] .mp-card-homebtn { left: auto; right: 52px; }

/* ================================================================
   FINAL MOBILE OVERRIDES — high-specificity, appended last so they
   win the cascade against legacy `@media (max-width: 768px)` rules
   above (which used `grid-template-columns` / `padding` that muted
   colors) and against tokens.css / dark-mode.css that darken form
   controls system-wide.
   ================================================================ */

/* Drawer must be SOLID (no transparency, no filter) on every device.
   Earlier declarations relied on CSS vars that some pages override to
   translucent — force literal white with !important so labels aren't
   washed-out ("as if disabled" per user report). */
html body .mp-sidebar {
    background: #ffffff !important;
    color: #0f172a !important;
    opacity: 1 !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: 100000 !important;
    isolation: isolate;
}
html body .mp-sidebar-overlay {
    z-index: 99990 !important;
}
html body .mp-sidebar-body-scroll {
    background: #ffffff !important;
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 8px !important;
    min-height: 0;
}
html body .mp-sidebar .mp-filter-group {
    background: #ffffff !important;
    padding: 12px 20px 0 !important;
    margin: 0 0 12px !important;
    color: #0f172a !important;
    opacity: 1 !important;
}
html body .mp-sidebar .mp-filter-label {
    color: #0f172a !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    opacity: 1 !important;
    margin-bottom: 8px !important;
}
html body .mp-sidebar .mp-select {
    color: #0f172a !important;
    background: #ffffff !important;
    border: 2px solid #94a3b8 !important;
    font-weight: 600 !important;
    opacity: 1 !important;
    /* Chevron sits at the inline-end (right in LTR, left in RTL). Padding
       reserves space on that side so text never sits under the arrow. */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='3'><polyline points='6 9 12 15 18 9'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position-y: center !important;
    background-position-x: calc(100% - 14px) !important;   /* right side (LTR) */
    padding-inline-start: 16px !important;
    padding-inline-end: 44px !important;
    padding-block: 14px !important;
    text-align: start !important;
}
/* In RTL the chevron flips to the left side of the field. */
[dir="rtl"] html body .mp-sidebar .mp-select {
    background-position-x: 14px !important;
    direction: rtl !important;
}
html body .mp-sidebar .mp-select option {
    direction: inherit;
    color: #0f172a !important;
    background: #ffffff !important;
    padding: 8px !important;
    font-weight: 500;
}
html body .mp-sidebar .mp-select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.25) !important;
}
html body .mp-sidebar .mp-range {
    width: 100% !important;
    accent-color: #10b981;
    height: 32px;
}
html body .mp-sidebar-actions {
    background: #ffffff !important;
    border-top: 1px solid #cbd5e0 !important;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    box-shadow: 0 -6px 20px rgba(0,0,0,0.08);
    z-index: 1;
}
html body .mp-sidebar-header {
    background: #ffffff !important;
    border-bottom: 1px solid #cbd5e0 !important;
    padding: 18px 20px 12px !important;
}
html body .mp-sidebar-title {
    color: #0f172a !important;
    font-weight: 800 !important;
    font-size: 18px !important;
}
html body .mp-sidebar-close {
    color: #0f172a !important;
}

/* Compact vertical rhythm so the "empty area" between tabs and the
   results shrinks to a natural single gap. */
html body .mp-toolbar { padding: 6px 0 !important; margin: 0 !important; }
html body .mp-layout { margin-top: 0 !important; }
html body .mp-results-head { margin: 8px 0 6px !important; padding: 0 !important; }
html body .mp-result-tabs { margin: 8px 0 4px !important; }
html body .mp-store-grid { min-height: 200px; }
html body .mp-featured[style*="none"] + .mp-results-head,
html body .mp-featured[style*="display: none"] + .mp-results-head { margin-top: 0 !important; }

/* Ensure the grid always shows *something* visible so the page never
   collapses to a blank slab while the API responds. The skeleton rule
   below fills the grid instantly (marketplace.js also injects skeletons
   into innerHTML, but this is a defensive fallback). */
html body .mp-store-grid:empty::before {
    content: '';
    display: block;
    grid-column: 1 / -1;
    height: 300px;
    border-radius: 16px;
    background: linear-gradient(90deg, #f1f5f9 0%, #f8fafc 40%, #f1f5f9 80%);
    background-size: 400% 100%;
    animation: mpSkelShimmer 1.6s ease-in-out infinite;
}

/* Mobile-specific polish. */
@media (max-width: 640px) {
    html body .mp-hero { padding: 18px 14px 16px !important; }
    html body .mp-hero p, html body .mp-hero-nav { display: none !important; }
    /* Hide the "All Businesses" secondary heading + view toggle on mobile —
       the sticky tabs above already tell users what they're looking at,
       and this section was only stretching empty vertical space. */
    html body .mp-results-head { display: none !important; }
    html body .mp-hero h1 { font-size: 18px !important; margin: 0 0 10px !important; text-align: center; }
    html body .mp-hero-search {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        background: rgba(255,255,255,0.08) !important;
        padding: 6px !important;
        border-radius: 14px !important;
    }
    /* CRITICAL FIX: the base rule uses `flex: 1 1 200px` which in column
       layout is interpreted as `flex-basis: 200px HEIGHT`, ballooning each
       field to ~200 px tall. Reset to natural content height. */
    html body .mp-hero-field {
        flex: 0 0 auto !important;
        width: 100% !important;
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 12px !important;
        background: #fff !important;
        border-radius: 10px !important;
    }
    html body .mp-hero-field input {
        padding: 10px 0 !important;
        font-size: 14px !important;
    }
    html body .mp-hero-mode {
        flex: 0 0 auto !important;
        width: 100% !important;
        min-height: 44px !important;
        justify-content: space-between !important;
    }
    html body .mp-mode-opt { flex: 1; padding: 8px 6px !important; font-size: 12px !important; }
    html body .mp-search-btn, html body .mp-near-btn {
        flex: 0 0 auto !important;
        width: 100% !important;
        min-height: 44px !important;
        padding: 10px !important;
        font-size: 14px !important;
        justify-content: center !important;
    }
    html body .mp-store-grid { min-height: 280px; }
    /* Full-height bottom-sheet feel on tiny screens. */
    html body .mp-sidebar {
        max-height: 92vh !important;
    }
    html body .mp-toolbar { top: 0 !important; }
}

/* ================================================================
   Custom dropdown component (replaces native <select> that suffered
   from Chromium RTL popup-position bug — options appeared offset
   next to the field instead of below it). Same visual as .mp-select
   but the menu is a real DOM element we position ourselves.
   ================================================================ */
.mp-cselect {
    position: relative;
    width: 100%;
    background: #ffffff;
    border: 2px solid #94a3b8;
    border-radius: 12px;
    font-weight: 600;
    color: #0f172a;
    font-size: 15px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.mp-cselect:hover, .mp-cselect:focus { border-color: #2563eb; }
.mp-cselect.is-open {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
}
.mp-cselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px;
    min-height: 48px;
    user-select: none;
}
.mp-cselect-label {
    flex: 1;
    color: #0f172a;
    text-align: start;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mp-cselect-caret {
    color: #2563eb;
    font-size: 18px;
    font-weight: 900;
    transition: transform 0.15s;
    flex-shrink: 0;
}
.mp-cselect.is-open .mp-cselect-caret { transform: rotate(180deg); }

/* Menu: absolutely positioned RIGHT BELOW the field, always full width. */
.mp-cselect-menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    width: 100%;
    max-height: 280px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #cbd5e0;
    border-radius: 12px;
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.24);
    z-index: 999;
    padding: 6px;
    animation: mpCsIn 140ms ease-out;
}
@keyframes mpCsIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.mp-cselect-item {
    padding: 12px 14px;
    border-radius: 8px;
    color: #0f172a;
    font-weight: 500;
    cursor: pointer;
    text-align: start;
    user-select: none;
    transition: background 0.1s;
}
.mp-cselect-item:hover { background: #f1f5f9; }
.mp-cselect-item.is-active {
    background: #2563eb;
    color: #fff;
    font-weight: 700;
}
.mp-cselect-item.is-active:hover { background: #1d4ed8; }

/* Force the shared bottom tabbar visible on marketplace/platform pages.
   dark-mode.css or other overrides may have set display:none on some
   pages that don't include navbar.html natively. */
html body .site-tabbar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 1000 !important;
}
/* Leave room above the fixed tabbar so the platform footer isn't hidden
   behind it. `body:has(.site-tabbar)` already adds padding for pages that
   render the tabbar; we also add it defensively on the platform footer. */
html body .mp-platform-footer {
    padding-block-end: calc(var(--tabbar-h, 68px) + env(safe-area-inset-bottom, 0px) + 20px);
}

/* ================================================================
   Minimal platform footer (marketplace only) — no tenant data, no
   floating icons. Meets the legal minimum (aviso legal + GDPR) with
   brand, contact email, privacy/terms/cookies links and copyright.
   ================================================================ */
.mp-platform-footer {
    margin-top: 40px;
    padding: 28px 20px calc(28px + env(safe-area-inset-bottom, 0px));
    background: #0f172a;
    color: #cbd5e0;
    font-size: 13px;
}
.mp-platform-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.mp-pf-brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    color: #f1f5f9;
}
.mp-pf-brand strong { font-size: 17px; font-weight: 800; letter-spacing: 0.2px; }
.mp-pf-tagline { color: #94a3b8; font-size: 12px; }
.mp-pf-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
}
.mp-pf-links a {
    color: #cbd5e0;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}
.mp-pf-links a:hover { color: #60a5fa; text-decoration: underline; }
.mp-pf-copy { color: #64748b; font-size: 12px; }
@media (max-width: 640px) {
    .mp-platform-footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    .mp-pf-brand { flex-direction: column; gap: 2px; }
    .mp-pf-links { justify-content: center; }
}

/* ============================================================
   Unified search (single input + categorized dropdown)
   Replaces the old Specialty + City twin fields.
   ============================================================ */
.mp-usearch {
    position: relative;
    flex: 1 1 340px;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-radius: 14px;
    padding: 0 16px;
    box-shadow: 0 4px 14px rgba(15,23,42,0.10);
    transition: box-shadow .18s ease, transform .18s ease;
}
.mp-usearch:focus-within {
    box-shadow: 0 6px 22px rgba(15,23,42,0.18);
}
.mp-usearch-icon {
    color: var(--mp-primary);
    font-size: 15px;
}
.mp-usearch-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 16px 0;
    font-size: 16px;
    background: transparent;
    color: var(--mp-text);
    font-weight: 500;
}
.mp-usearch-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}
.mp-usearch-clear {
    border: none;
    background: #f1f5f9;
    color: #64748b;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    transition: background .15s;
}
.mp-usearch-clear:hover { background: #e2e8f0; color: #0f172a; }

/* Dropdown panel — floats below the input, edge-to-edge on mobile */
.mp-usearch-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15,23,42,0.18);
    max-height: 460px;
    overflow-y: auto;
    z-index: 500;
    padding: 6px 0;
    color: var(--mp-text);
    animation: mpSugFade .14s ease;
}
@keyframes mpSugFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.mp-sug-section { padding: 6px 0; }
.mp-sug-section + .mp-sug-section {
    border-top: 1px solid #f1f5f9;
    margin-top: 2px;
}
.mp-sug-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}
.mp-sug-head i { font-size: 11px; color: var(--mp-primary); }
.mp-sug-clear {
    margin-inline-start: auto;
    border: none;
    background: transparent;
    color: var(--mp-primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
}
.mp-sug-clear:hover { text-decoration: underline; }
.mp-sug-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    text-align: inherit;
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: background .12s;
}
.mp-sug-item:hover,
.mp-sug-item.is-active {
    background: #f1f5f9;
}
.mp-sug-ic {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(31,143,235,0.10);
    color: var(--mp-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.mp-sug-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    gap: 2px;
}
.mp-sug-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--mp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mp-sug-label mark {
    background: rgba(31,143,235,0.18);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}
.mp-sug-sub {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mp-sug-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 14px 8px;
}
.mp-sug-chip {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: var(--mp-text);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.mp-sug-chip:hover {
    background: rgba(31,143,235,0.08);
    border-color: var(--mp-primary);
    color: var(--mp-primary);
}
.mp-sug-empty {
    padding: 18px 16px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
}
/* City rail — horizontal scroller at the very top of the dropdown.
   Sticky so it stays visible while scrolling other categories. */
.mp-sug-city-rail {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    padding-top: 8px;
}
.mp-sug-city-rail .mp-sug-head { padding-bottom: 6px; }
.mp-city-scroll {
    display: flex;
    gap: 6px;
    padding: 0 16px 10px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.mp-city-scroll::-webkit-scrollbar { height: 4px; }
.mp-city-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.mp-city-pill {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 8px;
    background: #f1f5f9;
    color: var(--mp-text);
    border: 1.5px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s, transform .12s;
}
.mp-city-pill:hover {
    background: rgba(31,143,235,0.10);
    color: var(--mp-primary);
}
.mp-city-pill.is-active {
    background: var(--mp-primary);
    color: #fff;
    border-color: var(--mp-primary);
    box-shadow: 0 3px 10px rgba(31,143,235,0.35);
}
.mp-city-pill.is-active:hover { background: var(--mp-primary); color: #fff; }
.mp-city-pill i { font-size: 10px; opacity: 0.75; }
.mp-city-pill-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.mp-city-pill-count {
    background: rgba(0,0,0,0.08);
    color: inherit;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    opacity: 0.75;
}
/* Near-me pill — first item, visually distinct (accent color + no counter) */
.mp-city-pill-near {
    background: rgba(0,193,168,0.12);
    color: var(--mp-accent);
    border-color: rgba(0,193,168,0.35);
}
.mp-city-pill-near:hover {
    background: rgba(0,193,168,0.22);
    color: var(--mp-accent);
    border-color: var(--mp-accent);
}
.mp-city-pill-near.is-active {
    background: var(--mp-accent);
    color: #fff;
    border-color: var(--mp-accent);
    box-shadow: 0 3px 10px rgba(0,193,168,0.40);
}
.mp-city-pill-near.is-active:hover {
    background: var(--mp-accent);
    color: #fff;
}
.mp-city-pill-near.is-loading { opacity: 0.75; cursor: wait; }
.mp-city-pill-near i { opacity: 1; }

.mp-city-pill.is-active .mp-city-pill-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
    opacity: 1;
}
.mp-sug-clear .fa-times { font-size: 9px; margin-inline-end: 2px; }

.mp-sug-freetext { padding-top: 4px; }
.mp-sug-freebtn .mp-sug-ic {
    background: rgba(0,193,168,0.14);
    color: var(--mp-accent);
}

/* Active-filter chips shown beneath the search */
.mp-active-chips {
    max-width: 900px;
    margin: 10px auto 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 6px;
    min-height: 0;
}
.mp-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 12px;
    background: rgba(255,255,255,0.95);
    color: var(--mp-text);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(15,23,42,0.10);
}
.mp-active-chip button {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}
.mp-active-chip button:hover { background: #e2e8f0; color: #0f172a; }
.mp-active-chip.is-loading {
    background: rgba(0,193,168,0.14);
    color: var(--mp-accent);
}
.mp-active-chip.is-loading .fa-spinner { margin-inline-end: 2px; }

/* Mobile: full-width input rows, panel edge-to-edge */
@media (max-width: 720px) {
    .mp-usearch { flex: 1 1 100%; }
    .mp-hero-mode, .mp-search-btn, .mp-near-btn { flex: 1 1 auto; }
    .mp-usearch-panel {
        max-height: 60vh;
    }
}

/* Dark-mode nudges (dark-mode.css handles the neutrals, we only tweak
   the sub text + hover contrast). */
@media (prefers-color-scheme: dark) {
    .mp-usearch { background: #1e293b; box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
    .mp-usearch-input { color: #e2e8f0; }
    .mp-usearch-input::placeholder { color: #64748b; }
    .mp-usearch-clear { background: #334155; color: #cbd5e1; }
    .mp-usearch-clear:hover { background: #475569; color: #fff; }
    .mp-usearch-panel { background: #1e293b; box-shadow: 0 12px 40px rgba(0,0,0,0.55); }
    .mp-sug-section + .mp-sug-section { border-top-color: #334155; }
    .mp-sug-item:hover, .mp-sug-item.is-active { background: #334155; }
    .mp-sug-label { color: #e2e8f0; }
    .mp-sug-sub, .mp-sug-head, .mp-sug-empty { color: #94a3b8; }
    .mp-sug-chip { background: #1e293b; border-color: #334155; color: #e2e8f0; }
    .mp-sug-city-rail { background: #1e293b; }
    .mp-city-pill { background: #334155; color: #e2e8f0; }
    .mp-city-pill-count { background: rgba(255,255,255,0.10); }
    .mp-active-chip { background: #1e293b; color: #e2e8f0; }
    .mp-active-chip button { background: #334155; color: #cbd5e1; }
}
