﻿/* =====================================================================
   Site.css  (Panelya - FINAL / Clean / Commented)
   نکته: این فایل باید «بعد از» main.css و MenuCss.css لود شود.
   هدف: همه Override ها فقط اینجا باشد.
   ===================================================================== */


/* =====================================================================
   01) Rating Stars (RTL)
   ===================================================================== */
.rating-stars {
    direction: rtl;
    display: inline-flex;
    gap: 2px;
    user-select: none;
    position: relative; /* چون input ها absolute هستند */
}

    .rating-stars input {
        position: absolute;
        opacity: 0;
        width: 1px;
        height: 1px;
        overflow: hidden;
    }

    .rating-stars label {
        font-size: 25px;
        color: #ccc;
        cursor: pointer;
        transition: color .2s ease;
        line-height: 1;
    }

        .rating-stars input:checked ~ label,
        .rating-stars label:hover,
        .rating-stars label:hover ~ label {
            color: #FFD700;
        }
    /* فوکوس کیبورد */
    .rating-stars input:focus-visible + label {
        outline: 2px solid rgba(247,133,141,.55);
        outline-offset: 3px;
        border-radius: 6px;
    }


/* =====================================================================
   02) Top Support Bar
   ===================================================================== */
.top-support-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    gap: 10px;
    flex-wrap: wrap; /* موبایل */
}

.top-support {
    display: flex;
    align-items: center;
    gap: 10px;
    direction: rtl;
}

.top-support__label {
    font: 700 14px/1.2 Tahoma, Arial, sans-serif;
    color: #2d6f23;
    white-space: nowrap;
}
/* Call button */
.top-support__call {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #111;
    background: #fff;
    border: 1px solid rgba(0,0,0,.10);
    border-radius: 14px;
    padding: 6px 10px;
    box-shadow: 0 6px 16px rgba(0,0,0,.06);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

    .top-support__call:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 22px rgba(0,0,0,.10);
        border-color: rgba(0,0,0,.16);
    }

.top-support__iconWrap {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: #f6f7f8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 auto;
}

.top-support__icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

.top-support__phone {
    font: 800 14px/1 Tahoma, Arial, sans-serif;
    letter-spacing: .3px;
    white-space: nowrap;
}

.top-support-bar__note {
    color: #6b7280;
    font: 600 12px/1.2 Tahoma, Arial, sans-serif;
    white-space: nowrap;
}
/* Mobile alignment */
@media (max-width:576px) {
    .top-support-bar {
        justify-content: center;
    }

    .top-support-bar__note {
        width: 100%;
        text-align: center;
    }
}
/* Headset icon */
.top-support__mdi {
    font-size: 40px;
    color: #16a34a;
    line-height: 1;
}

.top-support__call:hover .top-support__mdi {
    color: #16a34a;
}


/* =====================================================================
   03) Panelya Toast (ONE definitive block)
   ===================================================================== */
.pn-toast {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999999;
    width: min(360px, calc(100vw - 32px));
    background: rgba(17,24,39,.92);
    color: #fff;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(0,0,0,.28);
    backdrop-filter: blur(8px);
    display: grid;
    grid-template-columns: 34px 1fr 28px;
    gap: 10px;
    align-items: center;
    padding: 12px;
    direction: rtl;
    text-align: right;
    font-family: Tahoma, Arial, sans-serif;
    transform: translateY(-14px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

    .pn-toast.is-show {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

.pn-toast__icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16,185,129,.18);
    border: 1px solid rgba(16,185,129,.35);
    font-weight: 900;
    font-size: 16px;
}

.pn-toast__content {
    min-width: 0;
}

.pn-toast__title {
    font-weight: 900;
    font-size: 13px;
    opacity: .95;
    line-height: 1.1;
}

.pn-toast__msg {
    font-size: 12px;
    opacity: .9;
    margin-top: 2px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pn-toast__close {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.14);
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    opacity: .9;
}

    .pn-toast__close:hover {
        opacity: 1;
    }
/* Mobile: toast پایین صفحه */
@media (max-width:576px) {
    .pn-toast {
        top: auto;
        bottom: 16px;
        left: 16px;
        right: 16px;
        width: auto;
    }
}

@media (prefers-reduced-motion:reduce) {
    .pn-toast {
        transition: none;
    }
}


/* =====================================================================
   04) Header/Menu Z-index + Clip fix (Desktop mega/menu)
   ===================================================================== */
.main-header,
.bottom-header,
.bottom-header .container,
.bottom-header .container.main-container,
.main-menu,
.main-menu nav,
.main-menu .list,
.main-menu .list > li,
.dt-sl,
.container.main-container {
    overflow: visible !important;
}
/* لایه‌بندی صحیح هدر و منو */
.main-header,
.bottom-header {
    position: relative;
    z-index: 10000;
}

.main-menu {
    position: relative;
    z-index: 10010;
}

    .main-menu .list {
        position: relative;
        z-index: 10020;
    }
        /* زیرمنو/مگا همیشه بالاتر */
        .pn-mega,
        .main-menu .sub-menu,
        .main-menu .mega-menu,
        .main-menu .list > li > ul {
            z-index: 20000 !important;
        }
/* اگر قالب روی والد transform گذاشته باشد، z-index خراب می‌شود */
.main-header,
.bottom-header,
.main-menu {
    transform: none !important;
}
/* اوورلی سایدمنو */
.overlay-side-menu {
    z-index: 9980 !important;
}
/* Fallback hover برای مگا منو (Desktop) */
@media (min-width:993px) {
    .pn-mega__parent:hover .pn-mega__pane {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .pn-mega__parent:hover .pn-mega__parentBtn {
        background: #fff;
        box-shadow: 0 8px 18px rgba(0,0,0,.06);
        color: #111;
    }

    .pn-mega__parent:first-child .pn-mega__pane {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}


/* =====================================================================
   05) Header Account (Login Partial) - Scoped
   ===================================================================== */
.topbar-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
}

#header-account.header-account {
    position: relative;
    z-index: 13000;
}

#header-account .nav {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
}

#header-account .nav-item.dropdown {
    position: relative;
}

#header-account .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

#header-account .label-dropdown {
    font-weight: 700;
    font-size: 13px;
}

#header-account .dropdown-menu {
    min-width: 230px;
    max-width: calc(100vw - 24px);
    margin-top: 10px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 12px 30px rgba(0,0,0,.14);
    padding: 6px 0;
    z-index: 13010;
    direction: rtl;
    text-align: right;
}

    #header-account .dropdown-menu.dropdown-menu-left {
        left: 0;
        right: auto;
    }

#header-account .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-weight: 700;
    color: #222;
}

    #header-account .dropdown-item i {
        font-size: 18px;
        opacity: .85;
    }

#header-account .wallet-row {
    justify-content: space-between;
}

#header-account .wallet-left {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#header-account .logout-form {
    margin: 0;
}

#header-account .logout-btn {
    width: 100%;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: right;
}

#header-account .badge-success {
    background-color: #28a745;
    color: #fff;
    font-size: .75rem;
    padding: 3px 7px;
    border-radius: 12px;
}
/* کمک به اینکه روی لایه‌های هدر نیفتد */
.main-header .topbar,
.main-header .topbar.dt-sl {
    position: relative;
    z-index: 12990;
}

.main-header .bottom-header {
    position: relative;
    z-index: 12000;
}


/* =====================================================================
   06) Register link (Login page)
   ===================================================================== */
.mini-link--register {
    font-weight: 800;
    color: #16a34a !important;
    background: rgba(22,163,74,.10);
    border: 1px solid rgba(22,163,74,.28);
    padding: 6px 10px;
    border-radius: 10px;
    text-decoration: none;
}

    .mini-link--register:hover {
        background: rgba(22,163,74,.16);
        border-color: rgba(22,163,74,.38);
        color: #15803d !important;
        text-decoration: none;
    }


/* =====================================================================
   07) OTP helper alert
   ===================================================================== */
.otp-help-alert {
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,.06);
    background: #f2f8ff;
    color: #0f172a;
    font-size: 13px;
    line-height: 1.9;
    margin-bottom: 14px;
}


/* =====================================================================
   08) Header Cart Dropdown (Desktop hover) + Z-index
   ===================================================================== */
#headerCartRoot {
    position: relative;
    z-index: 20010; /* بالاتر از منو/هدر */
}

    #headerCartRoot .cart--wrapper {
        position: relative;
    }

    #headerCartRoot .header-cart-info {
        position: absolute;
        top: 100%;
        margin-top: 8px;
        left: 0; /* اگر RTL و سمت راست می‌خواهی: right:0; left:auto; */
        right: auto;
        width: 360px;
        max-width: calc(100vw - 24px);
        background: #fff;
        border: 1px solid rgba(0,0,0,.10);
        border-radius: 14px;
        box-shadow: 0 18px 45px rgba(0,0,0,.18);
        z-index: 20020;
        display: none; /* پیش‌فرض بسته */
        pointer-events: auto;
    }
        /* Hover bridge (فقط دسکتاپ) */
        #headerCartRoot .header-cart-info::before {
            content: "";
            position: absolute;
            top: -10px;
            left: 0;
            right: 0;
            height: 10px;
        }
    /* Desktop: open by hover/focus */
    #headerCartRoot .cart--wrapper:hover .header-cart-info,
    #headerCartRoot .cart--wrapper:focus-within .header-cart-info {
        display: block;
    }


/* =====================================================================
   09) Mobile Side Menu: Scroll + ensure content visible
   ===================================================================== */
@media (max-width:992px) {
    .side-menu {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        max-height: 100vh;
    }

        .side-menu .search-box-side-menu {
            display: block !important;
            padding: 10px 12px;
        }

        .side-menu .sb {
            display: block !important;
            padding: 8px 12px 16px;
        }
}


/* =====================================================================
   10) Mobile Dropdowns (Cart + Account)  **FINAL FIX**
   مشکل شما: روی موبایل “تاگل می‌شود ولی سریع بسته می‌شود”.
   علت رایج: روی موبایل «hover state» بعد از tap فعال می‌شود و چون selector
   hover از نظر specificity قوی‌تر است، display را صفر می‌کند.
   راه‌حل: در موبایل، hover/focus دسکتاپ را خنثی می‌کنیم و با is-open کنترل می‌کنیم،
   و یک override بسیار دقیق برای حالت is-open + hover می‌گذاریم.
   ===================================================================== */
@media (max-width:992px) {

    /* -------------------------------------------------
       A) CART: در موبایل فقط is-open ملاک باشد
       ------------------------------------------------- */

    /* 1) خنثی کردن رفتار دسکتاپ (hover/focus) */
    #headerCartRoot .cart--wrapper:hover .header-cart-info,
    #headerCartRoot .cart--wrapper:focus-within .header-cart-info {
        display: none !important;
    }

    /* 2) حالت پایه: بسته */
    #headerCartRoot .header-cart-info {
        display: none !important;
        z-index: 21000;
    }

    /* 3) حالت باز: is-open */
    #headerCartRoot.is-open .header-cart-info {
        display: block !important;
    }

    /* 4) اگر در موبایل tap باعث hover هم شد، باز هم وقتی is-open است باز بماند
          (این selector از hover-only قوی‌تر است و مشکل “سریع بسته شدن” را می‌بندد) */
    #headerCartRoot.is-open .cart--wrapper:hover .header-cart-info,
    #headerCartRoot.is-open .cart--wrapper:focus-within .header-cart-info {
        display: block !important;
    }

    /* تجربه لمس بهتر */
    #headerCartRoot .js-cart-toggle {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }


    /* -------------------------------------------------
       B) ACCOUNT: فقط is-open ملاک باشد (Bootstrap show بی‌اثر)
       ------------------------------------------------- */
    #header-account .dropdown-menu {
        display: none !important; /* پایه: بسته */
        z-index: 21000;
    }

    #header-account.is-open .dropdown-menu {
        display: block !important; /* باز */
    }

    /* اگر جایی Bootstrap کلاس show اضافه کرد، باز هم فقط is-open ملاک باشد */
    #header-account .dropdown-menu.show {
        display: none !important;
    }

    #header-account.is-open .dropdown-menu.show {
        display: block !important;
    }

    #header-account .js-account-toggle {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* کلیک/اسکرول داخل باکس‌ها راحت باشد */
    #headerCartRoot .header-cart-info,
    #header-account .dropdown-menu {
        pointer-events: auto;
        touch-action: pan-y;
    }
}

/* فقط مخصوص همین فرم در فوتر */
#newsletter-form .btn-newsletter {
    background: #000 !important;
    border-color: #000 !important;
    color: #fff !important;
    transition: 0.2s ease;
}

    #newsletter-form .btn-newsletter:hover,
    #newsletter-form .btn-newsletter:focus {
        background: #111 !important;
        border-color: #111 !important;
        color: #fff !important;
        box-shadow: none;
        outline: none;
    }

    #newsletter-form .btn-newsletter:active {
        background: #222 !important;
        border-color: #222 !important;
    }

/* =========================================================
   DK Story Carousel - SIMPLE & CLEAN (FINAL)
   RTL | Stable | Simple Border
   ========================================================= */

.dk-story,
.dk-story * {
    box-sizing: border-box;
}

/* Wrapper */
.dk-story {
    position: relative;
    width: 100%;
    direction: rtl;
}

/* Track */
.dk-story__track {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth;
    gap: 14px !important;
    padding: 10px 54px !important; /* فضای دکمه‌ها */
    align-items: flex-start !important;
    scrollbar-width: none;
}

    .dk-story__track::-webkit-scrollbar {
        display: none !important;
    }

/* Item */
.dk-story__item {
    flex: 0 0 auto !important;
    width: 104px !important;
    display: block !important;
    text-decoration: none !important;
    color: #222 !important;
    user-select: none !important;
}

/* Circle (simple border) */
.dk-story__ring {
    width: 86px !important;
    height: 86px !important;
    margin: 0 auto 8px !important;
    border-radius: 50% !important;
    border: 1px solid rgba(0,0,0,.25) !important;
    background: #fff !important;
    overflow: hidden !important; /* مهم */
    display: block;
}

    /* Image */
    .dk-story__ring img {
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        border-radius: 50% !important;
        object-fit: cover !important;
        object-position: center center !important;
        border: 0 !important;
        background: #fff !important;
    }

/* Label */
.dk-story__label {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    text-align: center !important;
    max-width: 104px !important;
    min-height: 34px !important;
    overflow: hidden !important;
    white-space: normal !important;
    padding: 0 4px !important;
}

/* Navigation buttons */
.dk-story__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999 !important;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.15);
    background: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.dk-story__nav--right {
    right: 6px;
}

.dk-story__nav--left {
    left: 6px;
}

/* Even if disabled */
.dk-story__nav[disabled] {
    opacity: .6 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Click feel */
.dk-story__nav:active {
    transform: translateY(-50%) scale(.96);
}

/* Mobile */
@media (max-width: 576px) {
    .dk-story__nav {
        display: none !important;
    }

    .dk-story__track {
        padding: 8px 10px !important;
        gap: 12px !important;
    }

    .dk-story__item {
        width: 96px !important;
    }

    .dk-story__ring {
        width: 78px !important;
        height: 78px !important;
    }

    .dk-story__label {
        max-width: 96px !important;
        min-height: 30px !important;
    }
}
