/**
 * Product Filter Display - Frontend Styles
 *
 * @package ProductFilterDisplay
 */

/* ============================================
   Container and Wrapper
   ============================================ */

.pfd-container {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.pfd-wrapper {
    display: flex;
    gap: 30px;
    position: relative;
    width: 100%;
    max-width: 100%;
}

/* ============================================
   Sidebar (30%)
   ============================================ */

.pfd-sidebar {
    width: 30%;
    flex-shrink: 0;
}

.pfd-sidebar-inner {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.pfd-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ddd;
}

.pfd-sidebar-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.pfd-reset-filters {
    background: #d9534f;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s ease;
}

.pfd-reset-filters:hover {
    background: #c9302c;
}

/* ============================================
   Filter Groups
   ============================================ */

.pfd-filter-group {
    margin-bottom: 25px;
}

.pfd-filter-group h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #555;
    font-weight: 600;
}

/* ============================================
   Active Filters
   ============================================ */

.pfd-active-filters {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pfd-active-filters h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
}

.pfd-active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pfd-active-filter-tag {
    display: inline-flex;
    align-items: center;
    background: #007cba;
    color: #fff;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 13px;
    gap: 8px;
}

.pfd-active-filter-tag .pfd-remove-filter {
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
}

.pfd-active-filter-tag .pfd-remove-filter:hover {
    color: #ff0000;
}

/* ============================================
   Search Filter
   ============================================ */

.pfd-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.pfd-search-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

/* ============================================
   Category Filter
   ============================================ */

.pfd-category-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pfd-category-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pfd-category-items li {
    margin-bottom: 10px;
}

.pfd-category-items label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.pfd-category-items input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.pfd-category-count {
    margin-left: auto;
    color: #999;
    font-size: 13px;
}

/* ============================================
   Price Filter
   ============================================ */

.pfd-price-filter-wrapper {
    padding: 0;
}

.pfd-price-label {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #555;
    font-weight: 600;
}

.pfd-price-inputs-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 12px;
}

.pfd-price-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pfd-price-input-group label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.pfd-price-input-field {
    position: relative;
    display: flex;
    align-items: center;
}

.pfd-currency-symbol {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: #555;
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}

.pfd-min-price-input,
.pfd-max-price-input {
    width: 100%;
    padding: 10px 12px 10px 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.pfd-min-price-input:focus,
.pfd-max-price-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.pfd-price-separator {
    font-size: 18px;
    color: #999;
    padding: 0 5px;
    align-self: center;
    margin-bottom: 10px;
}

.pfd-apply-price-filter {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.pfd-apply-price-filter:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.pfd-apply-price-filter:active {
    transform: translateY(0);
}

/* Remove number input arrows in some browsers */
.pfd-min-price-input::-webkit-outer-spin-button,
.pfd-min-price-input::-webkit-inner-spin-button,
.pfd-max-price-input::-webkit-outer-spin-button,
.pfd-max-price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pfd-min-price-input[type=number],
.pfd-max-price-input[type=number] {
    -moz-appearance: textfield;
}

/* ============================================
   Content Area (70%)
   ============================================ */

.pfd-content {
    width: 70%;
    flex-grow: 1;
}

.pfd-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 15px;
}

.pfd-results-count {
    font-size: 16px;
    color: #555;
    font-weight: 500;
}

.pfd-sorting {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pfd-sorting label {
    font-size: 14px;
    color: #555;
}

.pfd-sort-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.pfd-sort-select:focus {
    outline: none;
    border-color: #007cba;
}

/* ============================================
   Loading Indicator
   ============================================ */

.pfd-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
}

.pfd-loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: pfd-spin 1s linear infinite;
}

@keyframes pfd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   Products Grid
   ============================================ */

.pfd-products-grid {
    display: grid;
    gap: 25px;
    margin-bottom: 30px;
}

/* Default 4 columns - will be overridden by JS based on settings */
.pfd-products-grid {
    grid-template-columns: repeat(4, 1fr);
}

.pfd-products-grid.pfd-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.pfd-products-grid.pfd-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.pfd-products-grid.pfd-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.pfd-products-grid.pfd-cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.pfd-products-grid.pfd-cols-6 {
    grid-template-columns: repeat(6, 1fr);
}

.pfd-product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.pfd-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.pfd-product-image {
    position: relative;
    overflow: hidden;
    background: #f8f8f8;
    aspect-ratio: 1;
}

.pfd-product-image a {
    display: block;
    height: 100%;
}

.pfd-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pfd-product-card:hover .pfd-product-image img {
    transform: scale(1.05);
}

.pfd-product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.pfd-product-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    line-height: 1.4;
}

.pfd-product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.pfd-product-title a:hover {
    color: #007cba;
}

.pfd-product-price {
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #007cba;
}

.pfd-product-price del {
    color: #999;
    font-size: 14px;
    margin-right: 8px;
}

.pfd-product-price ins {
    text-decoration: none;
}

.pfd-product-actions {
    margin-top: auto;
}

.pfd-product-actions .button,
.pfd-product-actions a.button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.pfd-product-actions .button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.pfd-product-actions .button.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.pfd-out-of-stock {
    display: block;
    text-align: center;
    padding: 12px;
    background: #f8f8f8;
    color: #999;
    border-radius: 4px;
    font-weight: 500;
}

/* ============================================
   No Products Message
   ============================================ */

.pfd-no-products {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

.pfd-no-products p {
    margin: 0;
}

/* ============================================
   Pagination
   ============================================ */

.pfd-pagination {
    margin-top: 30px;
}

.pfd-pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pfd-page-numbers {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pfd-page-btn {
    padding: 10px 15px;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.pfd-page-btn:hover:not(.pfd-active) {
    background: #f8f8f8;
    border-color: #007cba;
    color: #007cba;
}

.pfd-page-btn.pfd-active {
    background: #007cba;
    color: #fff;
    border-color: #007cba;
    cursor: default;
}

.pfd-page-dots {
    padding: 0 5px;
    color: #999;
}

.pfd-prev-page,
.pfd-next-page {
    font-weight: 600;
}

/* ============================================
   Mobile Filter Toggle
   ============================================ */

.pfd-mobile-filter-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #007cba;
    color: #fff;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.4);
    z-index: 999;
    transition: all 0.3s ease;
}

.pfd-mobile-filter-toggle:hover {
    background: #005a87;
    transform: scale(1.05);
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .pfd-sidebar {
        width: 35%;
    }

    .pfd-content {
        width: 65%;
    }

    .pfd-products-grid,
    .pfd-products-grid.pfd-cols-5,
    .pfd-products-grid.pfd-cols-6 {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .pfd-products-grid.pfd-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .pfd-container {
        padding: 15px;
    }

    .pfd-wrapper {
        flex-direction: column;
        gap: 0;
    }

    .pfd-sidebar {
        width: 100%;
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    .pfd-sidebar.pfd-sidebar-open {
        left: 0;
    }

    .pfd-sidebar-inner {
        border-radius: 0;
        max-height: none;
        position: static;
        min-height: 100vh;
    }

    .pfd-content {
        width: 100%;
    }

    .pfd-content-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pfd-sorting {
        width: 100%;
        justify-content: space-between;
    }

    .pfd-products-grid,
    .pfd-products-grid.pfd-cols-2,
    .pfd-products-grid.pfd-cols-3,
    .pfd-products-grid.pfd-cols-4,
    .pfd-products-grid.pfd-cols-5,
    .pfd-products-grid.pfd-cols-6 {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .pfd-mobile-filter-toggle {
        display: block;
    }

    .pfd-pagination-wrapper {
        gap: 5px;
    }

    .pfd-page-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .pfd-prev-page,
    .pfd-next-page {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .pfd-products-grid,
    .pfd-products-grid.pfd-cols-2,
    .pfd-products-grid.pfd-cols-3,
    .pfd-products-grid.pfd-cols-4,
    .pfd-products-grid.pfd-cols-5,
    .pfd-products-grid.pfd-cols-6 {
        grid-template-columns: repeat(1, 1fr);
        gap: 12px;
    }

    .pfd-product-title {
        font-size: 14px;
    }

    .pfd-product-price {
        font-size: 16px;
    }

    .pfd-product-actions .button {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* Overlay for mobile sidebar */
.pfd-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.pfd-overlay.pfd-overlay-visible {
    display: block;
}

/* Close button for mobile sidebar */
.pfd-sidebar-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .pfd-sidebar-close {
        display: flex;
    }
}

.pfd-sidebar-close:hover {
    background: #f8f8f8;
}

