/* Version: 1.1.1 */
:root {
    --ss-primary: #ff0055;
    --ss-bg: #ffffff;
    --ss-card-bg: #ffffff;
    --ss-text-main: #1f2937;
    --ss-text-muted: #6b7280;
    --ss-border: #f3f4f6;
    --ss-radius: 16px;
    --ss-radius-sm: 8px;
    --ss-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --ss-shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
}

.ss-wrapper {
    position: relative;
    max-width: 900px;
    margin: 20px auto;
    font-family: 'Outfit', -apple-system, sans-serif;
    color: var(--ss-text-main);
}

/* Search Box Overhaul */
.ss-search-box {
    position: relative;
    background: #fff;
    padding: 6px;
    border-radius: var(--ss-radius);
    box-shadow: var(--ss-shadow-md);
    border: 1px solid var(--ss-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ss-search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

.ss-search-box input {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: calc(var(--ss-radius) - 6px);
    font-size: 18px;
    font-weight: 500;
    color: var(--ss-text-main);
    background: transparent;
    outline: none;
}

.ss-loader {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(var(--ss-primary-rgb), 0.1);
    border-top-color: var(--ss-primary);
    border-radius: 50%;
    animation: ss-spin 0.6s linear infinite;
    display: none;
}

@keyframes ss-spin { to { transform: translateY(-50%) rotate(360deg); } }

/* Results Panel */
.ss-results-container {
    border: 1px solid var(--ss-border);
    display: none;
    overflow: hidden;
    z-index: 10000;
    min-height: 200px;
}

/* Main Layout */
.ss-facets {
    width: 260px;
    background: #fafafa;
    border-right: 1px solid var(--ss-border);
    padding: 24px;
    overflow-y: auto;
    flex-shrink: 0;
}

.ss-no-sidebar .ss-facets {
    display: none;
}

.ss-hits {
    flex: 1;
    overflow-y: auto;
    padding: 0; /* Bento Sections handle padding */
    background: #fff;
    max-height: 700px;
}

/* Facet Styling */
.ss-facets {
    position: sticky;
    top: 20px;
    padding-bottom: 40px;
    flex-shrink: 0;
    min-height: 500px; /* Base height to keep background visible */
}

.ss-facet-clear-all {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    background: transparent;
    border: 1px solid rgba(var(--ss-primary-rgb), 0.3);
    color: var(--ss-primary);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ss-facet-clear-all:before {
    content: "✕";
    font-size: 10px;
}

.ss-facet-clear-all:hover {
    background: rgba(var(--ss-primary-rgb), 0.05);
    border-color: var(--ss-primary);
}

.ss-facet-group {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f3f4f6;
}

.ss-facet-group:last-child {
    border-bottom: none;
}
.ss-facet-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9ca3af;
    margin: 0 0 16px 0;
}
.ss-facet-list { list-style: none; padding: 0; margin: 0; }
.ss-facet-list label {
    display: flex;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
}
.ss-facet-list label:hover { color: var(--ss-primary); }
.ss-facet-list input {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    margin-right: 12px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}
.ss-facet-list input:checked {
    background: var(--ss-primary);
    border-color: var(--ss-primary);
}
.ss-facet-list input:checked::after {
    content: '\2713';
    color: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
}
.ss-facet-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    opacity: 0.7;
}

/* Bento Sections */
.ss-section {
    padding: 24px;
    border-bottom: 1px solid var(--ss-border);
}
.ss-section:last-child { border-bottom: none; }
.ss-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.ss-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    margin: 0;
}
.ss-section-count { font-size: 12px; color: #9ca3af; font-weight: 600; }

/* Grid vs List */
.ss-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* Premium Card Design */
.ss-card {
    border-radius: var(--ss-radius);
    background: var(--ss-card-bg);
    border: 1px solid var(--ss-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.ss-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ss-shadow-md);
    border-color: rgba(var(--ss-primary-rgb), 0.3);
}

.ss-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ss-card-image {
    width: 100%;
    aspect-ratio: 1;
    background: #f9fafb;
    position: relative;
    overflow: hidden;
}

.ss-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.ss-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.ss-card-title mark {
    background: rgba(var(--ss-primary-rgb), 0.08);
    color: var(--ss-primary);
    padding: 0 1px;
    border-radius: 2px;
}

.ss-card-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--ss-primary);
    margin-top: auto;
}

.ss-card-excerpt {
    font-size: 12px;
    color: var(--ss-text-muted);
    margin: 8px 0 0 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Compact Sidebar Layout */
@media (max-width: 768px) {
    .ss-results-container { flex-direction: column; max-height: 85vh; }
    .ss-facets { width: 100%; border-right: none; border-bottom: 1px solid var(--ss-border); max-height: 250px; }
    .ss-grid { grid-template-columns: repeat(2, 1fr); }
}

/* No Results State */
.ss-no-results {
    padding: 80px 40px;
    text-align: center;
}
.ss-no-results .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #e5e7eb;
    margin-bottom: 24px;
}
.ss-no-results p {
    font-size: 16px;
    color: var(--ss-text-muted);
    margin: 0;
}

/* Full Page Catalog Layout overrides */
.ss-layout-catalog.ss-wrapper {
    max-width: 100% !important;
}

.ss-layout-catalog .ss-results-container {
    border: none;
    overflow: visible;
    box-shadow: none;
    margin-top: 35px;
}

.ss-layout-catalog .ss-facets {
    overflow-y: visible;
    background: transparent;
    border-right: 1px solid var(--ss-border);
    position: sticky;
    top: 30px;
    height: fit-content;
}

.ss-layout-catalog .ss-hits {
    max-height: none;
    overflow-y: visible;
}

.ss-layout-catalog .ss-card {
    box-shadow: none;
    border-color: var(--ss-border);
}

.ss-layout-catalog .ss-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    border-color: var(--ss-primary);
}

/* Catalog Sort & Header */
.ss-layout-catalog .ss-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ss-border);
}

.ss-header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.ss-layout-catalog .ss-section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--ss-text-main);
}

.ss-layout-catalog .ss-section-count {
    font-size: 14px;
    color: var(--ss-text-muted);
}

.ss-sort-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ss-sort-container label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ss-text-muted);
}

.ss-sort-select {
    padding: 6px 32px 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ss-text-main);
    border: 1px solid var(--ss-border);
    border-radius: var(--ss-radius-sm);
    background-color: #fff;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    transition: border-color 0.15s ease;
}

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

.ss-layout-catalog .ss-facet-count {
    margin-left: 6px;
}

/* Pagination Styling */
.ss-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 30px 20px;
    border-top: 1px solid var(--ss-border);
    margin-top: 30px;
}

.ss-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--ss-border);
    color: var(--ss-text-main);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.ss-page-link:hover {
    border-color: var(--ss-primary);
    color: var(--ss-primary);
    background: rgba(255, 0, 85, 0.05); /* Fallback */
}

/* If dynamic RGB exists */
@supports (color: rgba(var(--ss-primary-rgb), 0.1)) {
    .ss-page-link:hover {
        background: rgba(var(--ss-primary-rgb), 0.05);
    }
}

.ss-page-link.active {
    background: var(--ss-primary);
    border-color: var(--ss-primary);
    color: #fff;
}

.ss-page-link.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}