/**
 * WooCommerce Advanced Product Filter - Frontend Styles
 * Version: 0.1.4
 */

/* Filter Wrapper */
.wc-advanced-filter-wrapper {
    width: 100%;
    margin: 20px 0;
}

/* v0.1.4 FIX START - Top Filters Bar */
.wc-filter-top-bar {
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.wc-filter-form-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Main Content Area */
.wc-filter-main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Category Sidebar */
.wc-filter-category-sidebar {
    width: var(--category-width);
    flex-shrink: 0;
}

.wc-filter-category-sidebar.wc-position-left {
    order: 1;
}

.wc-filter-category-sidebar.wc-position-right {
    order: 3;
}

.wc-filter-category-container {
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.wc-filter-category-title {
    margin: 0 0 15px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e1e1;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* Products Area */
.wc-filter-products-area {
    width: var(--products-width);
    flex-grow: 1;
    order: 2;
}
/* v0.1.4 FIX END */

/* Filter Sections */
.wc-filter-section {
    display: flex;
    flex-direction: column;
}

.wc-filter-section label {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}

.wc-filter-section input[type="text"],
.wc-filter-section input[type="number"],
.wc-filter-section select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.wc-filter-section input[type="text"]:focus,
.wc-filter-section input[type="number"]:focus,
.wc-filter-section select:focus {
    outline: none;
    border-color: #0073aa;
}

/* Price Range Inputs */
.wc-price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wc-price-inputs input {
    flex: 1;
}

.price-separator {
    color: #666;
    font-size: 14px;
}

/* Checkboxes */
.wc-filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wc-filter-checkboxes label {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
}

.wc-filter-checkboxes input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* Single Checkbox Filters */
.wc-filter-sale label,
.wc-filter-featured label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.wc-filter-sale input[type="checkbox"],
.wc-filter-featured input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* v0.1.2 FIX START - Hierarchical Category Tree Styles */
/* v0.1.4 FIX - Removed max-height and border for sidebar layout */
.wc-filter-category-tree {
    padding: 10px 0;
}

.wc-category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wc-category-list .wc-category-list {
    margin-left: 20px;
    margin-top: 5px;
    padding-left: 10px;
    border-left: 2px solid #e1e1e1;
}

.wc-category-item {
    margin: 5px 0;
}

.wc-category-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-weight: normal;
    margin-bottom: 0;
}

.wc-category-label:hover {
    background-color: #f5f5f5;
}

.wc-category-checkbox {
    margin: 0 8px 0 0;
    cursor: pointer;
}

.wc-category-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #333;
}

.wc-category-count {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.wc-category-level-0 {
    padding: 0;
}

.wc-category-level-1 .wc-category-label {
    font-size: 13px;
}

.wc-category-level-2 .wc-category-label {
    font-size: 12px;
}

/* Custom scrollbar for category container */
.wc-filter-category-container::-webkit-scrollbar {
    width: 8px;
}

.wc-filter-category-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.wc-filter-category-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.wc-filter-category-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}
/* v0.1.2 FIX END */

/* Filter Actions */
.wc-filter-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    margin-top: 10px;
}

.wc-filter-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.wc-filter-apply {
    background: #0073aa;
    color: #fff;
}

.wc-filter-apply:hover {
    background: #005177;
}

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

.wc-filter-reset:hover {
    background: #e0e0e0;
}

/* Results Wrapper */
.wc-filter-results-wrapper {
    margin-top: 30px;
}

/* Results Count */
.wc-filter-results-count {
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 4px;
}

.wc-filter-results-count .results-text {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

/* Products Grid */
.wc-products-grid {
    display: grid;
    gap: 25px;
    margin-bottom: 30px;
}

.wc-products-grid.wc-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.wc-products-grid.wc-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.wc-products-grid.wc-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.wc-products-grid.wc-columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.wc-products-grid.wc-columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Product Item */
.wc-product-item {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.wc-product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.wc-product-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.wc-product-link {
    text-decoration: none;
    color: inherit;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Product Image */
.wc-product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
}

.wc-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.wc-product-item:hover .wc-product-image img {
    transform: scale(1.05);
}

.wc-product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.wc-product-badge.sale {
    background: #e74c3c;
}

.wc-product-badge.featured {
    background: #f39c12;
    top: 45px;
}

/* Product Details */
.wc-product-details {
    padding: 15px;
    flex: 1;
}

.wc-product-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.4;
    color: #333;
}

.wc-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #0073aa;
    margin-bottom: 10px;
}

.wc-product-price del {
    color: #999;
    font-size: 14px;
    margin-right: 5px;
}

.wc-product-rating {
    margin-bottom: 10px;
}

/* Product Actions */
.wc-product-actions {
    padding: 0 15px 15px;
}

.wc-product-actions .button {
    width: 100%;
    text-align: center;
}

/* Loading State */
.wc-filter-loading {
    text-align: center;
    padding: 60px 20px;
}

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

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

/* No Products */
.wc-no-products {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.wc-no-products p {
    font-size: 18px;
    color: #666;
    margin: 0;
}

/* Error State */
.wc-filter-error {
    text-align: center;
    padding: 40px 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
}

.wc-filter-error p {
    color: #856404;
    margin: 0;
}

/* Pagination */
.wc-filter-pagination {
    margin-top: 30px;
}

.wc-filter-pagination-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wc-page-btn,
.wc-page-number {
    padding: 10px 15px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.wc-page-btn:hover {
    background: #f0f0f0;
    border-color: #0073aa;
}

.wc-page-number.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
    cursor: default;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .wc-products-grid.wc-columns-6,
    .wc-products-grid.wc-columns-5 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .wc-filter-form-top {
        grid-template-columns: repeat(2, 1fr);
    }

    .wc-products-grid.wc-columns-4,
    .wc-products-grid.wc-columns-5,
    .wc-products-grid.wc-columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }

    /* v0.1.4 FIX - Stack layout on tablets */
    .wc-filter-main-content {
        flex-direction: column;
    }

    .wc-filter-category-sidebar,
    .wc-filter-products-area {
        width: 100% !important;
        order: unset !important;
    }

    .wc-filter-category-container {
        position: relative;
        top: 0;
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .wc-filter-form-top {
        grid-template-columns: 1fr;
    }

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

    .wc-filter-btn {
        width: 100%;
    }

    .wc-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

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

    .wc-filter-top-bar,
    .wc-filter-category-container {
        padding: 15px;
    }
}