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

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

.dg-top-products {
    --tp-primary: #6366f1;
    --tp-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

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

/* دکوراسیون پس‌زمینه */
.dg-top-products::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    transform: translateY(-50%);
}

/* هدر بخش */
.dg-section-header {
    text-align: center;
    margin-bottom: 40px;
}

.dg-section-title {
    font-family: 'Vazir', sans-serif;
    font-size: clamp(1.6rem, 3vw, 2.25rem);
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
    position: relative;
    display: inline-block;
    letter-spacing: -0.5px;
}

.dg-section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 50%;
    transform: translateX(50%);
    width: 80px;
    height: 4px;
    background: var(--tp-gradient);
    border-radius: 9999px;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.dg-section-subtitle {
    font-family: 'Vazir', sans-serif;
    font-size: 1rem;
    color: #64748b;
    margin-top: 20px;
}

/* تب‌ها - مدرن */
.dg-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    padding: 8px;
    background: rgba(241, 245, 249, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.dg-tab {
    padding: 10px 24px;
    background: transparent;
    color: #64748b;
    border: none;
    border-radius: 12px;
    font-family: 'Vazir', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.dg-tab svg { width: 16px; height: 16px; }

.dg-tab:hover {
    color: #4f46e5;
    background: rgba(99, 102, 241, 0.05);
}

.dg-tab.active {
    background: var(--tp-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

/* محتوای تب */
.dg-tab-content { display: none; }
.dg-tab-content.active {
    display: block;
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* کارت محصول - مشابه product_section اما با طراحی لوکس */
.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);
}

.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: var(--tp-gradient);
    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__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: #4f46e5;
}

.dg-product-card__price {
    margin-top: auto;
}

.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;
}

.dg-product-card__body::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 18px;
    left: 18px;
    height: 2px;
    background: var(--tp-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-top-products { 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; }

    .dg-tab {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}
