/* Post/Product Filter - Public CSS v1.9.1 */

.post-product-filter-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.filter-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 992px) {
    .filter-container { grid-template-columns: 1fr; }
}

.filter-sidebar {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (max-width: 992px) {
    .filter-sidebar { position: relative; top: 0; }
}

.filter-widget, .filter-group {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-group-title {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.filter-group-title.toggle-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.filter-group-title.toggle-trigger:hover { color: #2271b1; }
.filter-group-title .toggle-icon { transition: transform 0.2s; }
.filter-group-content.collapsed { display: none; }

.category-description {
    background: #fff;
    border: none;
    border-radius: 0;
    padding: 30px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid #e5e5e5;
}

.category-description-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.category-description-content {
    font-size: 15px;
    line-height: 1.7;
    color: #666;
}

.category-description-content p { margin: 0 0 15px 0; }
.category-description-content p:last-child { margin-bottom: 0; }

.filter-option.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.filter-option.disabled .filter-label { color: #999; }

.filter-search { margin-bottom: 15px; }

.filter-search input, .category-search {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.filter-search input:focus, .category-search:focus {
    outline: none;
    border-color: #2271b1;
}

.filter-options {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 0;
    padding-right: 5px;
}

.filter-options::-webkit-scrollbar { width: 6px; }
.filter-options::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.filter-options::-webkit-scrollbar-thumb { background: #888; border-radius: 10px; }
.filter-options::-webkit-scrollbar-thumb:hover { background: #555; }

.filter-option {
    display: flex;
    align-items: center;
    padding: 10px 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 4px;
}

.filter-option:hover { background-color: #f8f9fa; }

.filter-option.selected {
    background-color: #e8f4fc;
    border-left: 3px solid #2271b1;
    padding-left: 7px;
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #2271b1;
    flex-shrink: 0;
}

.filter-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    font-size: 14px;
    color: #333;
}

.filter-count {
    color: #999;
    font-size: 13px;
    margin-left: 8px;
}

.active-filters {
    margin-top: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.active-filters h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background-color: #2271b1;
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
    line-height: 1;
}

.remove-filter {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    margin-left: 8px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.remove-filter:hover { opacity: 0.8; }

.posts-container { position: relative; }

.posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.results-count { font-size: 16px; color: #666; }
.results-count-number { font-weight: 600; color: #333; }

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 100;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

.loading-text { margin-top: 15px; font-size: 14px; color: #646970; }

.posts-grid {
    display: grid;
    transition: opacity 0.3s;
}

.posts-grid.loading { opacity: 0.5; }

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

@media (min-width: 769px) and (max-width: 1200px) {
    .posts-grid[style*="repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
    .posts-grid[style*="repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
}

.post-item, .product-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    height: 100%;
}

.post-item:hover, .product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.post-thumbnail, .product-thumbnail {
    position: relative;
    overflow: hidden;
    padding-top: 100%; /* Square 1:1 aspect ratio */
    background-color: #f0f0f0;
    flex-shrink: 0;
}

.post-thumbnail img, .product-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

/* Image Fit: Contain - Show full image without cropping */
.image-fit-contain .post-thumbnail img,
.image-fit-contain .product-thumbnail img {
    object-fit: contain;
    background-color: #fff;
}

.post-item:hover .post-thumbnail img,
.product-item:hover .product-thumbnail img {
    transform: scale(1.05);
}

.post-content, .product-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.post-categories, .product-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 28px;
}

.post-category, .product-category {
    display: inline-block;
    padding: 4px 12px;
    background-color: #f0f0f0;
    color: #666;
    font-size: 12px;
    border-radius: 3px;
    font-weight: 500;
}

.post-title, .product-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    line-height: 1.4;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 56px;
}

.post-title a, .product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.post-title a:hover, .product-title a:hover { color: #2271b1; }

.post-author, .post-date {
    font-size: 13px;
    color: #999;
    margin: 0 0 5px 0;
    line-height: 1.5;
}

.post-excerpt, .product-excerpt {
    color: #666;
    line-height: 1.6;
    margin: 0 0 15px 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
    min-height: 27px;
}

.product-price del { color: #999; font-weight: 400; margin-right: 8px; }
.product-price ins { text-decoration: none; color: #e74c3c; }

.product-actions { margin-top: auto; padding-top: 15px; }

.product-actions .button,
.product-actions .add_to_cart_button,
.product-actions .product_type_variable,
.product-actions .product_type_simple,
.product-actions .product_type_grouped,
.product-actions .product_type_external,
.product-actions .view-product,
.product-actions a.button {
    display: inline-block;
    width: 100%;
    padding: 12px 20px;
    background-color: #2271b1;
    color: #fff !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
    box-sizing: border-box;
}

.product-actions .button:hover,
.product-actions .add_to_cart_button:hover,
.product-actions .product_type_variable:hover,
.product-actions .product_type_simple:hover,
.product-actions .product_type_grouped:hover,
.product-actions .product_type_external:hover,
.product-actions .view-product:hover,
.product-actions a.button:hover {
    background-color: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.read-more {
    display: inline-block;
    padding: 12px 20px;
    background-color: #2271b1;
    color: #fff !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
    align-self: flex-start;
    margin-top: auto;
}

.read-more:hover {
    background-color: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.posts-pagination { margin-top: 50px; }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 10px 15px;
    background: #fff;
    border: 1px solid #e5e5e5;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
    font-size: 14px;
}

.pagination a:hover {
    background-color: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.pagination .current {
    background-color: #2271b1;
    color: #fff;
    border-color: #2271b1;
    font-weight: 600;
}

.no-posts {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
    background: #f9f9f9;
    border-radius: 8px;
}

.load-more-wrapper { text-align: center; padding: 40px 0; }

.load-more-btn {
    padding: 14px 40px !important;
    background-color: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.load-more-btn:hover {
    background-color: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media (max-width: 768px) {
    .post-product-filter-wrapper { padding: 20px 15px; }
    .filter-container { gap: 20px; }
    .filter-sidebar { position: relative; top: 0; }
    .posts-grid { gap: 20px; }
    .post-title, .product-title { font-size: 18px; min-height: 50px; }
}

.post-thumbnail-placeholder { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }

.thumbnail-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail-placeholder .dashicons {
    font-size: 80px;
    width: 80px;
    height: 80px;
    color: rgba(255, 255, 255, 0.5);
}

.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #d63638;
    background: #fff5f5;
    border-radius: 8px;
    border: 1px solid #ffcccc;
}

/* ============ MOBILE FILTER MODAL - Amazon Style ============ */

/* Mobile Filter Toggle Button - Hidden on desktop */
.mobile-filter-toggle {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: 15px;
}

.mobile-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-filter-btn:hover {
    background: #eee;
    border-color: #ccc;
}

.mobile-filter-btn .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

.mobile-filter-count {
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.mobile-results-count {
    font-size: 14px;
    color: #666;
}

.mobile-results-count .results-count-number {
    font-weight: 600;
    color: #333;
}

/* Mobile Filter Modal */
.mobile-filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: none;
}

.mobile-filter-modal.active {
    display: block !important;
}

.mobile-filter-modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.mobile-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.mobile-filter-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.mobile-filter-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-filter-close:hover {
    color: #333;
}

.mobile-filter-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.mobile-filter-body .filter-group {
    border: none;
    border-bottom: 1px solid #e5e5e5;
    border-radius: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    background: #fff;
}

.mobile-filter-body .filter-group-title {
    padding: 16px 20px;
    margin: 0;
    border-bottom: none;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-filter-body .filter-group-title .toggle-icon {
    transition: transform 0.2s;
}

.mobile-filter-body .filter-group-title.expanded .toggle-icon {
    transform: rotate(180deg);
}

.mobile-filter-body .filter-group-content {
    padding: 0 20px 16px;
}

.mobile-filter-body .filter-group-content.collapsed {
    display: none;
}

.mobile-filter-body .filter-options {
    max-height: 200px;
    overflow-y: auto;
}

.mobile-filter-body .filter-option {
    padding: 12px 8px;
    border-radius: 6px;
}

.mobile-filter-body .filter-option input[type="checkbox"],
.mobile-filter-body .filter-option input[type="radio"] {
    width: 20px;
    height: 20px;
}

.mobile-filter-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
    flex-shrink: 0;
}

.mobile-filter-clear {
    flex: 1;
    padding: 14px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-filter-clear:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.mobile-filter-apply {
    flex: 2;
    padding: 14px 20px;
    background: #f0a500;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #111;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-filter-apply:hover {
    background: #e09800;
}

/* Responsive - Show mobile filter on smaller screens */
@media (max-width: 992px) {
    .mobile-filter-toggle {
        display: flex;
    }
    
    .filter-sidebar {
        display: none !important;
    }
    
    .filter-container {
        grid-template-columns: 1fr !important;
    }
    
    /* Hide desktop results count, use mobile one */
    .posts-header .results-count {
        display: none;
    }
}

/* Body scroll lock when modal is open */
body.mobile-filter-open {
    overflow: hidden;
}
