/*
Theme Name: UpMobile
Theme URI: https://upmobi.ir
Author: UpMobile Team
Author URI: https://upmobi.ir
Description: قالب اختصاصی فروشگاه آب موبایل با طراحی مدرن، پشتیبانی کامل از ووکامرس، صفحه تسویه حساب سفارشی، خرید قسطی و امکانات پیشرفته
Version: 2.1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: upmobile
Tags: e-commerce, rtl-language-support, custom-logo, custom-menu, featured-images, translation-ready, woocommerce
*/

/* ═══════════════════════════════════════════════════════════
   فهرست مطالب (Table of Contents)
   ۱. ریست و استایل‌های پایه
   ۲. تایپوگرافی و فونت
   ۳. دکمه‌ها
   ۴. هدر اصلی
   ۵. آیکون‌های هدر و زیرمنوها
   ۶. منوی ناوبری اصلی
   ۷. فوتر
   ۸. نوار مزایا (Features Bar)
   ۹. ریسپانسیو عمومی (هدر، منو، نوار مزایا)
   ۱۰. ریسپانسیو اختصاصی (کوتاه کردن عناوین در موبایل)
   ═══════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════
   ۱. ریست و استایل‌های پایه (Reset & Base)
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after { 
    box-sizing: border-box; 
}

html, body {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: clip !important; /* برای جلوگیری از اسکرول افقی و خرابی Sticky */
    overflow-y: visible !important;
    position: relative;
    width: 100%;
    background-color: #f4f6f9;
    direction: rtl;
    text-align: right;
    color: #333;
    line-height: 1.7;
}

/* حذف transform/overflow از والدها که sticky را می‌شکنند */
body,
#page,
.site,
.site-content,
.wp-site-blocks {
    overflow: visible !important;
    transform: none !important;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 25px;
}

a { 
    text-decoration: none; 
    transition: all 0.3s; 
}

img { 
    max-width: 100%; 
    height: auto; 
    display: block; 
}

ul { 
    list-style: none; 
    margin: 0; 
    padding: 0; 
}

h1, h2, h3, h4, h5, h6 { 
    margin: 0; 
    font-weight: bold; 
}

button { 
    font-family: inherit; 
    cursor: pointer; 
}


/* ═══════════════════════════════════════════════════════════
   ۲. تایپوگرافی و فونت (Typography & Font)
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after,
body, html,
h1, h2, h3, h4, h5, h6,
p, a, span, div, li,
button, input, textarea, select {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif !important;
}

/* وزن‌های تیترها */
h1, h2 { font-weight: 900 !important; }
h3, h4 { font-weight: 700 !important; }
h5, h6 { font-weight: 500 !important; }

/* متن عادی */
body, p { font-weight: 400; }

/* تأکیدی */
strong, b { font-weight: 700; }

/* قیمت‌ها */
.price, .woocommerce-Price-amount, .amount {
    font-weight: 700 !important;
}


/* ═══════════════════════════════════════════════════════════
   ۳. دکمه‌ها (Buttons)
   ═══════════════════════════════════════════════════════════ */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #4837F3, #6b5bff);
    color: #fff;
    box-shadow: 0 8px 20px rgba(72, 55, 243, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(72, 55, 243, 0.4);
    color: #fff;
}


/* ═══════════════════════════════════════════════════════════
   ۴. هدر اصلی (Main Header)
   ═══════════════════════════════════════════════════════════ */
.site-header {
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 9999;
    width: 100%;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05), 0 4px 20px rgba(72, 55, 243, 0.06);
    border-top: 3px solid #4837F3;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    padding: 18px 30px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 85px;
}

/* لوگو */
.site-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.site-logo a {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.site-logo img,
.site-logo .custom-logo,
.site-logo .custom-logo-link img {
    max-height: 50px !important;
    max-width: 160px !important;
    width: auto !important;
    height: auto !important;
    display: block !important;
    object-fit: contain;
}

.site-title {
    font-size: 22px;
    font-weight: 900;
    background: linear-gradient(135deg, #4837F3, #FF6B35);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    line-height: 1;
}

/* نوار جستجو */
.header-search {
    flex: 1 1 auto;
    max-width: 100%;
    min-width: 200px;
    position: relative;
}

.header-search .dgwt-wcas-search-wrapp,
.header-search .dgwt-wcas-search-form {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}


/* ═══════════════════════════════════════════════════════════
   ۵. آیکون‌های هدر و زیرمنوها (Header Icons & Dropdowns)
   ═══════════════════════════════════════════════════════════ */
.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.h-icon-wrap {
    position: relative;
    display: inline-block;
}

.h-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(145deg, #ffffff, #eef1f8);
    color: #4837F3;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 4px 10px rgba(72, 55, 243, 0.10), -3px -3px 8px rgba(255, 255, 255, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    padding: 0;
    margin: 0;
}

.h-icon-btn svg { transition: all 0.3s; stroke: #4837F3; }

.h-icon-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(145deg, #6b5bff, #4837F3);
    box-shadow: 6px 6px 14px rgba(72, 55, 243, 0.35), -3px -3px 8px rgba(255, 255, 255, 0.9);
}

.h-icon-btn:hover svg { stroke: #fff; }

.h-icon-wrap.is-open .h-icon-btn {
    background: linear-gradient(145deg, #6b5bff, #4837F3);
    box-shadow: inset 3px 3px 8px rgba(0, 0, 0, 0.15), inset -2px -2px 6px rgba(255, 255, 255, 0.1);
}

.h-icon-wrap.is-open .h-icon-btn svg { stroke: #fff; }

/* نشانگر تعداد سبد خرید */
.h-cart-count {
    position: absolute;
    top: -5px;
    left: -5px;
    background: linear-gradient(145deg, #FF6B35, #e85a2a);
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    padding: 0 4px;
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.5);
    z-index: 2;
}

/* زیرمنوها */
.h-dropdown {
    position: absolute;
    top: calc(100% + 14px);
    left: 0;
    right: auto;
    transform: translateY(-8px);
    background: #fff;
    min-width: 250px;
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(72, 55, 243, 0.06);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99999;
    display: block;
}

.h-icon-wrap.is-open .h-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.h-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    right: auto;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(72, 55, 243, 0.05);
    border-radius: 2px;
}

.h-dropdown-title {
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: bold;
    color: #222;
    border-bottom: 1px solid #f0f0f5;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.h-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #555 !important;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s;
}

.h-dropdown-item svg { stroke: #4837F3; flex-shrink: 0; transition: all 0.2s; }

.h-dropdown-item:hover {
    background: #f7f8fc;
    color: #4837F3 !important;
    padding-right: 18px;
}

.h-dropdown-item-logout svg { stroke: #e63946; }

.h-dropdown-item-logout:hover { background: #fff5f5; color: #e63946 !important; }


/* ═══════════════════════════════════════════════════════════
   ۶. منوی ناوبری اصلی (Main Navigation)
   ═══════════════════════════════════════════════════════════ */
.main-navigation {
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.6) !important;
    border-bottom: 1px solid rgba(72, 55, 243, 0.12) !important;
    box-shadow: 0 4px 20px rgba(72, 55, 243, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
    position: sticky;
    top: 85px;
    z-index: 9998;
    width: 100%;
}

.nav-container {
    display: flex;
    justify-content: flex-start !important;
    padding: 0 30px !important;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.main-navigation ul.primary-menu {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: flex-start !important;
    gap: 2px;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
}

.main-navigation ul li { position: relative; }

.main-navigation ul li a {
    display: block;
    color: #333 !important;
    font-weight: 600 !important;
    text-shadow: none !important;
    font-size: 14.5px;
    padding: 15px 20px;
    white-space: nowrap;
    position: relative;
}

.main-navigation ul li a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 60%;
    height: 3px;
    background: linear-gradient(90deg, #4837F3, #FF6B35) !important;
    border-radius: 2px 2px 0 0;
    transition: transform 0.3s;
}

.main-navigation ul li a:hover {
    background: rgba(72, 55, 243, 0.08) !important;
    color: #4837F3 !important;
}

.main-navigation ul li a:hover::before,
.main-navigation ul li.current-menu-item a::before {
    transform: translateX(-50%) scaleX(1);
}


/* ═══════════════════════════════════════════════════════════
   ۷. فوتر (Footer)
   ═══════════════════════════════════════════════════════════ */
.site-footer {
    background: #1a1a2e;
    color: #aaa;
    padding: 50px 0;
    text-align: center;
    margin-top: 60px;
    border-top: 4px solid #4837F3;
    width: 100%;
}

.site-footer p { margin: 5px 0; }


/* ═══════════════════════════════════════════════════════════
   ۸. نوار مزایا (Features Bar)
   ═══════════════════════════════════════════════════════════ */
.features-bar {
    background: #fff;
    padding: 30px 0;
    margin-bottom: 40px;
    width: 100%;
}

.features-bar .container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-left: 3px solid #4837F3;
    background: #fafafa;
    border-radius: 12px;
    transition: all 0.3s;
}

.feature-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.feature-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.feature-icon svg {
    width: 32px;
    height: 32px;
    stroke: #4837F3;
}

.feature-item h4 {
    margin: 0 0 5px;
    font-size: 15px;
    color: #222;
    font-weight: 700;
}

.feature-item p {
    margin: 0;
    font-size: 13px;
    color: #777;
    line-height: 1.5;
}


/* ═══════════════════════════════════════════════════════════
   ۹. ریسپانسیو عمومی (تبلت)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
    .header-container {
        flex-wrap: wrap;
        padding: 12px 20px;
        gap: 15px;
    }
    
    .header-search {
        order: 3;
        width: 100%;
        max-width: 100%;
        flex: 1 1 100%;
        margin-top: 10px;
    }

    .features-bar .container {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 10px !important;
    }

    .feature-item {
        flex-direction: column !important;
        text-align: center !important;
        padding: 12px 6px !important;
        gap: 6px !important;
        border-left: none !important;
        border-top: 2px solid #4837F3 !important;
    }

    .feature-icon { font-size: 20px !important; }
    .feature-icon svg { width: 20px !important; height: 20px !important; }
    .feature-item h4 { font-size: 11px !important; }
    .feature-item p { font-size: 10px !important; }
}

/* ═══════════════════════════════════════════════════════════
   ۱۰. ریسپانسیو اختصاصی موبایل (هدر فشرده + عناوین کوتاه)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .container { padding: 0 15px; }
    .header-container { 
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 15px; 
        min-height: 60px;
        flex-wrap: nowrap;
    }

    /* لوگو */
    .site-logo img, 
    .site-logo .custom-logo,
    .site-logo .custom-logo-link img { 
        max-height: 36px !important; 
        max-width: 100px !important; 
    }
    .site-title { font-size: 16px; }

    /* جستجو */
    .header-search {
        flex: 1 1 auto !important;
        order: 0 !important;
        margin-top: 0 !important;
        width: auto !important;
        min-width: 0 !important;
    }

    .header-search input,
    .header-search .search-field,
    .header-search .dgwt-wcas-search-input {
        height: 40px !important;
        font-size: 13px !important;
        padding: 8px 14px !important;
    }

    /* مخفی کردن آیکون‌های هدر (چون در منوی پایین هستند) */
    .site-header .header-actions {
        display: none !important;
    }

    /* منو */
    .main-navigation { top: 60px !important; }
    .main-navigation .nav-container { padding: 0 10px !important; }
    .main-navigation ul li a { padding: 10px 12px !important; font-size: 12.5px !important; }

    /* زیرمنوها */
    .h-dropdown {
        position: fixed !important;
        top: auto !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
        min-width: auto !important;
        transform: translateY(-8px) !important;
    }
    .h-icon-wrap.is-open .h-dropdown { transform: translateY(0) !important; }
    .h-dropdown::before { display: none; }
    .h-dropdown-cart { min-width: auto !important; }

    /* نوار مزایا در موبایل */
    .features-bar { padding: 12px 0 !important; margin-bottom: 20px !important; }
    .features-bar .container { grid-template-columns: repeat(4, 1fr) !important; gap: 6px !important; padding: 0 8px !important; }
    .feature-item {
        flex-direction: column !important;
        text-align: center !important;
        padding: 10px 4px !important;
        gap: 5px !important;
        border-left: none !important;
        border-top: 2px solid #4837F3 !important;
        border-radius: 8px !important;
        background: #fafafa !important;
        min-width: 0 !important;
    }
    .feature-icon { font-size: 18px !important; margin: 0 !important; }
    .feature-icon svg { width: 18px !important; height: 18px !important; }
    .feature-item h4 {
        font-size: 9.5px !important;
        margin: 0 !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
    }
    .feature-item p { display: none !important; }
    .feature-item > div { width: 100% !important; min-width: 0 !important; }

    /* ═══════════════════════════════════════════════════════
       کوتاه کردن عنوان محصولات (فقط در موبایل)
       ═══════════════════════════════════════════════════════ */
    .up-arc-name,                           /* صفحه فروشگاه و دسته‌بندی */
    .woocommerce-loop-product__title,       /* کارت‌های استاندارد ووکامرس */
    .up-sale-title,                         /* رگال صفحه اصلی */
    .up-product-title,                      /* سایر رگال‌ها */
    .up-cart-item__title,                   /* مینی‌کارت هدر و موبایل */
    .h-cart-item-info a,                    /* مینی‌کارت (کلاس قدیمی) */
    .up-co-product-name {                   /* صفحه تسویه حساب */
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;   /* حداکثر ۲ خط */
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: normal !important;
        
        /* تنظیم ارتفاع ثابت برای هم‌قد شدن کارت‌ها */
        line-height: 1.5 !important;
        max-height: 3em !important; /* ۲ خط × ۱.۵ */
        min-height: 3em !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   انیمیشن منوی دسکتاپ (مخفی شدن با اسکرول)
   ═══════════════════════════════════════════════════════════ */
.main-navigation {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease !important;
    will-change: transform;
}

/* کلاس مخفی‌کننده منو */
body.nav-hidden .main-navigation {
    transform: translateY(-100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ═══════════════════════════════════════════════════════════
   استایل دکمه همبرگری (Hamburger)
   ═══════════════════════════════════════════════════════════ */
.mobile-toggle-btn {
    display: none;
    background: #f4f6f9;
    border: none;
    width: 38px; /* سایز مناسب و کوچک */
    height: 38px;
    border-radius: 10px;
    color: #4837F3;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
    margin-right: 8px; /* فاصله از نوار جستجو */
}
.mobile-toggle-btn:active { transform: scale(0.9); }
.mobile-toggle-btn svg { width: 20px; height: 20px; }

/* پاپ‌آپ منوی موبایل */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: #ffffff;
    z-index: 999999;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    direction: rtl;
}

.mobile-menu-overlay.is-active {
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #f0f0f5;
}
.mobile-menu-title { font-size: 16px; font-weight: 900; color: #222; }
.mobile-menu-close {
    background: #f4f6f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.mobile-menu-content { flex: 1; overflow-y: auto; padding: 20px; }
.mobile-menu-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.mobile-menu-list li a {
    display: block;
    padding: 15px;
    background: #f9fafc;
    border-radius: 12px;
    color: #333;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}
.mobile-menu-list li a:active { background: #ede9ff; color: #4837F3; }

/* ═══════════════════════════════════════════════════════════
   تنظیمات ریسپانسیو موبایل
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .main-navigation { display: none !important; }
    .header-actions { display: none !important; }
    .mobile-toggle-btn { display: flex !important; }

    /* چیدمان: لوگو (راست) - سرچ (وسط) - همبرگر (چپ) */
    .header-container {
        display: flex !important;
        align-items: center;
        justify-content: space-between !important;
        gap: 8px !important;
        padding: 10px 12px !important;
        flex-wrap: nowrap !important;
    }

    .site-logo { flex-shrink: 0; max-width: 75px; }
    
    .header-search {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        margin: 0 !important;
    }
    
    .header-search input {
        height: 38px !important;
        font-size: 12px !important;
        padding: 0 10px 0 38px !important;
    }
}