/* استایل بخش محصولات صفحه اصلی — منتقل‌شده از <style> داخل قالب برای کش بهتر */

.dg-product-section *,
.dg-product-section *::before,
.dg-product-section *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.dg-product-section {
    --ps-primary: #6366f1;
    --ps-primary-dark: #4f46e5;
    --ps-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --ps-accent: #f59e0b;

    width: 100%;
    max-width: 1320px;
    margin: 60px auto;
    padding: 0 24px;
    direction: rtl;
    position: relative;
    overflow: hidden;
}

/* هدر بخش */
.dg-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.dg-section-title-wrap { text-align: right; }

.dg-section-title {
    font-family: 'Vazir', sans-serif;
    font-size: clamp(1.4rem, 2.5vw, 1.875rem);
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
    position: relative;
    display: inline-block;
    padding-right: 20px;
    letter-spacing: -0.5px;
}

.dg-section-title::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 5px;
    height: 100%;
    background: {% if is_promoted %}var(--ps-accent){% else %}var(--ps-gradient){% endif %};
    border-radius: 9999px;
    box-shadow: 0 0 15px {% if is_promoted %}rgba(245, 158, 11, 0.5){% else %}rgba(99, 102, 241, 0.4){% endif %};
}

.dg-section-subtitle {
    font-family: 'Vazir', sans-serif;
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.7;
}

/* دکمه مشاهده همه */
.dg-section-view-all {
    padding: 10px 20px;
    background: {% if is_promoted %}rgba(245, 158, 11, 0.1){% else %}rgba(99, 102, 241, 0.08){% endif %};
    color: {% if is_promoted %}#d97706{% else %}#4f46e5{% endif %};
    border: 1px solid {% if is_promoted %}rgba(245, 158, 11, 0.2){% else %}rgba(99, 102, 241, 0.15){% endif %};
    border-radius: 12px;
    font-family: 'Vazir', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dg-section-view-all:hover {
    background: {% if is_promoted %}#f59e0b{% else %}var(--ps-gradient){% endif %};
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px {% if is_promoted %}rgba(245, 158, 11, 0.3){% else %}rgba(99, 102, 241, 0.3){% endif %};
    border-color: transparent;
}

.dg-section-view-all svg { width: 16px; height: 16px; }

/* گرید محصولات */
.dg-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

/* کارت محصول - مدرن با گلس‌مورفیسم */
.dg-product-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    position: relative;
    box-shadow: 0 4px 20px -5px rgba(15, 23, 42, 0.08);
}

.dg-product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
}

/* تصویر محصول */
.dg-product-card__image {
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    position: relative;
}

.dg-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.dg-product-card:hover .dg-product-card__image img {
    transform: scale(1.08);
}

/* اورلی روی تصویر هنگام hover */
.dg-product-card__image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(15, 23, 42, 0.4) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.dg-product-card:hover .dg-product-card__image::after {
    opacity: 1;
}

/* بجت‌ها */
.dg-product-card__badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: {% if is_promoted %}#f59e0b{% else %}var(--ps-gradient){% endif %};
    color: #fff;
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
    z-index: 1;
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.dg-product-card__discount-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    z-index: 1;
}

/* بدنه کارت */
.dg-product-card__body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* برند */
.dg-product-card__brand {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 6px;
    font-weight: 500;
}

/* عنوان */
.dg-product-card__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.85em;
    transition: color 0.3s ease;
}

.dg-product-card:hover .dg-product-card__title {
    color: var(--ps-primary-dark);
}

/* قیمت */
.dg-product-card__price {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dg-product-card__price-original {
    font-size: 0.8rem;
    color: #94a3b8;
    text-decoration: line-through;
    margin-bottom: 2px;
}

.dg-product-card__price-current {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.dg-product-card__price-current small {
    font-size: 0.75rem;
    font-weight: 400;
    color: #64748b;
}

/* خط افقی متحرک هنگام hover */
.dg-product-card__body::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 18px;
    left: 18px;
    height: 2px;
    background: var(--ps-gradient);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dg-product-card:hover .dg-product-card__body::after {
    transform: scaleX(1);
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .dg-product-section { margin: 40px auto; }

    .dg-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .dg-product-card__image { height: 180px; }
    .dg-product-card__title { font-size: 0.88rem; }
    .dg-product-card__price-current { font-size: 1rem; }
}

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

    .dg-product-card__image { height: 160px; }
    .dg-product-card__body { padding: 14px; }
}
