/* =========================================================
   آموزشگاه آمانج — جلوه‌های بصری فرانت‌اند (افزوده‌شده)
   فقط لایه‌ی ظاهری؛ هیچ چیزی از ساختار اصلی را حذف نمی‌کند.
   همه‌ی قواعد زیر با کلاس html.fx-js فعال می‌شوند، پس اگر
   جاوااسکریپت غیرفعال باشد سایت دقیقاً مثل قبل کار می‌کند.
   ========================================================= */

:root {
    --fx-accent: #c99a35;
    --fx-accent-2: #d4a53f;
}

/* ---------- 1) نوار پیشرفت مطالعه ---------- */
.fx-progress {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    z-index: 60;
    pointer-events: none;
    background: transparent;
}

.fx-progress > i {
    display: block;
    height: 100%;
    width: 100%;
    transform-origin: right center;
    transform: scaleX(0);
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, #c99a35, #b8862b 45%, #d4a53f 80%, #f0d089);
    box-shadow: 0 0 14px rgba(201, 154, 53, 0.35);
}

/* ---------- 2) هدر جمع‌شونده هنگام اسکرول ---------- */
.site-header {
    transition: box-shadow 260ms ease, background-color 260ms ease;
}

.header-inner {
    transition: min-height 260ms ease;
}

html.fx-js .site-header.is-compact .header-inner {
    min-height: 70px;
}

.site-header.is-compact {
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

/* ---------- 3) آشکارسازی هنگام اسکرول ---------- */
html.fx-js .fx-reveal {
    opacity: 0;
    transform: translate3d(0, 22px, 0);
    transition: opacity 620ms cubic-bezier(.22, 1, .36, 1) var(--fx-delay, 0ms),
                transform 620ms cubic-bezier(.22, 1, .36, 1) var(--fx-delay, 0ms);
    will-change: opacity, transform;
}

html.fx-js .fx-reveal.fx-shown {
    opacity: 1;
    transform: none;
}

#courses {
    scroll-margin-top: 112px;
}

/* ---------- 4) دکمه بازگشت به بالا ---------- */
.fx-to-top {
    position: fixed;
    z-index: 40;
    right: 22px;
    bottom: 22px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid #f5e7c6;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    color: #c99a35;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(.92);
    transition: opacity 260ms ease, transform 260ms cubic-bezier(.2, .8, .2, 1), visibility 260ms, border-color 200ms ease;
}

.fx-to-top.is-on {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.fx-to-top:hover {
    border-color: #eed9a3;
    transform: translateY(-3px);
}

.fx-to-top svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 640px) {
    .fx-to-top { width: 42px; height: 42px; right: 14px; bottom: 76px; }
}

/* ---------- 5) هاله‌ی نوری و کج‌شدن سه‌بعدی کارت‌ها ---------- */
html.fx-js .card {
    position: relative;
    transition: transform 260ms cubic-bezier(.2, .8, .2, 1), box-shadow 320ms ease, border-color 260ms ease;
    transform-style: preserve-3d;
}

html.fx-js .card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 280ms ease;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 0%), rgba(212, 165, 63, 0.20), transparent 62%);
}

html.fx-js .card:hover::before { opacity: 1; }
html.fx-js .card .card-body { position: relative; z-index: 2; }

/* ---------- 6) نوار ابزار جستجو و فیلتر دوره‌ها ---------- */
.catalog-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 28px 0 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface, #fff);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.fx-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 240px;
    min-width: 200px;
}

.fx-field > svg {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    color: #94a3b8;
}

.fx-field .input { width: 100%; }

.fx-sort {
    flex: 0 1 190px;
    min-width: 150px;
    cursor: pointer;
}

.fx-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.fx-chip {
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 200ms ease, background-color 200ms ease, color 200ms ease, transform 200ms ease;
}

.fx-chip:hover { border-color: #eed9a3; transform: translateY(-1px); }

.fx-chip.is-on {
    border-color: #eed9a3;
    background: #fbf4e1;
    color: #8a6a1c;
}

.fx-count {
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    margin-inline-start: 4px;
}

.fx-empty {
    padding: 34px 18px;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    background: #f8fafc;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

html.fx-js .card.fx-hidden { display: none; }

/* ---------- 7) پالت فرمان (Ctrl+K) ---------- */
.fx-palette-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    justify-items: center;
    padding: 12vh 16px 16px;
    background: rgba(15, 23, 42, 0.36);
    backdrop-filter: blur(6px);
    animation: fx-fade 180ms ease both;
}

.fx-palette {
    width: min(580px, 100%);
    overflow: hidden;
    border: 1px solid #f5e7c6;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
    animation: fx-pop 220ms cubic-bezier(.2, .8, .2, 1) both;
}

.fx-palette-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.fx-palette-head svg { width: 18px; height: 18px; color: var(--fx-accent); flex: 0 0 auto; }

.fx-palette-head input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
}

.fx-palette-list {
    max-height: min(46vh, 380px);
    overflow-y: auto;
    margin: 0;
    padding: 8px;
    list-style: none;
}

.fx-palette-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--ink);
    font-size: 14px;
    cursor: pointer;
}

.fx-palette-list li .fx-kind {
    flex: 0 0 auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
}

.fx-palette-list li.is-sel,
.fx-palette-list li:hover { background: #fbf4e1; }
.fx-palette-list li.is-sel .fx-kind { background: #f5e7c6; color: #8a6a1c; }

.fx-palette-foot {
    display: flex;
    gap: 14px;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
}

.fx-kbd {
    padding: 1px 6px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font: 600 11px/1.7 Vazirmatn, sans-serif;
}

.fx-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 200ms ease, color 200ms ease, transform 200ms ease;
}

.fx-hint:hover { border-color: #eed9a3; color: #8a6a1c; transform: translateY(-1px); }

@media (max-width: 700px) {
    .fx-hint { display: none; }
}

/* ---------- 8) اعلان‌های شناور (Toast) ---------- */
.fx-toasts {
    position: fixed;
    z-index: 210;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    gap: 8px;
    justify-items: center;
    pointer-events: none;
}

.fx-toast {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 18px;
    border: 1px solid #eed9a3;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.97);
    color: #7a5c14;
    font-size: 13.5px;
    font-weight: 700;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    animation: fx-toast-in 320ms cubic-bezier(.2, .8, .2, 1) both;
}

.fx-toast.is-leaving { animation: fx-toast-out 320ms ease forwards; }
.fx-toast span[aria-hidden] { font-size: 15px; }

/* ---------- 9) کاغذ رنگی جشن ---------- */
.fx-confetti {
    position: fixed;
    inset: 0;
    z-index: 220;
    overflow: hidden;
    pointer-events: none;
}

.fx-confetti i {
    position: absolute;
    top: -14px;
    width: 9px;
    height: 14px;
    border-radius: 2px;
    opacity: 0.95;
    animation: fx-fall linear forwards;
}

@keyframes fx-fall {
    0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate3d(var(--dx, 0px), 106vh, 0) rotate(var(--rot, 540deg)); opacity: 0.9; }
}

@keyframes fx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fx-pop { from { opacity: 0; transform: translateY(-12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fx-toast-in { from { opacity: 0; transform: translateY(16px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes fx-toast-out { to { opacity: 0; transform: translateY(14px) scale(.96); } }

/* ---------- 11) حاشیه رنگی دور دکمه‌ها ---------- */
.btn,
button.btn {
    border: 2px solid var(--btn-ring, #c99a35);
    transition: transform 170ms ease, box-shadow 200ms ease, filter 170ms ease;
}

.btn:hover,
button.btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--btn-ring, #c99a35) 16%, transparent),
        0 12px 26px color-mix(in srgb, var(--btn-ring, #c99a35) 26%, transparent);
}

.btn:active,
button.btn:active {
    transform: translateY(0);
}

.btn:focus-visible,
button.btn:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--btn-ring, #c99a35) 45%, white);
    outline-offset: 2px;
}

.btn-ghost {
    border-color: var(--btn-ring, #eed9a3);
    color: var(--ink);
}

.btn-ghost:hover {
    border-color: var(--btn-ring, #e3b95f);
    background: color-mix(in srgb, var(--btn-ring, #d4a53f) 6%, white);
}

.btn-danger {
    --btn-ring: #f43f5e;
    border-color: var(--btn-ring);
}

/* حالت «در حال ارسال» فرم پشتیبانی */
.btn.is-busy {
    pointer-events: none;
    animation: btn-pulse 1.1s ease-in-out infinite;
}

@keyframes btn-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.18); }
}

/* ---------- 12) پرداخت‌های حرفه‌ای کلی ---------- */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

::selection {
    background: #f5e7c6;
    color: #5c450f;
}

::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    border: 3px solid #f1f5f9;
    border-radius: 999px;
    background: linear-gradient(180deg, #e3b95f, #c99a35);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #d4a53f, #8a6a1c);
}

html {
    scrollbar-color: #d4a53f #f1f5f9;
    scrollbar-width: thin;
}

/* بزرگ‌نمایی نرم تصویر دوره هنگام هاور */
.card .cover {
    transition: transform 520ms cubic-bezier(.2, .8, .2, 1);
}

.card:hover .cover {
    transform: scale(1.045);
}

/* خط گرادیانی بالای فوتر */
.site-footer {
    position: relative;
}

.site-footer::before {
    content: "";
    position: absolute;
    top: -1px;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #d4a53f 30%, #d4a53f 55%, #e3b95f 75%, transparent);
    opacity: 0.75;
}

/* نبض ملایم نشان تخفیف */
.discount-badge {
    animation: badge-breathe 2.6s ease-in-out infinite;
}

@keyframes badge-breathe {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
    50% { transform: scale(1.05); box-shadow: 0 4px 14px rgba(244, 63, 94, 0.28); }
}

@media (prefers-reduced-motion: reduce) {
    .card .cover,
    .btn,
    button.btn {
        transition: none;
    }

    .card:hover .cover {
        transform: none;
    }

    .discount-badge,
    .btn.is-busy {
        animation: none;
    }
}

/* ---------- 10) حالت بدون حرکت ---------- */
@media (prefers-reduced-motion: reduce) {
    html.fx-js .fx-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .fx-to-top,
    .site-header,
    .header-inner,
    html.fx-js .card {
        transition: none;
    }

    .fx-palette-backdrop,
    .fx-palette,
    .fx-toast { animation: none; }
}
