/*
 * Panth Search Autocomplete — Luma stylesheet.
 *
 * Mirrors the Hyva inline CSS exactly so a merchant running both stores
 * gets the same look on both. Uses Luma-friendly defaults (no Tailwind),
 * Open Sans font fallback, and CSS custom properties so future themes
 * can override colors without forking.
 */

/* ─── Trigger button (icon-only by default, label revealed on >= sm) ── */
.psac-trigger-wrap {
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 5;
}
.psac-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 8px 10px !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    color: #404040 !important;
    cursor: pointer;
    font-size: 14px !important;
    font-weight: 500 !important;
    border-radius: 8px !important;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}
.psac-trigger:hover, .psac-trigger:focus { color: #0d9488 !important; background: rgba(13,148,136,0.06) !important; outline: none; }
.psac-trigger svg { width: 22px; height: 22px; flex: 0 0 22px; }
.psac-trigger-label { display: none; }
@media (min-width: 768px) {
    .psac-trigger-label { display: inline; }
}

/* ─── Overlay (popup that opens on trigger click) ───────────────────── */
.psac-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 16px 16px 16px;
}
.psac-overlay[hidden] { display: none !important; }
.psac-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: psac-fade 0.18s ease-out;
}
.psac-overlay-panel {
    position: relative;
    width: 100%;
    max-width: 720px;
    z-index: 1;
    animation: psac-slide 0.22s ease-out;
}
@keyframes psac-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes psac-slide {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 639px) {
    .psac-overlay { padding: 0; align-items: stretch; }
    .psac-overlay-panel { max-width: none; }
}

/* Close (×) button — corner pill on the overlay panel, NOT inside the form */
.psac-close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.95) !important;
    border: 0 !important;
    cursor: pointer;
    color: #171717 !important;
    border-radius: 9999px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: background 0.15s, transform 0.15s;
    padding: 0 !important;
    z-index: 2;
}
.psac-close:hover, .psac-close:focus {
    background: #ffffff !important;
    transform: scale(1.05);
    outline: none;
}
@media (max-width: 639px) {
    .psac-close {
        top: 12px;
        right: 12px;
        background: rgba(255,255,255,0.95) !important;
    }
}

/* ─── Popup header (Close × bar above the search input in overlays) ── */
.psac-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px 16px;
    background: #ffffff;
    border-bottom: 1px solid #f5f5f5;
}
.psac-popup-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #737373;
    font-family: 'DM Sans', 'Inter', 'Open Sans', sans-serif;
}
.psac-popup-close {
    width: 36px;
    height: 36px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: #f5f5f5 !important;
    border: 0 !important;
    color: #171717 !important;
    cursor: pointer;
    border-radius: 9999px !important;
    transition: background 0.15s, color 0.15s;
    padding: 0 !important;
}
.psac-popup-close:hover, .psac-popup-close:focus {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    outline: none;
}

.psac-wrap {
    --psac-input-bg: #ffffff;
    --psac-input-border: #e5e5e5;
    --psac-input-focus-border: #0d9488;
    --psac-input-focus-ring: rgba(13, 148, 136, 0.15);
    --psac-input-text: #171717;
    --psac-input-placeholder: #a3a3a3;
    --psac-icon-color: #525252;
    --psac-icon-hover: #0d9488;
    --psac-icon-clear: #a3a3a3;
    --psac-icon-clear-hover: #525252;
    --psac-dropdown-bg: #ffffff;
    --psac-dropdown-border: #e5e5e5;
    --psac-dropdown-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.18);
    --psac-dropdown-radius: 12px;
    --psac-section-heading-color: #737373;
    --psac-section-heading-bg: #fafafa;
    --psac-row-hover-bg: #f0fdfa;
    --psac-row-hover-text: #0d9488;
    --psac-row-divider: #f5f5f5;
    --psac-product-name: #171717;
    --psac-product-sku: #a3a3a3;
    --psac-product-price: #0f766e;
    --psac-product-old-price: #a3a3a3;
    --psac-product-image-bg: #f5f5f5;
    --psac-product-image-border: #e5e5e5;
    --psac-category-text: #404040;
    --psac-category-count: #a3a3a3;
    --psac-page-text: #404040;
    --psac-popular-tag-bg: #f0fdfa;
    --psac-popular-tag-text: #0f766e;
    --psac-popular-tag-hover-bg: #0d9488;
    --psac-popular-tag-hover-text: #ffffff;
    --psac-highlight-bg: rgba(13, 148, 136, 0.18);
    --psac-highlight-text: #0f766e;
    --psac-view-all-bg: #0d9488;
    --psac-view-all-text: #ffffff;
    --psac-view-all-hover-bg: #0f766e;
    --psac-empty-icon: #d4d4d4;
    --psac-empty-text: #737373;
    --psac-loading-bar: #0d9488;
    position: relative;
    width: 100%;
    font-family: 'DM Sans', 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
    box-sizing: border-box;
}
.psac-wrap *,
.psac-wrap *::before,
.psac-wrap *::after { box-sizing: border-box; }

.psac-form { position: relative; display: flex; align-items: center; width: 100%; }
.psac-input {
    width: 100% !important;
    height: 48px !important;
    /* Right padding reserves 130px for the clear-button + Search submit
       button group so the typed text never sits underneath them. */
    padding: 0 132px 0 48px !important;
    margin: 0 !important;
    font-size: 15px !important;
    color: var(--psac-input-text) !important;
    background: var(--psac-input-bg) !important;
    border: 1.5px solid var(--psac-input-border) !important;
    border-radius: 9999px !important;
    outline: none !important;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none !important;
}
.psac-input::placeholder { color: var(--psac-input-placeholder); }
.psac-input:focus {
    border-color: var(--psac-input-focus-border) !important;
    box-shadow: 0 0 0 4px var(--psac-input-focus-ring) !important;
}
.psac-input::-webkit-search-decoration,
.psac-input::-webkit-search-cancel-button,
.psac-input::-webkit-search-results-button,
.psac-input::-webkit-search-results-decoration { display: none; }
.psac-icon-search {
    position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
    width: 20px; height: 20px; color: var(--psac-icon-color); pointer-events: none;
}
.psac-input:focus ~ .psac-icon-search { color: var(--psac-icon-hover); }
.psac-clear {
    position: absolute; right: 116px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    background: transparent !important; border: 0 !important; cursor: pointer;
    color: var(--psac-icon-clear); border-radius: 9999px;
    transition: color 0.15s, background 0.15s; padding: 0 !important;
}
.psac-clear:hover { color: var(--psac-icon-clear-hover); background: #f5f5f5 !important; }
.psac-submit {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    height: 36px !important; padding: 0 16px !important;
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--psac-view-all-bg) !important;
    color: var(--psac-view-all-text) !important;
    border: 0 !important; border-radius: 9999px !important; cursor: pointer;
    font-size: 13px !important; font-weight: 600 !important;
    transition: background 0.15s; line-height: 1 !important; text-transform: none !important;
}
.psac-submit:hover { background: var(--psac-view-all-hover-bg) !important; }
.psac-honeypot {
    position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important;
    opacity: 0 !important; pointer-events: none !important;
}
.psac-loading {
    position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
    overflow: hidden; border-radius: 0 0 9999px 9999px;
}
.psac-loading::before {
    content: ''; display: block; width: 40%; height: 100%;
    background: var(--psac-loading-bar);
    animation: psac-bar 1s ease-in-out infinite;
}
@keyframes psac-bar {
    0%   { margin-left: -40%; }
    100% { margin-left: 100%; }
}

.psac-dropdown {
    position: absolute; left: 0; right: 0; top: calc(100% + 8px);
    background: var(--psac-dropdown-bg);
    border: 1px solid var(--psac-dropdown-border);
    border-radius: var(--psac-dropdown-radius);
    box-shadow: var(--psac-dropdown-shadow);
    overflow: hidden; z-index: 99;
    max-height: min(560px, calc(100vh - 140px));
    display: flex; flex-direction: column;
}
.psac-dropdown[hidden] { display: none !important; }
.psac-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.psac-section-heading {
    padding: 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--psac-section-heading-color);
    background: var(--psac-section-heading-bg);
    border-bottom: 1px solid var(--psac-row-divider);
    position: sticky; top: 0; z-index: 1;
}
.psac-row {
    display: flex; align-items: center; gap: 14px; padding: 12px 16px; cursor: pointer;
    text-decoration: none !important; color: inherit !important;
    border-bottom: 1px solid var(--psac-row-divider);
    transition: background 0.12s;
}
.psac-row:last-child { border-bottom: none; }
.psac-row:hover, .psac-row.is-active { background: var(--psac-row-hover-bg); }
.psac-row:hover .psac-product-name,
.psac-row.is-active .psac-product-name { color: var(--psac-row-hover-text); }
.psac-product-image {
    flex: 0 0 56px; width: 56px; height: 56px; border-radius: 8px; overflow: hidden;
    background: var(--psac-product-image-bg);
    border: 1px solid var(--psac-product-image-border);
    display: flex; align-items: center; justify-content: center;
}
.psac-product-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.psac-product-info { flex: 1; min-width: 0; }
.psac-product-name {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis;
    font-size: 14px; font-weight: 600; color: var(--psac-product-name); line-height: 1.35;
}
.psac-product-sku { font-size: 11px; color: var(--psac-product-sku); margin-top: 2px; }
.psac-product-price {
    display: flex; align-items: baseline; gap: 8px; margin-top: 4px;
    font-size: 13px; font-weight: 700; color: var(--psac-product-price);
}
.psac-product-price .psac-old { font-weight: 500; color: var(--psac-product-old-price); text-decoration: line-through; font-size: 11px; }
.psac-cat-row, .psac-page-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    text-decoration: none !important; color: var(--psac-category-text) !important;
    border-bottom: 1px solid var(--psac-row-divider); transition: background 0.12s;
}
.psac-cat-row:last-child, .psac-page-row:last-child { border-bottom: none; }
.psac-cat-row:hover, .psac-cat-row.is-active,
.psac-page-row:hover, .psac-page-row.is-active {
    background: var(--psac-row-hover-bg); color: var(--psac-row-hover-text) !important;
}
.psac-cat-icon, .psac-page-icon {
    flex: 0 0 32px; width: 32px; height: 32px; border-radius: 8px;
    background: var(--psac-section-heading-bg);
    display: flex; align-items: center; justify-content: center; color: var(--psac-icon-color);
}
.psac-cat-name, .psac-page-name { flex: 1; font-size: 13px; font-weight: 500; }
.psac-cat-count { font-size: 11px; color: var(--psac-category-count); font-weight: 500; }
.psac-popular-wrap { padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.psac-popular-tag {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    font-size: 12px; font-weight: 600;
    color: var(--psac-popular-tag-text) !important;
    background: var(--psac-popular-tag-bg) !important;
    border-radius: 9999px !important;
    text-decoration: none !important; border: 0 !important; cursor: pointer;
    transition: background 0.12s, color 0.12s; line-height: 1.2 !important;
}
.psac-popular-tag:hover {
    background: var(--psac-popular-tag-hover-bg) !important;
    color: var(--psac-popular-tag-hover-text) !important;
}
.psac-empty { padding: 36px 24px; text-align: center; color: var(--psac-empty-text); }
.psac-empty svg { color: var(--psac-empty-icon); margin: 0 auto 12px; display: block; }
.psac-empty p { margin: 0; font-size: 14px; line-height: 1.5; }
.psac-view-all {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 16px;
    background: var(--psac-view-all-bg) !important;
    color: var(--psac-view-all-text) !important;
    text-decoration: none !important;
    font-size: 14px; font-weight: 700;
    transition: background 0.15s;
    border-top: 1px solid var(--psac-row-divider);
}
.psac-view-all:hover { background: var(--psac-view-all-hover-bg) !important; }
mark.psac-hl {
    background: var(--psac-highlight-bg);
    color: var(--psac-highlight-text);
    padding: 0 2px; border-radius: 2px; font-weight: 700;
}

/* Attach mode: dropdown is injected as a child of .panth-search-inner
   (the centered max-width 1280px container inside #panth-search-bar)
   so it spans the same width as the form and sits directly under it. */
.psac-attached-dropdown {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    top: calc(100% + 10px) !important;
    z-index: 200;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.18), 0 8px 16px -8px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    max-height: min(640px, calc(100vh - 220px));
    display: flex;
    flex-direction: column;
    animation: psac-attached-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes psac-attached-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.psac-attached-dropdown[hidden] { display: none !important; }

/* Polished section headings inside the attached dropdown */
.psac-attached-dropdown .psac-section-heading {
    padding: 14px 20px 8px 20px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: #6b7280 !important;
    background: #ffffff !important;
    border-bottom: 0 !important;
    border-top: 1px solid #f3f4f6 !important;
}
.psac-attached-dropdown .psac-section-heading:first-child {
    border-top: 0 !important;
}

/* Polished product rows */
.psac-attached-dropdown .psac-row {
    padding: 14px 20px !important;
    gap: 16px !important;
    border-bottom: 1px solid #f9fafb !important;
    transition: background 0.15s, padding-left 0.15s !important;
}
.psac-attached-dropdown .psac-row:hover,
.psac-attached-dropdown .psac-row.is-active {
    background: linear-gradient(90deg, #f0fdfa 0%, #ffffff 100%) !important;
    padding-left: 24px !important;
}
.psac-attached-dropdown .psac-product-image {
    flex: 0 0 60px !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 10px !important;
    background: #f9fafb !important;
    border: 1px solid #f3f4f6 !important;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.psac-attached-dropdown .psac-product-name {
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: #111827 !important;
    margin-bottom: 2px;
}
.psac-attached-dropdown .psac-product-sku {
    font-size: 11px !important;
    color: #9ca3af !important;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.psac-attached-dropdown .psac-product-price {
    margin-top: 6px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #0f766e !important;
}

/* Category and CMS rows */
.psac-attached-dropdown .psac-cat-row,
.psac-attached-dropdown .psac-page-row {
    padding: 12px 20px !important;
    gap: 14px !important;
    border-bottom: 1px solid #f9fafb !important;
    transition: background 0.15s, padding-left 0.15s !important;
}
.psac-attached-dropdown .psac-cat-row:hover,
.psac-attached-dropdown .psac-page-row:hover {
    background: #f0fdfa !important;
    padding-left: 24px !important;
}
.psac-attached-dropdown .psac-cat-icon,
.psac-attached-dropdown .psac-page-icon {
    flex: 0 0 36px !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
    background: #f0fdfa !important;
    color: #0d9488 !important;
}
.psac-attached-dropdown .psac-cat-name,
.psac-attached-dropdown .psac-page-name {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #374151 !important;
}
.psac-attached-dropdown .psac-cat-count {
    font-size: 12px !important;
    color: #6b7280 !important;
    background: #f3f4f6;
    padding: 2px 10px;
    border-radius: 9999px;
    font-weight: 600;
}

/* Popular / recent chip rows */
.psac-attached-dropdown .psac-popular-wrap {
    padding: 8px 20px 16px 20px !important;
    gap: 8px !important;
}
.psac-attached-dropdown .psac-popular-tag {
    padding: 8px 14px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #0f766e !important;
    background: #f0fdfa !important;
    border: 1px solid #ccfbf1 !important;
    border-radius: 9999px !important;
    transition: all 0.15s !important;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.psac-attached-dropdown .psac-popular-tag:hover {
    background: #0d9488 !important;
    color: #ffffff !important;
    border-color: #0d9488 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13,148,136,0.25);
}

/* Polished view-all CTA */
.psac-attached-dropdown .psac-view-all {
    padding: 16px 20px !important;
    background: linear-gradient(90deg, #0d9488 0%, #14b8a6 100%) !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    border-top: 0 !important;
    transition: filter 0.15s !important;
    gap: 10px !important;
}
.psac-attached-dropdown .psac-view-all:hover {
    background: linear-gradient(90deg, #0f766e 0%, #0d9488 100%) !important;
    filter: brightness(1.05);
}

/* Empty state inside attached dropdown */
.psac-attached-dropdown .psac-empty {
    padding: 48px 24px !important;
    color: #9ca3af !important;
}
.psac-attached-dropdown .psac-empty p {
    font-size: 14px !important;
    margin: 12px 0 0 0 !important;
}

.psac-attached-loading {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    top: 100% !important;
    height: 3px;
    overflow: hidden;
    z-index: 201;
    margin-top: 4px;
    border-radius: 9999px;
}
.psac-attached-loading::before {
    content: '';
    display: block;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, #0d9488 0%, #14b8a6 100%);
    border-radius: 9999px;
    animation: psac-bar 1s ease-in-out infinite;
}

@media (max-width: 639px) {
    .psac-input { height: 44px !important; font-size: 16px !important; padding: 0 124px 0 44px !important; }
    .psac-icon-search { left: 14px; width: 18px; height: 18px; }
    .psac-submit { height: 32px !important; padding: 0 12px !important; font-size: 12px !important; }
    .psac-clear { right: 102px; width: 24px; height: 24px; }
    /* On mobile we keep the dropdown directly under the input (NOT
       pinned to viewport bottom, which created a confusing gap). */
    .psac-dropdown {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        top: calc(100% + 6px) !important;
        max-height: 60vh;
        border-radius: 12px;
    }
    .psac-row { padding: 14px 16px; }
    .psac-product-image { flex-basis: 64px; width: 64px; height: 64px; }
    .psac-product-name { font-size: 15px; }
    .psac-popup-header { padding: 10px 14px 6px 14px; }
}
