/**
 * pikaaso-search.css — Phase R.5 frontend dropdown
 * Etsy-simple. Reuses existing pill header search (Phase L.O styling).
 * Prefix: pks- (PiKaaso Search) to avoid collisions with Flatsome.
 */

/* ── Dim overlay (desktop only) ────────────────────────────────────────────── */
/* Starts BELOW the header so clicks on the search input still register
   (the input would otherwise sit behind the dim and be uninteractive). */
.pks-dim {
    position: fixed;
    top: 118px;        /* moved from 80 to match dropdown so overlay does not cross search input */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease;
}
.pks-dim.pks-open {
    opacity: 1;
    pointer-events: auto;
}
/* Belt + suspenders: also lift the header search form above the dim
   so the input is fully click-through even if header height differs. */
li.header-search-form,
.header-search-form-wrapper,
form.searchform {
    position: relative;
    z-index: 9999;
}
@media (max-width: 768px) {
    .pks-dim {
        display: none;  /* mobile uses full overlay instead */
    }
}

/* ── Desktop dropdown ──────────────────────────────────────────────────────── */
.pks-dropdown {
    position: fixed;
    top: 118px;               /* below the header search input (input bottom = 110px + 8px gap) */
    left: 50%;
    transform: translateX(-50%);
    width: 720px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    display: none;
    font-family: inherit;
    color: #222;
}

/* ── Admin bar compensation (2026-08-22) ─────────────────────────────────────
   WordPress adds a 32px toolbar at the top of the page for logged-in users,
   pushing the header (and search input) down by 32px. .pks-dim and
   .pks-dropdown are position:fixed, so they don't shift with it -- without
   this override they stay anchored at the logged-out top:118px, overlapping
   the bottom ~24px of the search input and hiding whatever text is typed
   there. Bug: logged-in users could not see text they typed in search. */
body.admin-bar .pks-dim,
body.admin-bar .pks-dropdown {
    top: 150px; /* 118px + 32px admin bar height */
}

.pks-dropdown.pks-open {
    display: block;
}

/* ── Mobile takeover (full viewport) ───────────────────────────────────────── */
.pks-dropdown.pks-mobile {
    top: 0;
    left: 0;
    transform: none;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
}

/* ── Section labels ────────────────────────────────────────────────────────── */
.pks-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    padding: 12px 16px 6px 16px;
}

.pks-section {
    padding: 0 8px 6px 8px;
}

/* ── Item (collection or product row) ──────────────────────────────────────── */
.pks-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    text-decoration: none;
    color: inherit;
    border-radius: 4px;
    transition: background 100ms ease;
}
.pks-item:hover,
.pks-item.pks-highlight {
    background: #f6f6f6;
}

.pks-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    background: #f0f0f0;
    flex-shrink: 0;
}
.pks-thumb-collection {
    background: linear-gradient(135deg, #fff3e8 0%, #ffe0c4 100%);
    width: 60px;
    height: 60px;
    border-radius: 4px;
    position: relative;
}
.pks-thumb-collection::after {
    content: "📁";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    opacity: 0.5;
}

.pks-meta {
    flex: 1;
    min-width: 0;
}
.pks-title {
    font-size: 14px;
    line-height: 1.3;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.pks-occasion {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}
.pks-badge {
    display: inline-block;
    font-size: 11px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
}
.pks-badge-cat {
    background: #fff3e8;
    color: #F1641E;
}

.pks-chevron {
    color: #ccc;
    font-size: 24px;
    flex-shrink: 0;
}

/* ── Footer (See all results for X) ────────────────────────────────────────── */
.pks-footer {
    display: block;
    text-align: center;
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    color: #F1641E;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    background: #fafafa;
}
.pks-footer:hover {
    background: #f5f5f5;
    text-decoration: underline;
}

/* mobile sticky footer */
.pks-dropdown.pks-mobile .pks-footer {
    position: sticky;
    bottom: 0;
}

/* ── Chips (trending / fallback browse) ────────────────────────────────────── */
.pks-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px 16px 16px;
}
.pks-chip {
    display: inline-block;
    padding: 8px 14px;
    background: #f6f6f6;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    font-size: 13px;
    color: #333;
    text-decoration: none;
    transition: all 100ms ease;
}
.pks-chip:hover {
    background: #fff3e8;
    border-color: #F1641E;
    color: #F1641E;
}

/* ── Empty / error states ──────────────────────────────────────────────────── */
.pks-empty {
    padding: 24px 16px 8px 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* ── Skeleton loading ──────────────────────────────────────────────────────── */
.pks-skeleton {
    height: 60px;
    background: linear-gradient(90deg, #f0f0f0 0%, #fafafa 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin: 4px 8px;
    animation: pks-shimmer 1.2s linear infinite;
}
@keyframes pks-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Mobile-specific tweaks ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .pks-thumb { width: 80px; height: 80px; }
    .pks-title { font-size: 15px; -webkit-line-clamp: 2; }
}
