/* Product Finder Styles */

.product-finder-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.product-finder-header {
    text-align: center;
    margin-bottom: 50px;
}

.product-finder-header h1 {
    font-size: 2.75rem;
    margin-bottom: 12px;
    color: #0c1830;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.product-finder-subtitle {
    font-size: 1.125rem;
    color: #6b7280;
    margin: 0;
    font-weight: 400;
}

/* Filters Section */
.product-filters {
    background: #ffffff;
    border-radius: 16px;
    padding: 35px;
    margin-bottom: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e9ea;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    justify-content: center;
    align-items: stretch;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 700;
    margin-bottom: 10px;
    color: #0c1830;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.filter-select {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    font-size: 1rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: none;
    padding-right: 15px;
}

.filter-select:hover {
    border-color: #0c1830;
}

.filter-select:focus {
    outline: none;
    border-color: #0c1830;
    box-shadow: 0 0 0 3px rgba(12, 24, 48, 0.1);
}

/* SlimSelect Styling */
.ss-main {
    min-height: 50px;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    box-shadow: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
}

.ss-main:hover {
    border-color: #0c1830;
    box-shadow: 0 2px 8px rgba(12, 24, 48, 0.1);
}

.ss-main.ss-open {
    border-color: #0c1830;
    box-shadow: 0 0 0 4px rgba(12, 24, 48, 0.08), 0 2px 8px rgba(12, 24, 48, 0.12);
}

.ss-multi-selected {
    min-height: 50px;
    padding: 8px 12px;
    gap: 6px;
}

.ss-multi-selected .ss-values .ss-value {
    background: #0c1830;
    color: #fff;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 0.875rem;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.ss-multi-selected .ss-values .ss-value:hover {
    background: #0a1426;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.ss-multi-selected .ss-values .ss-value .ss-value-delete {
    margin-left: 6px;
    opacity: 0.85;
}

.ss-multi-selected .ss-values .ss-value .ss-value-delete:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.ss-placeholder {
    color: #9ca3af;
    font-size: 0.95rem;
}

.ss-single-selected {
    min-height: 50px;
    padding: 12px 12px;
    border-radius: 12px;
}

.ss-single-selected .ss-arrow {
    right: 12px;
    top: 14px;
    transform: none;
}

.ss-content {
    border: 1.5px solid #d1d5db;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.ss-list .ss-option {
    padding: 12px 16px;
    font-size: 0.95rem;
}

.ss-list .ss-option:hover,
.ss-list .ss-option.ss-highlighted {
    background: #0c1830;
    color: #fff;
}

/* Select2 Custom Styling */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    min-height: 50px;
    padding: 0;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 0.95rem;
    background: white;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    position: relative;
}

.select2-container--default .select2-selection--single {
    height: 50px;
}

.select2-container--default .select2-selection--single:hover,
.select2-container--default .select2-selection--multiple:hover {
    border-color: #0c1830;
    box-shadow: 0 2px 8px rgba(12, 24, 48, 0.1);
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #0c1830;
    box-shadow: 0 0 0 4px rgba(12, 24, 48, 0.08), 0 2px 8px rgba(12, 24, 48, 0.12);
    outline: none;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 12px 15px;
    padding-right: 40px;
    line-height: 1.5;
    color: #333;
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    height: 100%;
    box-sizing: border-box;
}

/* Multiple Selection Styling */
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    padding: 8px 15px;
    padding-right: 40px;
    line-height: 1.5;
    color: #333;
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 34px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #0c1830;
    border: none;
    border-radius: 16px;
    color: white;
    padding: 6px 12px;
    margin: 5px 6px 5px 0;
    font-size: 0.875rem;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice:hover {
    background-color: #0a1426;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    color: white;
    padding-right: 6px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: white;
    cursor: pointer;
    margin-right: 0;
    margin-left: 4px;
    font-weight: 600;
    opacity: 0.85;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    opacity: 1;
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    color: #9ca3af;
    margin-top: 10px;
    padding-left: 0;
    font-size: 0.95rem;
}

/* Search input in multiple selection */
.select2-container--default .select2-search--inline .select2-search__field {
    margin-top: 8px;
    padding: 0;
    border: none;
    outline: none;
    font-size: 0.95rem;
    color: #333;
    min-width: 150px;
    height: auto;
}

.select2-container--default .select2-search--inline .select2-search__field::placeholder {
    color: #9ca3af;
}

/* Clear button for multiple selection */
.select2-container--default .select2-selection--multiple .select2-selection__clear {
    margin-right: 25px;
    color: #999;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
}

.select2-container--default .select2-selection--multiple .select2-selection__clear:hover {
    color: #0c1830;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
    width: 20px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #333 transparent transparent transparent;
    border-width: 6px 6px 0 6px;
    margin-top: -3px;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #333 transparent;
    border-width: 0 6px 6px 6px;
    margin-top: -3px;
}

/* Select2 Dropdown */
.select2-dropdown {
    border: 2px solid #0c1830;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 0;
    background: white;
    overflow: hidden;
    top: 100% !important;
}

/* Select2 Search Container */
.select2-container--default .select2-search--dropdown {
    padding: 0;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    position: relative;
    display: block;
    margin: 0;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: none;
    border-bottom: 2px solid #e0e0e0;
    border-radius: 0;
    padding: 12px 15px;
    padding-right: 40px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    height: 48px;
    line-height: 1.5;
    display: block;
    background: white;
    font-family: inherit;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-bottom-color: #0c1830;
    outline: none;
    box-shadow: none;
}

.select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
    color: #999;
}


/* Select2 Results Container */
.select2-container--default .select2-results {
    padding: 0;
}

.select2-container--default .select2-results__options {
    max-height: 300px;
    overflow-y: auto;
}

.select2-container--default .select2-results__option {
    padding: 12px 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.select2-container--default .select2-results__option:first-child {
    margin-top: 0;
}

.select2-container--default .select2-results__option:last-child {
    margin-bottom: 0;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #0c1830;
    color: white;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #f3f4f6;
    color: #0c1830;
    font-weight: 500;
}

.select2-container--default .select2-results__option[aria-selected=true]:hover {
    background-color: #0c1830;
    color: white;
}

.select2-results__option {
    padding: 10px 15px;
}

/* Select2 Clear Button */
.select2-container--default .select2-selection--single .select2-selection__clear {
    margin-right: 25px;
    color: #999;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    color: #0c1830;
}

/* Ensure dropdown width matches select */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-dropdown {
    width: 100%;
    box-sizing: border-box;
}

/* Sort Select2 (no search) */
#sort-by+.select2-container .select2-selection--single {
    padding: 10px 15px;
}

/* Fix for Select2 results scrolling */
.select2-container--default .select2-results__options::-webkit-scrollbar {
    width: 8px;
}

.select2-container--default .select2-results__options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.select2-container--default .select2-results__options::-webkit-scrollbar-thumb {
    background: #0c1830;
    border-radius: 4px;
}

.select2-container--default .select2-results__options::-webkit-scrollbar-thumb:hover {
    background: #0a1426;
}

/* ABV Slider */
/* ABV group uses default filter-group spacing */

.abv-slider-container {
    position: relative;
    width: 100%;
    overflow: visible;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.abv-slider-wrapper {
    position: relative;
    height: 40px;
    margin: 0 0 8px 0;
    width: 100%;
    padding: 0;
}

.abv-slider-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    z-index: 0;
}

#abv-min {
    z-index: 3;
}

#abv-max {
    z-index: 4;
}

.abv-slider {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 6px;
    background: transparent;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    padding: 0;
    pointer-events: none;
    z-index: 2;
}

.abv-slider::-webkit-slider-thumb {
    pointer-events: all;
}

.abv-slider::-moz-range-thumb {
    pointer-events: all;
}

.abv-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #0c1830;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.abv-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.abv-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #0c1830;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.abv-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.abv-slider::-moz-range-track {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
}

#abv-max {
    z-index: 1;
}

.abv-values {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    color: #0c1830;
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Filter Actions */
.filter-actions {
    margin-top: 30px;
    text-align: center;
    padding-top: 25px;
    border-top: 1px solid #e8e9ea;
}

.filter-actions-group {
    grid-column: span 3 / span 3;
    align-self: center;
}

.filter-actions-group label {
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
}

.filter-actions-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
}

.btn-action {
    padding: 11px 22px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: #ffffff;
}

.btn-primary {
    background: #0c1830;
    color: #ffffff;
    border-color: #0c1830;
}

.btn-primary:hover {
    background: #050814;
    border-color: #050814;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(12, 24, 48, 0.3);
}

.btn-secondary {
    background: #ffffff;
    color: #0c1830;
    border-color: #0c1830;
}

.btn-secondary:hover {
    background: #0c1830;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(12, 24, 48, 0.2);
}

.btn-tertiary {
    background: transparent;
    color: #6b7280;
    border-color: #d1d5db;
}

.btn-tertiary:hover {
    background: #f3f4f6;
    color: #374151;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(148, 163, 184, 0.4);
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8e9ea;
}

.results-count {
    font-size: 1rem;
    color: #6b7280;
    font-weight: 500;
}

.results-count #results-count {
    font-weight: 700;
    color: #0c1830;
    font-size: 1.5rem;
    margin-right: 4px;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-controls label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    white-space: nowrap;
}

.sort-select {
    padding: 10px 15px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 0.95rem;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 12px;
    background-size: 12px;
    padding-right: 35px;
}

/* Remove duplicate arrow when SlimSelect enhances the sort dropdown */
.ss-main.sort-select {
    background-image: none;
    padding-right: 15px;
}

/* Ensure sort dropdown options are not clipped */
.ss-content.sort-select {
    min-width: 180px;
    transform: translateX(-40%);
    transform-origin: top right;
}

/* Hide search field specifically for the sort-by SlimSelect dropdown */
.ss-content.sort-select .ss-search {
    display: none !important;
}

.sort-select:hover,
.sort-select:focus {
    border-color: #0c1830;
    outline: none;
    box-shadow: 0 0 0 4px rgba(12, 24, 48, 0.08), 0 2px 8px rgba(12, 24, 48, 0.12);
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0c1830;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.loading-indicator p {
    color: #666;
    font-size: 1.1rem;
}

/* Products Grid */
.products-grid {
    margin-top: 30px;
}

.products-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Product Groups (for sorted results) */
.product-group {
    margin-bottom: 50px;
}

.group-header {
    font-size: 1.8rem;
    color: #0c1830;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0c1830;
    font-weight: 700;
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #f0f0f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    border-color: #e8e9ea;
}

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

.product-image-wrapper {
    width: 100%;
    padding-top: 75%;
    position: relative;
    background: #f8f9fa;
    overflow: hidden;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 15px;
}

.product-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.9rem;
    background: #f0f0f0;
}

.product-info {
    padding: 22px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #0c1830;
    margin: 0 0 12px 0;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.product-abv {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0 0 10px 0;
    font-weight: 500;
}

.product-brewery {
    font-size: 0.875rem;
    color: #9ca3af;
    margin: auto 0 0 0;
    font-style: italic;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.no-results p {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
}

.error-message {
    text-align: center;
    padding: 20px;
    background: #fee;
    color: #c33;
    border-radius: 8px;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-finder-container {
        padding: 20px 15px;
    }

    .product-finder-header h1 {
        font-size: 2rem;
    }

    .product-filters {
        padding: 20px;
    }

    .filters-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .products-grid-inner {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 20px;
    }

    .group-header {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .products-grid-inner {
        grid-template-columns: 1fr;
    }
}