/*
 * eubb999 — 999.md-inspired layer on top of Storefront.
 * Loaded after storefront.css, so it only overrides tokens and the layout rules that
 * differ: a solid blue header with the category picker and search beside the logo,
 * a location bar (country and city type-ahead) above it, icon category tiles,
 * dense listing cards and a mobile action bar.
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

:root {
    --color-bg: #f2f4f7;
    --color-surface: #ffffff;
    --color-text: #1c2733;
    --color-accent: #1e5fc7;
    --color-accent-2: #ff7a1a;
    --color-divider: #dde3ea;
    --color-accent-fill: #1e5fc7;
    --color-accent-fill-hover: #174ea6;
    --color-accent-fill-active: #123f88;
    --radius-md: 8px;
    --eubb-header: #1e5fc7;
    --eubb-header-ink: #ffffff;
    --eubb-price: #1e5fc7;
    --eubb-muted: #5b6776;
    --eubb-mbar-h: 60px;
}

[hidden] {
    display: none !important;
}

/* ---------- Location bar (top strip) ---------- */

.eubb-topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-divider);
    font-size: 0.9rem;
}
.eubb-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 46px;
}
.eubb-topbar__link {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.eubb-locbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}
.eubb-locbar__country {
    height: 34px;
    border: 1px solid var(--color-divider);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-weight: 600;
    padding: 0 8px;
    max-width: 200px;
}
.eubb-locbar__city {
    position: relative;
    flex: 0 1 260px;
    min-width: 0;
}
.eubb-locbar__city input {
    width: 100%;
    height: 34px;
    border: 1px solid var(--color-divider);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    padding: 0 10px;
}
.eubb-locbar__city input:disabled {
    background: var(--color-bg);
    color: var(--eubb-muted);
    cursor: not-allowed;
}
.eubb-locbar__list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 70;
    list-style: none;
    margin: 0;
    padding: 4px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(28, 39, 51, 0.18);
}
.eubb-locbar__list li {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text);
}
.eubb-locbar__list li[aria-selected="true"],
.eubb-locbar__list li:hover {
    background: var(--color-bg);
    color: var(--color-accent);
}
.eubb-locbar__list small {
    display: block;
    font-size: 0.78rem;
    color: var(--eubb-muted);
}
.eubb-locbar__go {
    height: 34px;
    border: 0;
    border-radius: 6px;
    background: var(--color-accent-fill);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    padding: 0 16px;
    cursor: pointer;
}
.eubb-locbar__go:hover {
    background: var(--color-accent-fill-hover);
}

/* ---------- Header: logo, category picker, search, nav ---------- */

.sf-header {
    background: var(--eubb-header);
    border-bottom: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.sf-header .sf-logo,
.sf-header .sf-nav__link,
.sf-header .sf-account__name {
    color: var(--eubb-header-ink);
}
.sf-header .sf-nav__link[aria-current="page"] {
    box-shadow: inset 0 -3px 0 var(--color-accent-2);
}
.sf-header .sf-nav-toggle span {
    background: var(--eubb-header-ink);
}
.sf-header :focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Category picker: a popover with every top-level category and its subcategories. */
.eubb-catmenu {
    position: relative;
    flex: 0 0 auto;
}
.eubb-catmenu > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    background: #ffffff;
    color: var(--color-text);
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}
.eubb-catmenu > summary::-webkit-details-marker {
    display: none;
}
.eubb-catmenu > summary .eubb-ic {
    color: var(--color-accent);
}
.eubb-catmenu[open] .eubb-catmenu__chev {
    transform: rotate(180deg);
}
.eubb-catmenu__panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 80;
    width: min(980px, 94vw);
    max-height: 72vh;
    overflow-y: auto;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-divider);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(28, 39, 51, 0.22);
    padding: 18px;
}
.eubb-catmenu__split {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 360px;
}
.eubb-catmenu__parents {
    list-style: none;
    margin: 0;
    padding: 0 10px 0 0;
    border-right: 1px solid var(--color-divider);
}
.eubb-catmenu__parent a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 6px;
    color: var(--color-text);
    font-weight: 700;
    text-decoration: none;
}
.eubb-catmenu__parent a:hover,
.eubb-catmenu__parent a:focus-visible,
.eubb-catmenu__parent.is-active a {
    background: var(--color-bg);
    color: var(--color-accent);
}
.eubb-catmenu__parent .eubb-ic {
    color: var(--color-accent);
    flex: 0 0 auto;
}
.eubb-catmenu__next {
    margin-left: auto;
    opacity: 0.5;
    flex: 0 0 auto;
}
.eubb-catmenu__subs {
    padding-left: 22px;
    min-width: 0;
}
.eubb-catmenu__panelsub[hidden] {
    display: none;
}
.eubb-catmenu__all {
    display: inline-block;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--color-accent);
    color: var(--color-accent);
    font-weight: 800;
    text-decoration: none;
}
.eubb-catmenu__panelsub:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 26px;
    align-content: start;
}
.eubb-catmenu__panelsub > .eubb-catmenu__all {
    grid-column: 1 / -1;
}
.eubb-catmenu__group {
    break-inside: avoid;
    margin-bottom: 14px;
}
.eubb-catmenu__grouptitle {
    margin: 0 0 4px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--eubb-muted);
}
.eubb-catmenu__group ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.eubb-catmenu__group li {
    break-inside: avoid;
}
.eubb-catmenu__panelsub li a {
    display: block;
    padding: 5px 0;
    font-size: 0.92rem;
    color: var(--color-text);
    text-decoration: none;
}
.eubb-catmenu__panelsub li a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

/* Header search: one field, orange button. */
.eubb-hsearch {
    display: flex;
    flex: 1 1 260px;
    min-width: 0;
    max-width: 640px;
}
.eubb-hsearch__q {
    flex: 1;
    min-width: 0;
    height: 40px;
    border: 0;
    border-radius: 8px 0 0 8px;
    padding: 0 14px;
    font: inherit;
    font-size: 0.98rem;
    background: #ffffff;
    color: var(--color-text);
}
.eubb-hsearch__btn {
    width: 46px;
    height: 40px;
    border: 0;
    border-radius: 0 8px 8px 0;
    background: var(--color-accent-2);
    color: #1c2733;
    display: grid;
    place-items: center;
    cursor: pointer;
}
.eubb-hsearch__btn:hover {
    background: #ff8c3a;
}

/* Orange "post an ad" CTA stands out against the blue bar. */
.sf-nav__cta,
.sf-header .sf-btn--primary {
    background: var(--color-accent-2);
    color: #1c2733;
    border-color: var(--color-accent-2);
}
.sf-nav__cta:hover,
.sf-header .sf-btn--primary:hover {
    background: #ff8c3a;
}

/* ---------- Home ---------- */

.eubb-hero {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-divider);
    padding: 34px 0 26px;
}
.eubb-hero__title {
    font-size: clamp(1.6rem, 3.6vw, 2.4rem);
    font-weight: 800;
    margin: 0 0 6px;
}
.eubb-hero__sub {
    margin: 0;
    color: var(--eubb-muted);
}

.eubb-section {
    padding: 28px 0 8px;
}
.eubb-cats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}
.eubb-cat {
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.15s ease;
}
.eubb-cat:hover {
    border-color: var(--color-accent);
}
.eubb-cat__head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    color: var(--color-text);
    text-decoration: none;
}
.eubb-cat__icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
}
.eubb-cat__name {
    font-weight: 700;
    font-size: 1.02rem;
}
.eubb-cat__count {
    font-size: 0.8rem;
    color: var(--eubb-muted);
    background: var(--color-bg);
    border-radius: 999px;
    padding: 2px 9px;
}
.eubb-cat__subs {
    list-style: none;
    margin: 0;
    padding: 0 14px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.eubb-cat__subs a {
    display: inline-block;
    font-size: 0.82rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
}
.eubb-cat__subs a:hover {
    color: var(--color-accent);
}

/* ---------- Listings ---------- */

.sf-cards {
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 12px;
}
.sf-card {
    border-radius: var(--radius-md);
    border-color: var(--color-divider);
}
.sf-card:hover {
    transform: none;
    box-shadow: 0 2px 10px rgba(28, 39, 51, 0.12);
}
.sf-card__price,
.sf-card__pricerow .sf-card__price {
    color: var(--eubb-price);
    font-size: 1.25rem;
    font-weight: 800;
}
.sf-card__title {
    font-size: 0.95rem;
    line-height: 1.3;
}
.sf-card__meta {
    font-size: 0.8rem;
}

/* Linked headings: the subcategory itself is the heading (Real Estate, Jobs). */
.eubb-catmenu__grouptitle a {
    color: inherit;
    text-decoration: none;
}
.eubb-catmenu__grouptitle a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

/* Groups: the same markup in the dropdown and on a category page. */
.eubb-catmenu__group li a {
    display: block;
    padding: 4px 0;
    color: var(--color-text);
    text-decoration: none;
}
.eubb-catmenu__group li a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}
.eubb-catmenu__more {
    margin-top: 2px;
}
.eubb-catmenu__more > summary {
    list-style: none;
    display: inline-block;
    padding: 4px 0;
    color: var(--color-accent);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}
.eubb-catmenu__more > summary::-webkit-details-marker {
    display: none;
}
.eubb-catmenu__more > summary:hover {
    text-decoration: underline;
}
.eubb-catmenu__more[open] > summary {
    color: var(--color-text);
}

/* Category page: the full grouped list above the results. */
.eubb-browse {
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: 10px;
    padding: 18px 20px;
    margin: 0 0 18px;
}
.eubb-browse__title {
    margin: 0 0 12px;
    font-size: 1.3rem;
    font-weight: 800;
}
.eubb-browse__groups {
    display: block;
}
.eubb-browse__groups > .eubb-catmenu__group {
    margin-bottom: 14px;
}
.eubb-browse__groups:has(> .eubb-catmenu__group) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px 26px;
}
.eubb-browse .eubb-catmenu__grouptitle {
    margin: 0 0 4px;
}

/* ---------- Mobile ---------- */

.eubb-mbar {
    display: none;
}

@media (max-width: 900px) {
    .sf-header__bar {
        flex-wrap: wrap;
        row-gap: 10px;
    }
    .sf-header__bar > .sf-logo {
        order: 1;
    }
    .sf-header__bar > .sf-nav-toggle {
        order: 2;
        margin-left: auto;
    }
    .eubb-catmenu {
        order: 3;
    }
    .eubb-hsearch {
        order: 4;
        flex: 1 1 100%;
        max-width: none;
    }
    .sf-header__bar > .sf-nav {
        order: 5;
    }
    .eubb-catmenu__panel {
        position: fixed;
        left: 3vw;
        right: 3vw;
        top: 118px;
        width: auto;
        max-height: 70vh;
    }
    .eubb-catmenu__split {
        grid-template-columns: 200px minmax(0, 1fr);
    }
    .eubb-locbar__city {
        flex: 1 1 180px;
    }
}

@media (max-width: 767px) {
    body {
        padding-bottom: var(--eubb-mbar-h);
    }
    .eubb-browse__groups:has(> .eubb-catmenu__group) {
        grid-template-columns: 1fr;
    }
    .eubb-topbar__link {
        display: none;
    }
    .eubb-locbar {
        flex-wrap: wrap;
    }
    .eubb-locbar__country {
        flex: 1 1 100%;
        max-width: none;
    }
    .eubb-cats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .eubb-cat__head {
        grid-template-columns: 1fr;
        justify-items: start;
        gap: 8px;
        padding: 12px;
    }
    .eubb-cat__subs {
        display: none;
    }
    .eubb-mbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        height: var(--eubb-mbar-h);
        display: grid;
        grid-template-columns: 1fr 1fr;
        background: var(--color-surface);
        border-top: 1px solid var(--color-divider);
        box-shadow: 0 -2px 10px rgba(28, 39, 51, 0.08);
    }
    .eubb-mbar a {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-weight: 700;
        color: var(--color-text);
        text-decoration: none;
    }
    .eubb-mbar a.eubb-mbar__post {
        background: var(--color-accent-2);
        color: #1c2733;
    }
}

@media (max-width: 600px) {
    .eubb-catmenu__split {
        grid-template-columns: 1fr;
        min-height: 0;
    }
    .eubb-catmenu__parents {
        border-right: 0;
        border-bottom: 1px solid var(--color-divider);
        padding: 0 0 8px;
        margin-bottom: 8px;
    }
    .eubb-catmenu__subs {
        padding-left: 0;
    }
    .eubb-catmenu__panelsub:not([hidden]) {
        grid-template-columns: 1fr;
    }
    .eubb-catmenu__panel {
        top: 150px;
    }
}
