/* Woaly Search — Trigger + Fullscreen Overlay */

/* ── Trigger (Desktop Header) ── */
.woaly-search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    height: 33px;
    padding: 0 14px;
    border: 1px solid #EEEDEC;
    border-radius: 20px;
    background: #FAF9F8;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: #999;
    transition: border-color 0.2s;
}

.woaly-search-trigger:hover {
    border-color: #ccc;
}

.woaly-search-trigger svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.woaly-search-trigger__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Overlay ── */
.woaly-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 100020;
    background: #fff;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.woaly-search-overlay.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Inner Container ── */
.woaly-search-inner {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
}

/* ── Header (Input + Cancel) ── */
.woaly-search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.woaly-search-input-wrap {
    flex: 1;
    position: relative;
}

.woaly-search-input-wrap svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #999;
    pointer-events: none;
}

.woaly-search-input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 40px;
    border: 1.5px solid #EEEDEC;
    border-radius: 12px;
    background: #FAF9F8;
    font-family: inherit;
    font-size: 16px; /* prevents iOS zoom */
    color: #242638;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.woaly-search-input::placeholder {
    color: #999;
}

.woaly-search-input:focus {
    border-color: var(--primary-color, #242638);
    background: #fff;
}

.woaly-search-cancel {
    flex-shrink: 0;
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--primary-color, #242638);
    cursor: pointer;
    white-space: nowrap;
}

/* ── Section Titles ── */
.woaly-search-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #242638;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px;
}

.woaly-search-section + .woaly-search-section {
    margin-top: 24px;
}

/* ── Chips (Recent + Trending) ── */
.woaly-search-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.woaly-search-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 160px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #EEEDEC;
    border-radius: 20px;
    background: #FAF9F8;
    font-family: inherit;
    font-size: 13px;
    color: #242638;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s;
}

.woaly-search-chip:hover {
    background: #F0EFEE;
}

.woaly-search-chip--trending {
    background: transparent;
    border-color: #EEEDEC;
}

.woaly-search-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    background: none;
    font-size: 14px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    flex-shrink: 0;
}

.woaly-search-chip__remove:hover {
    color: #242638;
}

/* ── Category Results ── */
.woaly-search-categories {
    list-style: none;
    margin: 0;
    padding: 0;
}

.woaly-search-category-item {
    margin: 0;
    padding: 0;
}

.woaly-search-category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #242638;
    font-size: 14px;
    transition: background 0.15s;
}

.woaly-search-category-link:hover {
    background: #F6F7FB;
}

.woaly-search-category-count {
    font-size: 12px;
    color: #999;
}

/* ── Product Results ── */
.woaly-search-products {
    list-style: none;
    margin: 0;
    padding: 0;
}

.woaly-search-product-item {
    margin: 0;
    padding: 0;
}

.woaly-search-product-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #242638;
    transition: background 0.15s;
}

.woaly-search-product-link:hover,
.woaly-search-product-link.is-active {
    background: #F6F7FB;
}

.woaly-search-product-img {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: #F6F7FB;
}

.woaly-search-product-info {
    flex: 1;
    min-width: 0;
}

.woaly-search-product-title {
    font-size: 14px;
    font-weight: 500;
    color: #242638;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.woaly-search-product-title mark {
    background: none;
    color: var(--primary-color, #242638);
    font-weight: 700;
}

.woaly-search-product-meta {
    font-size: 12px;
    color: #999;
    margin: 2px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.woaly-search-product-price {
    font-size: 13px;
    font-weight: 600;
    color: #242638;
    white-space: nowrap;
    flex-shrink: 0;
}

.woaly-search-product-price del {
    color: #999;
    font-weight: 400;
    font-size: 11px;
}

.woaly-search-product-price ins {
    text-decoration: none;
}

/* ── View All Button ── */
.woaly-search-view-all {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    border: none;
    border-radius: 20px;
    background: var(--primary-color, #242638);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.15s;
    text-decoration: none;
}

.woaly-search-view-all:hover {
    opacity: 0.85;
    color: #fff;
}

/* ── No Results ── */
.woaly-search-no-results {
    text-align: center;
    padding: 40px 20px;
}

.woaly-search-no-results__title {
    font-size: 15px;
    font-weight: 600;
    color: #242638;
    margin: 0 0 6px;
}

.woaly-search-no-results__hint {
    font-size: 13px;
    color: #999;
    margin: 0;
}

/* ── Spinner ── */
.woaly-search-spinner {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.woaly-search-spinner::after {
    content: '';
    width: 28px;
    height: 28px;
    border: 3px solid #EEEDEC;
    border-top-color: var(--primary-color, #242638);
    border-radius: 50%;
    animation: woaly-spin 0.6s linear infinite;
}

@keyframes woaly-spin {
    to { transform: rotate(360deg); }
}

/* ── Desktop ── */
@media (min-width: 769px) {
    .woaly-search-inner {
        padding: 40px;
    }

    .woaly-search-input {
        height: 52px;
    }
}

/* ── Mobile Adjustments ── */
@media (max-width: 768px) {
    .woaly-search-trigger {
        display: none;
    }
}
