/* css/mobile-fixes.css */

/* تنظیمات کلی */
html, body { overflow-x: hidden; width: 100%; }

/* =================================================
   استایل‌های PWA (همیشه فعال)
   ================================================= */
.pwa-install-banner {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; padding: 10px 15px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 9999; display: none; /* توسط JS کنترل می‌شود */
    flex-direction: row; align-items: center; justify-content: space-between;
    border-top: 1px solid #eee;
    padding-bottom: env(safe-area-inset-bottom, 10px);
}
.pwa-content { display: flex; align-items: center; gap: 12px; flex: 1; }
.pwa-icon { width: 45px; height: 45px; border-radius: 10px; object-fit: contain; border: 1px solid #f0f0f0; }
.pwa-text h4 { margin: 0 0 3px 0; font-size: 13px; font-weight: bold; color: #333; }
.pwa-text p { margin: 0; font-size: 11px; color: #777; }
.pwa-btn { background: #e91e63; color: #fff; border: none; padding: 6px 15px; border-radius: 20px; font-size: 12px; cursor: pointer; font-weight: bold; white-space: nowrap; }
.pwa-close { background: none; border: none; font-size: 22px; color: #999; cursor: pointer; padding: 0 10px; }

/* راهنمای iOS */
.ios-install-guide {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: rgba(255,255,255,0.98);
    padding: 20px; text-align: center;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.2);
    z-index: 10000; display: none;
    padding-bottom: max(30px, env(safe-area-inset-bottom));
}
.pwa-icon-ios { width: 60px; height: 60px; border-radius: 12px; margin-bottom: 10px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.ios-install-guide p { margin-bottom: 8px; font-size: 14px; color: #333; }
.ios-guide-icon { font-size: 18px; color: #007aff; margin: 0 5px; vertical-align: middle; }
.ios-close-bar { text-align: right; margin-bottom: 5px; }
.ios-close-bar span { font-size: 24px; cursor: pointer; color: #555; padding: 5px; }

/* =================================================
   استایل‌های فقط مخصوص موبایل (زیر 992px)
   این بخش روی دسکتاپ هیچ اثری ندارد
   ================================================= */
@media (max-width: 992px) {
    /* هدر موبایل */
    .header { padding: 8px 0 !important; position: fixed; width: 100%; top:0; }
    .header .container { 
        display: flex !important; 
        justify-content: space-between !important; 
        align-items: center !important; 
        padding: 0 15px !important; 
        flex-wrap: nowrap !important;
        direction: rtl;
    }

    /* 1. منوی همبرگری (راست) */
    .menu-toggle { 
        display: block !important; 
        order: 1; 
        font-size: 1.4rem; 
        background: none; border: none; cursor: pointer; 
        padding: 5px; margin-left: 10px; 
    }

    /* 2. لوگو */
    .header-right { 
        order: 2; flex: 0 0 auto; margin-right: 0 !important; 
    }
    .logo img { height: 35px !important; width: auto; }
    .logo-text { display: none !important; }

    /* 3. دکمه‌های چپ */
    .header-left {
        order: 3; flex: 1; 
        display: flex !important; 
        justify-content: flex-end !important; 
        align-items: center !important; 
        gap: 8px !important;
    }

    /* تبدیل دکمه‌ها به آیکون گرد */
    .desktop-text { display: none !important; } /* مخفی کردن متن */
    
    .auth-btn, .cart-btn, .search-icon {
        padding: 0 !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #f5f5f5 !important;
        border: 1px solid #eee !important;
        color: #444 !important;
        text-decoration: none !important;
    }
    .auth-btn i, .cart-btn i, .search-icon i { margin: 0 !important; font-size: 14px !important; }
    .cart-badge { position: absolute; top: -3px; right: -3px; width: 15px; height: 15px; font-size: 9px; display: flex; align-items: center; justify-content: center; }

    /* منوی کشویی */
    .main-nav {
        position: fixed; top: 0; right: -280px; width: 260px; height: 100vh;
        background: white; z-index: 2000; padding-top: 60px;
        transition: right 0.3s ease; box-shadow: -5px 0 20px rgba(0,0,0,0.1);
        display: block !important;
        overflow-y: auto;
    }
    .main-nav.active { right: 0; }
    .main-nav ul { flex-direction: column; padding: 0; margin: 0; }
    .main-nav li { width: 100%; border-bottom: 1px solid #f5f5f5; }
    .main-nav a { padding: 15px 20px; display: block; text-align: right; color: #333; }
    
    /* سرچ */
    .search-wrapper button { font-size: 1.2rem; padding: 5px; background: transparent; border: none; }
}
/* --- اصلاح کادر جستجو (رفع مشکل رفتن متن زیر ذره‌بین) --- */

/* استایل ورودی جستجو */
#globalSearch {
    /* فضای خالی از سمت راست برای دکمه ذره‌بین */
    padding-right: 50px !important; 
    /* فضای خالی از چپ */
    padding-left: 15px !important; 
    text-align: right !important;
    height: 50px !important;
    border-radius: 25px !important;
}

/* استایل دکمه ذره‌بین */
.search-submit-btn {
    position: absolute !important;
    right: 5px !important; /* چسبیدن به راست */
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 40px !important;
    height: 40px !important;
    background: transparent !important; /* شفاف کردن پس‌زمینه */
    color: #555 !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    cursor: pointer !important;
}

/* هاور دکمه */
.search-submit-btn:hover {
    color: #e91e63 !important;
    transform: translateY(-50%) scale(1.1) !important;
    background: transparent !important;
}

/* اطمینان از جهت صحیح در موبایل */
.search-input-group {
    position: relative !important;
    width: 100% !important;
    direction: rtl !important;
}