/* =============================================================================
   WooCommerce Advanced Search — search.css  v1.0.4
   Inline expanding header search bar — slides left from the trigger icon.
   ============================================================================= */

/* ── Trigger button ────────────────────────────────────────────────────────── */
.wcas-trigger-search,
.elementor-widget:has(.wcas-trigger-search),
.elementor-widget:has(.wcas-trigger-search) .elementor-widget-container,
.elementor-widget:has(.wcas-trigger-search) .elementor-button-wrapper,
.elementor-widget:has(.wcas-trigger-search) .elementor-button {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    color: inherit !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    height: auto !important;
}

.wcas-trigger-search {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    line-height: 1 !important;
    position: relative;
    z-index: 100002;         /* sit above the expanding bar */
}

.wcas-trigger-search svg,
.wcas-trigger-search i,
.elementor-widget:has(.wcas-trigger-search) svg,
.elementor-widget:has(.wcas-trigger-search) i {
    display: block !important;
    vertical-align: middle !important;
    line-height: 1 !important;
}

.wcas-trigger-search:hover,
.wcas-trigger-search:focus,
.wcas-trigger-search:active,
.wcas-trigger-search:focus-visible,
.elementor-widget:has(.wcas-trigger-search) .elementor-button:hover,
.elementor-widget:has(.wcas-trigger-search) .elementor-button:focus,
.elementor-widget:has(.wcas-trigger-search) .elementor-button:active {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* ── Inline header search bar ──────────────────────────────────────────────── */
/* JS moves this element to sit beside .wcas-trigger-search in the header,     */
/* so it flows naturally in Elementor's flex row and expands leftward.          */
.wcas-header-search-bar {
    display: inline-flex;
    align-items: center;
    position: relative;      /* anchor for the suggestions dropdown */
    width: 0;
    max-width: 0;
    overflow: hidden;
    transition: width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
                max-width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
}

.wcas-header-search-bar.active {
    width: 360px;
    max-width: 360px;
    overflow: visible;       /* must be visible so dropdown escapes below */
}

/* Inner pill */
.wcas-header-search-bar .wcas-search-input-wrapper {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    width: 100%;
    opacity: 0;
    transform: scaleX(0.85);
    transform-origin: right center;
    transition:
        opacity 0.22s ease 0.08s,
        transform 0.26s cubic-bezier(0.4, 0, 0.2, 1) 0.08s,
        border-color 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.wcas-header-search-bar.active .wcas-search-input-wrapper {
    opacity: 1;
    transform: scaleX(1);
}

.wcas-header-search-bar .wcas-search-input-wrapper:focus-within {
    border-color: #e8730a;
    box-shadow: 0 4px 20px rgba(232, 115, 10, 0.15);
}

/* Suggestions dropdown — anchored below the bar */
.wcas-header-search-bar .wcas-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    max-height: 360px;
    overflow-y: auto;
    z-index: 100002;
    display: none;
    margin-top: 8px;
}

.wcas-header-search-bar .wcas-suggestions-dropdown.active {
    display: block;
}

/* ── Search input ──────────────────────────────────────────────────────────── */
.wcas-input-icon {
    flex-shrink: 0;
    margin-left: 14px;
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.2s ease;
}

.wcas-search-input-wrapper:focus-within .wcas-input-icon {
    color: #e8730a;
}

.wcas-search-input {
    flex: 1;
    padding: 12px 12px;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #111827;
    outline: none;
    min-width: 0;
}

.wcas-search-input::placeholder {
    color: #9ca3af;
}

/* ── Submit button inside the bar ──────────────────────────────────────────── */
.wcas-search-input-wrapper .wcas-search-submit {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 46px;
    background: #e8730a;
    color: #ffffff;
    border: none !important;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-shadow: none !important;
    outline: none !important;
    padding: 0;
}

.wcas-search-input-wrapper .wcas-search-submit:hover {
    background: #c9620a;
}

.wcas-search-input-wrapper .wcas-search-submit svg {
    display: block;
    flex-shrink: 0;
    stroke: #ffffff;
    width: 20px;
    height: 20px;
}

/* ── Suggestions items ─────────────────────────────────────────────────────── */
.wcas-suggestion-item {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
}

.wcas-suggestion-item:last-child {
    border-bottom: none;
}

.wcas-suggestion-item:hover {
    background: #f9fafb;
}

.wcas-suggestion-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    margin-right: 14px;
    flex-shrink: 0;
    background: #f3f4f6;
}

.wcas-suggestion-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wcas-suggestion-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: #f3f4f6;
}

.wcas-suggestion-info {
    flex: 1;
    min-width: 0;
}

.wcas-suggestion-title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 3px;
    /* Allow up to 2 lines then ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}

.wcas-suggestion-price {
    font-size: 13px;
    color: #e8730a;
    font-weight: 600;
}

/* =============================================================================
   SEARCH RESULTS PAGE
   ============================================================================= */

.wcas-search-results {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 20px 60px;
}

.wcas-results-header {
    text-align: center;
    margin-bottom: 44px;
}

.wcas-results-header h1 {
    font-size: 30px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.wcas-results-header .wcas-search-query {
    color: #e8730a;
}

.wcas-results-count {
    color: #6b7280;
    font-size: 15px;
    margin: 0 0 28px;
}

.wcas-results-search-bar {
    max-width: 580px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

.wcas-results-search-bar form {
    display: flex;
    align-items: center;
    width: 100%;
}

.wcas-results-search-bar .wcas-search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
}

/* ── Two-column layout ─────────────────────────────────────────────────────── */
.wcas-results-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    align-items: start;
}

/* ── Filters sidebar ───────────────────────────────────────────────────────── */
.wcas-filters-sidebar {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 24px;
    border-radius: 12px;
    position: sticky;
    top: 24px;
}

.wcas-filter-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.wcas-filter-section:last-of-type {
    margin-bottom: 20px;
    padding-bottom: 0;
    border-bottom: none;
}

.wcas-filter-title {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0 0 12px;
}

#wcas-filter-category,
#wcas-filter-brand {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

#wcas-filter-category:focus,
#wcas-filter-brand:focus {
    border-color: #e8730a;
    box-shadow: 0 0 0 3px rgba(232, 115, 10, 0.1);
}

.wcas-price-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wcas-price-range input {
    flex: 1;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 14px;
    color: #374151;
    outline: none;
    transition: border-color 0.2s ease;
}

.wcas-price-range input:focus {
    border-color: #e8730a;
    box-shadow: 0 0 0 3px rgba(232, 115, 10, 0.1);
}

.wcas-price-range span {
    color: #9ca3af;
    flex-shrink: 0;
}

.wcas-filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wcas-filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    color: #4b5563;
    cursor: pointer;
    user-select: none;
}

.wcas-filter-option input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: #e8730a;
}

.wcas-filter-apply {
    width: 100%;
    padding: 11px;
    background: #111827;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.wcas-filter-apply:hover {
    background: #e8730a;
}

/* ── Pagination ────────────────────────────────────────────────────────────── */
.wcas-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 44px;
    flex-wrap: wrap;
}

.wcas-pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    background: #f9fafb;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.wcas-pagination-button:hover:not(.active):not(:disabled) {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.wcas-pagination-button.active {
    background: #e8730a;
    color: #ffffff;
    border-color: #e8730a;
    cursor: default;
}

.wcas-pagination-button:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

.wcas-pag-ellipsis {
    padding: 0 4px;
    color: #9ca3af;
    font-size: 14px;
    line-height: 40px;
}

/* ── Loading spinner ───────────────────────────────────────────────────────── */
.wcas-loading {
    text-align: center;
    padding: 40px;
}

.wcas-spinner {
    display: inline-block;
    width: 38px;
    height: 38px;
    border: 3px solid #e5e7eb;
    border-top-color: #e8730a;
    border-radius: 50%;
    animation: wcasSpin 0.75s linear infinite;
}

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

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

/* On mobile: bar drops below the header row instead of expanding sideways.
   We switch to absolute positioning anchored to the trigger's parent row.    */
@media (max-width: 600px) {
    .wcas-header-search-bar {
        /* Reset inline-flex constraints */
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        width: 100% !important;
        max-width: 100% !important;
        height: auto;
        overflow: hidden;
        padding: 0;
        z-index: 100001;
    }

    .wcas-header-search-bar.active {
        overflow: visible;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* On mobile the pill gets a small margin so it doesn't touch screen edges */
    .wcas-header-search-bar .wcas-search-input-wrapper {
        margin: 6px 10px;
        width: calc(100% - 20px);
        transform-origin: top center;
    }

    /* Dropdown full width on mobile */
    .wcas-header-search-bar .wcas-suggestions-dropdown {
        left: 10px;
        right: 10px;
    }

    .wcas-results-grid {
        grid-template-columns: 1fr;
    }

    .wcas-filters-sidebar {
        position: static;
    }

    .wcas-results-header h1 {
        font-size: 22px;
    }
}

@media (max-width: 900px) and (min-width: 601px) {
    .wcas-header-search-bar.active {
        width: 360px;
    }

    .wcas-results-grid {
        grid-template-columns: 1fr;
    }

    .wcas-filters-sidebar {
        position: static;
    }
}
