/* FalcoSearch - Live Search & Product Filter for WooCommerce (text domain: wpxero-search-filter) */
#wpxero-search-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    font-family: system-ui, sans-serif;
    color: var(--wpxero-color, #111);
}
#wpxero-search-modal *,
#wpxero-search-modal *::before,
#wpxero-search-modal *::after {
    box-sizing: border-box;
}
#wpxero-search-modal.open {
    display: block;
}
#wpxero-search-modal .wpxero-search-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}
#wpxero-search-modal .wpxero-search-content {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 720px;
    background: var(--wpxero-bg, #fff);
    color: var(--wpxero-color, #111);
    border-radius: 5px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}
#wpxero-search-modal.dark {
    --wpxero-bg: #1e1e1e;
    --wpxero-color: #eee;
}

/* Buttons */
#wpxero-search-modal .wpxero-search-icon,
#wpxero-search-modal .wpxero-voice-btn,
#wpxero-search-modal .wpxero-close-btn {
    position: absolute;
    top: 10px;
    width: 35px;
    height: 35px;
    line-height: 35px;
    padding: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    color: var(--wpxero-color, #111);
    fill: currentColor;
    font: inherit;
    cursor: pointer;
    transition: color 0.2s;
}
#wpxero-search-modal.dark .wpxero-search-icon,
#wpxero-search-modal.dark .wpxero-voice-btn,
#wpxero-search-modal.dark .wpxero-close-btn {
    color: var(--wpxero-color, #eee);
}
#wpxero-search-modal .wpxero-search-icon {
    left: 10px;
}
#wpxero-search-modal .wpxero-voice-btn {
    right: 40px;
}
#wpxero-search-modal .wpxero-close-btn {
    right: 10px;
}
#wpxero-search-modal .wpxero-clear-active:hover,
#wpxero-search-modal .wpxero-voice-btn:hover,
#wpxero-search-modal .wpxero-close-btn:hover {
    color: #999;
}
#wpxero-search-modal .wpxero-voice-btn.active {
    animation: pulse 1s infinite;
}

/* Input */
#wpxero-search-modal .wpxero-search-input {
    width: 100%;
    padding: 18px 75px 18px 50px;
    font-size: 16px;
    height: 58px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--wpxero-color, #111);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-family: inherit;
}
#wpxero-search-modal.dark .wpxero-search-input {
    color: var(--wpxero-color, #eee);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

/* Suggest Keywords */
.wpxero-suggestions {
    display: block;
    margin: 10px 0;
    padding: 5px 15px;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.wpxero-suggestions[hidden] {
    display: none;
}
.wpxero-suggestions::-webkit-scrollbar {
    display: none;
}

/* Slash Command List */
.wpxero-suggestions.wpxero-command-list {
    display: block;
    padding: 0;
    margin: 0;
    max-height: 61vh;
    overflow-y: auto;
    scroll-behavior: smooth;
    white-space: normal;
}
.wpxero-command-item {
    display: flex;
    gap: 0.75em;
    align-items: center;
    padding: 0.6em 1em;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
    transition: background 0.2s ease;
}
#wpxero-search-modal.dark .wpxero-command-item {
    background: #1e1e1e;
    border-color: rgba(255, 255, 255, 0.1);
}
.wpxero-command-item:hover,
.wpxero-command-item:focus,
.wpxero-command-item.active {
    background: #f0f0f0;
    outline: none;
}
#wpxero-search-modal.dark .wpxero-command-item:hover,
#wpxero-search-modal.dark .wpxero-command-item:focus,
#wpxero-search-modal.dark .wpxero-command-item.active {
    background: #2a2a2a;
}
.wpxero-command-code {
    font-family: Consolas, monaco, monospace;
    color: #f0506e;
    background: transparent;
    min-width: 115px;
    font-size: 16px;
}
#wpxero-search-modal.dark .wpxero-command-code {
    color: #f0506e;
}
.wpxero-command-desc {
    flex: 1;
    color: #666;
    font-size: 16px;
}
#wpxero-search-modal.dark .wpxero-command-desc {
    color: #bbb;
}
.wpxero-suggestions .wpxero-suggest-pill {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    background: #f1f1f1;
    border-radius: 20px;
    padding: 5px 12px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #111;
    text-decoration: none;
    transition: all 0.2s ease;
}
.wpxero-suggestions .wpxero-suggest-pill:hover {
    background: #e2e2e2;
}
#wpxero-search-modal.dark .wpxero-suggestions .wpxero-suggest-pill {
    color: #fff;
    background: #333;
}
#wpxero-search-modal.dark .wpxero-suggestions .wpxero-suggest-pill:hover {
    background: #666;
}
.wpxero-suggestions .wpxero-suggest-pill.active {
    background: #333;
    color: #fff;
}
#wpxero-search-modal.dark .wpxero-suggestions .wpxero-suggest-pill.active {
    background: #fff;
    color: #111;
}

/* Results */
.wpxero-results {
    max-height: 60vh;
    overflow-y: auto;
    scroll-behavior: smooth;
    background: var(--wpxero-bg, #fff);
    color: var(--wpxero-color, #111);
}
#wpxero-search-modal.dark .wpxero-results {
    background: var(--wpxero-bg, #1e1e1e);
    color: var(--wpxero-color, #eee);
}
.wpxero-results .wpxero-message {
    padding: 20px;
    font-size: 16px;
}

/* Each result item */
.wpxero-item {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--wpxero-color, #111);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: transparent;
    transition: all 0.2s ease;
}
.wpxero-item.active,
.wpxero-item:hover {
    background: rgba(0, 0, 0, 0.03);
    text-decoration: none;
}
#wpxero-search-modal.dark .wpxero-item {
    color: var(--wpxero-color, #eee);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}
#wpxero-search-modal.dark .wpxero-item.active,
#wpxero-search-modal.dark .wpxero-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
#wpxero-search-modal mark {
    background-color: #fff3a0;
    color: #000;
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}
#wpxero-search-modal.dark mark {
    background-color: #665c00;
    color: #fffbe0;
}

/* Thumbnail */
.wpxero-thumb {
    flex: 0 0 64px;
    height: 64px;
    overflow: hidden;
    border-radius: 5px;
    background: #ccc;
}
.wpxero-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Meta info */
.wpxero-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding-right: 30px;
}
.wpxero-title {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.3;
    color: inherit;
    margin: 0;
}
.wpxero-info {
    font-size: 14px;
    color: #666;
    margin: 0;
}
.wpxero-excerpt {
    margin-top: 3px;
    margin-bottom: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    color: #666;
}
#wpxero-search-modal.dark .wpxero-info,
#wpxero-search-modal.dark .wpxero-excerpt {
    color: #aaa;
}

/* Messages */
.wpxero-loading,
.wpxero-error,
.wpxero-empty {
    padding: 20px;
    margin-bottom: 0;
    text-align: center;
    color: #888;
    background: transparent;
}
#wpxero-search-modal.dark .wpxero-loading,
#wpxero-search-modal.dark .wpxero-error,
#wpxero-search-modal.dark .wpxero-empty {
    color: #aaa;
}
.wpxero-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}
.wpxero-loading-spinner svg {
    animation: wpxero-spin 0.7s linear infinite;
    display: block;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
@keyframes slideDown {
    from {
        transform: translate(-50%, -20%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}
@keyframes favFlash {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}
@keyframes wpxero-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Scrollbar (Webkit only) */
.wpxero-results::-webkit-scrollbar {
    width: 6px;
}
.wpxero-results::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}
#wpxero-search-modal.dark .wpxero-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

/* Favourite */
.wpxero-meta .wpxero-fav-btn {
    position: absolute;
    right: 0;
    top: calc(50% - 13px);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: inherit;
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
}
.wpxero-meta .wpxero-fav-btn:hover {
    opacity: 1;
}
.wpxero-meta .wpxero-fav-btn.active {
    color: #f1c40f;
    opacity: 1;
}
.wpxero-meta .wpxero-fav-btn.flash {
    animation: favFlash 0.4s ease-out;
}

/* CSS Style Variations */

/* Full Screen Mode */
#wpxero-search-modal.style-full .wpxero-search-content {
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    height: 100%;
    border-radius: 0;
    animation: fadeIn 0.3s ease-out;
}

#wpxero-search-modal.style-full .wpxero-results {
    max-height: calc(100vh - 58px);
}

/* Top Bar Mode */
#wpxero-search-modal.style-topbar .wpxero-search-content {
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: slideDownTopBar 0.3s ease-out;
}

#wpxero-search-modal.style-topbar .wpxero-results {
    max-height: 70vh;
}

@keyframes slideDownTopBar {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* None Mode - Minimal/No Background */
#wpxero-search-modal.style-none .wpxero-search-overlay {
    background: transparent;
    backdrop-filter: none;
}

/* Responsive */
@media (max-width: 600px) {
    #wpxero-search-modal .wpxero-search-content {
        top: 5%;
        width: 95%;
        border-radius: 8px;
    }
    .wpxero-item {
        padding: 10px 14px;
    }
    .wpxero-thumb {
        flex: 0 0 52px;
        height: 52px;
    }

    /* Full screen on mobile always */
    #wpxero-search-modal.style-full .wpxero-search-content,
    #wpxero-search-modal.style-topbar .wpxero-search-content {
        width: 100%;
        max-width: 100%;
    }
}
