/* ============================================
   Products Page Styles
   ============================================ */

/* ===== Header ===== */
.products-header {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.92), rgba(44, 24, 16, 0.88)), url('/images/products-header.webp') center/cover no-repeat;
    color: white;
    padding: 100px 0 60px;
    margin-bottom: 50px;
    position: relative;
    text-align: center;
    position: relative;
    min-height: 320px;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.products-header-overlay {
    width: 100%;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: linear-gradient( to bottom, rgba(0, 0, 0, 0.20), rgba(0, 0, 0, 0.60) );
}

.products-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}

.products-header p {
    font-size: 1.1rem;
    opacity: 0.85;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== Filters & Sorting ===== */
.filter-section {
    background: white;
    border-radius: 16px;
    padding: 25px 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    margin-bottom: 35px;
}

.sorting-options {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 15px;
}

.sort-btn {
    background: transparent;
    border: 2px solid #e5e7eb;
    color: #4a4a4a;
    padding: 8px 22px;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .sort-btn:hover,
    .sort-btn.active {
        background: #8B4513;
        color: white;
        border-color: #8B4513;
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(139, 69, 19, 0.25);
    }

.filter-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0ece8;
}

.filter-tag {
    background: #f8f4f0;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #4a4a4a;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .filter-tag .close {
        cursor: pointer;
        font-size: 1rem;
        opacity: 0.6;
        transition: opacity 0.3s ease;
    }

        .filter-tag .close:hover {
            opacity: 1;
        }

/* ===== Product Grid ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

/* ============================================
   Product Card
   ============================================ */
.product-card-grid {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    height: 100%;
    position: relative;
}

    .product-card-grid:hover {
        transform: translateY(-8px);
        box-shadow: 0 15px 40px rgba(0,0,0,0.12);
    }

    .product-card-grid .product-image {
        height: 360px;
        object-fit: cover;
        width: 100%;
        transition: transform 0.6s ease;
    }

    .product-card-grid:hover .product-image {
        transform: scale(1.04);
    }

    .product-card-grid .card-body {
        padding: 18px 20px 22px;
        display: flex;
        flex-direction: column;
        flex: 1;
    }

    .product-card-grid .card-title {
        font-size: 1.05rem;
        font-weight: 600;
        color: #2C1810;
        margin-bottom: 6px;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 48px;
    }

        .product-card-grid .card-title a {
            color: #2C1810;
            text-decoration: none;
            transition: color 0.3s ease;
        }

            .product-card-grid .card-title a:hover {
                color: #8B4513;
            }

    .product-card-grid .card-text {
        color: #6c757d;
        font-size: 0.88rem;
        margin-bottom: 12px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 40px;
    }

/* ===== کد محصول ===== */
.product-code {
    font-size: 0.78rem;
    color: #999;
    margin-bottom: 8px;
}

/* ===== قیمت‌ها ===== */
.product-prices {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

    .product-prices .old-price {
        font-size: 0.85rem;
        color: #999;
        text-decoration: line-through;
    }

    .product-prices .product-price {
        font-size: 1.2rem;
        font-weight: 700;
        color: #8B4513;
    }

/* ===== تخفیف ===== */
.discount-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    z-index: 5;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* ===== دکمه علاقه‌مندی ===== */
.btn-favorite {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    z-index: 5;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

    .btn-favorite i {
        font-size: 1rem;
        color: #ccc;
        transition: all 0.3s ease;
    }

    .btn-favorite:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    }

    .btn-favorite.favorited i {
        color: #e74c3c;
    }

    .btn-favorite.favorited {
        background: #fff5f5;
    }

/* ===== دکمه‌های اقدام ===== */
.product-actions-bottom {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 12px;
}

    .product-actions-bottom .btn {
        flex: 1;
        padding: 8px 14px;
        font-size: 0.85rem;
        border-radius: 10px;
        font-weight: 500;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

        .product-actions-bottom .btn i {
            font-size: 0.9rem;
        }

    .product-actions-bottom .btn-primary {
        background: linear-gradient(135deg, #8B4513, #A0522D);
        border: none;
        color: white;
    }

        .product-actions-bottom .btn-primary:hover {
            background: linear-gradient(135deg, #A0522D, #8B4513);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(139, 69, 19, 0.3);
        }

    .product-actions-bottom .btn-outline-primary {
        border: 2px solid #8B4513;
        color: #8B4513;
        background: transparent;
    }

        .product-actions-bottom .btn-outline-primary:hover {
            background: #8B4513;
            color: white;
            transform: translateY(-2px);
        }

    .product-actions-bottom .btn-secondary {
        background: #6c757d;
        border: none;
        color: white;
        cursor: not-allowed;
        opacity: 0.6;
    }

/* ===== رتبه‌بندی ===== */
.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.product-rating {
    color: #f4a460;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

    .product-rating .text-light {
        color: #ddd !important;
    }

    .product-rating .text-warning {
        color: #f4a460 !important;
    }

    .product-rating .rating-count {
        color: #999;
        font-size: 0.8rem;
    }

/* ===== Quick View ===== */
.quick-view-btn {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    padding: 8px 24px;
    border-radius: 25px;
    opacity: 0;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    cursor: pointer;
    z-index: 5;
    color: #2C1810;
    font-size: 0.85rem;
}

    .quick-view-btn:hover {
        background: white;
        transform: translateX(-50%) scale(1.05);
        box-shadow: 0 6px 25px rgba(0,0,0,0.15);
    }

.product-card-grid:hover .quick-view-btn {
    opacity: 1;
}

/* ===== Pagination ===== */
.pagination {
    justify-content: center;
    margin-top: 40px;
    gap: 4px;
}

.page-link {
    color: #2C1810;
    border: 1px solid #e5e7eb;
    padding: 10px 18px;
    border-radius: 8px !important;
    transition: all 0.3s ease;
    font-weight: 500;
}

    .page-link:hover {
        background: #8B4513;
        color: white;
        border-color: #8B4513;
        transform: translateY(-2px);
    }

.page-item.active .page-link {
    background: #8B4513;
    border-color: #8B4513;
    color: white;
}

.page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Loading ===== */
.products-loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 45px;
    height: 45px;
    border: 4px solid #f0ece8;
    border-top: 4px solid #8B4513;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.products-loading p {
    color: #999;
    font-size: 0.95rem;
}

/* ===== No Products ===== */
.no-products {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

    .no-products i {
        font-size: 3.5rem;
        color: #ddd;
        margin-bottom: 15px;
    }

    .no-products h4 {
        color: #2C1810;
        margin-bottom: 8px;
    }

    .no-products p {
        color: #999;
    }

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 991.98px) {
    .products-header {
        padding: 80px 0 50px;
    }

        .products-header h1 {
            font-size: 2.5rem;
        }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 25px;
    }

    .product-card-grid .product-image {
        height: 220px;
    }
}

@media (max-width: 767.98px) {
    .products-header {
        padding: 70px 0 40px;
        margin-bottom: 30px;
        min-height: 240px;
        background-position: center center;
    }

    .products-header-overlay {
        min-height: 240px;
        padding: 45px 15px;
    }

    .products-header h1 {
        font-size: 2rem;
    }

    .products-header p {
        font-size: 0.95rem;
    }

    .filter-section {
        padding: 18px 20px;
        margin-bottom: 25px;
    }

    .sorting-options {
        justify-content: center;
        gap: 8px;
    }

    .sort-btn {
        padding: 6px 16px;
        font-size: 0.75rem;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 18px;
    }

    .product-card-grid .product-image {
        height: 180px;
    }

    .product-card-grid .card-body {
        padding: 14px 16px 18px;
    }

    .product-card-grid .card-title {
        font-size: 1.08rem;
        min-height: 40px;
    }

    .product-prices .product-price {
        font-size: 1rem;
    }

    .product-prices .old-price {
        font-size: 0.75rem;
    }

    .product-actions-bottom .btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

        .product-actions-bottom .btn .btn-text {
            display: none;
        }

        .product-actions-bottom .btn i {
            font-size: 0.9rem;
        }

    .quick-view-btn {
        display: none;
    }

    .btn-favorite {
        width: 32px;
        height: 32px;
        top: 8px;
        left: 8px;
    }

        .btn-favorite i {
            font-size: 0.85rem;
        }

    .discount-badge {
        font-size: 0.65rem;
        padding: 3px 10px;
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .products-header {
        padding: 60px 0 30px;
    }

        .products-header h1 {
            font-size: 1.6rem;
        }

    .filter-section {
        padding: 14px 15px;
    }

    .sort-btn {
        padding: 5px 12px;
        font-size: 0.7rem;
    }

    .product-grid {
        gap: 12px;
    }

    .product-card-grid .product-image {
        height: 350px;
    }

    .product-card-grid .card-body {
        padding: 10px 12px 14px;
    }

    .product-card-grid .card-title {
        font-size: 1.8rem;
        min-height: 34px;
    }

    .product-card-grid .card-text {
        display: none;
    }

    .product-prices .product-price {
        font-size: 0.85rem;
    }

    .product-prices .old-price {
        font-size: 0.65rem;
    }

    .product-code {
        font-size: 0.65rem;
    }

    .product-actions-bottom {
        gap: 6px;
        padding-top: 8px;
    }

        .product-actions-bottom .btn {
            padding: 5px 8px;
            font-size: 0.65rem;
            border-radius: 6px;
        }

    .btn-favorite {
        width: 28px;
        height: 28px;
        top: 6px;
        left: 6px;
    }

        .btn-favorite i {
            font-size: 0.7rem;
        }

    .discount-badge {
        font-size: 0.55rem;
        padding: 2px 8px;
        top: 8px;
        right: 8px;
    }

    .page-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}
/* ============================================
   فیلتر محصولات - تنظیم منوی کشویی در موبایل
   ============================================ */

/* ===== دکمه دسته‌بندی ===== */
.category-dropdown .sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

/* ===== تنظیمات پایه برای دسکتاپ ===== */
.category-dropdown .dropdown-menu {
    border: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 8px 0;
    min-width: 200px;
}

.category-dropdown .dropdown-item {
    padding: 8px 20px;
    font-size: 0.9rem;
    color: #2C1810;
    transition: all 0.3s ease;
}

    .category-dropdown .dropdown-item:hover {
        background: #f8f4f0;
        color: #8B4513;
    }

.category-dropdown .dropdown-divider {
    margin: 4px 0;
}

/* ============================================
   Full-Width Dropdown در موبایل
   ============================================ */
@media (max-width: 767.98px) {
    /* ===== Sorting Options ===== */
    .sorting-options {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        justify-content: flex-start !important;
        padding: 5px 0;
    }

        .sorting-options .sort-btn {
            padding: 4px 10px !important;
            font-size: 0.7rem !important;
            border-radius: 20px !important;
        }

        .sorting-options .fw-bold {
            display: none !important;
        }

    /* ===== منوی دسته‌بندی Full-Width ===== */
    .category-dropdown {
        position: relative !important;
    }

        .category-dropdown .dropdown-menu.category-dropdown-menu {
            position: fixed !important;
            top: auto !important;
            right: 0 !important;
            left: 0 !important;
            width: 100% !important;
            min-width: unset !important;
            max-width: unset !important;
            border-radius: 0 !important;
            box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
            padding: 12px 0 !important;
            margin: 0 !important;
            transform: none !important;
            will-change: auto !important;
            max-height: calc(100vh - 200px);
            overflow-y: auto;
            border: none;
            background: var(--white);
            z-index: 1050;
            display: none !important;
            animation: slideDown 0.25s ease forwards;
            border-top: 2px solid #8B4513;
        }

            .category-dropdown .dropdown-menu.category-dropdown-menu.show {
                display: block !important;
            }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* ===== آیتم‌های منو ===== */
    .category-dropdown .dropdown-item {
        padding: 12px 24px !important;
        font-size: 0.95rem !important;
        border-bottom: 1px solid #f5f5f5;
        display: flex;
        align-items: center;
        justify-content: space-between;
        color: #2C1810;
        transition: all 0.3s ease;
    }

        .category-dropdown .dropdown-item:last-child {
            border-bottom: none;
        }

        .category-dropdown .dropdown-item:hover {
            background: #f8f4f0;
            color: #8B4513;
            padding-right: 30px !important;
        }

        /* اضافه کردن آیکون به آیتم‌ها */
        .category-dropdown .dropdown-item::after {
            content: '\f100';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            color: #8B4513;
            font-size: 0.8rem;
            opacity: 0;
            transition: all 0.3s ease;
        }

        .category-dropdown .dropdown-item:hover::after {
            opacity: 1;
            transform: translateX(-5px);
        }

    .category-dropdown .dropdown-divider {
        margin: 6px 0;
    }

    /* ===== دکمه بستن منو ===== */
    .category-dropdown .dropdown-close-btn {
        position: absolute;
        top: 10px;
        left: 15px;
        background: none;
        border: none;
        font-size: 1.2rem;
        color: #999;
        cursor: pointer;
        padding: 5px;
        transition: color 0.3s ease;
        z-index: 10;
    }

        .category-dropdown .dropdown-close-btn:hover {
            color: #333;
        }

    /* ===== Header منو ===== */
    .category-dropdown .dropdown-header-title {
        padding: 8px 24px 12px;
        font-size: 1rem;
        font-weight: 600;
        color: #2C1810;
        border-bottom: 2px solid #8B4513;
        margin-bottom: 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* ===== دکمه دسته‌بندی در موبایل ===== */
    .category-dropdown .sort-btn.dropdown-toggle {
        padding: 4px 12px !important;
        font-size: 0.75rem !important;
        border-radius: 20px !important;
        background: #f8f4f0;
        border: 1px solid #e5ddd5;
        color: #2C1810;
    }

        .category-dropdown .sort-btn.dropdown-toggle:hover {
            background: #8B4513;
            color: white;
            border-color: #8B4513;
        }

        .category-dropdown .sort-btn.dropdown-toggle::after {
            margin-right: 4px;
            font-size: 0.6rem;
        }

    /* ===== نمایش تعداد دسته‌بندی ===== */
    .category-dropdown .category-count {
        font-size: 0.7rem;
        color: #999;
        background: #f0ece8;
        padding: 1px 8px;
        border-radius: 12px;
        margin-right: 4px;
    }

    /* ===== Overlay برای بستن منو ===== */
    .dropdown-overlay-category {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.3);
        z-index: 1040;
        display: none;
    }

        .dropdown-overlay-category.show {
            display: block;
        }
}

/* ============================================
   موبایل بسیار کوچک
   ============================================ */
@media (max-width: 480px) {
    .sorting-options {
        gap: 4px;
    }

        .sorting-options .sort-btn {
            padding: 3px 8px !important;
            font-size: 0.6rem !important;
        }

    .category-dropdown .dropdown-menu.category-dropdown-menu {
        max-height: calc(100vh - 180px);
    }

    .category-dropdown .dropdown-item {
        padding: 10px 18px !important;
        font-size: 0.85rem !important;
    }

    .category-dropdown .dropdown-header-title {
        padding: 6px 18px 10px;
        font-size: 0.9rem;
    }

    .category-dropdown .sort-btn.dropdown-toggle {
        padding: 3px 10px !important;
        font-size: 0.65rem !important;
    }

    .category-dropdown .dropdown-close-btn {
        top: 6px;
        left: 10px;
        font-size: 1rem;
    }

    .category-dropdown .category-count {
        font-size: 0.6rem;
        padding: 0 6px;
    }
}

/* ============================================
   تبلت
   ============================================ */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sorting-options {
        justify-content: flex-end !important;
    }

        .sorting-options .sort-btn {
            padding: 5px 14px !important;
            font-size: 0.8rem !important;
        }

    .category-dropdown .dropdown-menu {
        min-width: 220px !important;
    }
}
