/* WC Attribute Filter Styles - AJAX verzió */

/* Widget styles */
.wc-attribute-filter-widget {
    position: relative;
}

.wc-attribute-filter-widget .wc-attribute-filter-form {
    display: block !important;
    padding: 0;
}

.wc-attribute-filter-widget .wc-filter-attributes {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wc-attribute-filter-widget .wc-filter-group {
    background: #fff;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.wc-attribute-filter-widget .wc-filter-actions {
    margin-top: 15px;
    padding-top: 15px;
}

.wc-attribute-filter-widget .wc-filter-loading {
    border-radius: 6px;
}

.wc-attribute-filter-wrap {
    margin-bottom: 30px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.wc-filter-toggle {
    width: 100%;
    padding: 15px 20px;
    background: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.wc-filter-toggle:hover {
    background: #f0f0f0;
}

.wc-filter-toggle .toggle-icon {
    transition: transform 0.3s;
}

.wc-filter-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.wc-attribute-filter-form {
    padding: 20px;
    display: none;
    transition: opacity 0.3s;
}

.wc-attribute-filter-form.open {
    display: block;
}

.wc-attribute-filter-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.wc-filter-attributes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    margin-bottom: 20px;
}

.wc-filter-group {
    background: #fff;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.wc-filter-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #007cba;
}

.wc-filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.wc-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 14px;
}

.wc-filter-option:hover {
    background: #f0f0f0;
}

.wc-filter-option.checked {
    background: #e8f4fc;
}

.wc-filter-option input[type="checkbox"] {
    display: none;
}

.wc-filter-option .checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.wc-filter-option input:checked + .checkmark {
    background: #007cba;
    border-color: #007cba;
}

.wc-filter-option input:checked + .checkmark::after {
    content: "✓";
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.wc-filter-option .option-label {
    flex: 1;
    color: #333;
}

.wc-filter-option .option-count {
    color: #888;
    font-size: 12px;
}

.wc-filter-actions {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.wc-filter-submit {
    padding: 12px 25px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.wc-filter-submit:hover {
    background: #005a87;
}

.wc-filter-reset {
    padding: 12px 25px;
    background: #fff;
    color: #666;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.wc-filter-reset:hover {
    background: #f0f0f0;
    color: #333;
}

/* Active filters indicator */
.wc-filter-toggle .filter-count {
    background: #007cba;
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
}

/* Loading indicator */
.wc-filter-loading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 15px;
    z-index: 100;
}

.wc-filter-loading.active {
    display: flex;
}

.wc-filter-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #007cba;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.wc-filter-loading span {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Products loading state */
ul.products.wc-loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

ul.products.wc-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: #007cba;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .wc-filter-attributes {
        grid-template-columns: 1fr;
    }

    .wc-filter-actions {
        flex-direction: column;
    }

    .wc-filter-submit,
    .wc-filter-reset {
        width: 100%;
        text-align: center;
    }
}

/* Scrollbar styling */
.wc-filter-options::-webkit-scrollbar {
    width: 6px;
}

.wc-filter-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.wc-filter-options::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.wc-filter-options::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Smooth transition for products */
.woocommerce ul.products {
    transition: opacity 0.3s ease;
}

/* No results message styling */
.woocommerce-info {
    padding: 20px;
    background: #f8f9fa;
    border-left: 4px solid #007cba;
    margin: 20px 0;
}

/* Category filter styles */
.wc-filter-group-category {
    grid-column: 1 / -1; /* Full width on grid layout */
}

.wc-filter-group-category .wc-filter-options {
    max-height: 350px;
}

/* Level 1 - Parent category (bold) */
.wc-filter-option-level-1 .option-label {
    font-weight: 600;
}

/* Level 2 - Child category (indented) */
.wc-filter-option-level-2 {
    padding-left: 24px !important;
}

.wc-filter-option-level-2 .option-label {
    font-size: 13px;
}

/* Level 3 - Grandchild category (more indented) */
.wc-filter-option-level-3 {
    padding-left: 44px !important;
}

.wc-filter-option-level-3 .option-label {
    font-size: 12px;
    color: #555;
}

/* Widget specific category styles */
.wc-attribute-filter-widget .wc-filter-group-category {
    order: -1; /* Ensure it's at the top */
}

.wc-attribute-filter-widget .wc-filter-group-category .wc-filter-options {
    max-height: 300px;
}

/* No results styling for filter options */
.wc-filter-option.no-results {
    opacity: 0.5;
}

.wc-filter-option.no-results .option-count {
    color: #c00;
}

/* Animate count changes */
.wc-filter-option .option-count {
    transition: color 0.3s ease;
}
