/**
 * WooCommerce Live Search Styles
 */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Instrument+Serif:wght@400&display=swap');

/* Modal Base Styles */
.wls-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    background: #fff;
    overflow: hidden;
}

.wls-modal-overlay {
    display: none;
}

.wls-modal-content {
    position: relative;
    background: #fff;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes wlsSlideIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Prevent body scroll when modal is open */
body.wls-modal-open {
    overflow: hidden;
}

/* Logo at top */
.wls-modal-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 20px 20px;
    background: #fff;
}

.wls-modal-logo img {
    max-width: 200px;
    height: auto;
}

/* Modal Header - Search Bar */
.wls-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px 20px;
    background: #fff;
    border-bottom: none;
}

.wls-search-input-wrapper {
    max-width: 800px;
    width: 100%;
    position: relative;
}

#wls-search-input {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-bottom: 2px solid #000;
    border-radius: 0px;
    font-family: 'Roboto', sans-serif;
    font-size: 20px;
    font-weight: 400;
    background: #fff;
    text-align: center;
    transition: none;
    box-shadow: none !important;
}

#wls-search-input::placeholder {
    color: #999;
}

#wls-search-input:focus {
    outline: none;
    border-bottom: 2px solid #000;
    box-shadow: none !important;
}

.wls-search-loading {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.wls-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    border-top-color: #007cba;
    animation: wlsSpin 1s ease-in-out infinite;
}

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

.wls-close-modal {
    position: fixed;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 32px;
    color: #000;
    cursor: pointer;
    padding: 10px;
    z-index: 10001;
    line-height: 1;
    transition: opacity 0.2s;
}

.wls-close-modal:hover {
    opacity: 0.6;
}

/* Brand Bar - Full Width */
.wls-brand-bar {
    padding: 0;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Hide scrollbar */
.wls-brand-bar::-webkit-scrollbar {
    display: none;
}

.wls-brand-bar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* White shadow overlay on right side */
.wls-brand-bar::after {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 100px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    pointer-events: none;
    z-index: 10;
}

.wls-brand-bar .wls-brand-icons {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    flex-wrap: nowrap;
    padding: 0 40px;
}

/* Modal Body Layout */
.wls-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.wls-sidebar {
    width: 20%;
    background: #000;
    color: #fff;
    overflow-y: auto;
    flex-shrink: 0;
    padding: 40px 20px;
}

.wls-content {
    width: 80%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #fff;
}

/* Sidebar Filters */
.wls-filter-section {
    padding: 0;
    border-bottom: none;
}

.wls-filter-section h4 {
    display: none;
}

/* Category Filters - Black Sidebar */
.wls-category-filters {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wls-category-filters .wls-filter-item {
    display: block;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: opacity 0.3s;
}

.wls-category-filters .wls-filter-item.hidden {
    display: none;
}

.wls-category-filters input[type="checkbox"] {
    display: none;
}

.wls-category-filters a,
.wls-category-filters span {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #fff !important;
    text-decoration: none;
    display: block;
    transition: opacity 0.2s;
    opacity: 1;
    background: transparent !important;
}

.wls-category-filters a:hover {
    opacity: 0.9;
    color: #fff !important;
    background: transparent !important;
}

/* Brand Filters */
.wls-brand-filters {
    display: none;
}

.wls-brand-item {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 100px;
    height: 60px;
    cursor: pointer;
    transition: all 0.3s;
    background: #fff;
    padding: 0;
    border: 1px solid transparent;
    text-decoration: none;
}

.wls-brand-item.hidden {
    display: none !important;
}

.wls-brand-item:hover {
    opacity: 0.7;
}

.wls-brand-item img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(0);
}

.wls-brand-text {
    font-size: 12px;
    color: #333;
    font-weight: 400;
    font-family: 'Roboto', sans-serif;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Clear Filters Button */
.wls-clear-filters {
    display: none;
}

/* Content Area */
.wls-results-header {
    padding: 30px 40px 20px;
    text-align: left;
}

.wls-results-title {
    font-family: 'Instrument Serif', serif;
    font-size: 28px;
    font-weight: 400;
    color: #000;
    margin: 0;
}

.wls-results-count {
    display: none;
}

/* Products Grid */
.wls-products-grid {
    flex: 1;
    padding: 40px;
}

/* WooCommerce product grid styling */
.wls-products-grid ul.products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wls-products-grid .product {
    /* Let Shoptimizer handle all product styling */
}

/* See More Button */
.wls-see-more {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px 20px;
}

.wls-see-more a {
    font-family: 'Instrument Serif', serif;
    font-size: 20px;
    font-weight: 400;
    color: #000;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    transition: opacity 0.3s;
    display: inline-block;
}

.wls-see-more a:hover {
    opacity: 0.7;
}

/* State Messages */
.wls-no-search,
.wls-no-results,
.wls-min-chars-message,
.wls-error-message {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.wls-search-icon,
.wls-empty-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.wls-no-search h3,
.wls-no-results h3 {
    margin: 10px 0;
    font-size: 20px;
    color: #333;
}

.wls-no-search p,
.wls-no-results p {
    margin: 0;
    font-size: 16px;
}

/* Loading State */
.wls-loading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.wls-skeleton-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.wls-skeleton-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: wlsShimmer 2s infinite;
}

.wls-skeleton-title,
.wls-skeleton-price {
    margin: 15px;
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: wlsShimmer 2s infinite;
    border-radius: 4px;
}

.wls-skeleton-price {
    width: 60%;
    height: 20px;
    margin-top: 8px;
}

@keyframes wlsShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Search Trigger Styles */
.wls-search-trigger-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 400px;
}

.wls-search-trigger {
    width: 100% !important;
    padding: 12px 40px 12px 20px !important;
    border: none !important;
    border-bottom: 1px solid #000 !important;
    border-radius: 0 !important;
    font-size: 16px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
}

.wls-search-trigger::placeholder {
    color: #000 !important;
    opacity: 0.8 !important;
}

.wls-search-trigger-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.wls-search-trigger:hover {
    border-bottom-color: rgba(0, 0, 0, 0.8) !important;
}

.wls-search-trigger:focus {
    outline: none !important;
    border-bottom-color: #000 !important;
    box-shadow: none !important;
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    /* Search trigger - icon only on mobile */
    .wls-search-trigger-wrapper {
        max-width: 25px;
        margin-bottom: 0;
    }

    .wls-search-trigger {
        width: 20px !important;
        height: 20px !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        text-indent: -9999px !important;
        overflow: hidden !important;
        font-size: 16px !important;
        margin-bottom: 0 !important;
    }

    .wls-search-trigger-icon {
        right: 50%;
        transform: translate(50%, -50%);
        width: 20px;
        height: 20px;
    }

    /* Hide logo on mobile */
    .wls-modal-logo {
        display: none;
    }

    /* Full height modal */
    .wls-modal {
        padding: 0;
        height: 100vh;
    }

    .wls-modal-content {
        margin-top: 0;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    /* Close button positioning */
    .wls-close-modal {
        top: -15px;
        right: 10px;
        font-size: 32px;
        margin: 0;
        padding: 0;
        width: 32px;
        height: 32px;
        line-height: 32px;
        text-align: center;
    }

    /* Search bar - sticky at top */
    .wls-modal-header {
        position: sticky;
        top: 0;
        z-index: 300;
        padding: 15px 10px 10px;
        background: #fff;
        border-bottom: 1px solid #e0e0e0;
    }

    #wls-search-input {
        padding: 10px 15px;
        font-size: 14px;
    }

    /* Brand bar - sticky below search */
    .wls-brand-bar {
        position: sticky;
        top: 60px;
        z-index: 200;
        padding: 10px 0;
        background: #fff;
        border-bottom: 1px solid #e0e0e0;
    }

    .wls-brand-bar::after {
        display: none;
    }



    .wls-brand-bar .wls-brand-icons {
        padding: 0 10px;
        gap: 15px;
    }

    .wls-brand-item {
        width: 80px;
        height: 50px;
    }

    /* Modal body - scrollable area */
    .wls-modal-body {
        flex-direction: column;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Categories - sticky below brands */
    .wls-sidebar {
        position: sticky;
        top: 0px;
        z-index: 100;
        width: 100%;
        background: #fff;
        padding: 0;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .wls-sidebar::-webkit-scrollbar {
        height: 8px;
    }

    .wls-sidebar::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .wls-sidebar::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }

    .wls-filter-section {
        padding: 15px 10px;
    }

    .wls-category-filters {
        flex-direction: row;
        gap: 10px;
        white-space: nowrap;
    }

    .wls-category-filters .wls-filter-item {
        display: inline-block;
    }

    .wls-category-filters a,
    .wls-category-filters span {
        color: #000 !important;
        padding: 8px 15px;
        background: #f0f0f0 !important;
        border-radius: 20px;
        font-size: 14px;
    }

    .wls-category-filters a:hover {
        background: #e0e0e0 !important;
        opacity: 1;
    }

    /* Content area - normal vertical scroll */
    .wls-content {
        width: 100%;
        overflow: visible;
        flex: 1;
    }

    /* Results header */
    .wls-results-header {
        padding: 20px 15px 15px;
    }

    .wls-results-title {
        font-size: 24px;
    }

    /* Products - vertical scroll grid (2 columns) */
    .wls-products-grid {
        padding: 0 15px 100px;
        overflow: visible;
        width: 100%;
    }

    .wls-products-grid ul.products {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        grid-auto-flow: row;
        gap: 15px;
    }

    .wls-products-grid .product {
        width: 100%;
    }

    /* Loading and no results states */
    .wls-loading-state {
        padding: 0 15px 100px;
    }

    .wls-loading-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        grid-auto-flow: row;
        gap: 15px;
    }

    .wls-skeleton-card {
        width: 100%;
    }

    .wls-skeleton-image {
        height: 150px;
    }

    /* No results */
    .wls-no-results {
        padding-bottom: 100px;
    }

    /* See more button - sticky at bottom */
    .wls-see-more {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        padding: 20px 15px;
        border-top: 1px solid #e0e0e0;
        text-align: center;
        z-index: 100;
        grid-column: 1 / -1;
    }

    .wls-see-more a {
        font-family: 'Instrument Serif', serif;
        font-size: 18px;
        font-weight: 400;
        color: #000;
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        text-decoration: underline;
        display: inline-block;
    }
}