/**
 * Live Search Overlay — StoreVitre
 *
 * @package Digidaad_Theme
 * @version 2.11.29
 */

/* ============================================
 * OVERLAY WRAPPER
 * ============================================ */

.sv-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sv-search-overlay.is-active {
    pointer-events: auto;
    opacity: 1;
}

/* Backdrop */
.sv-search-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Panel */
.sv-search-overlay__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    background: #fff;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(-12px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sv-search-overlay.is-active .sv-search-overlay__panel {
    transform: translateY(0);
}

/* ============================================
 * SEARCH BAR
 * ============================================ */

.sv-search-overlay__bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.sv-search-overlay__icon {
    flex-shrink: 0;
    color: #9ca3af;
}

.sv-search-overlay__input {
    flex: 1;
    font-size: 18px;
    font-weight: 400;
    color: #111827;
    background: transparent;
    border: none;
    outline: none;
    min-width: 0;
    font-family: inherit;
    line-height: 1.4;
}

.sv-search-overlay__input::placeholder {
    color: #9ca3af;
    font-size: 16px;
}

.sv-search-overlay__clear,
.sv-search-overlay__close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: 50%;
    cursor: pointer;
    color: #6b7280;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0;
}

.sv-search-overlay__clear:hover,
.sv-search-overlay__close:hover {
    background: #f3f4f6;
    color: #111827;
}

/* ============================================
 * BODY / SCROLLABLE AREA
 * ============================================ */

.sv-search-overlay__body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 16px 20px 24px;
}

.sv-search-overlay__hint {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #9ca3af;
    margin: 0 0 10px;
}

/* ============================================
 * DEFAULT — chips
 * ============================================ */

.sv-search-default__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sv-search-chip {
    padding: 6px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 100px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.sv-search-chip:hover {
    border-color: #1d4ed8;
    color: #1d4ed8;
    background: #eff6ff;
}

/* ============================================
 * SECTION LABEL
 * ============================================ */

.sv-search-section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #9ca3af;
    margin: 4px 0 12px;
}

.sv-search-all-link {
    font-size: 12px;
    font-weight: 500;
    color: #1d4ed8;
    text-transform: none;
    letter-spacing: 0;
}

/* ============================================
 * PRODUCT RESULTS
 * ============================================ */

.sv-search-products {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.sv-search-product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.12s ease;
}

.sv-search-product:hover {
    background: #f9fafb;
}

.sv-search-product__img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #f9fafb;
}

.sv-search-product__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sv-search-product__name {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sv-search-product__sku {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 500;
}

.sv-search-product__price {
    font-size: 14px;
    font-weight: 700;
    color: #dc2626;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================
 * CONTENT FALLBACK
 * ============================================ */

.sv-search-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.sv-search-content-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.12s ease;
}

.sv-search-content-item:hover {
    background: #f9fafb;
}

.sv-search-content-item__title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.sv-search-content-item__excerpt {
    font-size: 12px;
    color: #6b7280;
}

/* ============================================
 * SUGGESTION (typo correction)
 * ============================================ */

.sv-search-suggestion {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: 10px;
    font-size: 13px;
    color: #92400e;
    margin-bottom: 16px;
}

.sv-search-suggestion__btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: #1d4ed8;
    padding: 0;
    font-family: inherit;
    text-decoration: underline;
}

.sv-search-suggestion__btn:hover {
    color: #1e40af;
}

/* ============================================
 * CTA BUTTONS
 * ============================================ */

.sv-search-cta {
    padding-top: 8px;
}

.sv-search-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #16a34a;
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
    margin-right: 8px;
    margin-bottom: 8px;
}

.sv-search-cta__btn:hover {
    background: #15803d;
    color: #fff;
}

.sv-search-cta__btn--secondary {
    background: #1d4ed8;
}

.sv-search-cta__btn--secondary:hover {
    background: #1e40af;
}

.sv-search-cta__btn--ghost {
    background: transparent;
    color: #374151;
    border: 1.5px solid #e5e7eb;
}

.sv-search-cta__btn--ghost:hover {
    background: #f3f4f6;
    color: #111827;
}

/* ============================================
 * EMPTY STATE
 * ============================================ */

.sv-search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 20px;
    gap: 12px;
    color: #9ca3af;
}

.sv-search-empty svg {
    opacity: 0.35;
}

.sv-search-empty p {
    font-size: 15px;
    color: #374151;
    margin: 0;
}

.sv-search-empty strong {
    color: #111827;
}

.sv-search-empty__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}

/* ============================================
 * LOADING SPINNER
 * ============================================ */

.sv-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    color: #6b7280;
    font-size: 14px;
}

.sv-search-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid #e5e7eb;
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: svSearchSpin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes svSearchSpin {
    to { transform: rotate(360deg); }
}

/* ============================================
 * BODY LOCK
 * ============================================ */

body.sv-search-open {
    overflow: hidden;
    overflow-y: scroll; /* keep scrollbar gutter — no layout shift */
}

/* ============================================
 * MOBILE
 * ============================================ */

@media (max-width: 767px) {
    .sv-search-overlay__panel {
        max-width: 100%;
        border-radius: 0 0 12px 12px;
    }

    .sv-search-overlay__input {
        font-size: 16px; /* Prevent iOS zoom */
    }

    .sv-search-product__img {
        width: 44px;
        height: 44px;
    }
}
