/**
 * Product Filter Styles
 * Inspired Crystal Awards
 * Developed by AppWT LLC
 */

/* =============================================
   LAYOUT
   ============================================= */
#product-filter-app {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

@media (max-width: 992px) {
    #product-filter-app {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   FILTER SIDEBAR
   ============================================= */
.filter-sidebar {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: fit-content;
    position: sticky;
    top: 100px;
}

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

.filter-section {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.filter-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.filter-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e3a5f;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Search */
.filter-search {
    display: flex;
    gap: 8px;
}

.filter-search input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.filter-search input:focus {
    outline: none;
    border-color: #2563eb;
}

.filter-search button {
    padding: 10px 14px;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-search button:hover {
    background: #2c4a73;
}

/* Select */
.filter-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

/* Checkboxes */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 0;
}

.filter-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: #1e3a5f;
    cursor: pointer;
}

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

.filter-icon {
    font-size: 16px;
}

.filter-count {
    font-size: 12px;
    color: #9ca3af;
}

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

.price-input {
    flex: 1;
    position: relative;
}

.price-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-size: 14px;
}

.price-input input {
    width: 100%;
    padding: 10px 12px 10px 28px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

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

.btn-apply-price {
    width: 100%;
    padding: 10px;
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-apply-price:hover {
    background: #e5e7eb;
}

/* Tags */
.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tag:hover {
    background: #e5e7eb;
}

.filter-tag.active {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}

/* Clear Button */
.btn-clear-filters {
    width: 100%;
    padding: 12px;
    background: #fee2e2;
    color: #991b1b;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-clear-filters:hover {
    background: #fecaca;
}

/* =============================================
   PRODUCT GRID CONTAINER
   ============================================= */
.product-grid-container {
    position: relative;
    min-height: 400px;
}

.product-grid-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.product-grid-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #e5e7eb;
    border-top-color: #1e3a5f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 11;
}

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

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.results-count {
    font-size: 14px;
    color: #6b7280;
}

/* =============================================
   PRODUCT GRID
   ============================================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
}

@media (max-width: 576px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Product Card */
.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-image {
    position: relative;
    aspect-ratio: 1;
    background: #f9fafb;
    overflow: hidden;
}

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

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

.no-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #e5e7eb;
    color: #9ca3af;
    font-size: 14px;
}

/* Badges */
.sale-badge,
.featured-badge {
    position: absolute;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    z-index: 2;
}

.sale-badge {
    top: 10px;
    left: 10px;
    background: #dc2626;
    color: #fff;
}

.featured-badge {
    top: 10px;
    right: 10px;
    background: #fbbf24;
    color: #1e3a5f;
}

/* Product Info */
.product-info {
    padding: 16px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: #1e3a5f;
    margin: 0 0 6px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-category {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-price,
.sale-price {
    font-size: 18px;
    font-weight: 700;
    color: #1e3a5f;
}

.sale-price {
    color: #dc2626;
}

.original-price {
    font-size: 14px;
    color: #9ca3af;
    text-decoration: line-through;
}

/* Add to Cart Button */
.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background: #1e3a5f;
    color: #fff;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.add-to-cart-btn:hover {
    background: #2c4a73;
}

/* =============================================
   NO PRODUCTS
   ============================================= */
.no-products {
    text-align: center;
    padding: 60px 20px;
    background: #f9fafb;
    border-radius: 12px;
}

.no-products svg {
    color: #d1d5db;
    margin-bottom: 20px;
}

.no-products h3 {
    font-size: 20px;
    color: #374151;
    margin: 0 0 8px 0;
}

.no-products p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 20px 0;
}

.btn-primary {
    display: inline-block;
    padding: 12px 24px;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2c4a73;
}

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e5e7eb;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.pagination-btn.active {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}

.pagination-ellipsis {
    color: #6b7280;
    font-size: 14px;
}

/* =============================================
   MOBILE FILTER TOGGLE
   ============================================= */
@media (max-width: 992px) {
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 20px;
        background: #1e3a5f;
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        margin-bottom: 20px;
    }

    .filter-sidebar {
        display: none;
    }

    .filter-sidebar.open {
        display: block;
    }
}

@media (min-width: 993px) {
    .mobile-filter-toggle {
        display: none;
    }
}
