/* =========================================================
   Yaghut special pages: آمار + تغییرات اخیر
   ========================================================= */

.yg-special {
    --yg-primary: var(--yaghut-primary, #bc2050);
    --yg-primary-soft: rgba(188, 32, 80, .08);
    --yg-secondary: var(--yaghut-secondary, #344258);
    --yg-text: #2b3445;
    --yg-muted: #6b7385;
    --yg-border: rgba(52, 66, 88, .12);
    --yg-surface: rgba(255, 255, 255, .88);
    --yg-green: #15805a;
    --yg-red: #c62839;
    --yg-gold: #8a6a2f;
    --yg-radius: 1.25rem;

    direction: rtl;
    text-align: right;
    color: var(--yg-text);
}

.yg-special a { color: var(--yg-text); transition: color .2s ease; }
.yg-special a:hover { color: var(--yg-primary); }

/* ---------- پنل ---------- */
.yg-panel {
    background: var(--yg-surface);
    border: 1px solid var(--yg-border);
    border-radius: var(--yg-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px -16px rgba(52, 66, 88, .25);
}

.yg-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem .75rem;
    margin-bottom: 1.1rem;
}

.yg-panel__title {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 900;
    font-variation-settings: "wght" 900, "DOTS" 4;
    color: var(--yg-secondary);
}

.yg-panel__title::before {
    content: "";
    width: .35rem;
    height: 1.2rem;
    border-radius: 999px;
    background: var(--yg-primary);
    flex-shrink: 0;
}

.yg-panel__note { color: var(--yg-muted); font-size: .85rem; }

.yg-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.yg-grid-2 > .yg-panel { margin-bottom: 0; }

/* ---------- کارت‌های خلاصه ---------- */
.yg-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.yg-stat {
    position: relative;
    overflow: hidden;
    padding: 1.1rem 1.25rem 1rem;
    background: var(--yg-surface);
    border: 1px solid var(--yg-border);
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.yg-stat::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: var(--yg-primary);
}
.yg-stat--alt::before { background: var(--yg-secondary); }

.yg-stat__value {
    display: block;
    font-size: 1.8rem;
    line-height: 1.5;
    font-weight: 1000;
    font-variation-settings: "wght" 1000, "DOTS" 4;
    color: var(--yg-secondary);
}

.yg-stat__label {
    display: block;
    font-size: .9rem;
    font-weight: 700;
    color: var(--yg-muted);
}

.yg-stat__hint {
    display: block;
    margin-top: .3rem;
    font-size: .78rem;
    color: var(--yg-muted);
}

/* ---------- نوار دسته‌بندی ---------- */
.yg-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }

.yg-bar__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .75rem;
    margin-bottom: .4rem;
    font-weight: 800;
}

.yg-bar__count { flex-shrink: 0; color: var(--yg-muted); font-size: .88rem; font-weight: 700; }
.yg-bar__count strong { color: var(--yg-secondary); font-size: .95rem; }

.yg-bar__track {
    height: .6rem;
    border-radius: 999px;
    background: rgba(52, 66, 88, .08);
    overflow: hidden;
}

.yg-bar__fill {
    height: 100%;
    min-width: .6rem;
    border-radius: inherit;
    background: linear-gradient(to left, var(--yg-primary), #e0577f);
}

/* ---------- نمودار ---------- */
.yg-chart { position: relative; height: 320px; }

/* ---------- فهرست رتبه‌بندی ---------- */
.yg-rank { list-style: none; margin: 0; padding: 0; counter-reset: yg-rank; }

.yg-rank li {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .15rem;
    border-bottom: 1px dashed var(--yg-border);
}
.yg-rank li:last-child { border-bottom: 0; }

.yg-rank li::before {
    counter-increment: yg-rank;
    content: counter(yg-rank, persian);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: .6rem;
    background: var(--yg-primary-soft);
    color: var(--yg-primary);
    font-size: .85rem;
    font-weight: 800;
}
.yg-rank li:nth-child(-n+3)::before { background: var(--yg-primary); color: #fff; }

.yg-rank__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.yg-rank__value { flex-shrink: 0; font-size: .85rem; font-weight: 700; color: var(--yg-muted); }

/* ---------- حالت خالی ---------- */
.yg-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--yg-muted);
    border: 2px dashed var(--yg-border);
    border-radius: 1rem;
    line-height: 2;
}

/* ---------- دکمه ---------- */
.yg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 2.5rem;
    padding: .45rem 1.1rem;
    border: 1px solid var(--yg-primary);
    border-radius: .75rem;
    background: var(--yg-primary);
    color: #fff !important;
    font: inherit;
    font-weight: 800;
    font-size: .9rem;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}
.yg-btn:hover { background: #a01a44; }

.yg-btn--ghost {
    background: transparent;
    color: var(--yg-primary) !important;
}
.yg-btn--ghost:hover { background: var(--yg-primary-soft); }

.yg-btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* ---------- فیلترهای تغییرات اخیر ---------- */
.yg-filters { display: grid; gap: 1rem; }

.yg-filters__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.yg-field { display: flex; flex-direction: column; gap: .4rem; min-width: 180px; border: 0; margin: 0; padding: 0; }

.yg-field__label, .yg-field legend {
    padding: 0;
    font-size: .85rem;
    font-weight: 800;
    color: var(--yg-muted);
}

.yg-select {
    min-height: 2.5rem;
    padding: .45rem .75rem;
    border: 1px solid var(--yg-border);
    border-radius: .75rem;
    background: #fff;
    color: var(--yg-secondary);
    font: inherit;
    font-weight: 700;
}
.yg-select:focus { outline: 2px solid var(--yg-primary); outline-offset: 1px; }

.yg-chips { display: flex; flex-wrap: wrap; gap: .5rem; }

.yg-chip { position: relative; }
.yg-chip input { position: absolute; opacity: 0; pointer-events: none; }

.yg-chip span {
    display: inline-block;
    padding: .4rem .95rem;
    border: 1px solid var(--yg-border);
    border-radius: 999px;
    background: #fff;
    color: var(--yg-secondary);
    font-size: .88rem;
    font-weight: 800;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.yg-chip span:hover { border-color: var(--yg-primary); }
.yg-chip input:checked + span { background: var(--yg-primary); border-color: var(--yg-primary); color: #fff; }
.yg-chip input:focus-visible + span { outline: 2px solid var(--yg-primary); outline-offset: 2px; }

.yg-check {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 2.5rem;
    font-weight: 800;
    color: var(--yg-secondary);
    cursor: pointer;
}
.yg-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--yg-primary); }

.yg-filters__actions { display: flex; gap: .5rem; margin-inline-start: auto; }

/* ---------- فهرست تغییرات ---------- */
.yg-rc-day + .yg-rc-day { margin-top: 1.75rem; }

.yg-rc-day__title {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 0 0 .5rem;
    font-size: 1rem;
    font-weight: 900;
    font-variation-settings: "wght" 900, "DOTS" 4;
    color: var(--yg-secondary);
}
.yg-rc-day__title::after { content: ""; flex: 1; height: 1px; background: var(--yg-border); }

.yg-rc-list { list-style: none; margin: 0; padding: 0; }

.yg-rc-item {
    display: flex;
    gap: 1rem;
    padding: .85rem .6rem;
    border-bottom: 1px solid var(--yg-border);
    border-radius: .75rem;
    transition: background-color .2s ease;
}
.yg-rc-item:last-child { border-bottom: 0; }
.yg-rc-item:hover { background: rgba(188, 32, 80, .035); }

.yg-rc-time {
    flex-shrink: 0;
    width: 3.2rem;
    padding-top: .1rem;
    font-size: .9rem;
    font-weight: 800;
    color: var(--yg-muted);
}

.yg-rc-main { flex: 1; min-width: 0; }

.yg-rc-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; }

.yg-rc-title { font-weight: 800; overflow-wrap: anywhere; }

.yg-badge {
    display: inline-flex;
    align-items: center;
    padding: 0 .55rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 800;
    line-height: 1.8;
    white-space: nowrap;
}
.yg-badge--new { background: rgba(21, 128, 90, .1); color: var(--yg-green); }
.yg-badge--minor { background: rgba(52, 66, 88, .08); color: var(--yg-secondary); }
.yg-badge--restore { background: rgba(217, 187, 138, .28); color: var(--yg-gold); }

.yg-rc-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem .5rem;
    margin-top: .5rem;
    font-size: .84rem;
    color: var(--yg-muted);
}

/* ویرایشگر و دسته‌بندی به‌صورت برچسب با آیکون */
.yg-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    max-width: 100%;
    padding: .15rem .65rem .15rem .7rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 800;
    line-height: 1.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.yg-meta-chip--editor {
    background: rgba(52, 66, 88, .07);
    color: var(--yg-secondary);
}

.yg-special a.yg-meta-chip--category,
.yg-meta-chip--category {
    background: var(--yg-primary-soft);
    color: var(--yg-primary);
}
.yg-special a.yg-meta-chip--category:hover { background: rgba(188, 32, 80, .15); color: var(--yg-primary); }

.yg-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.yg-diff {
    display: inline-flex;
    align-items: center;
    padding: 0 .55rem;
    border-radius: .5rem;
    font-size: .8rem;
    font-weight: 800;
    line-height: 1.8;
    direction: ltr;
    unicode-bidi: isolate;
}
.yg-diff--pos { color: var(--yg-green); background: rgba(21, 128, 90, .08); }
.yg-diff--neg { color: var(--yg-red); background: rgba(198, 40, 57, .08); }
.yg-diff--zero { color: var(--yg-muted); background: rgba(52, 66, 88, .05); }
.yg-diff--big { font-weight: 1000; font-variation-settings: "wght" 1000; }

.yg-rc-summary {
    margin-top: .35rem;
    font-size: .86rem;
    line-height: 1.9;
    color: #4b5465;
    overflow-wrap: anywhere;
}
.yg-rc-summary::before { content: "«"; }
.yg-rc-summary::after { content: "»"; }

.yg-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--yg-border);
}

/* ---------- موبایل ---------- */
@media (max-width: 768px) {
    .yg-panel { padding: 1rem; border-radius: 1rem; margin-bottom: 1rem; }
    .yg-grid-2 { grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; }

    .yg-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
    .yg-stat { padding: .85rem 1rem .8rem; }
    .yg-stat__value { font-size: 1.35rem; }
    .yg-stat__label { font-size: .82rem; }

    .yg-chart { height: 250px; }

    .yg-filters__row { gap: .85rem; }
    .yg-field { min-width: 0; flex: 1 1 100%; }
    .yg-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
    .yg-chips::-webkit-scrollbar { display: none; }
    .yg-chip span { white-space: nowrap; }
    .yg-filters__actions { width: 100%; margin-inline-start: 0; }
    .yg-filters__actions .yg-btn { flex: 1; }

    .yg-rc-item { flex-direction: column; gap: .2rem; padding: .8rem .35rem; }
    .yg-rc-time { width: auto; font-size: .8rem; }
    .yg-rc-meta { gap: .2rem .75rem; }

    .yg-pager .yg-btn { flex: 1; }
}
