/* =========================================
   SEARCH MODAL STYLES
   ========================================= */

.pr-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none; /* Controlled by JS */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pr-search-modal.is-active {
    display: block;
    opacity: 1;
}

.pr-search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.pr-search-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    width: calc(100dvw - 200px);
    max-width: 1600px;
    max-height: 90dvh;
    background: #fff;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.pr-search-modal.is-active .pr-search-container {
    transform: translate(-50%, -50%);
}

@media (max-width: 1200px) {
    .pr-search-container {
        width: calc(100dvw - 40px);
    }
}

.pr-search-inner {
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
    padding: 40px 20px;
}

/* Close Button */
.pr-search-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: #333;
    z-index: 10;
}

/* Top Section: Search Bar & Tags */
.pr-search-top {
    border-bottom: 1px solid #efefef;
    padding-bottom: 30px;
    margin-bottom: 30px;
}

.pr-search-input-field {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 24px;
    margin-bottom: 20px;
}

.pr-search-input-field .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: #999;
}

#pr-search-input {
    border: none;
    flex: 1;
    font-size: 24px;
    font-weight: 500;
    outline: none;
    padding: 10px 0;
}

.pr-search-trends {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.trends-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.trends-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pr-trend-item {
    background: #f4f6f8;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.pr-trend-item:hover {
    background: #e1e3e5;
}

/* Main Section: Sidebar + Results */
.pr-search-main {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 40px;
}

/* Sidebar Filters */
.pr-search-sidebar {
    border-right: 1px solid #efefef;
    padding-right: 20px;
}

.filter-section {
    margin-bottom: 30px;
}

.filter-title {
    font-size: 15px;
    margin-bottom: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Price Range Slider */
.price-range-container {
    padding: 0 10px;
}

.range-slider {
    position: relative;
    height: 6px;
    background: #efefef;
    border-radius: 3px;
    margin-bottom: 15px;
}

.range-slider input {
    position: absolute;
    width: 100%;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    top: -5px;
}

.range-slider input::-webkit-slider-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--pr-color-primary, #000);
    pointer-events: auto;
    -webkit-appearance: none;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.price-inputs {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
}

/* Checkbox Filters */
.category-filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-filter-list li {
    margin-bottom: 10px;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.custom-checkbox input {
    display: none;
}

.checkbox-box {
    width: 18px;
    height: 18px;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
    transition: 0.2s;
}

.custom-checkbox input:checked + .checkbox-box {
    background: var(--pr-color-primary, #000);
    border-color: var(--pr-color-primary, #000);
}

.custom-checkbox input:checked + .checkbox-box:after {
    content: '\2713';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
}

.cat-count {
    margin-left: auto;
    color: #999;
    font-size: 12px;
}

/* Results Grid */
.pr-search-results-wrap {
    min-height: 400px;
    position: relative;
}

.results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.results-sorting select {
    border: none;
    font-weight: 600;
    color: #000;
    background: none;
    cursor: pointer;
    outline: none;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
}

.search-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 100px 0;
    color: #999;
}

/* Product Card */
.search-result-card {
    transition: transform 0.3s;
}

.search-result-card:hover {
    transform: translateY(-5px);
}

.search-result-card .card-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: #f4f6f8;
}

.search-result-card .card-content {
    margin-top: 12px;
}

.search-result-card .card-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 5px;
}

.search-result-card .card-price {
    font-size: 14px;
    color: var(--pr-color-secondary, #008060);
    font-weight: 700;
}

/* Loader */
.search-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pr-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--pr-color-primary, #000);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsiveness */
@media (max-width: 900px) {
    .pr-search-main {
        grid-template-columns: 1fr;
    }
    
    .pr-search-sidebar {
        display: none; /* We can add a "Filters" toggle button later if needed */
        border: none;
        padding: 0;
    }
    
    .pr-search-top {
        padding-bottom: 20px;
    }
    
    #pr-search-input {
        font-size: 18px;
    }
    
    .pr-search-inner {
        padding: 30px 15px;
    }
}
