/* =====================================================================
   search-results.css  —  Scoped styles for the search results page
   All classes use the .sr- prefix to avoid global collisions
   ===================================================================== */

/* ── Page wrapper ── */
.sr-page {
    background: #f5f5f5;
    min-height: 80vh;
}

/* ── Top Banner ── */
.sr-top-banner {
    margin-bottom: 0;
}
.sr-top-banner .swiper-slide img {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
}

/* ── Container ── */
.sr-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ── Results Header Row ── */
.sr-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 10px;
    gap: 12px;
    flex-wrap: wrap;
}

.sr-heading {
    font-size: 0.9375rem;
    font-weight: 400;
    color: #374151;
    margin: 0;
    line-height: 1.4;
}

.sr-heading strong {
    font-weight: 700;
    color: #111827;
}

/* Sort dropdown */
.sr-sort-area {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #6b7280;
    white-space: nowrap;
}

.sr-sort-dropdown .dropdown-toggle {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.875rem;
    color: #111827;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sr-sort-dropdown .dropdown-toggle:hover,
.sr-sort-dropdown .dropdown-toggle:focus {
    border-color: #3b82f6;
    box-shadow: none;
    color: #111827;
}

.sr-sort-dropdown .dropdown-menu {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    padding: 4px 0;
    min-width: 180px;
}

.sr-sort-dropdown .dropdown-item {
    font-size: 0.875rem;
    padding: 8px 16px;
    color: #374151;
}

.sr-sort-dropdown .dropdown-item:hover,
.sr-sort-dropdown .dropdown-item.active {
    background: #eff6ff;
    color: #3b82f6;
}

/* ── Filter Chips Row ── */
.sr-chips-row {
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
    padding-bottom: 12px;
    position: relative;
}

.sr-chips-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
    align-items: center;
    scroll-behavior: smooth;
    padding-left: 32px;
    padding-right: 32px;
}

.sr-chips-scroll::-webkit-scrollbar {
    display: none;
}

/* Chips navigation arrows */
.sr-chips-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    color: #6b7280;
    font-size: 14px;
    transition: all 0.2s;
}

.sr-chips-nav:hover {
    background: #f3f4f6;
    color: #111827;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.sr-chips-nav--left {
    left: 0;
}

.sr-chips-nav--right {
    right: 0;
}

[dir="rtl"] .sr-chips-nav--left {
    left: auto;
    right: 0;
}

[dir="rtl"] .sr-chips-nav--right {
    right: auto;
    left: 0;
}

.sr-chips-scroll::-webkit-scrollbar {
    display: none;
}

.sr-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background: #fff;
    font-size: 0.8125rem;
    white-space: nowrap;
    cursor: pointer;
    color: #374151;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    line-height: 1;
}

.sr-chip:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    text-decoration: none;
}

.sr-chip--active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
    font-weight: 600;
}

.sr-chip--active:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.sr-chip--clear {
    border-color: #fca5a5;
    color: #ef4444;
}

.sr-chip--clear:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* ── Body: sidebar + main ── */
.sr-body {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* ── Left Sidebar ── */
.sr-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    position: sticky;
    top: 20px;
    height: auto;
    overflow: visible;
    z-index: 10;
}

/* Filter sections */
.sr-filter-section {
    border-bottom: 1px solid #f3f4f6;
    padding: 14px 16px;
}

.sr-filter-section:last-child {
    border-bottom: none;
}

.sr-filter-header {
    font-size: 0.875rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sr-filter-header--toggle {
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    margin-bottom: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: #111827;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sr-filter-header--toggle:focus {
    outline: none;
}

.sr-toggle-icon {
    color: #9ca3af;
    font-size: 14px;
    transition: transform 0.2s;
}

.sr-collapsible[data-open="false"] .sr-toggle-icon {
    transform: rotate(-90deg);
}

.sr-collapsible[data-open="false"] .sr-filter-body {
    display: none;
}

.sr-collapsible[data-open="true"] .sr-filter-body {
    display: block;
}

.sr-filter-body {
    margin-top: 10px;
}

/* Check/radio items */
.sr-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    font-size: 0.8125rem;
    color: #374151;
    line-height: 1.3;
}

.sr-check-item input[type="checkbox"],
.sr-check-item input[type="radio"] {
    accent-color: #3b82f6;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
}

.sr-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* See-more toggle */
.sr-see-more {
    font-size: 0.75rem;
    color: #3b82f6;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 0;
    display: block;
    margin-top: 4px;
}

.sr-see-more:hover {
    text-decoration: underline;
}

/* Fulfillment badges */
.sr-fulfillment-badge {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
}

.sr-fulfillment-badge input {
    display: none;
}

.sr-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.sr-badge--warehouse {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.sr-badge--seller {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.sr-fulfillment-badge input:checked + .sr-badge {
    box-shadow: 0 0 0 2px #3b82f6;
    border-color: #3b82f6;
}

/* Rating stars in sidebar */
.sr-rating-item {
    gap: 6px;
}

.sr-stars {
    display: inline-flex;
    gap: 1px;
    align-items: center;
}

.sr-star--filled {
    color: #f59e0b;
    font-size: 13px;
}

.sr-star--empty {
    color: #d1d5db;
    font-size: 13px;
}

/* Apply / Clear buttons */
.sr-apply-btn {
    display: block;
    width: 100%;
    padding: 9px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    margin-top: 14px;
    transition: opacity 0.15s;
}

.sr-apply-btn:hover {
    opacity: 0.9;
}

.sr-clear-sidebar-btn {
    display: block;
    text-align: center;
    color: #9ca3af;
    font-size: 0.8125rem;
    margin-top: 8px;
    text-decoration: underline;
    cursor: pointer;
}

.sr-clear-sidebar-btn:hover {
    color: #6b7280;
}

/* Sidebar ad */
.sr-sidebar-ad {
    border-radius: 8px;
    overflow: hidden;
    margin: 12px 16px 14px;
}

/* ── Main area ── */
.sr-main {
    flex: 1;
    min-width: 0;
}

/* Toolbar */
.sr-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.sr-show-label {
    font-size: 0.8125rem;
    color: #6b7280;
}

.sr-per-page-select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.8125rem;
    color: #374151;
    background: #fff;
    cursor: pointer;
}

.sr-per-page-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.sr-view-btn {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: #9ca3af;
    font-size: 16px;
    line-height: 1;
    transition: all 0.15s;
}

.sr-view-btn.active,
.sr-view-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

.sr-mobile-filter-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.sr-mobile-filter-btn:hover {
    background: #2563eb;
}

/* ── Product Grid ── */
.sr-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.sr-grid-item--full {
    grid-column: 1 / -1;
}

/* Inline ad inside grid */
.sr-inline-ad {
    border-radius: 8px;
    overflow: hidden;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* ── Product Card (sr-card) ── */
.sr-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sr-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.09);
    border-color: #d1d5db;
}

/* Image area */
.sr-card__image-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #f9fafb;
    overflow: hidden;
}

.sr-card__img-link {
    display: block;
    width: 100%;
    height: 100%;
}

.sr-card__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    padding: 8px;
}

.sr-card:hover .sr-card__img {
    transform: scale(1.05);
}

/* Badges */
.sr-card__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    border-radius: 5px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    z-index: 2;
    line-height: 1.2;
}

.sr-card__badge--pick {
    background: #3b82f6;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.sr-card__badge--discount {
    background: #ef4444;
    color: #fff;
    top: 36px;
    left: 8px;
}

/* Only discount, no pick badge → position at top */
.sr-card__badge--discount:first-child {
    top: 8px;
}

/* Wishlist button */
.sr-card__wishlist {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: border-color 0.15s, color 0.15s, transform 0.15s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    color: #9ca3af;
    padding: 0;
}

.sr-card__wishlist:hover {
    border-color: #ef4444;
    color: #ef4444;
    transform: scale(1.1);
}

.sr-card__wishlist--active {
    border-color: #ef4444;
    color: #ef4444;
    background: #fff;
}

/* Add to cart button */
.sr-card__add-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.15s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
    padding: 0;
    font-size: 16px;
}

.sr-card__add-btn:hover {
    background: #2563eb;
    transform: scale(1.1);
}

.sr-card__add-btn.loading {
    background: #93c5fd;
    pointer-events: none;
}

.sr-card__add-btn.added {
    background: #10b981;
}

/* Info section */
.sr-card__info {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

/* Fulfillment badge */
.sr-card__meta {
    font-size: 0.7rem;
    line-height: 1;
}

.sr-card__fulfilled {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 500;
}

.sr-card__fulfilled-icon {
    width: 13px;
    height: 13px;
    object-fit: contain;
}

.sr-card__fulfilled--warehouse {
    color: #1e40af;
}

.sr-card__fulfilled--seller {
    color: #166534;
}

/* Title */
.sr-card__title {
    font-size: 0.8125rem;
    color: #111827;
    font-weight: 400;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
    margin: 0;
}

.sr-card__title a {
    color: inherit;
    text-decoration: none;
}

.sr-card__title a:hover {
    color: #3b82f6;
}

/* Rating */
.sr-card__rating {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.sr-card__stars {
    display: inline-flex;
    gap: 1px;
    align-items: center;
}

.sr-card__star--filled {
    color: #f59e0b;
    font-size: 12px;
}

.sr-card__star--half {
    color: #f59e0b;
    font-size: 12px;
}

.sr-card__star--empty {
    color: #d1d5db;
    font-size: 12px;
}

.sr-card__rating-val {
    font-size: 0.75rem;
    color: #374151;
    font-weight: 600;
}

.sr-card__rating-count {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Price */
.sr-card__price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.sr-card__price {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #111827;
}

.sr-card__price-orig {
    font-size: 0.8125rem;
    color: #9ca3af;
    text-decoration: line-through;
}

/* ── No results block ── */
.sr-no-results {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 48px 24px;
    text-align: center;
}

/* ── Pagination wrapper ── */
.sr-pagination {
    margin-top: 24px;
}

/* ── Mobile Sidebar Overlay ── */
.sr-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1049;
}

.sr-sidebar-overlay--visible {
    display: block;
}

/* ── Responsive ── */

/* 3 columns on large but not xl */
@media (max-width: 1199px) {
    .sr-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Sidebar becomes drawer on tablet/mobile */
@media (max-width: 991px) {
    .sr-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1050;
        width: 280px;
        border-radius: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.14);
        height: 100vh;
        overflow-y: auto;
    }

    .sr-sidebar.sr-sidebar--open {
        display: block;
    }

    .sr-body {
        flex-direction: column;
    }

    .sr-chips-scroll {
        padding-left: 28px;
        padding-right: 28px;
    }

    .sr-chips-nav {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
}

/* 2 columns on mobile */
@media (max-width: 767px) {
    .sr-body {
        flex-direction: column;
    }

    .sr-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .sr-header-row {
        padding: 10px 0 6px;
    }

    .sr-main {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .sr-grid {
        gap: 6px;
    }

    .sr-card__price {
        font-size: 0.875rem;
    }
}

/* ── RTL Support ── */
[dir="rtl"] .sr-card__wishlist {
    right: auto;
    left: 8px;
}

[dir="rtl"] .sr-card__add-btn {
    right: auto;
    left: 8px;
}

[dir="rtl"] .sr-card__badge {
    left: auto;
    right: 8px;
}

[dir="rtl"] .sr-card__badge--discount {
    right: 8px;
    left: auto;
}

[dir="rtl"] .sr-sidebar {
    left: auto;
    right: 0;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.14);
}

[dir="rtl"] .sr-chips-scroll {
    direction: rtl;
}

/* ── Fulfilled by icons ── */
.sr-filter-header-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sr-filter-header-icon i {
    font-size: 14px;
    color: #6b7280;
}

/* ── Skeleton Loading ── */
.sr-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: sr-skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes sr-skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.sr-skeleton-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sr-skeleton-image {
    aspect-ratio: 1 / 1;
    background: #f9fafb;
}

.sr-skeleton-image .sr-skeleton {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.sr-skeleton-content {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sr-skeleton-line {
    height: 12px;
}

.sr-skeleton-line--short {
    width: 60%;
}

.sr-skeleton-line--medium {
    width: 80%;
}

.sr-skeleton-line--long {
    width: 100%;
}

.sr-skeleton-price {
    height: 18px;
    width: 40%;
    margin-top: 4px;
}

.sr-skeleton-badge {
    height: 16px;
    width: 50%;
}

/* Skeleton for list view */
.sr-skeleton-list-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
}

.sr-skeleton-list-image {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
    border-radius: 8px;
}

.sr-skeleton-list-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sr-skeleton-list-title {
    height: 20px;
    width: 70%;
}

.sr-skeleton-list-text {
    height: 14px;
    width: 50%;
}

.sr-skeleton-list-price {
    height: 24px;
    width: 30%;
    margin-top: auto;
}

/* Loading overlay */
.sr-loading-overlay {
    position: relative;
    min-height: 200px;
}

.sr-loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
}

/* Hide skeleton when content is loaded */
.sr-content-loaded .sr-skeleton-container {
    display: none;
}
