/* ==================================================
   دکمه‌ی بازگشت به بالا — در سایت و پنل مدیریت مشترک است،
   پس رنگ‌هایش مستقل از توکن‌های هر لایوت تعریف می‌شود.
   ================================================== */

:root {
    --btt-bg: #009DAE;
    --btt-fg: #04252b;
    --btt-shadow: rgba(0,0,0,.45);
}

:root[data-theme="light"] {
    --btt-bg: #00808f;
    --btt-fg: #ffffff;
    --btt-shadow: rgba(12,28,36,.22);
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --btt-bg: #00808f;
        --btt-fg: #ffffff;
        --btt-shadow: rgba(12,28,36,.22);
    }
}

.back-to-top {
    position: fixed;
    inset-inline-end: 18px;
    bottom: 18px;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--btt-bg);
    color: var(--btt-fg);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 24px var(--btt-shadow);

    /* تا وقتی صفحه اسکرول نشده، دکمه نه دیده می‌شود نه کلیک‌پذیر است */
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.back-to-top:hover {
    filter: brightness(1.1);
}

.back-to-top:focus-visible {
    outline: 2px solid var(--btt-bg);
    outline-offset: 3px;
}

@media (max-width: 767.98px) {
    .back-to-top {
        inset-inline-end: 14px;
        bottom: 14px;
        width: 42px;
        height: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        transition: none;
    }
}
