/* ============================================================
   Brand polish: one-line welcome band, matching search and
   filter bars, cards with depth. Existing brand colors only.
   Loaded after every other sheet.
   ============================================================ */

:root {
    --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 12px rgba(16, 24, 40, 0.05);
    --shadow-card-hover: 0 2px 4px rgba(16, 24, 40, 0.05), 0 14px 32px rgba(16, 24, 40, 0.10);
}

/* ---------- Home welcome band (one line; room for banners later) ---------- */
.home-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-md);
    min-height: 56px;
    padding: 10px 10px 10px 20px;
    margin-bottom: var(--sp-md);
    border-radius: 22px;
    background:
        linear-gradient(90deg, rgba(0, 122, 255, 0.10), rgba(52, 199, 89, 0.10)),
        var(--bg-primary);
    border: 1px solid var(--separator);
}

.home-hero__title {
    margin: 0;
    min-width: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 600px) {
    .home-hero__title { font-size: 15px; }
}

/* ---------- Search and filter bars: one shape ---------- */
.home-search__icon { z-index: 1; }

.home-search__input,
.filter-bar__inner {
    height: 48px;
    border-radius: var(--r-pill);
    background: var(--bg-primary);
    border: 1px solid var(--separator);
    box-shadow: var(--shadow-card);
}

.home-search__input:focus {
    border-color: var(--b-primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.14), var(--shadow-card);
}

/* ---------- Trending: one row with the listing count ---------- */
.trending-section.trending-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    margin: var(--sp-sm) 0 var(--sp-md);
}

.trending-section .trending-section__title {
    margin: 0;
    font-size: 16px;
    flex-shrink: 0;
}

.trending-section .trending-section__pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    min-width: 0;
}

.trending-section .trending-section__pills::-webkit-scrollbar { display: none; }

.trending-section .trending-pill {
    padding: 6px 14px;
    background: var(--bg-primary);
}

@media (hover: hover) {
    .trending-section .trending-pill:hover {
        border-color: var(--b-primary);
        color: var(--b-primary-text-aa);
    }
}

.trending-section .results-count {
    margin-left: auto;
    padding: 0;
    flex-shrink: 0;
}

/* ---------- Listing cards ---------- */
.product-card {
    border: 1px solid rgba(16, 24, 40, 0.06);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
}

@media (hover: hover) {
    .product-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-card-hover);
    }

    .product-card:hover .product-card__image {
        transform: scale(1.04);
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-card,
    .product-card__image { transition: none; }
    .product-card:hover,
    .product-card:hover .product-card__image { transform: none; }
}

/* ============================================================
   Surfaces: iOS grouped style. The page stays light grey and
   every card is a white surface lifted by a soft shadow, so
   cards read by depth instead of by a grey outline.
   `html .x` outranks the single-class rules inside page
   templates, which load after this sheet.
   ============================================================ */
:root {
    --surface: var(--bg-primary);
    --surface-edge: rgba(16, 24, 40, 0.05);
    --surface-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 18px rgba(16, 24, 40, 0.06);
    --surface-shadow-hover: 0 2px 6px rgba(16, 24, 40, 0.06), 0 16px 36px rgba(16, 24, 40, 0.11);
    --surface-radius: 20px;
    --well: var(--bg-secondary);
}

html :is(
    .stat-card, .mini-card, .chat-item, .request-card, .skeleton-chat,
    .notif-item, .listing-item, .campaign-card, .native-ad, .user-card,
    .profile-header, .profile-section, .profile-review, .pub-ratings-summary,
    .profile-badge-card, .referral-code, .support-card, .delete-card,
    .badge-card, .row, .safety-tips, .share-app-banner, .ad-row,
    .pd-auction-info, .auth-form, .unsub-card, .restriction-notice, .hero
) {
    background: var(--surface);
    border: 1px solid var(--surface-edge);
    border-radius: var(--surface-radius);
    box-shadow: var(--surface-shadow);
}

/* Clickable cards lift on hover instead of turning grey. */
html :is(.mini-card, .chat-item, .notif-item, .listing-item, .user-card, a.row, button.row, .ad-row, .request-card) {
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
}

@media (hover: hover) {
    html :is(.mini-card, .chat-item, .notif-item, .listing-item, .user-card, a.row, button.row, .ad-row):hover {
        background: var(--surface);
        transform: translateY(-2px);
        box-shadow: var(--surface-shadow-hover);
    }
}

/* Pictures and empty slots inside a white card sit in a grey well. */
html :is(.mini-thumb, .listing-item__img, .request-card__thumb, .native-ad__thumb, .pa-thumb, .chat-product__img) {
    background: var(--well);
}

/* Round back buttons and small round actions: white chips with depth. */
html :is(
    .page-header__back, .dash-header__back, .settings-back, .legal-header__back,
    .listings-header__back, .about-header__back, .faq-header__back
) {
    background: var(--surface);
    box-shadow: var(--surface-shadow);
}

/* Inputs on the grey page: white fields. */
html :is(.form-input, .lf-input, .settings-form-input, .chat-input__field, .apply-referral__input, .gift-dialog__input) {
    background: var(--surface);
}

/* Segmented control as on iOS: grey track, white thumb. */
html .seg-control {
    background: rgba(118, 118, 128, 0.12);
    border-radius: 12px;
    padding: 3px;
}

html .seg-control__btn { border-radius: 9px; padding: 8px 12px; }

html .seg-control__btn.active {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
}

/* ---------- Header: frosted glass with a soft edge ---------- */
.app-header {
    border-bottom-color: transparent;
    box-shadow: 0 1px 0 rgba(16, 24, 40, 0.06), 0 6px 20px rgba(16, 24, 40, 0.04);
}

/* ---------- Primary actions carry a soft glow of their own colour ---------- */
html :is(.btn-primary, .header-nav__link--sell) {
    box-shadow: 0 4px 14px rgba(0, 98, 204, 0.28);
}

/* ---------- Seller dashboard figures ---------- */
html .stat-card {
    padding: 20px 16px;
}

html .stat-card__icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: color-mix(in srgb, currentColor 13%, transparent);
}

html .stat-card__icon svg { width: 20px; height: 20px; }

html .stat-card__value {
    font-size: 32px;
    letter-spacing: -0.02em;
}

html .stat-card__label { font-size: 13px; }

/* ---------- Chat list ---------- */
html .chat-item { padding: 14px 16px; }

html .chat-item__avatar {
    box-shadow: 0 0 0 3px var(--surface), 0 4px 10px rgba(16, 24, 40, 0.12);
}

@media (prefers-reduced-motion: reduce) {
    html :is(.mini-card, .chat-item, .notif-item, .listing-item, .user-card, a.row, button.row, .ad-row):hover {
        transform: none;
    }
}

/* ---------- Conversation: a floating panel on wide screens ---------- */
@media (min-width: 769px) {
    html .chat-detail {
        height: calc(100dvh - 60px - 48px);
        margin: 24px auto;
        border-radius: 24px;
        overflow: hidden;
        border: 1px solid var(--surface-edge);
        box-shadow: 0 2px 6px rgba(16, 24, 40, 0.05), 0 24px 60px rgba(16, 24, 40, 0.10);
    }
}

html .chat-header,
html .chat-product { border-bottom-color: rgba(16, 24, 40, 0.06); }

html .chat-product__img { border-radius: 12px; }

html .chat-messages { background: #F7F7FA; padding: 20px 20px 24px; gap: 4px; }

html .msg--received {
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 2px 8px rgba(16, 24, 40, 0.04);
}

html .msg--sent { box-shadow: 0 2px 8px rgba(0, 98, 204, 0.22); }

html .chat-input { border-top-color: rgba(16, 24, 40, 0.06); }

/* ---------- Account sidebar ---------- */
/* The sidebar scrolls, which clips anything drawn outside its box: leave
   room inside it for the selected row's shadow, then pull it back so the
   rows stay aligned with the page. */
@media (min-width: 1024px) {
    html .account-shell__nav {
        padding: 6px 10px var(--sp-lg);
        margin: -6px -10px 0;
    }
}

html :is(.account-nav__me.is-current, .account-nav__item.is-current) {
    box-shadow: 0 0 0 1px var(--surface-edge), var(--surface-shadow);
}

/* ---------- Listing page: one white card per block ---------- */
.pd-info { gap: var(--sp-md); }

html .pd-card {
    background: var(--surface, var(--bg-primary));
    border: 1px solid var(--surface-edge, var(--separator));
    border-radius: var(--surface-radius, 20px);
    box-shadow: var(--surface-shadow, none);
    padding: 20px;
}

.pd-card .pd-section-title { font-size: 17px; margin-bottom: 12px; }
.pd-card--head .pd-badge { margin-bottom: 10px; border-radius: var(--r-pill); padding: 4px 10px; }
.pd-card--head .pd-title { margin-bottom: 6px; }

/* Facts as grey pills instead of a row between two lines. */
.pd-card--head .pd-meta {
    gap: 8px;
    padding: 0;
    margin: 16px 0;
    border: 0;
}
.pd-card--head .pd-meta-item {
    padding: 6px 12px;
    border-radius: var(--r-pill);
    background: var(--bg-secondary);
    font-size: 13px;
}
.pd-card--head .pd-actions { margin-top: 0; }
.pd-card--head .pd-auction-info { margin-top: 16px; box-shadow: none; }

/* Details: label/value tiles in grey wells. */
.pd-card.pd-attributes { padding: 20px; border-top: 1px solid var(--surface-edge, var(--separator)); }
.pd-card .pd-attributes__grid { gap: 8px; }
.pd-card .pd-attributes__item {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-secondary);
}

/* Seller: profile row + trust chips in one card. */
.pd-seller-card .pd-seller {
    margin: 0 -8px;
    padding: 8px;
    background: none;
    border-radius: 14px;
    color: var(--text-primary);
    transition: background 0.15s ease;
}
@media (hover: hover) {
    .pd-seller-card .pd-seller:hover { background: var(--bg-secondary); }
}
.pd-seller-card .pd-seller > svg { color: var(--text-tertiary); flex-shrink: 0; }
.pd-seller-card .pd-trust { margin-top: 12px; }
.pd-seller-card .pd-trust__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pd-seller-card .pd-trust__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--r-pill);
    background: var(--bg-secondary);
    font-size: 13px;
    color: var(--text-secondary);
}

.pd-card .pd-description__text { font-size: 15px; }
.pd-card.pd-map .pd-map__zone { margin: -4px 0 12px; color: var(--text-secondary); font-size: 14px; }
.pd-card.pd-map .pd-map__canvas { border-radius: 14px; overflow: hidden; }

/* Picture in a white frame like the other cards. */
.pd-gallery__main {
    border: 1px solid var(--surface-edge, var(--separator));
    border-radius: var(--surface-radius, 20px);
    box-shadow: var(--surface-shadow, none);
}

@media (max-width: 600px) {
    html .pd-card { padding: 16px; border-radius: 18px; }
}
.pd-card.pd-map { margin-top: 0; }
.pd-card .pd-description__text { margin: 0; }
/* Inside the quick view there is no site header: the sticky picture lines up
   with the first card instead of dropping below it. */
@media (min-width: 768px) {
    body.is-embedded .pd-gallery { top: 60px; }
}
.pd-card .pd-description__text { font-size: 16px; line-height: 1.65; }
