/* =========================================================
   Topical — media cards v5 (رپورتاژ / بک‌لینک / پکیج)
   کارت‌ها مثل «برگه مشخصات رسانه» طراحی شده‌اند: داده‌ها (DA/PA/DR، قیمت، مدت)
   ساختار کارت را می‌سازند، نه تزئین.
   ========================================================= */
:root {
    --mc-ink: #0d1d32;
    --mc-navy: #173e75;
    --mc-navy-2: #245fae;
    --mc-red: #df263c;
    --mc-green: #168566;
    --mc-amber: #b7791f;
    --mc-muted: #6e7c90;
    --mc-line: #e3e8ef;
    --mc-line-2: #edf1f6;
    --mc-mist: #f6f8fb;
    --mc-paper: #ffffff;
}

/* ---------- logo (shared helper tp_site_logo) ---------- */
.tp-site-logo-box {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
    background: var(--mc-mist);
    border: 1px solid var(--mc-line);
}
.tp-site-logo-box .tp-site-logo-initial {
    color: var(--mc-navy);
    font-weight: 800;
    font-size: 1.05em;
    line-height: 1;
}
.tp-site-logo-box img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
    background: #fff;
}
.tp-site-logo { width: 46px; height: 46px; border-radius: 12px; }

/* ---------- card shell ---------- */
.mc-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--mc-paper);
    border: 1px solid var(--mc-line);
    border-radius: 16px;
    color: var(--mc-ink);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.mc-card:hover { border-color: #b9c8dc; box-shadow: 0 14px 34px rgba(13, 29, 50, .08); }
.mc-card:focus-within { border-color: var(--mc-navy-2); }
.mc-card.is-featured { border-color: #c9d6ea; box-shadow: inset 0 3px 0 var(--mc-navy); }
.mc-card.is-flash { box-shadow: inset 0 3px 0 var(--mc-red); }

.mc-body { display: flex; flex-direction: column; gap: 14px; padding: 18px; flex: 1 1 auto; }

/* ---------- head ---------- */
.mc-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mc-logo { width: 52px; height: 52px; border-radius: 13px; font-size: 1.15rem; }
.mc-id { min-width: 0; flex: 1 1 auto; }
.mc-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.5;
    color: var(--mc-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mc-name a { color: inherit; text-decoration: none; }
.mc-name a:hover { color: var(--mc-navy-2); }
.mc-domain {
    text-decoration: none;
    display: block;
    direction: ltr;
    text-align: right;
    font-size: .76rem;
    color: var(--mc-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mc-flags { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 0 0 auto; }
.mc-flag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 7px;
    font-size: .7rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid var(--mc-line);
    color: var(--mc-muted);
    background: #fff;
}
.mc-flag--featured { color: var(--mc-navy); border-color: #c9d6ea; background: #eef4fc; }
.mc-flag--flash { color: #fff; border-color: var(--mc-red); background: var(--mc-red); }

/* ---------- facts row (category / link type / value) ---------- */
.mc-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-fact {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 8px;
    background: var(--mc-mist);
    color: #3b4a5e;
    font-size: .74rem;
    font-weight: 600;
    max-width: 100%;
}
.mc-fact b { color: var(--mc-ink); font-weight: 800; }
.mc-fact--value { background: #fdf6ea; color: #7a4f12; }
.mc-fact--value b { color: #7a4f12; }
.mc-fact.has-tip { position: relative; cursor: help; }
.mc-fact.has-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    z-index: 30;
    width: max-content;
    max-width: 240px;
    padding: 9px 11px;
    border-radius: 10px;
    background: var(--mc-ink);
    color: #fff;
    font-size: .74rem;
    font-weight: 400;
    line-height: 1.8;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease;
}
.mc-fact.has-tip:hover::after, .mc-fact.has-tip:focus::after { opacity: 1; visibility: visible; }

/* ---------- authority meters: the signature element ---------- */
.mc-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid var(--mc-line-2);
    border-radius: 12px;
    overflow: hidden;
}
.mc-metric { padding: 9px 10px 10px; text-align: center; }
.mc-metric + .mc-metric { border-right: 1px solid var(--mc-line-2); }
.mc-metric span { display: block; font-size: .66rem; font-weight: 700; color: var(--mc-muted); letter-spacing: .02em; }
.mc-metric b { display: block; margin: 1px 0 6px; font-size: 1.12rem; font-weight: 800; color: var(--mc-ink); line-height: 1.3; }
.mc-metric i {
    display: block;
    height: 4px;
    border-radius: 4px;
    background: var(--mc-line-2);
    overflow: hidden;
}
.mc-metric i::after {
    content: "";
    display: block;
    height: 100%;
    width: calc(var(--v, 0) * 1%);
    background: var(--mc-navy);
    border-radius: 4px;
}
.mc-metric.is-empty b { color: #b3bdca; }

/* ---------- price ---------- */
.mc-price {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px dashed var(--mc-line);
}
.mc-price-label { display: block; font-size: .72rem; color: var(--mc-muted); margin-bottom: 2px; }
.mc-price-old { display: block; font-size: .78rem; color: #98a4b5; text-decoration: line-through; }
.mc-price-main { font-size: 1.28rem; font-weight: 800; color: var(--mc-ink); line-height: 1.35; white-space: nowrap; }
.mc-price-main small { font-size: .72rem; font-weight: 600; color: var(--mc-muted); }
.mc-price-off {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 8px;
    background: #e8f5ef;
    color: var(--mc-green);
    font-size: .74rem;
    font-weight: 800;
    white-space: nowrap;
}
.mc-price-note { font-size: .72rem; color: var(--mc-muted); }
.mc-price--empty { font-size: .82rem; color: var(--mc-muted); }

/* ---------- actions ---------- */
.mc-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.mc-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid var(--mc-line);
    border-radius: 11px;
    cursor: pointer;
    font-size: .8rem;
    font-weight: 700;
    color: #2f3e52;
}
.mc-toggle input { width: 2.1em; height: 1.1em; margin: 0; flex: 0 0 auto; cursor: pointer; }
.mc-toggle small { display: block; font-weight: 500; color: var(--mc-muted); font-size: .7rem; }
.mc-toggle:has(input:checked) { border-color: #9fd2bd; background: #f2faf6; }

.mc-buy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 46px;
    padding: 8px 14px;
    border: 0;
    border-radius: 11px;
    background: var(--mc-navy);
    color: #fff;
    font-size: .88rem;
    font-weight: 800;
    transition: background-color .15s ease;
}
.mc-buy:hover { background: var(--mc-ink); color: #fff; }
.mc-buy:focus-visible, .mc-link:focus-visible, .mc-chip input:focus-visible + span, .mc-dur input:focus-visible + span {
    outline: 3px solid rgba(36, 95, 174, .35);
    outline-offset: 2px;
}
.mc-buy:disabled { background: #c3ccd8; cursor: not-allowed; }
.mc-buy svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mc-buy .media-cart-copy strong { font-size: .86rem; }
.mc-link {
    display: block;
    text-align: center;
    padding: 6px;
    border-radius: 9px;
    font-size: .78rem;
    font-weight: 700;
    color: var(--mc-navy) !important;
    text-decoration: none;
}
.mc-link:hover { background: var(--mc-mist); }

/* ---------- backlink picker ---------- */
.mc-picker { display: flex; flex-direction: column; gap: 10px; }
.mc-picker-label { font-size: .72rem; font-weight: 700; color: var(--mc-muted); margin-bottom: 5px; }
.mc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-chip { margin: 0; cursor: pointer; flex: 1 1 0; min-width: max-content; }
.mc-chip input, .mc-dur input { position: absolute; opacity: 0; pointer-events: none; }
.mc-chip span {
    display: block;
    padding: 7px 10px;
    border: 1px solid var(--mc-line);
    border-radius: 10px;
    text-align: center;
    font-size: .76rem;
    font-weight: 700;
    color: #3b4a5e;
    background: #fff;
    transition: border-color .12s ease, background-color .12s ease;
}
.mc-chip:hover span { border-color: #b9c8dc; }
.mc-chip input:checked + span { border-color: var(--mc-navy); background: var(--mc-navy); color: #fff; }
.mc-chip--single { cursor: default; }
.mc-chip--single span { background: #eef4fc; border-color: #c9d6ea; color: var(--mc-navy); }
.mc-placement-hint { font-size: .72rem; color: var(--mc-muted); line-height: 1.7; margin-top: 6px; min-height: 1.7em; }

.mc-durs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mc-dur { margin: 0; cursor: pointer; }
.mc-dur span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 7px 4px;
    border: 1px solid var(--mc-line);
    border-radius: 10px;
    background: #fff;
    text-align: center;
    transition: border-color .12s ease, background-color .12s ease;
}
.mc-dur b { font-size: .8rem; font-weight: 800; color: var(--mc-ink); }
.mc-dur em { font-style: normal; font-size: .66rem; color: var(--mc-muted); white-space: nowrap; }
.mc-dur:hover span { border-color: #b9c8dc; }
.mc-dur input:checked + span { border-color: var(--mc-navy); background: #eef4fc; box-shadow: inset 0 0 0 1px var(--mc-navy); }
.mc-dur input:disabled + span { opacity: .4; cursor: not-allowed; background: var(--mc-mist); }
.mc-dur input:disabled + span em { text-decoration: line-through; }

/* ---------- section shells used on list pages ---------- */
.mc-section { margin-bottom: 26px; }
.mc-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.mc-section-title { margin: 0; font-size: 1.12rem; font-weight: 800; color: var(--mc-ink); }
.mc-section-sub { margin: 3px 0 0; font-size: .8rem; color: var(--mc-muted); }
.mc-sortbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mc-sortbar > span { font-size: .76rem; color: var(--mc-muted); }
.mc-sort {
    padding: 6px 11px;
    border: 1px solid var(--mc-line);
    border-radius: 9px;
    background: #fff;
    color: #3b4a5e;
    font-size: .76rem;
    font-weight: 700;
}
.mc-sort:hover { border-color: #b9c8dc; }
.mc-sort.is-active { border-color: var(--mc-navy); background: var(--mc-navy); color: #fff; }
.mc-sort.is-active[data-order="desc"]::after { content: " ↑"; }
.mc-sort.is-active[data-order="asc"]::after { content: " ↓"; }

.mc-more {
    min-width: 220px;
    padding: 10px 18px;
    border: 1px solid var(--mc-line);
    border-radius: 11px;
    background: #fff;
    color: var(--mc-navy);
    font-weight: 800;
}
.mc-more:hover { border-color: var(--mc-navy); }
.mc-more small { display: block; font-weight: 500; color: var(--mc-muted); font-size: .72rem; }
.mc-more.is-loading { opacity: .6; }

/* ---------- package card ---------- */
.mc-pack .mc-body { gap: 16px; padding: 20px; }
.mc-pack-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.mc-pack-kind { display: block; font-size: .74rem; font-weight: 700; color: var(--mc-navy-2); margin-bottom: 3px; }
.mc-pack-title { margin: 0; font-size: 1.12rem; font-weight: 800; line-height: 1.55; color: var(--mc-ink); }
.mc-pack-off {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--mc-red);
    color: var(--mc-red);
    text-align: center;
    line-height: 1.15;
    transform: rotate(-8deg);
}
.mc-pack-off b { display: block; font-size: 1.08rem; font-weight: 800; }
.mc-pack-off small { display: block; font-size: .62rem; font-weight: 700; }
.mc-pack-desc { margin: 0; font-size: .82rem; line-height: 1.9; color: #4a5a6f; }

.mc-pack-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--mc-line-2); border-radius: 12px; }
.mc-pack-stat { padding: 10px 8px; text-align: center; }
.mc-pack-stat + .mc-pack-stat { border-right: 1px solid var(--mc-line-2); }
.mc-pack-stat span { display: block; font-size: .68rem; color: var(--mc-muted); font-weight: 700; }
.mc-pack-stat b { display: block; font-size: 1.05rem; font-weight: 800; color: var(--mc-ink); }

.mc-pack-list { border: 1px solid var(--mc-line-2); border-radius: 12px; overflow: hidden; }
.mc-pack-list-head {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--mc-mist);
    font-size: .72rem;
    font-weight: 700;
    color: var(--mc-muted);
}
.mc-pack-rows { max-height: 292px; overflow-y: auto; }
.mc-pack-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-top: 1px solid var(--mc-line-2);
}
.mc-pack-row:first-child { border-top: 0; }
.mc-pack-row .tp-site-logo-box { width: 34px; height: 34px; border-radius: 9px; font-size: .82rem; }
.mc-pack-row-name { min-width: 0; }
.mc-pack-row-name a { display: block; font-size: .82rem; font-weight: 700; color: var(--mc-ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-pack-row-name a:hover { color: var(--mc-navy-2); }
.mc-pack-row-name span { display: block; direction: ltr; text-align: right; font-size: .7rem; color: var(--mc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-pack-row-metrics { font-size: .7rem; color: var(--mc-muted); white-space: nowrap; }
.mc-pack-row-metrics b { color: var(--mc-ink); }
.mc-pack-row-price { font-size: .78rem; font-weight: 800; color: var(--mc-ink); white-space: nowrap; }

.mc-pack-total { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; background: var(--mc-mist); }
.mc-pack-total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .8rem; color: var(--mc-muted); }
.mc-pack-total-row s { color: #98a4b5; }
.mc-pack-total-row .mc-price-main { font-size: 1.4rem; }
.mc-pack-save { color: var(--mc-green); font-weight: 800; }

/* ---------- responsive / motion ---------- */
@media (max-width: 575.98px) {
    .mc-body { padding: 15px; }
    .mc-durs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mc-pack-row { grid-template-columns: 30px minmax(0, 1fr) auto; }
    .mc-pack-row-metrics { display: none; }
    .mc-pack-off { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
    .mc-card, .mc-chip span, .mc-dur span, .mc-buy { transition: none; }
}

/* Bootstrap form-switch inside the toggle row */
.mc-toggle.form-switch { padding: 9px 11px; }
.mc-toggle.form-switch .form-check-input { float: none; margin: 0; }
.mc-pack-logo { width: 34px; height: 34px; border-radius: 9px; font-size: .82rem; }
[data-bl-old][hidden], .mc-card [hidden] { display: none !important; }
