/* ===========================
   SubWave Custom Styles
   =========================== */

:root {
    --subwave-font-sans: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html[dir="ltr"],
:root[data-lang="en"] {
    --subwave-font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Vazirmatn', sans-serif;
}

html, body {
    max-width: 100%;
    overflow-x: clip;
    position: relative;
    font-family: var(--subwave-font-sans);
    transition: background-color 0.3s ease, color 0.3s ease;
}

#subwaveMainHeader {
    position: sticky;
    top: 0;
    z-index: 50;
}

/* چرخش خودکار آیکون‌های جهت‌دار (پیکان / فلش) در حالت انگلیسی LTR */
html[dir="ltr"] .subwave-dir-arrow {
    transform: rotate(180deg);
}

/* استایل هوشمند بج فعال زبان متناسب با data-lang برای حذف هرگونه پرش بصری */
html[data-lang="fa"] #langBadgeFa,
html[data-lang="en"] #langBadgeEn {
    background-color: rgba(234, 179, 8, 0.18);
    color: #92400e;
    opacity: 1;
}
html.dark[data-lang="fa"] #langBadgeFa,
html.dark[data-lang="en"] #langBadgeEn {
    background-color: rgba(234, 179, 8, 0.18);
    color: #EAB308;
    opacity: 1;
}
html[data-lang="fa"] #langBadgeEn,
html[data-lang="en"] #langBadgeFa {
    background-color: transparent;
    opacity: 0.55;
}

/* جلوگیری از سرریز افقی عناصر در رزولوشن‌های موبایل */
img, svg, video, canvas, audio, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* استایل کادرهای پیام ووکامرس در تم تیره و شنی ساب‌ویو */
.woocommerce-info, .woocommerce-message, .woocommerce-error {
    background-color: #ded6c1 !important;
    color: #1e293b !important;
    border: 1px solid #cfc6b1 !important;
    border-top: 3px solid #d97706 !important;
    border-radius: 1rem !important;
    padding: 1rem 1.25rem !important;
    margin: 1.5rem 0 !important;
    font-size: 0.875rem !important;
    line-height: 1.6 !important;
}

.dark .woocommerce-info, .dark .woocommerce-message, .dark .woocommerce-error {
    background-color: #14161e !important;
    color: #f1f5f9 !important;
    border: 1px solid #232836 !important;
    border-top: 3px solid #eab308 !important;
}

.woocommerce-info a.button, .woocommerce-message a.button {
    background-color: #f59e0b !important;
    color: #090a0f !important;
    font-weight: 800 !important;
    border-radius: 0.75rem !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.75rem !important;
    border: none !important;
    margin-right: 0.75rem !important;
}

/* گرید پس‌زمینه تم شب */
.dark .titanium-grid,
:root[data-theme="dark"] .titanium-grid,
.dark-mode .titanium-grid,
body.dark-mode.titanium-grid,
html.dark.titanium-grid {
    background-color: #090A0F;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(234, 179, 8, 0.08) 0%, transparent 60%),
        linear-gradient(to right, rgba(35, 40, 54, 0.45) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(35, 40, 54, 0.45) 1px, transparent 1px);
    background-size: 100% 100%, 42px 42px, 42px 42px;
}

/* گرید پس‌زمینه تم روز پالت Sand */
html:not(.dark) .titanium-grid,
:root[data-theme="light"] .titanium-grid,
.light-mode:not(.dark) .titanium-grid,
body.light-mode.titanium-grid,
html.light-mode.titanium-grid {
    background-color: #EBE2CC;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(183, 176, 158, 0.25) 0%, transparent 65%),
        linear-gradient(to right, rgba(183, 176, 158, 0.35) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(183, 176, 158, 0.35) 1px, transparent 1px);
    background-size: 100% 100%, 42px 42px, 42px 42px;
}

/* فالبک بومی گرید برای حالت اولیه بدون data-theme */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .titanium-grid {
        background-color: #090A0F;
        background-image: 
            radial-gradient(circle at 50% 0%, rgba(234, 179, 8, 0.08) 0%, transparent 60%),
            linear-gradient(to right, rgba(35, 40, 54, 0.45) 1px, transparent 1px),
            linear-gradient(to bottom, rgba(35, 40, 54, 0.45) 1px, transparent 1px);
        background-size: 100% 100%, 42px 42px, 42px 42px;
    }
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme]) .titanium-grid {
        background-color: #EBE2CC;
        background-image: 
            radial-gradient(circle at 50% 0%, rgba(183, 176, 158, 0.25) 0%, transparent 65%),
            linear-gradient(to right, rgba(183, 176, 158, 0.35) 1px, transparent 1px),
            linear-gradient(to bottom, rgba(183, 176, 158, 0.35) 1px, transparent 1px);
        background-size: 100% 100%, 42px 42px, 42px 42px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 7px;
}
.dark ::-webkit-scrollbar-track,
:root[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #090A0F;
}
html:not(.dark) ::-webkit-scrollbar-track,
:root[data-theme="light"] ::-webkit-scrollbar-track {
    background: #EBE2CC;
}
.dark ::-webkit-scrollbar-thumb,
:root[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #232836;
    border-radius: 4px;
}
html:not(.dark) ::-webkit-scrollbar-thumb,
:root[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #B7B09E;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #EAB308;
}

/* ========================================================
   WooCommerce Elements (Cart, Checkout, Tables, Inputs)
   ======================================================== */
.woocommerce table.shop_table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 1px solid #cfc6b1 !important;
    border-radius: 1rem !important;
    overflow: hidden !important;
    background-color: #ded6c1 !important;
    width: 100% !important;
}

.dark .woocommerce table.shop_table {
    border-color: #232836 !important;
    background-color: #14161e !important;
}

.woocommerce table.shop_table th {
    background-color: #d1c8b2 !important;
    color: #1e293b !important;
    font-weight: 700 !important;
    padding: 12px 16px !important;
}

.dark .woocommerce table.shop_table th {
    background-color: #1a1d27 !important;
    color: #f1f5f9 !important;
}

.woocommerce table.shop_table td {
    padding: 12px 16px !important;
    border-top: 1px solid #cfc6b1 !important;
    color: inherit !important;
}

.dark .woocommerce table.shop_table td {
    border-color: #232836 !important;
}

.woocommerce input.input-text, .woocommerce textarea, .woocommerce select {
    background-color: #ebe2cc !important;
    border: 1px solid #b7b09e !important;
    color: #1e293b !important;
    border-radius: 0.5rem !important;
    padding: 0.6rem 0.8rem !important;
}

.dark .woocommerce input.input-text, .dark .woocommerce textarea, .dark .woocommerce select {
    background-color: #090a0f !important;
    border-color: #232836 !important;
    color: #f1f5f9 !important;
}

.woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt {
    background-color: #f59e0b !important;
    color: #090a0f !important;
    font-weight: 800 !important;
    border-radius: 0.75rem !important;
}

.woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover, .woocommerce input.button.alt:hover {
    background-color: #d97706 !important;
    color: #000000 !important;
}

/* ==========================================================================
   قفل موقعیت ویجت شناور پشتیبانی در پایین-چپ (Support Floating Widget RTL/LTR Lock)
   ========================================================================== */
#subwaveSupportWidget.subwave-support-widget,
#subwaveSupportWidget {
    position: fixed !important;
    bottom: 24px !important;
    left: 24px !important;
    right: auto !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    margin: 0 !important;
    padding: 0 !important;
}

html[dir="rtl"] #subwaveSupportWidget {
    direction: rtl;
    text-align: right;
}

html[dir="ltr"] #subwaveSupportWidget {
    direction: ltr;
    text-align: left;
}

#subwaveSupportPopover.subwave-support-popover,
#subwaveSupportPopover {
    position: absolute !important;
    bottom: calc(100% + 14px) !important;
    left: 0 !important;
    right: auto !important;
    margin: 0 !important;
    transform-origin: bottom left !important;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#subwaveSupportPopover.hidden {
    display: none !important;
    opacity: 0 !important;
    transform: scale(0.95) translateY(8px) !important;
    pointer-events: none !important;
}

#subwaveSupportPopover:not(.hidden) {
    display: block !important;
    opacity: 1 !important;
    transform: scale(1) translateY(0) !important;
    pointer-events: auto !important;
}
