/* ===========================================================================
   هدر خوانشیار — شیشه‌ای، پیل‌های ناوبری، منوی «بیشتر» کارتی، چیپ دریک، منوی کاربر.
   فقط از توکن‌های tokens.css استفاده می‌کند (تم روشن/تیره خودکار).
   =========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    margin-bottom: 1.25rem;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    border-bottom: 1px solid var(--border);
}

/* خط ظریف گرادیانی پایین هدر (امضای برند، کم‌رنگ و محو در لبه‌ها) */
.site-header::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--brand) 45%, transparent) 30%, color-mix(in srgb, var(--accent) 45%, transparent) 70%, transparent);
    pointer-events: none;
}

.site-nav {
    padding: 0;
}

.site-nav__inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-height: 68px;
}

/* --- برند --- */
.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 1.3rem;
    line-height: 1;
}

.site-brand .brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 35%, transparent);
}

.site-brand .brand-name {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.site-brand small {
    display: block;
    margin-top: 3px;
    font-size: .5em;
    font-weight: 600;
    letter-spacing: .22em;
    color: var(--text-muted);
    -webkit-text-fill-color: var(--text-muted);
}

/* --- لینک‌های ناوبری (پیل) --- */
.site-nav__links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 4px;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: .93rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.nav-pill i {
    font-size: 1.05rem;
    opacity: .9;
}

.nav-pill:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--brand) 10%, transparent);
}

.nav-pill.active,
.nav-pill.show {
    color: var(--text);
    background: var(--brand-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 38%, transparent);
}

.nav-pill.active i {
    color: var(--brand);
    opacity: 1;
}

.nav-pill.dropdown-toggle::after {
    margin-inline-start: 2px;
    border-width: .3em .3em 0;
    opacity: .7;
    transition: transform .2s ease;
}

.nav-pill.dropdown-toggle.show::after {
    transform: rotate(180deg);
}

/* --- منوی «بیشتر» (کارتی، شیشه‌ای) --- */
.mega-menu {
    color: var(--text);
    --bs-dropdown-min-width: 0;
    width: 440px;
    padding: 14px;
    margin-top: 12px !important;
    border: 1px solid var(--border);
    border-radius: 22px;
    /* بدون backdrop-filter: داخل هدرِ دارای backdrop-filter کار نمی‌کند و متن پشت منو دیده می‌شد */
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .34), 0 0 0 1px color-mix(in srgb, var(--brand) 10%, transparent);
    animation: menuIn .18s ease;
}

@keyframes menuIn {
    from { opacity: 0; transform: translateY(-6px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.mega-menu__title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 8px 10px;
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.mega-menu__title i { color: var(--accent); }

.mega-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.mega-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid transparent;
    color: var(--text);
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}

.mega-item:hover {
    background: color-mix(in srgb, var(--brand) 9%, transparent);
    border-color: color-mix(in srgb, var(--brand) 25%, transparent);
    color: var(--text);
    transform: translateY(-1px);
}

.mega-item.active {
    background: var(--brand-soft);
    border-color: color-mix(in srgb, var(--brand) 35%, transparent);
}

.mega-ico {
    flex: none;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 1.15rem;
    color: #fff;
    background: linear-gradient(135deg, var(--c1, var(--brand)), var(--c2, var(--accent)));
    box-shadow: 0 6px 16px color-mix(in srgb, var(--c1, var(--brand)) 30%, transparent);
}

.mega-txt b {
    display: block;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.3;
}

.mega-txt small {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: .76rem;
    line-height: 1.5;
}

/* --- عملیات سمت دیگر هدر --- */
.site-nav__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-inline-start: auto;
}

/* دکمه‌ی ضبط کلاس */
.btn-record {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    background: var(--brand-gradient);
    color: #fff !important;
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
    box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 38%, transparent);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.btn-record:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--brand) 48%, transparent);
}

.btn-record .rec-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, .65);
    animation: recPulse 1.8s infinite;
}

@keyframes recPulse {
    70% { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* چیپ دریک */
.daric-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 5px 0 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-2) 70%, transparent);
    color: var(--warning);
    font-weight: 700;
    cursor: default;
    transition: border-color .15s ease;
}

.daric-badge:hover { border-color: color-mix(in srgb, var(--warning) 45%, transparent); }

.daric-badge > i {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--warning) 18%, transparent);
    font-size: .85rem;
}

.daric-badge-amount {
    color: var(--text);
    font-size: .95rem;
    min-width: 1ch;
}

.daric-badge-add {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand) !important;
    font-size: .8rem;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.daric-badge-add:hover {
    background: var(--brand);
    color: #fff !important;
}

/* دکمه‌ی تم */
.theme-toggle-btn {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-2) 70%, transparent);
    color: var(--text-muted);
    font-size: 1.05rem;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.theme-toggle-btn:hover {
    color: var(--brand);
    border-color: color-mix(in srgb, var(--brand) 45%, transparent);
    background: var(--brand-soft);
}

.theme-toggle-btn:active { transform: scale(.94); }

/* دکمه‌های مهمان */
.btn-ghost-pill,
.btn-solid-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 20px;
    border-radius: 14px;
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}

.btn-ghost-pill {
    border: 1px solid color-mix(in srgb, var(--brand) 45%, transparent);
    background: transparent;
    color: var(--text) !important;
}

.btn-ghost-pill:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
}

.btn-solid-pill {
    border: 0;
    background: var(--brand-gradient);
    color: #fff !important;
    box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 34%, transparent);
}

.btn-solid-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--brand) 46%, transparent);
}

/* --- منوی کاربر --- */
.user-avatar-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 42px;
    padding: 4px 12px 4px 5px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-2) 70%, transparent);
    color: var(--text);
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.user-avatar-btn:hover,
.user-avatar-btn.show {
    border-color: color-mix(in srgb, var(--brand) 45%, transparent);
    background: var(--brand-soft);
}

.user-avatar-btn.dropdown-toggle::after {
    margin: 0;
    border-width: .3em .3em 0;
    opacity: .6;
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--brand-gradient);
    color: #fff;
    font-weight: 800;
    font-size: .95rem;
}

.user-menu {
    color: var(--text);
    min-width: 270px;
    padding: 8px;
    margin-top: 12px !important;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .34), 0 0 0 1px color-mix(in srgb, var(--brand) 10%, transparent);
    animation: menuIn .18s ease;
}

.user-menu__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 12px;
    margin-bottom: 6px;
    border-radius: 14px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 16%, transparent), color-mix(in srgb, var(--accent) 10%, transparent));
}

.user-menu__head .user-avatar { width: 44px; height: 44px; border-radius: 14px; font-size: 1.15rem; }
.user-menu__head b { display: block; font-size: .95rem; }
.user-menu__head small { display: block; color: var(--text-muted); font-size: .78rem; direction: ltr; text-align: start; unicode-bidi: plaintext; }

.user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text);
    font-weight: 600;
    font-size: .9rem;
}

.user-menu .dropdown-item i {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 1rem;
}

.user-menu .dropdown-item:hover { background: color-mix(in srgb, var(--brand) 9%, transparent); color: var(--text); }
.user-menu .dropdown-item.logout { color: var(--danger); }
.user-menu .dropdown-item.logout i { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.user-menu .dropdown-item.logout:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.user-menu .dropdown-divider { margin: 6px 4px; border-color: var(--border); opacity: 1; }

/* --- موبایل: هدر ساده --- */
@media (max-width: 991.98px) {
    .site-nav__inner { min-height: 60px; gap: .75rem; }
    .site-brand .brand-logo { width: 34px; height: 34px; }
    .site-nav__actions-mobile { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
    .site-nav__actions-mobile .btn-ghost-pill, .site-nav__actions-mobile .btn-solid-pill { height: 38px; padding: 0 14px; font-size: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
    .btn-record .rec-dot, .mega-menu, .user-menu { animation: none; }
}

/* --- کارت ویژه‌ی بالای منوی «بیشتر» --- */
.mega-feature {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 16%, transparent), color-mix(in srgb, var(--accent) 10%, transparent));
    color: var(--text);
    text-decoration: none;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.mega-feature:hover { color: var(--text); transform: translateY(-1px); border-color: var(--brand); box-shadow: 0 10px 26px color-mix(in srgb, var(--brand) 22%, transparent); }
.mega-feature.active { border-color: var(--brand); }
.mega-feature .mega-ico { width: 46px; height: 46px; font-size: 1.3rem; }
.mega-badge {
    margin-inline-start: auto;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--brand-gradient);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
}

/* --- چیپ نوبت فعال مطالعه در هدر --- */
.study-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--success) 40%, transparent);
    background: color-mix(in srgb, var(--success) 12%, transparent);
    color: var(--success);
    font-weight: 800;
    font-size: .88rem;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
}
.study-chip i { animation: studyPulse 1.6s infinite; }
.study-chip__time { direction: ltr; }
.study-chip.paused { border-color: color-mix(in srgb, var(--warning) 45%, transparent); background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--warning); }
.study-chip.paused i { animation: none; }
.study-chip:hover { filter: brightness(1.1); color: inherit; }
@keyframes studyPulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
@media (max-width: 991.98px) { .study-chip { height: 38px; padding: 0 10px; font-size: .8rem; } }
@media (prefers-reduced-motion: reduce) { .study-chip i { animation: none; } }

.mega-features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.mega-features .mega-feature { margin-bottom: 0; padding: 12px; gap: 10px; }
.mega-features .mega-feature .mega-ico { width: 40px; height: 40px; font-size: 1.15rem; }
.mega-features .mega-txt small { font-size: .72rem; }
.mega-features .mega-badge { position: absolute; top: -8px; inset-inline-start: 10px; margin: 0; }

/* زنگوله‌ی اعلان‌ها */
.ntf-bell { position: relative; width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none; }
.ntf-bell:hover { border-color: var(--brand); color: var(--text); }
.ntf-bell .cnt { position: absolute; top: -6px; inset-inline-start: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: #EF4444; color: #fff; font-size: .68rem; font-weight: 800; display: none; place-items: center; line-height: 19px; text-align: center; }
.ntf-bell.has .cnt { display: inline-block; }

/* فوتر */
.site-footer { margin-top: 64px; padding: 44px 0 22px; border-top: 1px solid var(--border); position: relative;
    background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--surface) 65%, transparent)); }
.site-footer::before { content: ""; position: absolute; top: -1px; inset-inline: 0; height: 2px; margin-inline: auto; width: min(520px, 60%);
    background: linear-gradient(90deg, transparent, var(--brand), var(--accent), transparent); opacity: .8; }
.site-footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px; }
.site-footer__brand p { color: var(--text-muted); font-size: .9rem; line-height: 2; margin: 14px 0 0; max-width: 420px; }
.site-footer__col h6 { font-weight: 800; font-size: .92rem; margin-bottom: 14px; color: var(--text); }
.site-footer__col a { display: block; color: var(--text-muted); text-decoration: none; font-size: .9rem; padding: 5px 0; transition: color .15s, transform .15s; }
.site-footer__col a:hover { color: var(--accent); transform: translateX(-3px); }
.site-footer__bottom { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 34px; padding-top: 18px;
    border-top: 1px dashed var(--border); color: var(--text-muted); font-size: .82rem; }
