/* =====================================================================
 * مقایسه قیمت صرافی‌ها — استایل سمت کاربر (RTL)
 * ===================================================================== */
.cpc-app {
    direction: rtl;
    font-family: inherit;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    max-width: 1100px;
    margin: 20px auto;
    box-sizing: border-box;
}
.cpc-app *, .cpc-app *::before, .cpc-app *::after { box-sizing: border-box; }

/* ---------- سربرگ و کنترل‌ها ---------- */
.cpc-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.cpc-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* اسکرول افقی تب‌ها */
.cpc-chips-wrapper {
    flex: 1;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none; /* فایرفاکس */
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
}
.cpc-chips-wrapper::-webkit-scrollbar { display: none; } /* کروم و سافاری */

.cpc-chips {
    display: inline-flex;
    gap: 8px;
}
.cpc-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #d8dfe8;
    background: #fff;
    color: #2c3345;
    border-radius: 24px;
    padding: 7px 15px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s ease;
    flex-shrink: 0;
}
.cpc-chip img { width: 18px; height: 18px; border-radius: 50%; object-fit: contain; }
.cpc-chip small { color: #8a94a6; font-size: 10px; direction: ltr; }
.cpc-chip:hover { border-color: #14b8a6; color: #0d9488; }
.cpc-chip.is-active {
    background: #14b8a6;
    border-color: #14b8a6;
    color: #fff;
    box-shadow: 0 4px 12px rgba(20,184,166,.3);
}
.cpc-chip.is-active small { color: rgba(255,255,255,.8); }

/* ---------- دراپ‌داون همراه با سرچ ---------- */
.cpc-search-dropdown {
    position: relative;
    flex-shrink: 0;
}
.cpc-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #d8dfe8;
    border-radius: 24px;
    padding: 7px 14px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    transition: border-color .2s;
}
.cpc-dropdown-toggle:hover { border-color: #14b8a6; }
.cpc-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 250px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,.08);
    z-index: 100;
    padding: 10px;
}
.cpc-search-dropdown.is-open .cpc-dropdown-menu { display: block; }
.cpc-search-box { margin-bottom: 8px; }
.cpc-search-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 12px;
    outline: none;
    font-family: inherit;
}
.cpc-search-input:focus { border-color: #14b8a6; }
.cpc-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}
.cpc-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background .15s;
}
.cpc-dropdown-item:hover, .cpc-dropdown-item.is-active {
    background: #f0fdfa;
    color: #0d9488;
}
.cpc-dropdown-item img { width: 18px; height: 18px; border-radius: 50%; }
.cpc-dropdown-item .cpc-sym { margin-right: auto; font-size: 11px; color: #94a3b8; direction: ltr; }

/* نشان زنده */
.cpc-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #0d9488;
    background: #e6faf7;
    border: 1px solid #b5ece3;
    border-radius: 20px;
    padding: 5px 12px;
    flex-shrink: 0;
}
.cpc-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #10b981;
    animation: cpc-pulse 1.6s infinite;
}
@keyframes cpc-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.6); }
    70%  { box-shadow: 0 0 0 7px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ---------- شبکه کارت‌ها ---------- */
.cpc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    transition: opacity .2s ease;
}
.cpc-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    transition: box-shadow .2s ease, transform .2s ease;
    position: relative;
    overflow: hidden;
}
.cpc-card:hover {
    box-shadow: 0 8px 24px rgba(20,40,80,.08);
    transform: translateY(-2px);
}
.cpc-card.is-best { border-color: #f59e0b; }
.cpc-card.is-best::before {
    content: "بهترین نرخ";
    position: absolute;
    top: 0; left: 0;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 0 0 10px 0;
}
.cpc-card.is-up   .cpc-value { color: #10b981; }
.cpc-card.is-down .cpc-value { color: #ef4444; }

.cpc-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cpc-logo {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 4px;
    flex-shrink: 0;
}
.cpc-logo-ph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
    color: #14b8a6;
}
.cpc-names { display: flex; flex-direction: column; min-width: 0; }
.cpc-names strong { font-size: 14px; color: #1e293b; }
.cpc-names span  { font-size: 11px; color: #94a3b8; direction: ltr; text-align: right; }

.cpc-prices { display: flex; gap: 8px; margin-bottom: 8px; }
.cpc-price-box {
    flex: 1;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 8px 10px;
    text-align: center;
}
.cpc-label  { display: block; font-size: 11px; color: #64748b; margin-bottom: 3px; }
.cpc-value  { display: block; font-size: 14px; font-weight: 700; color: #0f172a; direction: ltr; unicode-bidi: plaintext; transition: color .3s ease; }
.cpc-unit   { font-size: 11px; color: #94a3b8; margin-bottom: 12px; text-align: center; }

.cpc-btn {
    display: block;
    text-align: center;
    background: #14b8a6;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    padding: 9px 0;
    font-size: 13px;
    font-weight: 700;
    transition: background .18s ease;
}
.cpc-btn:hover { background: #0d9488; }

.cpc-note {
    margin: 18px 0 0;
    font-size: 12px;
    line-height: 1.8;
    color: #64748b;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 10px 14px;
}

/* ---------- ریسپانسیو اختصاصی موبایل ---------- */
@media (max-width: 768px) {
    .cpc-head { flex-direction: column; align-items: stretch; }
    .cpc-controls { width: 100%; }
    .cpc-live-badge { align-self: flex-start; }
    .cpc-dropdown-menu { right: auto; left: 0; width: 100%; min-width: 220px; }
}
@media (max-width: 580px) {
    .cpc-app { padding: 12px; }
    .cpc-grid { grid-template-columns: 1fr; gap: 10px; }
}
