/* =====================================================================
   Ecomm.WEB/wwwroot/css/ec-search.css   (NEW)
   Header search button + dropdown. Loaded by _SiteSearch.cshtml.
   The panel is moved to <body> by ec-search.js, so theme CSS can't
   squash it and no parent overflow can cut it off.
   ===================================================================== */

/* ---------- the magnifier in the menu bar ---------- */
.ec-search { position: relative; display: inline-flex; align-items: center; }

.ec-search-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; padding: 0; margin: 0;
    border: 0; border-radius: 50%; background: transparent;
    color: var(--palette2, #000); cursor: pointer;
    transition: color .2s ease, background-color .2s ease;
}
.ec-search-btn:hover,
.ec-search-btn[aria-expanded="true"] { color: var(--palette1, #f89e00); }
.ec-search-btn:focus-visible { outline: 2px solid var(--palette1, #f89e00); outline-offset: 2px; }
.ec-search-btn svg { width: 22px; height: 22px; fill: currentColor; }

/* ---------- dropdown panel ---------- */
.ec-search-panel {
    --ec-gold: var(--palette1, #f89e00);
    --ec-ink: #1d1a16;
    --ec-muted: #8c8476;
    --ec-line: #e9e3d8;
    --ec-soft: #faf7f2;

    position: fixed; z-index: 10050;
    display: flex; flex-direction: column;
    background: #fff; color: var(--ec-ink);
    border-radius: 16px;
    box-shadow: 0 28px 60px -14px rgba(29, 26, 22, .30), 0 0 0 1px rgba(29, 26, 22, .06);
    font-size: 14px; line-height: 1.4; text-align: left;
    opacity: 0; transform: translateY(-8px) scale(.985); transform-origin: top right;
    transition: opacity .16s ease, transform .16s ease;
}
.ec-search-panel[hidden] { display: none; }
.ec-search-panel.is-open { opacity: 1; transform: none; }

/* little pointer towards the magnifier */
.ec-search-panel::before {
    content: ""; position: absolute; top: -6px;
    left: calc(var(--ec-arrow-x, 90%) - 6px);
    width: 12px; height: 12px; background: #fff;
    transform: rotate(45deg);
    box-shadow: -1px -1px 0 rgba(29, 26, 22, .06);
}

/* ---------- input row ---------- */
.ec-search-form {
    position: relative; display: flex; align-items: center; gap: 8px;
    margin: 14px 14px 4px; padding: 0 5px 0 16px; height: 52px;
    border: 1.5px solid var(--ec-line); border-radius: 999px;
    background: var(--ec-soft);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.ec-search-form:focus-within {
    border-color: var(--ec-gold); background: #fff;
    box-shadow: 0 0 0 4px rgba(248, 158, 0, .16);
}
.ec-search-form > svg { flex: none; width: 17px; height: 17px; fill: var(--ec-muted); }

.ec-search-panel .ec-search-input {
    flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0;
    border: 0; outline: 0; box-shadow: none; background: transparent;
    font: inherit; font-size: 15px; color: var(--ec-ink);
    -webkit-appearance: none; appearance: none;
}
.ec-search-panel .ec-search-input::placeholder { color: #a9a193; }
.ec-search-panel .ec-search-input::-webkit-search-cancel-button { display: none; }

.ec-search-clear {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
    background: #ece6db; color: #5d564b; font-size: 17px; line-height: 1; cursor: pointer;
}
.ec-search-clear[hidden] { display: none; }
.ec-search-clear:hover { background: #e0d8ca; }

.ec-search-go {
    flex: none; height: 40px; padding: 0 20px; border: 0; border-radius: 999px;
    background: var(--ec-gold); color: #fff; font: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: filter .15s ease;
}
.ec-search-go:hover { filter: brightness(.94); }

/* ---------- results area ---------- */
.ec-search-body { overflow-y: auto; overscroll-behavior: contain; padding: 2px 8px 8px; }

.ec-s-label {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 8px 6px; font-size: 11px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: #9a9284;
}
.ec-s-label button {
    padding: 0; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none;
    color: #9a9284;
}
.ec-s-label button:hover { color: var(--ec-gold); }

/* chips: recent, popular, categories */
.ec-s-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 8px 6px; }
.ec-s-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border: 1px solid var(--ec-line); border-radius: 999px;
    background: #fff; color: #3a352d; font-size: 13px; text-decoration: none; cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.ec-s-chip:hover, .ec-s-chip.is-active {
    border-color: var(--ec-gold); background: #fff8ec; color: #b86f00; text-decoration: none;
}
.ec-s-chip svg { width: 13px; height: 13px; fill: currentColor; opacity: .65; }

/* product rows */
.ec-s-list { list-style: none; margin: 0; padding: 0; }
.ec-s-prod {
    display: flex; align-items: center; gap: 12px;
    padding: 8px; border-radius: 12px; color: inherit; text-decoration: none;
}
.ec-s-prod:hover, .ec-s-prod.is-active { background: #fbf6ee; color: inherit; text-decoration: none; }

.ec-s-img {
    flex: none; display: flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; overflow: hidden;
    border-radius: 10px; background: #f4f0e9;
}
.ec-s-img img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.ec-s-img svg { width: 22px; height: 22px; fill: #cbbfa9; }

.ec-s-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ec-s-name {
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    font-size: 14px; font-weight: 500; line-height: 1.3;
}
.ec-search-panel mark {
    padding: 0; background: none; color: inherit; font-weight: 700;
    box-shadow: inset 0 -.38em 0 rgba(248, 158, 0, .24);
}
.ec-s-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ec-muted); }
.ec-s-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.ec-s-in  { color: #15803d; font-weight: 600; }
.ec-s-out { color: #c2410c; font-weight: 600; }

.ec-s-price {
    flex: none; display: flex; flex-direction: column; align-items: flex-end;
    font-size: 14px; font-weight: 700; color: var(--ec-ink);
}
.ec-s-price s { font-size: 12px; font-weight: 400; color: #a39b8e; }

/* "view all" bar */
.ec-s-all {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin: 8px 8px 2px; padding: 12px; border-radius: 12px;
    background: var(--ec-ink); color: #fff; font-size: 13.5px; font-weight: 500; text-decoration: none;
    transition: background-color .15s ease;
}
.ec-s-all:hover, .ec-s-all.is-active { background: var(--ec-gold); color: #fff; text-decoration: none; }

/* empty / error / hint */
.ec-s-empty { padding: 26px 16px 20px; text-align: center; color: #5d564b; font-size: 14px; }
.ec-s-empty svg { display: block; width: 42px; height: 42px; margin: 0 auto 10px; fill: #ddd3c2; }
.ec-s-empty small { display: block; margin-top: 6px; color: #9a9284; font-size: 12.5px; }

/* loading skeleton */
.ec-s-sk { display: flex; align-items: center; gap: 12px; padding: 8px; }
.ec-s-sk i {
    display: block; border-radius: 8px;
    background: linear-gradient(90deg, #f1ece4 25%, #f8f5f0 50%, #f1ece4 75%);
    background-size: 200% 100%; animation: ec-s-shine 1.1s linear infinite;
}
.ec-s-sk i:first-child { width: 52px; height: 52px; border-radius: 10px; }
.ec-s-sk span { flex: 1; display: flex; flex-direction: column; gap: 8px; }
@keyframes ec-s-shine { to { background-position: -200% 0; } }

/* keyboard hint footer */
.ec-search-keys {
    display: flex; gap: 16px; justify-content: flex-end;
    padding: 9px 18px; border-top: 1px solid #f0ebe2;
    font-size: 11.5px; color: #a39b8e;
}
.ec-search-keys kbd {
    display: inline-block; min-width: 18px; margin-right: 3px; padding: 1px 5px;
    border: 1px solid #e3dccf; border-bottom-width: 2px; border-radius: 5px;
    background: #fff; color: #6b6458; font: inherit; font-size: 11px; text-align: center;
    box-shadow: none;
}

/* ---------- phones ---------- */
@media (max-width: 639px) {
    .ec-search-panel { border-radius: 14px; }
    .ec-search-panel::before,
    .ec-search-keys,
    .ec-search-go { display: none; }
    .ec-search-form { margin: 10px 10px 4px; padding-right: 10px; }
    .ec-search-panel .ec-search-input { font-size: 16px; }   /* stops iPhone zoom-in */
}

@media (prefers-reduced-motion: reduce) {
    .ec-search-panel { transition: none; }
    .ec-s-sk i { animation: none; }
}
