/**
 * Gerrards Shop Filter - Styles
 *
 * @package Gerrards_Utilities
 */

/* Filter Container */
.gerrards-shop-filter {
    background: #ffffff;
    margin-bottom: 2rem;
}

.gerrards-shop-filter.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Filter Header */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0px 0px 5px
    border-bottom: 1px solid #e5e7eb;
}

.filter-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.filter-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s ease;
}

.filter-toggle:hover {
    color: #111827;
}

.toggle-icon {
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    position: relative;
}

.toggle-icon::before,
.toggle-icon::after {
    content: '';
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    position: absolute;
    left: 0;
    transition: transform 0.2s ease;
}

.toggle-icon::before {
    top: -8px;
}

.toggle-icon::after {
    top: 8px;
}

.gerrards-shop-filter.is-open .toggle-icon {
    background: transparent;
}

.gerrards-shop-filter.is-open .toggle-icon::before {
    transform: rotate(45deg);
    top: 0;
}

.gerrards-shop-filter.is-open .toggle-icon::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Filter Content */
.filter-content {
    padding: 0px;
}

/* Active Filters */
.active-filters {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.active-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.active-filters-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.clear-all-filters {
    background: none;
    border: none;
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s ease;
}

.clear-all-filters:hover {
    color: #991b1b;
    text-decoration: underline;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
    font-size: 14px;
    color: #374151;
}

.active-filter-remove {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0px;
    margin-left: 0.25rem;
    transition: color 0.2s ease;
}

.active-filter-remove:hover {
    color: #dc2626;
}

/* Filter Groups */
.filter-group {
    margin-bottom: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.filter-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: #f9fafb;
    border: none;
    padding: 0.2rem 0.4rem
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s ease;
}

.filter-group-header:hover {
    background: #f3f4f6;
}

.filter-group.is-open .filter-group-header {
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}

.filter-group-title {
    font-weight: 400;
    font-size: 15px;
    color: #111827;
}

.filter-group-toggle {
    display: block;
    width: 12px;
    height: 12px;
    border-right: 2px solid #6b7280;
    border-bottom: 2px solid #6b7280;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    margin-top: -4px;
}

.filter-group-header[aria-expanded="true"] .filter-group-toggle {
    transform: rotate(-135deg);
    margin-top: 4px;
}

.filter-group-content {
    display: none;
    padding: 0.4rem;
    background: #ffffff;
}

/* Filter Options */
.filter-option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 2px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.filter-option:hover {
    background: #f9fafb;
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #16284f;
}

.filter-option-label {
    font-size: 15px;
    color: #374151;
    flex: 1;
}

.filter-option-count {
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Price Filter */
.price-inputs {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.price-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.price-input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.price-input-group input {
    width: 100%;
    padding: 0.3rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9375rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.price-input-group input:focus {
    outline: none;
    border-color: #16284f;
    box-shadow: 0 0 0 3px rgba(22, 40, 79, 0.1);
}

.price-separator {
    margin-bottom: 0.625rem;
    color: #6b7280;
    font-weight: 500;
}

/* Loading State */
.gerrards-shop-filter.is-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Products Loading State */
ul.products.is-loading {
    position: relative;
}

ul.products.is-loading::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    color: #16284f;
    z-index: 10;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .filter-toggle {
        display: block;
    }

    .filter-content {
        display: none;
    }

    .gerrards-shop-filter.is-open .filter-content {
        display: block;
    }

    .filter-header {
        padding: 1rem;
    }

    .filter-content {
        padding: 1rem;
    }

    .filter-group-content {
        padding: 0.75rem;
    }

    .price-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .price-separator {
        text-align: center;
        margin: 0;
    }

    .active-filters-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .filter-title {
        font-size: 1.125rem;
    }

    .filter-group-title {
        font-size: 0.875rem;
    }

    .filter-option-label {
        font-size: 0.875rem;
    }
}

/* Scrollbar Styling for Filter Groups with Many Options */
.filter-group-content {
    max-height: 300px;
    overflow-y: auto;
}

.filter-group-content::-webkit-scrollbar {
    width: 8px;
}

.filter-group-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.filter-group-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.filter-group-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animation for filter groups */
.filter-group-content {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* WooCommerce Info Message Styling */
.woocommerce-info {
    background: #f0f9ff;
    border-left: 4px solid #0284c7;
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    border-radius: 4px;
    color: #0c4a6e;
}
