/* بک‌دراپ برای تیره کردن پس‌زمینه */
.ppc-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    display: none;
}

/* استایل اصلی پاپ‌آپ */
.ppc-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1500px;
    max-height: 105vh;
    background: #fff;
    z-index: 9999;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
}

/* هدر پاپ‌آپ */
.ppc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 20px;
}

/* عنوان هدر */
.ppc-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

/* دکمه بستن */
.ppc-close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #333;
    line-height: 1;
}

/* محتوای پاپ‌آپ بدون اسکرول کلی */
.ppc-content {
    padding: 20px;
    max-height: calc(85vh - 60px); /* تنظیم ارتفاع با توجه به هدر */
    box-sizing: border-box;
    overflow: hidden; /* حذف اسکرول کلی */
}

/* جدول مقایسه */
.ppc-table {
    width: 100%;
    table-layout: fixed;
    border: 1px solid #ddd; /* خط مرزی کل جدول */
    border-radius: 10px;
    padding: 5px;
}

/* ستون ویژگی‌ها */
.ppc-attribute-column {
    width: 200px; /* عرض ثابت 200px */
    text-align: center;
    padding: 12px;
    border: 1px solid #ddd; /* خط مرزی برای هر سلول */
    vertical-align: middle;
    font-size: 14px;
    background-color: #f9f9f9; /* پس‌زمینه برای تمایز */
}

/* ستون محصولات */
.ppc-product-column {
    padding: 12px;
    border: 1px solid #ddd; /* خط مرزی برای هر سلول */
    text-align: center;
    vertical-align: middle;
    font-size: 14px;
    position: relative;
    background-color: #fff; /* پس‌زمینه برای تمایز */
}

/* ستون خالی 15 پیکسلی فقط برای هدر */
.ppc-scroll-offset-column {
    width: 13px; /* ستون برای جبران عرض نوار اسکرول */
    padding: 0;
}

/* تنظیم عرض ستون‌ها بر اساس تعداد */
.ppc-table th.ppc-product-column,
.ppc-table td.ppc-product-column {
    width: calc((100% - 200px) / 4); /* پیش‌فرض برای 4 ستون بدون فاصله نوار اسکرول */
}

.ppc-table th.ppc-product-column:nth-child(2),
.ppc-table td.ppc-product-column:nth-child(2) {
    width: calc((100% - 200px) / 2); /* 2 ستون بدون فاصله نوار اسکرول */
}

.ppc-table th.ppc-product-column:nth-child(n+2):nth-child(-n+3),
.ppc-table td.ppc-product-column:nth-child(n+2):nth-child(-n+3) {
    width: calc((100% - 200px) / 3); /* 3 ستون بدون فاصله نوار اسکرول */
}

.ppc-table.has-scroll th.ppc-product-column,
.ppc-table.has-scroll td.ppc-product-column {
    width: calc((100% - 200px - 15px) / 4); /* پیش‌فرض برای 4 ستون با فاصله نوار اسکرول */
}

.ppc-table.has-scroll th.ppc-product-column:nth-child(2),
.ppc-table.has-scroll td.ppc-product-column:nth-child(2) {
    width: calc((100% - 200px - 15px) / 2); /* 2 ستون با فاصله نوار اسکرول */
}

.ppc-table.has-scroll th.ppc-product-column:nth-child(n+2):nth-child(-n+3),
.ppc-table.has-scroll td.ppc-product-column:nth-child(n+2):nth-child(-n+3) {
    width: calc((100% - 200px - 15px) / 3); /* 3 ستون با فاصله نوار اسکرول */
}

/* تصویر محصول در هدر جدول */
.ppc-table th img,
.ppc-table td img {
    max-width: 100px;
    height: auto;
    margin: 0 auto; /* وسط‌چین افقی */
    display: block; /* برای مدیریت بهتر */
    text-align: center; /* اطمینان از وسط‌چین */
}

/* دکمه حذف ستون */
.ppc-remove-column {
    position: absolute;
    top: 15px;
    right: 10px;
    cursor: pointer;
    font-size: 18px;
    color: #f00;
    display: none;
    z-index: 1; /* اولویت بالاتر برای نمایش */
}

/* نمایش دکمه حذف فقط برای ستون‌های اضافی کنار عکس */
.ppc-product-column:not(:first-child) .ppc-remove-column {
    display: inline-block;
}

/* دکمه افزودن مقایسه */
.ppc-add-compare {
    padding: 10px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    width: 150px;
    text-align: center;
}

/* افکت هاور برای دکمه */
.ppc-add-compare:hover {
    background: #005f87;
}

/* بخش جستجو */
.ppc-search {
    margin: 10px 0;
    width: 100%;
    display: none;
}

/* ورودی جستجو */
.ppc-search input {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

/* لیست نتایج جستجو */
#ppc-search-results {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* آیتم‌های نتایج جستجو */
#ppc-search-results li {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    justify-content: flex-start;
}

/* تصویر در نتایج جستجو */
#ppc-search-results li img {
    width: 40px;
    height: auto;
    margin-left: 20px; /* مارجین راست 15px */
}

/* عنوان در نتایج جستجو */
#ppc-search-results li span {
    margin-left: 0; /* حذف مارجین چپ قبلی */
}

/* افکت هاور برای نتایج جستجو */
#ppc-search-results li:hover {
    background: #f5f5f5;
}

/* جلوگیری از اسکرول پس‌زمینه */
body.ppc-modal-open {
    overflow: hidden;
}

/* اطمینان از عدم تداخل */
.ppc-modal * {
    box-sizing: border-box;
}

/* ستون خالی برای دکمه */
.ppc-empty-column {
    text-align: center;
    vertical-align: middle;
}

/* اولویت بالاتر برای استایل‌های جدول */
.ppc-table,
.ppc-table th,
.ppc-table td {
    !important; /* اولویت بالاتر برای جلوگیری از تداخل */
}

/* ثابت نگه داشتن ردیف اول (هدر) */
.ppc-table thead th {
    position: sticky;
    top: 0;
    z-index: 2; /* اولویت بالاتر برای هدر */
}

/* اسکرول فقط برای بدنه جدول */
.ppc-table tbody {
    display: block;
    max-height: calc(90vh - 370px); /* تنظیم ارتفاع با توجه به هدر */
    overflow-y: auto; /* اسکرول فقط در صورت نیاز */
}

.ppc-table thead tr,
.ppc-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

/* استایل دکمه مقایسه */
.ppc-open {
    background: #ebebeb;
    font-size: 12px; /* اندازه فونت کوچکتر */
    border: none; /* حذف بوردر */
    color: #2c2c2c; /* رنگ متن */
    padding: 8px 12px; /* پدینگ برای ظاهر بهتر */
    border-radius: 5px; /* گوشه‌های گرد */
    cursor: pointer;
    display: inline-flex; /* برای تراز کردن آیکون و متن */
    align-items: center; /* تراز عمودی */
    transition: background 0.2s; /* افکت نرم برای هاور */
}

/* آیکون قبل از دکمه */
.ppc-open::before {
    content: '\f24d'; /* کد آیکون مقایسه از Font Awesome */
    font-family: 'Font Awesome 6 Pro';
    font-weight: 400; /* وزن فونت برای آیکون‌های solid */
    margin-left: 7px; /* فاصله آیکون از متن */
    font-size: 12px; /* اندازه آیکون هماهنگ با متن */
}
