/* =====================================================================
   custom.css — استایل‌های افزوده‌ی فروشگاه کافئین
   (نوار استوری، نمایشگر استوری، پیام‌ها و اجزای کوچک)
   عمداً بدون Tailwind نوشته شده تا به بیلد از پیش‌ساخته وابسته نباشد.
   ===================================================================== */

:root {
    --cf-green: #22c55e;
    --cf-green-dark: #16a34a;
    --cf-surface: #ffffff;
    --cf-text: #18181b;
    --cf-muted: #71717a;
    --cf-border: #e4e4e7;
}

html.dark {
    --cf-surface: #3f3f46;
    --cf-text: #ffffff;
    --cf-muted: #a1a1aa;
    --cf-border: rgba(255, 255, 255, .12);
}

/* ==================== کشوی سبد خرید و منوی موبایل ====================
   موقعیت این دو پنل با transform کنترل می‌شود، نه با left/right.
   دلیل: transform مستقل از جهت نوشتار (RTL/LTR) و خصوصیات منطقی است،
   روی لایه‌ی ترکیب اجرا می‌شود و انیمیشن نرم‌تری می‌دهد. همچنین به
   کلاس‌های موقعیت بیلد از پیش‌ساخته‌ی Tailwind وابسته نیست.
   ==================================================================== */
.cf-drawer,
.cf-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 50;
    transition: transform .3s ease;
}

/* کشوی سبد خرید — از لبه‌ی چپ (در RTL) وارد می‌شود */
.cf-drawer {
    left: 0;
    right: auto;
    width: 18rem;
    max-width: 85vw;
    transform: translateX(-100%);
}

.cf-drawer.is-open {
    transform: translateX(0);
}

/* منوی کناری موبایل — از لبه‌ی راست وارد می‌شود */
.cf-panel {
    right: 0;
    left: auto;
    width: 16rem;
    max-width: 85vw;
    transform: translateX(100%);
}

.cf-panel.is-open {
    transform: translateX(0);
}

/* در چیدمان چپ‌به‌راست جهت ورود برعکس می‌شود */
html[dir="ltr"] .cf-drawer {
    left: auto;
    right: 0;
    transform: translateX(100%);
}

html[dir="ltr"] .cf-panel {
    right: auto;
    left: 0;
    transform: translateX(-100%);
}

html[dir="ltr"] .cf-drawer.is-open,
html[dir="ltr"] .cf-panel.is-open {
    transform: translateX(0);
}

/* پوشش تیره پشت پنل‌ها */
.cf-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}

.cf-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

body.cf-locked {
    overflow: hidden;
}

/* ==================== نوار استوری ==================== */
.story-bar {
    background: var(--cf-surface);
    border-bottom: 1px solid var(--cf-border);
    padding: 14px 0 10px;
}

.story-bar__scroller {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
}

.story-bar__scroller::-webkit-scrollbar {
    display: none;
}

.story {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    width: 76px;
    scroll-snap-align: start;
    font-family: inherit;
}

.story__ring {
    --ring: var(--cf-green);
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    padding: 3px;
    background: conic-gradient(from 180deg, var(--ring), #f59e0b, #ef4444, var(--ring));
    transition: transform .2s ease;
}

.story:hover .story__ring {
    transform: scale(1.06);
}

/* استوری دیده‌شده حلقه‌ی خاکستری می‌گیرد */
.story--seen .story__ring {
    background: var(--cf-border);
}

.story__img-wrap {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    padding: 2px;
    background: var(--cf-surface);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.story__img-wrap img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.story__title {
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--cf-text);
    text-align: center;
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story--seen .story__title {
    color: var(--cf-muted);
}

@media (max-width: 640px) {
    .story__ring { width: 60px; height: 60px; }
    .story { width: 66px; }
    .story__title { font-size: 10.5px; max-width: 64px; }
}

/* ==================== نمایشگر استوری ==================== */
.story-viewer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
}

.story-viewer[hidden] {
    display: none;
}

.story-viewer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 9, 11, .93);
    backdrop-filter: blur(6px);
}

.story-viewer__stage {
    position: relative;
    display: flex;
    align-items: center;
    gap: 22px;
    width: 100%;
    height: 100%;
    justify-content: center;
    padding: 16px;
}

.story-viewer__card {
    position: relative;
    width: min(420px, 100%);
    height: min(88vh, 760px);
    margin: 0;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
    display: flex;
    flex-direction: column;
}

/* نوارهای پیشرفت */
.story-viewer__bars {
    position: absolute;
    top: 10px;
    left: 12px;
    right: 12px;
    z-index: 4;
    display: flex;
    gap: 4px;
}

.story-viewer__bar {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .32);
    overflow: hidden;
}

.story-viewer__bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 3px;
    background: #fff;
}

.story-viewer__bar--done span {
    width: 100%;
}

.story-viewer__head {
    position: absolute;
    top: 24px;
    left: 12px;
    right: 12px;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
}

.story-viewer__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, .85);
}

.story-viewer__name {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .7);
}

.story-viewer__pause,
.story-viewer__close {
    background: rgba(0, 0, 0, .35);
    border: 0;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    transition: background .2s;
}

.story-viewer__pause:hover,
.story-viewer__close:hover {
    background: rgba(0, 0, 0, .6);
}

.story-viewer__pause svg,
.story-viewer__close svg {
    width: 17px;
    height: 17px;
}

.story-viewer__media {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: #0a0a0a;
}

.story-viewer__media img,
.story-viewer__media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.story-viewer__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 76px;
    z-index: 3;
    padding: 26px 18px 12px;
    color: #fff;
    font-size: 14px;
    line-height: 1.9;
    text-align: center;
    background: linear-gradient(to top, rgba(0, 0, 0, .78), transparent);
    pointer-events: none;
}

.story-viewer__cta {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--cf-green);
    color: #fff;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 999px;
    transition: background .2s, transform .2s;
    font-family: inherit;
}

.story-viewer__cta:hover {
    background: var(--cf-green-dark);
    transform: translateX(-50%) translateY(-2px);
}

.story-viewer__cta[hidden] {
    display: none;
}

.story-viewer__cta svg {
    width: 15px;
    height: 15px;
}

/* نواحی لمسی چپ و راست برای رفتن به آیتم بعد/قبل */
.story-viewer__tap {
    position: absolute;
    top: 64px;
    bottom: 64px;
    width: 32%;
    z-index: 2;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0;
}

/* در حالت RTL: راست = قبلی، چپ = بعدی */
.story-viewer__tap--prev { right: 0; }
.story-viewer__tap--next { left: 0; }

.story-viewer__nav {
    position: relative;
    z-index: 3;
    background: rgba(255, 255, 255, .12);
    border: 0;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background .2s;
}

.story-viewer__nav:hover {
    background: rgba(255, 255, 255, .26);
}

.story-viewer__nav svg {
    width: 22px;
    height: 22px;
}

@media (max-width: 900px) {
    .story-viewer__nav { display: none; }
    .story-viewer__stage { padding: 0; }
    .story-viewer__card {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}

body.story-open {
    overflow: hidden;
}

/* ==================== پیام‌های شناور ==================== */
.toast-stack {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(360px, calc(100vw - 36px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--cf-surface);
    color: var(--cf-text);
    border-right: 4px solid var(--cf-green);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.9;
    box-shadow: 0 10px 34px rgba(0, 0, 0, .18);
    animation: toast-in .28s ease;
}

.toast--error   { border-right-color: #ef4444; }
.toast--warning { border-right-color: #f59e0b; }
.toast--info    { border-right-color: #0ea5e9; }

.toast__close {
    background: none;
    border: 0;
    color: var(--cf-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==================== اجزای کوچک ==================== */
.cf-field {
    width: 100%;
    background: transparent;
    border: 1px solid var(--cf-border);
    border-radius: 10px;
    padding: 11px 13px;
    font-family: inherit;
    font-size: 14px;
    color: var(--cf-text);
    transition: border-color .2s;
}

.cf-field:focus {
    outline: none;
    border-color: var(--cf-green);
}

.cf-field::placeholder {
    color: var(--cf-muted);
}

.cf-label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--cf-muted);
}

.cf-error {
    color: #ef4444;
    font-size: 12.5px;
    margin-top: 5px;
}

/* شماره کارت برای صفحه‌ی فیش واریزی */
.card-number {
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    direction: ltr;
    unicode-bidi: embed;
}

/* اسکلت بارگذاری */
.cf-skeleton {
    background: linear-gradient(90deg, var(--cf-border) 25%, transparent 37%, var(--cf-border) 63%);
    background-size: 400% 100%;
    animation: cf-shimmer 1.4s ease infinite;
    border-radius: 8px;
}

@keyframes cf-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}
