/* ─── FL WooCommerce Search — Frontend Overlay ─────────────────────────────── */

:root {
    --fls-accent:     #ff477e;
    --fls-overlay-bg: #ffffff;
    --fls-text:       #333333;
}


/* Force hidden attribute to work even if theme overrides it */
#fl-search-overlay [hidden] {
    display: none !important;
}
/* ── Overlay container ────────────────────────────────────────────────────── */

.fl-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--fls-overlay-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Enter animation */
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

.fl-search-overlay[hidden] {
    display: flex !important; /* keep in DOM for animation; hidden controls visibility */
    visibility: hidden;
}

.fl-search-overlay.fl-search-overlay--open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
    visibility: visible;
}

/* ── Inner layout ─────────────────────────────────────────────────────────── */

.fl-search-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */

.fl-search-header {
    flex-shrink: 0;
    border-bottom: 1px solid #eee;
    padding: 12px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.fl-search-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.fl-search-close:hover {
    background: #eee;
    color: #222;
}

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

.fl-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.fl-search-input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    background: #f5f5f5;
    border: none;
    border-radius: 100px;
    font-size: 15px;
    color: var(--fls-text);
    outline: none;
    transition: background 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.fl-search-input:focus {
    background: #efefef;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fls-accent) 20%, transparent);
}

.fl-search-input::placeholder {
    color: #aaa;
}

.fl-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ccc;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    padding: 0;
    transition: background 0.15s;
}

.fl-search-clear:hover {
    background: #999;
}

/* ── Body ─────────────────────────────────────────────────────────────────── */

.fl-search-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0 40px;
    -webkit-overflow-scrolling: touch;
}

/* ── Section labels ───────────────────────────────────────────────────────── */

.fl-search-section {
    margin-bottom: 28px;
}

.fl-search-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    margin: 0 0 10px;
}

/* ── Popular tags ─────────────────────────────────────────────────────────── */

.fl-search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fl-search-tag {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 100px;
    background: #f5f5f5;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}

.fl-search-tag:hover {
    background: #eee;
    color: var(--fls-accent);
}

/* ── Browse categories ────────────────────────────────────────────────────── */

.fl-search-browse {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media (min-width: 600px) {
    .fl-search-browse {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.fl-search-browse-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 12px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--fls-text);
    transition: background 0.15s, color 0.15s;
}

.fl-search-browse-link:hover {
    background: #eee;
    color: var(--fls-accent);
    text-decoration: none;
}

.fl-search-browse-link svg {
    color: #ccc;
    flex-shrink: 0;
    transition: color 0.15s;
}

.fl-search-browse-link:hover svg {
    color: var(--fls-accent);
}

/* ── Loading spinner ──────────────────────────────────────────────────────── */

.fl-search-loading {
    display: flex;
    justify-content: center;
    padding: 60px 0;
}

.fl-search-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #eee;
    border-top-color: var(--fls-accent);
    border-radius: 50%;
    animation: fl-spin 0.65s linear infinite;
    display: block;
}

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

/* ── Results ──────────────────────────────────────────────────────────────── */

.fl-search-results {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.fl-results-group {}

.fl-results-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.fl-results-group-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    margin: 0;
}

.fl-results-group-label span {
    color: #ccc;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
}

.fl-results-view-all {
    font-size: 12px;
    font-weight: 500;
    color: var(--fls-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: opacity 0.15s;
}

.fl-results-view-all:hover {
    opacity: 0.75;
    text-decoration: none;
}

.fl-results-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
}

@media (min-width: 600px) {
    .fl-results-list {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Individual result row ────────────────────────────────────────────────── */

.fl-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--fls-text);
    transition: background 0.12s;
}

.fl-result-item:hover {
    background: #f5f5f5;
    text-decoration: none;
    color: var(--fls-text);
}

.fl-result-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: #f0f0f0;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fl-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fl-result-thumb-placeholder {
    color: #ccc;
}

.fl-result-info {
    flex: 1;
    min-width: 0;
}

.fl-result-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--fls-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.12s;
}

.fl-result-item:hover .fl-result-title {
    color: var(--fls-accent);
}

.fl-result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.fl-result-price {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.fl-result-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
    background: #22c55e;
    color: #fff;
    line-height: 1.6;
}

.fl-result-chevron {
    color: #ddd;
    flex-shrink: 0;
    transition: color 0.12s;
}

.fl-result-item:hover .fl-result-chevron {
    color: var(--fls-accent);
}

/* ── No results ───────────────────────────────────────────────────────────── */

.fl-search-empty {
    text-align: center;
    padding: 40px 20px 20px;
}

.fl-search-empty p {
    font-size: 15px;
    color: var(--fls-text);
    margin: 0 0 6px;
}

.fl-search-empty-sub {
    font-size: 13px;
    color: #999;
    margin-bottom: 24px !important;
}

.fl-search-browse--inline {
    max-width: 480px;
    margin: 0 auto;
}

/* ── Shortcode (optional inline trigger) ──────────────────────────────────── */

.fl-search-shortcode-wrap {
    display: block;
}

.fl-search-shortcode-input-wrap {
    position: relative;
}

.fl-sc-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.fl-sc-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid #ddd;
    border-radius: 100px;
    font-size: 15px;
    color: var(--fls-text);
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.fl-sc-input:focus {
    border-color: var(--fls-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fls-accent) 15%, transparent);
}
