/**
 * SmartSearch Results Page Styles
 * Modern dropdown filters layout (cigar shop style)
 */

/* CSS Variables for theming */
:root {
    --ss-primary: #7c3aed;
    --ss-primary-hover: #6d28d9;
    --ss-secondary: #f59e0b;
    --ss-danger: #ef4444;
    --ss-success: #10b981;
    --ss-text: #1a1a1a;
    --ss-text-light: #6b7280;
    --ss-text-muted: #9ca3af;
    --ss-border: #e5e7eb;
    --ss-bg: #f9fafb;
    --ss-white: #ffffff;
    --ss-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --ss-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --ss-radius: 8px;
    --ss-radius-lg: 12px;
}

/* Page Container */
.smartsearch-page-wrapper {
    padding: 20px 0 40px;
    background: var(--ss-bg);
    min-height: 100vh;
}

.smartsearch-page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.smartsearch-page-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 24px;
    color: var(--ss-text);
}

/* Results Page */
.smartsearch-results-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ====== FILTERS BAR (Horizontal Dropdowns) ====== */
.smartsearch-filters-bar {
    background: var(--ss-white);
    border-radius: var(--ss-radius-lg);
    box-shadow: var(--ss-shadow);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.smartsearch-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.smartsearch-filters-left {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
}

.smartsearch-filters-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Dropdown Filter */
.smartsearch-dropdown {
    position: relative;
}

.smartsearch-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--ss-white);
    border: 1px solid var(--ss-border);
    border-radius: var(--ss-radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--ss-text);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 120px;
    justify-content: space-between;
}

.smartsearch-dropdown-toggle:hover {
    border-color: var(--ss-primary);
    background: #f8f5ff;
}

.smartsearch-dropdown-toggle.active {
    border-color: var(--ss-primary);
    background: var(--ss-primary);
    color: var(--ss-white);
}

.smartsearch-dropdown-toggle .arrow {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.2s;
}

.smartsearch-dropdown.open .smartsearch-dropdown-toggle .arrow {
    transform: rotate(180deg);
}

.smartsearch-dropdown-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--ss-primary);
    color: var(--ss-white);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}

.smartsearch-dropdown-toggle.active .smartsearch-dropdown-badge {
    background: var(--ss-white);
    color: var(--ss-primary);
}

/* Dropdown Menu */
.smartsearch-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--ss-white);
    border: 1px solid var(--ss-border);
    border-radius: var(--ss-radius);
    box-shadow: var(--ss-shadow-lg);
    z-index: 100;
    display: none;
    padding: 8px 0;
}

.smartsearch-dropdown.open .smartsearch-dropdown-menu {
    display: block;
}

.smartsearch-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
    color: var(--ss-text);
}

.smartsearch-dropdown-item:hover {
    background: var(--ss-bg);
}

.smartsearch-dropdown-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--ss-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.smartsearch-dropdown-item-label {
    flex: 1;
}

.smartsearch-dropdown-item-count {
    font-size: 12px;
    color: var(--ss-text-muted);
    background: var(--ss-bg);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Price Range Dropdown */
.smartsearch-price-dropdown {
    padding: 16px;
}

.smartsearch-price-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.smartsearch-price-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--ss-border);
    border-radius: var(--ss-radius);
    font-size: 14px;
    text-align: center;
}

.smartsearch-price-input:focus {
    outline: none;
    border-color: var(--ss-primary);
}

.smartsearch-price-separator {
    color: var(--ss-text-muted);
    font-weight: 500;
}

.smartsearch-price-apply {
    width: 100%;
    padding: 10px;
    background: var(--ss-primary);
    color: var(--ss-white);
    border: none;
    border-radius: var(--ss-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.smartsearch-price-apply:hover {
    background: var(--ss-primary-hover);
}

/* Sort Dropdown */
.smartsearch-sort-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
}

.smartsearch-sort-label {
    font-size: 14px;
    color: var(--ss-text-light);
    white-space: nowrap;
}

.smartsearch-sort-select {
    padding: 10px 36px 10px 14px;
    border: 1px solid var(--ss-border);
    border-radius: var(--ss-radius);
    font-size: 14px;
    background: var(--ss-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
    min-width: 160px;
}

.smartsearch-sort-select:focus {
    outline: none;
    border-color: var(--ss-primary);
}

/* Clear Filters */
.smartsearch-clear-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--ss-border);
    border-radius: var(--ss-radius);
    font-size: 13px;
    color: var(--ss-text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.smartsearch-clear-all:hover {
    border-color: var(--ss-danger);
    color: var(--ss-danger);
    background: #fef2f2;
}

.smartsearch-clear-all svg {
    width: 14px;
    height: 14px;
}

/* ====== SEARCH BAR ====== */
.smartsearch-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

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

.smartsearch-search-input {
    width: 100%;
    padding: 14px 50px 14px 18px;
    border: 2px solid var(--ss-border);
    border-radius: var(--ss-radius-lg);
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--ss-white);
}

.smartsearch-search-input:focus {
    outline: none;
    border-color: var(--ss-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.smartsearch-search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: var(--ss-primary);
    color: var(--ss-white);
    border: none;
    border-radius: var(--ss-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.smartsearch-search-btn:hover {
    background: var(--ss-primary-hover);
}

/* ====== RESULTS INFO BAR ====== */
.smartsearch-results-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--ss-white);
    border-radius: var(--ss-radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.smartsearch-results-count {
    font-size: 14px;
    color: var(--ss-text-light);
}

.smartsearch-results-count strong {
    color: var(--ss-text);
    font-weight: 600;
}

/* Active Filters Tags */
.smartsearch-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.smartsearch-active-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 12px;
    background: linear-gradient(135deg, var(--ss-primary), #9333ea);
    color: var(--ss-white);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.smartsearch-active-tag button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: var(--ss-white);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: background 0.2s;
}

.smartsearch-active-tag button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ====== PRODUCTS GRID ====== */
.smartsearch-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    transition: opacity 0.2s;
}

/* ====== PRODUCT CARD ====== */
.smartsearch-product-card {
    background: var(--ss-white);
    border-radius: var(--ss-radius-lg);
    overflow: hidden;
    box-shadow: var(--ss-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.smartsearch-product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--ss-shadow-lg);
}

.smartsearch-product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Product Image */
.smartsearch-product-image {
    position: relative;
    aspect-ratio: 1;
    background: #f3f4f6;
    overflow: hidden;
}

.smartsearch-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.smartsearch-product-card:hover .smartsearch-product-image img {
    transform: scale(1.08);
}

.smartsearch-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
}

/* Product Badges */
.smartsearch-product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.smartsearch-badge {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.smartsearch-badge.sale {
    background: var(--ss-danger);
    color: var(--ss-white);
}

.smartsearch-badge.new {
    background: var(--ss-success);
    color: var(--ss-white);
}

.smartsearch-badge.featured {
    background: var(--ss-secondary);
    color: var(--ss-white);
}

/* Wishlist Button */
.smartsearch-wishlist-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: var(--ss-white);
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
}

.smartsearch-wishlist-btn:hover {
    background: var(--ss-danger);
    color: var(--ss-white);
    transform: scale(1.1);
}

.smartsearch-wishlist-btn.active {
    background: var(--ss-danger);
    color: var(--ss-white);
}

.smartsearch-wishlist-btn svg {
    width: 18px;
    height: 18px;
}

/* Quick View Button */
.smartsearch-product-actions {
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    transition: bottom 0.3s;
}

.smartsearch-product-card:hover .smartsearch-product-actions {
    bottom: 0;
}

.smartsearch-quick-view,
.smartsearch-add-to-cart {
    padding: 10px 16px;
    border: none;
    border-radius: var(--ss-radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.smartsearch-quick-view {
    background: var(--ss-white);
    color: var(--ss-text);
}

.smartsearch-quick-view:hover {
    background: var(--ss-text);
    color: var(--ss-white);
}

.smartsearch-add-to-cart {
    background: var(--ss-primary);
    color: var(--ss-white);
}

.smartsearch-add-to-cart:hover {
    background: var(--ss-primary-hover);
}

/* Product Info */
.smartsearch-product-info {
    padding: 16px;
}

.smartsearch-product-category {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--ss-primary);
    margin-bottom: 6px;
    font-weight: 600;
}

.smartsearch-product-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--ss-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 42px;
}

.smartsearch-product-description {
    font-size: 13px;
    color: var(--ss-text-light);
    margin-bottom: 10px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Product Price */
.smartsearch-product-price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.smartsearch-price-regular {
    font-size: 14px;
    color: var(--ss-text-muted);
    text-decoration: line-through;
}

.smartsearch-price-current {
    font-size: 18px;
    font-weight: 700;
    color: var(--ss-text);
}

.smartsearch-price-current.sale {
    color: var(--ss-danger);
}

.smartsearch-price-unit {
    font-size: 12px;
    color: var(--ss-text-muted);
    font-weight: 400;
}

/* Stock Status */
.smartsearch-stock {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
}

.smartsearch-stock::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.smartsearch-stock.in-stock {
    color: var(--ss-success);
}

.smartsearch-stock.in-stock::before {
    background: var(--ss-success);
}

.smartsearch-stock.out-of-stock {
    color: var(--ss-danger);
}

.smartsearch-stock.out-of-stock::before {
    background: var(--ss-danger);
}

/* Rating */
.smartsearch-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.smartsearch-rating-stars {
    color: var(--ss-secondary);
    font-size: 14px;
    letter-spacing: -1px;
}

.smartsearch-rating-count {
    font-size: 12px;
    color: var(--ss-text-muted);
}

/* ====== LOADING ====== */
.smartsearch-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--ss-text-light);
}

.smartsearch-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--ss-border);
    border-top-color: var(--ss-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

/* ====== NO RESULTS ====== */
.smartsearch-no-results {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    color: var(--ss-text-light);
    text-align: center;
    background: var(--ss-white);
    border-radius: var(--ss-radius-lg);
    box-shadow: var(--ss-shadow);
}

.smartsearch-no-results svg {
    margin-bottom: 20px;
    color: var(--ss-border);
}

.smartsearch-no-results h3 {
    font-size: 22px;
    margin: 0 0 10px;
    color: var(--ss-text);
}

.smartsearch-no-results p {
    margin: 0;
    font-size: 15px;
}

/* ====== PAGINATION ====== */
.smartsearch-pagination {
    margin-top: 40px;
}

.smartsearch-pagination-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.smartsearch-page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--ss-border);
    background: var(--ss-white);
    border-radius: var(--ss-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--ss-text);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smartsearch-page-btn:hover {
    border-color: var(--ss-primary);
    color: var(--ss-primary);
    background: #f8f5ff;
}

.smartsearch-page-btn.active {
    background: var(--ss-primary);
    border-color: var(--ss-primary);
    color: var(--ss-white);
}

.smartsearch-page-btn.prev,
.smartsearch-page-btn.next {
    padding: 0 16px;
}

.smartsearch-page-ellipsis {
    color: var(--ss-text-muted);
    padding: 0 6px;
}

/* ====== EMPTY FACET MESSAGE ====== */
.smartsearch-no-facets {
    color: var(--ss-text-muted);
    font-size: 13px;
    font-style: italic;
    padding: 8px 14px;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
    .smartsearch-filters-row {
        flex-direction: column;
        align-items: stretch;
    }

    .smartsearch-filters-left {
        flex-wrap: wrap;
    }

    .smartsearch-filters-right {
        justify-content: space-between;
        padding-top: 12px;
        border-top: 1px solid var(--ss-border);
    }

    .smartsearch-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .smartsearch-filters-left {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .smartsearch-dropdown-toggle {
        min-width: auto;
        padding: 8px 12px;
        font-size: 13px;
    }

    .smartsearch-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 60vh;
        border-radius: var(--ss-radius-lg) var(--ss-radius-lg) 0 0;
    }

    .smartsearch-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .smartsearch-product-info {
        padding: 12px;
    }

    .smartsearch-product-title {
        font-size: 14px;
        min-height: 38px;
    }

    .smartsearch-price-current {
        font-size: 16px;
    }

    .smartsearch-product-actions {
        display: none;
    }

    .smartsearch-wishlist-btn {
        width: 32px;
        height: 32px;
    }

    .smartsearch-wishlist-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .smartsearch-page-title {
        font-size: 22px;
    }

    .smartsearch-search-input {
        padding: 12px 46px 12px 14px;
        font-size: 15px;
    }

    .smartsearch-filters-bar {
        padding: 12px;
    }

    .smartsearch-results-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .smartsearch-product-card {
        border-radius: var(--ss-radius);
    }

    .smartsearch-product-info {
        padding: 10px;
    }

    .smartsearch-product-description {
        display: none;
    }
}

/* Overlay for mobile dropdown */
.smartsearch-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.smartsearch-overlay.active {
    display: block;
}

/* ====== ADD TO CART STATES ====== */
.smartsearch-add-to-cart.loading {
    opacity: 0.7;
    pointer-events: none;
}

.smartsearch-add-to-cart.added {
    background: var(--ss-success) !important;
}

/* ====== CART NOTIFICATION ====== */
.smartsearch-cart-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--ss-white);
    border-radius: var(--ss-radius-lg);
    box-shadow: var(--ss-shadow-lg);
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 360px;
}

.smartsearch-cart-notification.show {
    transform: translateX(0);
}

.smartsearch-cart-notification.success .notification-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ss-success);
    color: var(--ss-white);
    border-radius: 50%;
    font-size: 16px;
    flex-shrink: 0;
}

.smartsearch-cart-notification.error .notification-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ss-danger);
    color: var(--ss-white);
    border-radius: 50%;
    font-size: 16px;
    flex-shrink: 0;
}

.smartsearch-cart-notification .notification-message {
    flex: 1;
    font-size: 14px;
    color: var(--ss-text);
    font-weight: 500;
}

.smartsearch-cart-notification .notification-link {
    padding: 8px 16px;
    background: var(--ss-primary);
    color: var(--ss-white);
    border-radius: var(--ss-radius);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
}

.smartsearch-cart-notification .notification-link:hover {
    background: var(--ss-primary-hover);
}

@media (max-width: 480px) {
    .smartsearch-cart-notification {
        left: 20px;
        right: 20px;
        bottom: 20px;
        max-width: none;
    }
}

/* Old sidebar classes - hidden but kept for compatibility */
.smartsearch-facets,
.smartsearch-results-header .smartsearch-search-box,
.smartsearch-results-header .smartsearch-sort {
    display: none !important;
}
