﻿
/* ============================================ */
/* پس‌زمینه گرادیانت طوسی ملایم - کل عرض */
/* ============================================ */
body {
    min-height: 100vh;
    background: linear-gradient( 180deg, #e8e8e8 0%, #f0f0f0 20%, #f5f5f5 40%, #fafafa 60%, transparent 80% ), #ffffff;
    background-attachment: fixed;
}

/* ============================================ */
/* کانتینر وسط */
/* ============================================ */
.panel.panel-default {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
    margin: 20px auto;
}

.panel-body {
    padding: 30px 25px;
}

/* ============================================ */
/* کانتینر مقالات - وسط‌چین */
/* ============================================ */
#blog-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 30px 20px;
    position: relative;
    /* فقط یه بار paint میشه */
    contain: layout style;
}

    /* هاله نوری - بدون هیچ انیمیشن */
    #blog-container::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 85%;
        height: 80%;
        background: radial-gradient( ellipse at center, rgba(232, 76, 91, 0.06) 0%, transparent 70% );
        z-index: -1;
        pointer-events: none;
    }

    /* ============================================ */
    /* حذف استایل‌های اضافی Bootstrap */
    /* ============================================ */
    #blog-container .row {
        display: contents !important;
        margin: 0 !important;
    }

/* ----- کارت‌های عمومی (ads) ----- */
.ads {
    padding: 10px !important;
    margin: 15px 5px !important;
    flex: 0 1 calc(25% - 15px) !important;
    max-width: calc(25% - 15px) !important;
    min-width: 250px !important;
    min-height: 280px !important;
    width: 250px !important;
    height: 280px !important;
    contain: layout style paint;
}

/* ----- کارت‌های کاربر (my-ads) - بلندتر ----- */
.my-ads {
    padding: 10px !important;
    margin: 15px 5px !important;
    flex: 0 1 calc(25% - 15px) !important;
    max-width: calc(25% - 15px) !important;
    min-width: 250px !important;
    min-height: 320px !important;
    width: 250px !important;
    height: 320px !important;
    contain: layout style paint;
}
/* ============================================ */
/* کارت مقاله - فقط یک قاب - بهینه */
/* ============================================ */
.item-container {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* فقط transform و box-shadow ترنزیشن */
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    text-decoration: none !important;
    color: inherit !important;
    /* GPU acceleration بدون will-change */
    transform: translateZ(0);
    backface-visibility: hidden;
}

    /* hover ساده و سریع */
    .item-container:hover {
        transform: translateY(-4px) translateZ(0);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    }

    /* ============================================ */
    /* استایل محتوای کارت */
    /* ============================================ */
    .item-container .item-title {
        font-size: 14px;
        font-weight: 600;
        margin: 0 0 8px 0;
        line-height: 1.5;
        color: #333;
        order: 1;
    }

    .item-container .time-difference {
        order: 2;
    }

        .item-container .time-difference h6 {
            font-size: 12px;
            margin: 0 0 4px 0;
            color: #999;
        }

    .item-container .text-muted {
        order: 3;
    }

        .item-container .text-muted h6 {
            font-size: 13px;
            margin: 0 0 12px 0;
        }

    .item-container .fa-clock-o {
        font-size: 12px;
        margin-left: 4px;
        vertical-align: middle;
    }

    /* کانتینر تصویر */
    .item-container .img-container {
        order: 4;
        width: 100%;
        height: 140px;
        overflow: hidden;
        border-radius: 10px;
        margin-top: auto;
        background: #f5f5f5;
    }

.item-image,
.item-image-default {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    /* فقط scale ترنزیشن - سبک */
    transition: transform 0.2s ease-out;
}

.item-container:hover .item-image,
.item-container:hover .item-image-default {
    transform: scale(1.03);
}

/* ============================================ */
/* حذف underline */
/* ============================================ */
a.item-container,
a.item-container:hover,
a.item-container:focus,
a.item-container:active {
    text-decoration: none !important;
}

/* ============================================ */
/* دارک مود */
/* ============================================ */
[data-bs-theme="dark"] body,
body.dark-mode,
.dark body {
    background: linear-gradient( 180deg, #2a2a2a 0%, #252525 20%, #1f1f1f 40%, transparent 80% ), #1a1a1a;
    background-attachment: fixed;
}

    [data-bs-theme="dark"] .panel.panel-default,
    body.dark-mode .panel.panel-default,
    .dark .panel.panel-default {
        background: rgba(22, 22, 30, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.05);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    [data-bs-theme="dark"] #blog-container::before,
    body.dark-mode #blog-container::before,
    .dark #blog-container::before {
        background: radial-gradient( ellipse at center, rgba(232, 76, 91, 0.08) 0%, transparent 70% );
    }

    [data-bs-theme="dark"] .item-container,
    body.dark-mode .item-container,
    .dark .item-container {
        background: rgba(60, 60, 60, 0.7);
        border: 1px solid rgba(100, 100, 100, 0.5);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

        [data-bs-theme="dark"] .item-container:hover,
        body.dark-mode .item-container:hover,
        .dark .item-container:hover {
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
        }

        [data-bs-theme="dark"] .item-container .item-title,
        body.dark-mode .item-container .item-title,
        .dark .item-container .item-title {
            color: #e0e0e0 !important;
        }

        [data-bs-theme="dark"] .item-container .img-container,
        body.dark-mode .item-container .img-container,
        .dark .item-container .img-container {
            background: #484849;
        }

        [data-bs-theme="dark"] .item-container .text-muted,
        body.dark-mode .item-container .text-muted,
        .dark .item-container .text-muted {
            color: #999 !important;
        }

/* ============================================ */
/* موبایل - یک ستون وسط */
/* ============================================ */
@media (max-width: 768px) {
    .panel-body {
        padding: 20px 15px;
    }

    #blog-container {
        padding: 20px 12px;
        gap: 16px;
    }

    .my-ads {
        flex: 0 1 100% !important;
        max-width: 100% !important;
    }

    .item-container .img-container {
        height: 180px;
    }
}

/* ============================================ */
/* تبلت - دو ستون */
/* ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .my-ads {
        flex: 0 1 calc(50% - 10px) !important;
        max-width: calc(50% - 10px) !important;
    }
}
/*for image default for ads*/
/* ============================================ */
/* عکس پیش‌فرض */
/* ============================================ */
.item-image-default {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
    margin: auto;
}

.item-container .img-container:has(.item-image-default) {
    display: flex;
    align-items: center;
    justify-content: center;
}
