/**
 * برد مقایسه‌ی قیمت — همان طراحیِ قبلی، منتقل‌شده از
 * iranbroker-tools/assets/public/css/ibw-exchange-comparison-short-code.css
 *
 * عمداً همان کلاس‌ها و همان مقادیر است تا ظاهر مو‌به‌مو یکی بماند. سه تفاوت:
 *
 *  ۱. قبلاً با getCssFileAndCompress داخل یک تگ <style> در بلید چاپ می‌شد؛ حالا
 *     enqueue می‌شود با ورژنِ filemtime، پس هم کش‌پذیر است هم بعد از ویرایش
 *     خودش باستر می‌خورد.
 *  ۲. قواعدی که تم می‌تواند به آن‌ها برسد (لینک داخل جدول) دوکلاسه شده‌اند:
 *     تم روی محتوا `.contentstyle table a` (۰-۱-۲) دارد که تک‌کلاس را می‌بازد.
 *  ۳. دکمه‌های `<button>` قبلی حالا `<a>`اند تا لینک صرافی قابل کلیک‌راست، قابل
 *     باز کردن در تب جدید و برای خزنده قابل دیدن باشد — ظاهرشان یکی است.
 */

.ibwComparisonTitle {
    color: #475569;
    font-weight: 500;
}

.ibwComparisonTitle span {
    color: #185ADB;
    font-weight: 600;
}

.ibwComparisonTitle img {
    max-width: 35px !important;
    max-height: 35px !important;
    vertical-align: middle !important;
}

.ibw-comparison-main {
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
    border: 0;
    outline: none;
    box-sizing: border-box;
    align-content: center;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.ibw-exchange-logo {
    padding-left: 7px;
    border-radius: 3px;
    vertical-align: middle;
    max-width: 32px !important;
    max-height: 25px;
    margin: unset !important;
    display: unset !important;
}

.ibw-exchange-name-logo-row {
    text-align: right !important;
    color: #536670 !important;
    font-weight: 700;
    vertical-align: middle;
}

.ibw-price-suffix {
    font-weight: bolder;
}

.ibwTheadTiTleCoin {
    display: inline-block;
    margin-bottom: 0 !important;
    cursor: pointer;
    word-break: normal;
    text-align: center;
}

/* پیکان مرتب‌سازی: حالت فعلی از اتریبیوت sorttype خوانده می‌شود */
.ibwBuySort[sorttype=''] svg,
.ibwSellSort[sorttype=''] svg {
    display: none;
}

.ibwBuySort[sorttype='descending'] svg:last-child,
.ibwBuySort[sorttype='ascending'] svg:first-child {
    display: none;
}

.ibwSellSort[sorttype='descending'] svg:first-child,
.ibwSellSort[sorttype='ascending'] svg:last-child {
    display: none;
}

.ibwBestPrice {
    font-weight: 700;
    color: #017c01 !important;
}

.ibwBadPrice {
    font-weight: 700;
    color: #ff0000 !important;
}

.ibwDropdownWrap {
    display: flex;
    width: auto;
    text-align: center;
}

.ibwCoinsDropbtn {
    background: #F8FAFC;
    padding: 12px;
    border: 1px solid #E2E8F0;
    font-size: 14px !important;
    border-radius: 5px;
    text-align: right;
    font-weight: 600;
    min-width: 250px;
    color: #475569;
    cursor: pointer;
}

/* برچسب دکمه: لوگو + نام ارزِ انتخاب‌شده. چوران با ibwFlushSpan مطلق سمت چپ
   می‌نشیند، پس برچسب فقط باید جای خودش را نگه دارد و زیرش نرود. */
.ibwCoinsDropbtn__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 24px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.ibwCoinsDropbtn__label .ibwCoinImage {
    width: 22px;
    max-width: 22px;
    height: auto !important;
    flex: 0 0 auto;
}

.ibwCoinsDropbtn button {
    font: inherit !important;
    font-weight: inherit !important;
    vertical-align: middle !important;
}

.ibwFlushSpan {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
}

.ibwCoinsDropdown {
    position: relative;
    display: inline-block;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
}

.ibwCoinsDropdown-content {
    position: absolute;
    right: 0;
    top: calc(100% + 14px);
    background-color: #fff;
    z-index: 9;
    width: 100%;
    padding: 8px;
    border-radius: 10px;
    box-shadow: 0 12px 16px -4px rgba(0, 0, 0, .04), 0 4px 6px -2px rgba(0, 0, 0, .02);
    border: 1px solid #EBF0F5;
    height: 0;
    opacity: 0;
    visibility: hidden;
    transition: height .3s;
    overflow: hidden;
}

.ibwCoinsDropdown-content.show {
    height: 325px;
    opacity: 100;
    visibility: visible;
}

.ibwCoinImage {
    width: 25px;
    height: auto !important;
    border-radius: 25px;
}

.ibwCoinSearch {
    width: 100%;
}

.ibwCoinSearchInput {
    background: #F8FAFC;
    border: 1px solid #F8FAFC !important;
    border-radius: 6px;
    padding: 12px;
    outline: none;
    font-size: 14px !important;
    width: 100%;
    -webkit-transition: all .2s ease;
    transition: .25s ease;
    box-shadow: none;
}

.ibwCoinSearchInput::placeholder {
    font-size: 14px !important;
    font-weight: 500;
    color: #94A3B8;
}

.ibwDropdownWrap__item {
    margin-top: 8px;
    max-height: 250px;
    overflow: auto;
    direction: ltr;
}

.ibwDropdownWrap__item::-webkit-scrollbar {
    width: 3px;
    height: 40px;
}

.ibwDropdownWrap__item::-webkit-scrollbar-track {
    background: #F8FAFC;
    border-radius: 99px;
}

.ibwDropdownWrap__item::-webkit-scrollbar-thumb {
    background-color: #D5DDE8;
    border-radius: 99px;
}

/* دوکلاسه: وگرنه رنگ لینکِ تم برنده می‌شود */
.ibwDropdownWrap .ibwDropdownWrap__item a {
    padding: 8px 16px;
    display: flex;
    font-size: 14px !important;
    font-weight: 500;
    gap: 8px;
    flex-direction: row-reverse;
    color: #475569;
    cursor: pointer;
    border-radius: 6px;
    transition: all .3s;
    text-decoration: none;
}

.ibwDropdownWrap__item a img {
    width: 22px;
    height: 22px;
    margin-left: 6px;
    margin-right: unset;
}

.ibwDropdownWrap .ibwDropdownWrap__item a:hover,
.ibwDropdownWrap .ibwDropdownWrap__item a[aria-selected="true"] {
    background: #F8FAFC;
}

.ibwDropdownWrap__item a.hide {
    display: none;
}

.ibwCoinsDropdown-content img {
    vertical-align: middle;
    padding: 5px;
    width: 32px;
    max-width: 32px;
}

.btn-go-to-exchange-sell {
    min-width: 82px !important;
    padding-top: 1px;
    padding-bottom: 3px;
    margin: 2px 0 0 0;
    line-height: 35px;
    font: inherit;
    position: relative;
    background-color: #dc3545;
    border: none;
    color: #FFFFFF;
    text-align: center;
    text-decoration: none;
    overflow: hidden;
    cursor: pointer;
}

.btn-go-to-exchange-sell:hover {
    background-color: #cc2434;
}

#ibwCountDownWrap {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
}

#ibwCountDownWrap p {
    color: #64748B;
    font-size: 14px !important;
    margin: 0;
}

#ibwCountDownContent {
    padding-left: 8px;
    margin-left: 8px;
    color: #334155;
    position: relative;
    font-weight: 600;
    vertical-align: middle;
    text-align: center;
}

#ibwCountDownContent:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    height: 16px;
    width: 1px;
    background: #EBF0F5;
    transform: translateY(-50%);
}

.ibwBlurEffect {
    -webkit-filter: blur(5px);
    filter: blur(5px);
    background-color: #ccc;
}

/* دوکلاسه: `.contentstyle table a` تم رنگ را می‌برد */
.ibw-comparison-main .exchangeReviewLink {
    text-decoration: none !important;
    color: #334155 !important;
}

.ibwBestPriceibw-td-price-btn-display,
.ibw-td-price-btn-display {
    display: flex;
    align-items: center;
    font-size: 14px !important;
    color: #334155;
    gap: 5px;
    justify-content: center;
}

.ibwBestPriceibw-td-price-btn-display small,
.ibw-td-price-btn-display small {
    color: #64748B;
    font-size: 12px !important;
}

.ibw-td-price-btn-display label {
    margin: 0;
}

.ibw-comparison-main__title {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid #EBF0F5;
    position: relative;
}

.custom-table {
    table-layout: fixed;
    color: #222;
    overflow: scroll;
    min-width: auto;
    text-align: center;
    word-break: normal;
    line-height: normal;
    background: #fff;
    margin: 20px auto 35px !important;
    width: 100% !important;
    border-spacing: 0;
}

.custom-table td,
.custom-table th {
    padding: 15px;
    line-height: 1.5;
    vertical-align: middle;
}

.custom-table th:first-child {
    border-radius: 0 12px 0 0;
    border-left: unset;
    background: #185ADB;
    z-index: 2;
    box-shadow: 0 -5px 10px rgba(255, 255, 255, 1);
}

.custom-table th {
    background: transparent;
    color: #fff;
}

.custom-table th:last-child {
    border-radius: 12px 0 0 0;
}

.custom-table td {
    padding: 14px 24px;
    position: relative;
    color: #334155;
    font-size: 14px !important;
}

.custom-table tr {
    content-visibility: auto;
}

.custom-table td:first-child {
    border-right: 1px solid #EBF0F5;
    border-left: unset;
    width: 120px;
    box-shadow: -5px 5px 10px rgba(255, 255, 255, 1);
    background: #fff !important;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform;
    z-index: 100;
}

.custom-table td:last-child {
    border-left: 1px solid #EBF0F5;
}

.custom-table thead tr {
    top: 0;
    z-index: 2;
    background-color: #185ADB !important;
    color: #fff !important;
    text-align: center;
    line-height: 45px;
    border: 0;
    font: inherit;
    vertical-align: baseline;
}

.custom-table thead tr th {
    position: relative;
    color: #fff;
    background: transparent;
    padding: 16px 24px;
    vertical-align: middle;
    border: none !important;
    font-size: 14px !important;
}

/*
 * سرستون‌ها باید دوکلاسه باشند وگرنه کارت PDP آن‌ها را می‌بَرد.
 *
 * تم داخل `.irb-financial-current-price` یک قاعده‌ی تودرتوی `.table th` دارد
 * (currentPriceSection.css، فقط در `min-width: 992px`) که برای جدول قدیمیِ
 * «قیمت لحظه‌ای» نوشته شده: رنگ #1e293b و راست‌چین. جدول ما هم کلاس بوت‌استرپیِ
 * `.table` را دارد و داخل همان کارت رندر می‌شود، پس آن قاعده رویش می‌افتد —
 * ویژگی (0,2,2) در برابر (0,1,3) قاعده‌ی بالا، یعنی تم برنده است.
 *
 * نتیجه‌اش روی دسکتاپ: متن تیره روی نوار آبی (کنتراست ۱.۹:۱) و سرستونِ
 * راست‌چین بالای سلول‌های وسط‌چین. زیر ۹۹۲px هیچ‌کدام رخ نمی‌داد، برای همین
 * فقط روی دسکتاپ دیده می‌شد.
 */
.ibw-comparison-main .custom-table thead tr th {
    color: #fff;
    text-align: center;
    font-variation-settings: "wght" 600, "KSHD" 100;
}

.custom-table thead tr th:not(:last-child):after,
.custom-table td:not(:last-child):after {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 24px;
    background: #EBF0F5;
}

/* دوکلاسه + حالت <a>: قبلاً <button> بود و رنگ لینکِ تم رویش نمی‌افتاد */
.ibw-comparison-main .btn-go-to-exchange-buy {
    display: inline-block;
    background: #EFF7FF;
    border-radius: 4px;
    border: 1px solid #DAEDFF;
    color: #2071F0 !important;
    padding: 4px 16px;
    font-size: 14px !important;
    text-decoration: none !important;
    cursor: pointer;
}

.ibw-comparison-main .btn-go-to-exchange-buy[disabled] {
    cursor: no-drop;
    opacity: .75;
}

.table-hover > tbody > tr:hover > * {
    background: #F8FAFC !important;
    --bs-table-color-state: unset;
    --bs-table-bg-state: unset;
}

.ibw-comparison-empty {
    padding: 24px;
    text-align: center;
    color: #64748B;
    background: #fff;
    border: 1px solid #EBF0F5;
    border-radius: 12px;
}

@media screen and (max-width: 850px) {
    .ibw-td-price-btn-display {
        display: inherit;
    }

    .ibw-mobile-flex {
        display: flex !important;
    }
}

@media screen and (max-width: 767px) {
    .custom-table {
        table-layout: auto;
        border-collapse: collapse;
        text-wrap: nowrap;
    }

    .custom-table td {
        padding: 12px;
    }

    .custom-table thead {
        margin: 0;
        padding: 0;
        border: 0;
        font-size: 100%;
        font: inherit;
        vertical-align: baseline;
    }

    .custom-table thead th {
        padding: 0;
        vertical-align: middle;
        word-break: normal;
    }

    .ibw-comparison-main__title {
        flex-wrap: wrap;
        gap: 16px 0;
    }

    #ibw-comparison-title {
        order: 3;
        width: 100%;
        font-size: 14px !important;
    }

    .ibwDropdownWrap {
        order: 2;
    }

    #ibwCountDownWrap p {
        display: none;
    }

    #ibwCountDownWrap {
        position: unset;
        transform: unset;
    }

    #ibwCountDownContent:after {
        display: none;
    }
}

@media screen and (min-width: 768px) and (max-width: 1200px) {
    .ibw-comparison-main__title {
        flex-wrap: wrap;
        gap: 16px 0;
    }

    #ibw-comparison-title {
        order: 1;
        font-size: 14px !important;
    }

    .ibwDropdownWrap {
        order: 3;
    }

    #ibwCountDownWrap {
        position: unset;
        transform: unset;
        order: 2;
    }

    #ibwCountDownContent:after {
        display: none;
    }

    #ibwCountDownWrap p {
        display: none;
    }
}

@media only screen and (max-width: 1200px) {
    .custom-table {
        table-layout: auto;
        border-collapse: collapse;
        text-wrap: nowrap;
        font-size: 14px !important;
    }

    .custom-table td {
        padding: 12px;
    }

    .custom-table td:first-child {
        width: fit-content;
    }
}

@media screen and (max-width: 600px) {
    .ibw-exchange-logo {
        padding-left: 1px;
        width: 32px;
        max-width: 20px !important;
        max-height: 25px;
    }

    .ibw-exchange-name-logo-row {
        font-size: small;
    }

    .ibw-price-suffix {
        font-weight: inherit;
    }

    .ibwCoinsDropbtn {
        min-width: 215px !important;
    }
}

/* ---------------------------------------------------------------------------
 * کارت «بیشتر وقت‌ها ارزان‌ترین» — نوار فشرده بالای جدول.
 *
 * نمودار روند حذف شد؛ این تنها چیزی است که فقط از تاریخچه درمی‌آید. عمداً یک
 * ردیف است نه فهرست عمودی: قرار است کمترین فضا را بگیرد و جدول را عقب نراند.
 *
 * رنگ‌ها همان توکن‌های موجود صفحه‌اند — برند #185ADB، متن #475569، بوردر
 * #EBF0F5، پس‌زمینه‌ی خنثی #F8FAFC — تا کنار بقیه‌ی کارت‌ها یک‌دست بماند.
 * --------------------------------------------------------------------------- */

.ibw-champ {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    background: #fff;
    border: 1px solid #EBF0F5;
    border-radius: 12px;
    padding: 10px 14px;
    margin-top: 12px;
}

.ibw-champ__head {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    color: #185ADB;
}

.ibw-champ__icon {
    flex: 0 0 auto;
}

.ibw-champ__title {
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.ibw-champ__title b {
    color: #185ADB;
    font-weight: 700;
}

/* روی صفحه‌ی باریک به‌جای شکستن، خودش افقی اسکرول می‌خورد */
.ibw-champ__list {
    display: flex;
    align-items: center;
    gap: 6px;
    /* پایه‌ی بزرگ عمداً: اگر کنار عنوان و بازه‌ها جا نشود، به خط بعدی می‌رود و
       تمام عرض را می‌گیرد — به‌جای اینکه له شود و چیپ‌ها از لبه بیرون بزنند */
    flex: 1 1 420px;
    min-width: 0;
    margin: 0;
    padding: 0 0 2px;
    list-style: none;
    overflow-x: auto;
    scrollbar-width: none;
}

.ibw-champ__list::-webkit-scrollbar {
    display: none;
}

.ibw-champ__list li {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    background: #F8FAFC;
    border: 1px solid #EBF0F5;
    border-radius: 999px;
    padding: 4px 10px 4px 5px;
    white-space: nowrap;
}

/* صدرنشین با ته‌رنگ برند از بقیه جدا می‌شود، بدون رنگِ تازه به پالت */
.ibw-champ__list li.is-first {
    background: rgba(24, 90, 219, .07);
    border-color: rgba(24, 90, 219, .18);
}

.ibw-champ__rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #E2E8F0;
    color: #64748B;
    font-size: 10px;
    font-weight: 700;
    flex: 0 0 auto;
}

.ibw-champ__list li.is-first .ibw-champ__rank {
    background: #185ADB;
    color: #fff;
}

.ibw-champ__list img {
    width: 18px;
    max-width: 18px;
    max-height: 16px;
    object-fit: contain;
    flex: 0 0 auto;
}

.ibw-champ__name {
    color: #475569;
    font-size: 12px;
    font-weight: 500;
}

.ibw-champ__share {
    color: #185ADB;
    font-size: 12px;
    font-weight: 700;
}

.ibw-champ__ranges {
    display: flex;
    gap: 2px;
    flex: 0 0 auto;
    margin-right: auto;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 2px;
}

.ibw-champ .ibw-champ__ranges button {
    border: 0;
    background: transparent;
    color: #64748B;
    font: inherit;
    font-size: 12px !important;
    padding: 3px 9px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s, color .2s;
}

.ibw-champ .ibw-champ__ranges button.is-active {
    background: #fff;
    color: #185ADB;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

.ibw-champ.is-loading {
    opacity: .55;
}

/*
 * زیر عرض دسکتاپ، کارت دو ردیفه می‌شود: عنوان و بازه‌ها بالا، چیپ‌ها در ردیف
 * *کاملِ* خودشان. با flex-wrap ساده، چیپ‌ها هم‌ردیف بازه‌ها می‌افتادند و باز جا
 * کم می‌آمد؛ گرید تضمین می‌کند ردیف دوم تمام عرض کارت را بگیرد.
 */
@media screen and (max-width: 1279px) {
    .ibw-champ {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        row-gap: 10px;
    }

    /* ردیف‌ها صریح‌اند: با جای‌گذاری خودکار، فهرستِ تمام‌عرض ستون دوم ردیف دوم را
       اشغال می‌کرد و بازه‌ها به ردیف سومِ بی‌مورد می‌افتادند */
    .ibw-champ__head {
        grid-column: 1;
        grid-row: 1;
    }

    .ibw-champ__ranges {
        grid-column: 2;
        grid-row: 1;
        margin-right: 0;
    }

    .ibw-champ__list {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

/*
 * موبایل: تک‌ستونی. عنوانِ nowrap کنار بازه‌ها عرض بیشتری از صفحه می‌خواست و
 * دکمه‌ی «۳۰ روز» از لبه‌ی کارت بیرون می‌زد؛ اینجا هر کدام ردیف خودشان را دارند.
 * چیپ‌ها همچنان افقی اسکرول می‌شوند — چیپِ نیمه‌پیدا خودش نشانه‌ی ادامه داشتن است.
 */
@media screen and (max-width: 767px) {
    .ibw-champ {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px;
    }

    .ibw-champ__head {
        grid-column: 1;
        grid-row: 1;
    }

    .ibw-champ__list {
        grid-column: 1;
        grid-row: 2;
    }

    .ibw-champ__ranges {
        grid-column: 1;
        grid-row: 3;
        justify-self: start;
        margin-right: 0;
    }

    .ibw-champ__title {
        font-size: 12px;
        white-space: normal;
    }
}
