/* Search sheet + suggestions + results-page states (2026-09-09 redesign).
   One file for the modal (injected by search.js), the desktop pill dropdown
   and the /search.html states, so the chips and rows match everywhere.
   Tokens: Cairo, cream #faf7f0, ink #16130f, green #16a34a, line rgba(22,19,15,.14). */

.search-modal { position: fixed; inset: 0; z-index: var(--z-overlay, 1000); display: none; }
.search-modal.active { display: block; }
.search-modal-overlay { position: absolute; inset: 0; background: rgba(22, 19, 15, 0.45); }
.search-sheet {
    position: absolute; inset: 0; background: #faf7f0; display: flex; flex-direction: column;
    max-width: none; width: auto; max-height: none; margin: 0; border-radius: 0; overflow: hidden;
    animation: ss-in .18s ease-out;
}
@keyframes ss-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (min-width: 1024px) {
    .search-sheet {
        inset: 6vh auto auto 50%; transform: translateX(-50%); width: min(720px, 92vw); max-height: 84vh;
        border-radius: 20px; box-shadow: 0 24px 60px rgba(22, 19, 15, 0.25);
    }
    @keyframes ss-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translateX(-50%); } }
}
.search-sheet-head {
    display: flex; align-items: center; gap: 6px; padding: 10px 12px 8px 14px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px)); border: 0; overflow: visible;
}
.search-sheet-back {
    width: 44px; height: 44px; border: 0; background: transparent; color: #16130f; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; font-size: 0;
}
.search-sheet-back:hover { background: rgba(22, 19, 15, 0.06); }
.search-sheet-field {
    position: relative; flex: 1; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 8px 0 14px;
    border-radius: 14px; background: #fff; border: 2px solid #16a34a; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}
.search-sheet-field .ss-ico { color: #16a34a; flex-shrink: 0; }
.search-sheet-field .search-input {
    flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; padding: 0;
    font: inherit; font-size: 16px; font-weight: 600; color: #16130f; -webkit-appearance: none; appearance: none;
}
.search-sheet-field .search-input::placeholder { color: #9a948a; font-weight: 500; }
.search-sheet-field .search-input::-webkit-search-cancel-button,
.search-sheet-field .search-input::-webkit-search-decoration { display: none; -webkit-appearance: none; }
.search-sheet-clear {
    width: 28px; height: 28px; border-radius: 50%; border: 0; background: #f1ede4; color: #6b6559;
    display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.search-sheet-clear[hidden] { display: none; }
.search-sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 0 24px; margin: 0; position: relative; }

/* ---- shared pieces: labels, chips, tiles, rows ---- */
.ss-label { font-size: 12.5px; font-weight: 700; color: #8a847a; padding: 14px 16px 8px; letter-spacing: 0.2px; }
.ss-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px; }
.ss-chips.ss-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.ss-chips.ss-scroll::-webkit-scrollbar { display: none; }
.ss-chip {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px;
    border: 1px solid rgba(22, 19, 15, 0.14); background: #fff; color: #16130f; font-size: 13.5px; font-weight: 600;
    white-space: nowrap; cursor: pointer; text-decoration: none; max-width: 100%; overflow: hidden;
    font-family: inherit; line-height: 1;
    /* never squash: a flex row shrank «خلاط بانيو» to «خلاط باني» (2026-09-09) */
    flex: 0 0 auto;
}
.ss-chip:hover, .ss-chip.selected { border-color: #16a34a; background: rgba(34, 197, 94, 0.08); color: #16130f; }
.ss-chip.ss-cat { background: #f6f3ea; }
.ss-chip.ss-recent { padding-inline-end: 6px; }
.ss-chip .ss-clock { color: #8a847a; display: flex; }
.ss-chip .ss-x {
    width: 22px; height: 22px; border-radius: 50%; background: #f1ede4; display: inline-flex; align-items: center;
    justify-content: center; color: #6b6559; flex-shrink: 0;
}
.ss-chip .ss-x:hover { background: #e4dfd3; color: #16130f; }
.ss-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 16px; }
.ss-tile { display: block; border-radius: 16px; overflow: hidden; background: #fff; border: 1px solid rgba(22, 19, 15, 0.10); color: #16130f; text-decoration: none; }
.ss-tile:hover { border-color: #16a34a; box-shadow: 0 6px 16px rgba(22, 163, 74, 0.12); color: #16130f; }
.ss-tile-img { height: 72px; background: #ece7dc center / cover no-repeat; }
.ss-tile-name { padding: 8px 12px; font-size: 13.5px; font-weight: 700; line-height: 1.4; }
.ss-list { background: #fff; border-top: 1px solid rgba(22, 19, 15, 0.08); border-bottom: 1px solid rgba(22, 19, 15, 0.08); }
.ss-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 72px; color: #16130f;
    text-decoration: none; cursor: pointer;
}
.ss-row + .ss-row { border-top: 1px solid rgba(22, 19, 15, 0.06); }
.ss-row:hover, .ss-row.selected { background: #f6f3ea; color: #16130f; }
.ss-thumb {
    width: 56px; height: 56px; border-radius: 12px; background: #f1ede4; border: 1px solid rgba(22, 19, 15, 0.08);
    flex-shrink: 0; object-fit: contain; display: block;
}
.ss-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ss-row-name { font-size: 14.5px; font-weight: 600; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ss-row-name strong, .ss-chip strong { font-weight: 800; color: #16130f; background: rgba(34, 197, 94, 0.16); border-radius: 4px; padding: 0 3px; }
.ss-row-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #8a847a; white-space: nowrap; overflow: hidden; }
.ss-price { color: #16a34a; font-weight: 800; }
.ss-oos { color: #b45309; font-weight: 700; }
.ss-row-arrow { color: #b8b2a6; flex-shrink: 0; display: flex; }
.ss-footer { position: sticky; bottom: 0; padding: 12px 16px 20px; background: linear-gradient(180deg, rgba(250, 247, 240, 0), #faf7f0 40%); }
.ss-cta {
    display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: 14px;
    background: #16a34a; color: #fff; font-size: 15.5px; font-weight: 800; text-decoration: none;
    box-shadow: 0 8px 20px rgba(22, 163, 74, 0.25); border: 0; width: 100%; cursor: pointer; font-family: inherit;
}
.ss-cta:hover { background: #128a3e; color: #fff; }
.ss-empty { padding: 36px 16px; text-align: center; color: #6b6559; font-size: 14.5px; line-height: 1.7; }
.ss-loading { padding: 24px 16px; text-align: center; color: #9a948a; font-size: 13px; }

/* ---- desktop pill dropdown (≥1280px) ---- */
.header-search-inline .search-autocomplete-dropdown.ss-inline {
    position: absolute; top: calc(100% + 8px) !important; right: 0; left: auto; margin: 0 !important;
    width: min(680px, calc(100vw - 32px)); background: #fff; border-radius: 16px !important;
    border: 1px solid rgba(22, 19, 15, 0.10); box-shadow: 0 24px 60px rgba(22, 19, 15, 0.16) !important;
    overflow: hidden; max-height: 76vh; overflow-y: auto; z-index: 10000;
}
.ss-inline-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 240px); }
/* the panel is right-anchored to the pill and grows LEFT — past the viewport edge it
   becomes horizontally scrollable page (see the RTL negative-left incident 09-06), so
   search.js clamps the width to the room actually available. */
.ss-inline-narrow .ss-inline-grid { grid-template-columns: minmax(0, 1fr); }
.ss-inline-narrow .ss-inline-side { border-inline-start: 0; border-top: 1px solid rgba(22, 19, 15, 0.08); }
.ss-inline-grid .ss-list { border: 0; }
.ss-inline-grid .ss-row { min-height: 64px; padding: 8px 12px; }
.ss-inline-grid .ss-thumb { width: 48px; height: 48px; border-radius: 10px; }
.ss-inline-grid .ss-row-name { font-size: 14px; -webkit-line-clamp: 1; }
.ss-inline-side { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 16px; border-inline-start: 1px solid rgba(22, 19, 15, 0.08); background: #fbfaf6; }
.ss-inline-side .ss-label { padding: 10px 4px 6px; }
.ss-inline-side .ss-chips { padding: 0; }
.ss-inline-side .ss-cta { margin-top: auto; height: 44px; font-size: 14px; border-radius: 12px; box-shadow: none; }
.ss-inline-single { padding: 8px 0 12px; }
.ss-inline-single .ss-chips { padding: 0 12px; }
.ss-inline-single .ss-label { padding: 10px 16px 6px; }

/* ---- /search.html: header pill, welcome, no-results ---- */
.search-results-header { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 18px; }
.sr-pill {
    display: flex; align-items: center; gap: 10px; width: 100%; max-width: 640px; height: 48px; padding: 0 8px 0 14px;
    border-radius: 14px; background: #fff; border: 1.5px solid rgba(22, 19, 15, 0.14); color: #16130f; cursor: text;
    font-family: inherit; text-align: start;
}
.sr-pill:hover { border-color: #16a34a; }
.sr-pill .ss-ico { color: #16a34a; flex-shrink: 0; }
.sr-pill-text { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-pill .ss-x { width: 28px; height: 28px; border-radius: 50%; background: #f1ede4; display: inline-flex; align-items: center; justify-content: center; color: #6b6559; flex-shrink: 0; }
.search-results-count { font-size: 13.5px; color: #6b6559; margin: 0; }
.search-results-count strong { color: #16130f; font-weight: 800; }
.sr-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.welcome-state, .no-results-state { max-width: 640px; margin: 0 auto; padding: 8px 0 24px; text-align: start; }
.welcome-state .ss-label:first-child { padding-top: 4px; }
.welcome-title { font-size: 22px; font-weight: 800; margin: 8px 16px 2px; }
.welcome-subtitle { font-size: 14.5px; color: #6b6559; margin: 0 16px 6px; line-height: 1.6; }
.welcome-brands { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px; }
.welcome-brand {
    background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; border-radius: 999px; padding: 0 14px; height: 36px;
    display: inline-flex; align-items: center; font-size: 13px; font-weight: 700; text-decoration: none;
}
.welcome-brand:hover { background: #dcfce7; color: #15803d; }

.nr-title { font-size: 22px; font-weight: 800; line-height: 1.35; margin: 20px 16px 6px; overflow-wrap: anywhere; }
.nr-sub { font-size: 14.5px; color: #6b6559; line-height: 1.6; margin: 0 16px 18px; }
.nr-wa {
    display: flex; align-items: center; gap: 14px; margin: 0 16px; padding: 14px 16px; border-radius: 16px; background: #fff;
    border: 1.5px solid #16a34a; color: #16130f; text-decoration: none; box-shadow: 0 8px 20px rgba(22, 163, 74, 0.12);
}
.nr-wa:hover { background: #f6fdf8; color: #16130f; }
.nr-wa-ico { width: 48px; height: 48px; border-radius: 14px; background: #16a34a; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nr-wa-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.nr-wa-text strong { font-size: 15.5px; font-weight: 800; }
.nr-wa-text span { font-size: 13px; color: #6b6559; }
.nr-wa-arrow { color: #16a34a; display: flex; flex-shrink: 0; }
.loading-state { text-align: center; padding: 48px 16px; color: #8a847a; font-size: 14px; }
.search-spinner { width: 32px; height: 32px; border: 3px solid #ece7dc; border-top-color: #16a34a; border-radius: 50%; margin: 0 auto 12px; animation: ss-spin .8s linear infinite; }
@keyframes ss-spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) { .ss-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .nr-title { font-size: 20px; } }
