/* ==========================================
   🎨 متغیرهای رنگی (تم دخترانه، ملایم و پاستلی)
   ========================================== */
:root { 
    --primary: #d47e8e; /* صورتی پاستلی ملایم (Dusty Rose) */
    --primary-hover: #c4687b; 
    --primary-fade: rgba(212, 126, 142, 0.15);
    
    --accent: #a78bfa; /* بنفش یاسی ملایم (Lavender) */
    --accent-hover: #8b5cf6; 
    --accent-fade: rgba(167, 139, 250, 0.15);
    
    /* تم روشن */
    --bg-color: #fdfafb; 
    --glass-bg: rgba(255, 255, 255, 0.7); 
    --glass-border: rgba(255, 255, 255, 0.9); 
    --glass-highlight: rgba(255, 255, 255, 0.95);
    --text-main: #334155; 
    --text-muted: #94a3b8; 
    
    --success: #10b981; --warning: #f59e0b; --danger: #f43f5e;
    
    --shadow-soft: 0 10px 25px -5px rgba(212, 126, 142, 0.1); 
    --shadow-float: 0 20px 40px -10px rgba(212, 126, 142, 0.2);
    --shadow-glow: 0 10px 25px -5px rgba(212, 126, 142, 0.3);
    
    --transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #e295a6; 
    --primary-hover: #d47e8e; 
    --primary-fade: rgba(226, 149, 166, 0.15);
    
    --accent: #c4b5fd; 
    --accent-hover: #a78bfa; 
    --accent-fade: rgba(196, 181, 253, 0.15);
    
    /* تم تاریک ملایم */
    --bg-color: #151316; 
    --glass-bg: rgba(30, 27, 34, 0.6); 
    --glass-border: rgba(255, 255, 255, 0.05); 
    --glass-highlight: rgba(255, 255, 255, 0.03);
    --text-main: #f1f5f9; 
    --text-muted: #64748b; 
    
    --shadow-soft: 0 10px 25px -5px rgba(0,0,0,0.3);
    --shadow-float: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 10px 30px -5px rgba(226, 149, 166, 0.15);
}

/* ==========================================
   🔒 قفل سخت‌گیرانه اسکرول افقی (حل مشکل پرش صفحه)
   ========================================== */
/* ==========================================
   🔒 قفل نهایی و قطعی اسکرول (جلوگیری از فرار صفحه به بغل)
   ========================================== */
html, body { 
    position: fixed; /* 🚀 این دستور بدنه سایت را میخکوب می‌کند */
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; 
    height: 100%; 
    overflow: hidden !important; /* هیچ چیزی بیرون از کادر نمیره */
    margin: 0; padding: 0;
    -webkit-text-size-adjust: 100%;
}
* { 
    box-sizing: border-box !important; 
    font-family: 'Vazirmatn', sans-serif; 
    margin: 0; padding: 0; 
    user-select: none; 
    -webkit-tap-highlight-color: transparent;
}

body { 
    background: var(--bg-color);
    background-image: radial-gradient(at 10% 10%, rgba(212, 126, 142, 0.08) 0px, transparent 50%), radial-gradient(at 90% 90%, rgba(167, 139, 250, 0.08) 0px, transparent 50%);
    color: var(--text-main); display: flex; justify-content: center; 
}
[data-theme="dark"] body { background: linear-gradient(135deg, #09090b 0%, #17171b 100%); }

.app-container { 
    width: 100%; 
    max-width: 480px; 
    height: 100%; 
    position: relative; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden !important; /* 🚀 کانتینر اصلی هم قفل شد */
    margin: 0 auto;
}


/* افکت‌های نوری محدود شده */
.glow-1 { position: absolute; width: 250px; height: 250px; background: var(--primary-fade); filter: blur(70px); border-radius: 50%; top: -50px; right: -50px; z-index: 0; pointer-events: none; max-width: 100vw;}
.glow-2 { position: absolute; width: 250px; height: 250px; background: var(--accent-fade); filter: blur(70px); border-radius: 50%; bottom: 10%; left: -50px; z-index: 0; pointer-events: none; max-width: 100vw;}

.glass-panel { background: var(--glass-bg); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); border: 1px solid var(--glass-border); border-radius: 28px; box-shadow: var(--shadow-soft); }
svg { width: 22px; height: 22px; stroke-width: 2; stroke: currentColor; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ==========================================
   🎩 هدر
   ========================================== */
header { padding: 25px 20px 15px; display: flex; justify-content: space-between; align-items: center; z-index: 100; flex-shrink: 0; position: relative;}
.header-title { font-weight: 900; font-size: 20px; color: var(--text-main); display: flex; align-items: center; gap: 8px;}
.header-title svg { color: var(--primary); }
.header-title span { color: var(--primary); }

.icon-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--glass-bg); border: 1px solid var(--glass-border); display: flex; justify-content: center; align-items: center; cursor: pointer; color: var(--text-main); transition: var(--transition); box-shadow: var(--shadow-soft);}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }

/* 🚀 اصلاح فاصله پایین برای رد شدن از روی نوار شناور */
.view-section { flex: 1; overflow-y: auto; overflow-x: hidden !important; display: none; animation: fadeIn 0.4s ease; padding: 20px 20px 140px 20px !important; z-index: 1; position: relative; }
.view-section.active { display: block; }
#view-store.active { display: flex; flex-direction: column; padding: 0 !important;}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================
   🔐 فرم‌ها و احراز هویت
   ========================================== */
.auth-container { margin-top: 5vh; text-align: center; padding: 0 20px;}
.auth-box { padding: 30px 20px; display: flex; flex-direction: column; gap: 20px; border-radius: 32px;}
.auth-icon { width: 75px; height: 75px; background: var(--primary-fade); color: var(--primary); border-radius: 26px; display: flex; justify-content: center; align-items: center; margin: 0 auto 10px; border: 1px dashed var(--primary); box-shadow: var(--shadow-glow);}
.auth-icon svg { width: 36px; height: 36px; }
.header-box h1 { font-size: 22px; font-weight: 900; margin-bottom: 5px; color: var(--text-main);}
.header-box p { font-size: 13px; font-weight: bold; color: var(--text-muted);}

.step-section { display: none; animation: fadeIn 0.3s; }
.step-section.active { display: block; }

.form-input { width: 100%; background: var(--glass-highlight); border: 1.5px solid var(--glass-border); color: var(--text-main); padding: 16px; border-radius: 18px; font-size: 15px; outline: none; transition: var(--transition); font-weight: 800; text-align: center; margin-bottom: 15px;}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-fade); }
select.form-input { appearance: none; cursor: pointer; }

.btn { width: 100%; padding: 16px; border-radius: 18px; border: none; font-weight: 900; font-size: 15px; cursor: pointer; transition: var(--transition); display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 10px; color: white;}
.btn-primary { background: var(--primary); box-shadow: var(--shadow-glow);}
.btn-primary:hover { opacity: 0.9; transform: translateY(-2px);}
.btn-outline { background: transparent; border: 1.5px solid var(--glass-border); color: var(--text-main);}

.text-link { color: var(--primary); font-size: 13px; display: block; margin-top: 20px; font-weight: bold; cursor: pointer;}
.alert-box { background: var(--accent-fade); border: 1px solid rgba(244, 63, 94, 0.2); color: var(--danger); padding: 14px; border-radius: 16px; font-size: 13px; text-align: center; font-weight: bold; margin-bottom: 20px; display: none;}

/* ==========================================
   🏪 فروشگاه
   ========================================== */
/* 🚀 نوار دسته‌بندی با قفل اسکرول */
.category-nav { 
    background: var(--glass-bg); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px); 
    padding: 15px 20px; 
    overflow-x: auto; 
    white-space: nowrap; 
    display: flex; 
    gap: 10px; 
    border-bottom: 1px solid var(--glass-border); 
    position: sticky; 
    top: 0; 
    z-index: 50; 
    scrollbar-width: none;
    
    /* 🔒 سه خط جادویی برای جلوگیری از کشیده شدن کل صفحه */
    width: 100%;
    overscroll-behavior-x: contain; 
    -webkit-overflow-scrolling: touch;
}

.category-nav::-webkit-scrollbar { display: none; }
.cat-link { background: var(--glass-highlight); border: 1px solid var(--glass-border); color: var(--text-muted); padding: 10px 18px; border-radius: 20px; font-size: 13px; font-weight: bold; transition: var(--transition); display: inline-flex; align-items: center; gap: 6px; cursor: pointer;}
.cat-link svg { width: 16px; height: 16px; }
.cat-link.active { background: var(--text-main); color: var(--bg-color); border-color: var(--text-main); box-shadow: var(--shadow-soft);}
[data-theme="dark"] .cat-link.active { background: var(--primary); color: #000; border-color: var(--primary); box-shadow: var(--shadow-glow);}

.store-content { flex: 1; overflow-y: auto; overflow-x: hidden !important; padding: 20px 0 140px 0; z-index: 1; position: relative;}
.category-section { margin-bottom: 40px; scroll-margin-top: 80px; }
.section-header { padding: 10px 20px 15px; font-size: 17px; font-weight: 900; color: var(--text-main); display: flex; align-items: center; gap: 8px;}
.section-header svg { color: var(--primary); }

.horizontal-list { 
    display: flex; 
    overflow-x: auto; 
    gap: 15px; 
    padding: 5px 20px 20px; 
    scrollbar-width: none; 
    width: 100%;
    overscroll-behavior-x: contain; /* 🚀 این دستور نمیذاره اسکرولِ محصولات، کل صفحه رو با خودش بکشه */
    -webkit-overflow-scrolling: touch; 
}

.horizontal-list::-webkit-scrollbar { display: none; }

.product-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-soft); flex: 0 0 155px; transition: var(--transition);}
.product-card:hover { border-color: var(--primary); transform: translateY(-4px);}
.product-img { width: 100%; height: 130px; background-color: var(--glass-highlight); background-position: center; background-size: cover; border-bottom: 1px solid var(--glass-border);}
.product-info { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1;}
.product-name { font-weight: 900; font-size: 13px; color: var(--text-main); line-height: 1.4;}
.product-price { color: var(--primary); font-weight: 900; font-size: 14px; margin-bottom: 5px;}
.product-price span { font-size: 10px; color: var(--text-muted); font-weight: bold;}

.btn-add-init { background: var(--primary-fade); color: var(--primary); border: 1px dashed var(--primary); padding: 8px; border-radius: 14px; font-weight: 900; font-size: 12px; margin-top: auto; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 6px;}
.qty-controls { display: flex; align-items: center; justify-content: space-between; background: var(--primary-fade); padding: 5px; border-radius: 14px; margin-top: auto; border: 1px dashed var(--primary); }
.qty-btn { background: var(--glass-highlight); border: none; color: var(--text-main); width: 30px; height: 30px; border-radius: 10px; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05);}
.qty-btn.del { color: var(--danger); }
.qty-display { font-size: 14px; font-weight: 900; color: var(--primary); width: 24px; text-align: center;}

/* ==========================================
   🛒 سبد خرید 
   ========================================== */
.view-title { font-size: 20px; font-weight: 900; margin: 10px 0 20px; display: flex; align-items: center; gap: 8px;}
.view-title svg { color: var(--primary); width: 26px; height: 26px;}

.checkout-box { padding: 25px 20px; margin-top: 15px; border-radius: 28px;}
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; border-bottom: 1px dashed var(--glass-border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-info { display: flex; flex-direction: column; gap: 6px; flex: 1; padding-left: 10px;}
.cart-item-name { font-size: 14px; font-weight: bold; color: var(--text-main); }
.cart-item-price { font-size: 13px; font-weight: bold; color: var(--primary); }

.payment-options { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; border-top: 1px dashed var(--glass-border); padding-top: 20px; }
.pay-option { border: 1.5px solid var(--glass-border); padding: 15px; border-radius: 20px; display: flex; align-items: center; gap: 12px; cursor: pointer; background: var(--glass-highlight); transition: var(--transition);}
.pay-option svg { width: 24px; height: 24px; color: var(--text-muted); transition: var(--transition);}
.pay-option input { display: none; }
.pay-option-content { display: flex; flex-direction: column; gap: 4px; flex: 1;}
.pay-title { font-size: 14px; font-weight: 900; color: var(--text-main); }
.pay-subtitle { font-size: 11px; color: var(--text-muted); font-weight: bold;}

.pay-option.active { border-color: var(--primary); background: var(--primary-fade); }
.pay-option.active svg { color: var(--primary); }

.wallet-badge { background: var(--glass-bg); padding: 4px 8px; border-radius: 8px; font-size: 11px; color: var(--text-main); border: 1px solid var(--glass-border); font-weight: bold;}

.summary-total { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--glass-border); }
.btn-checkout { width: 100%; padding: 18px; border-radius: 16px; border: none; font-weight: 900; font-size: 15px; cursor: pointer; margin-top: 20px; transition: var(--transition); display: flex; justify-content: center; align-items: center; gap: 8px; color: white;}
.btn-checkout.active { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); box-shadow: 0 10px 20px var(--primary-fade); text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.btn-checkout.disabled { background: var(--glass-border); color: var(--text-muted); cursor: not-allowed; }

.empty-state { text-align: center; margin-top: 80px; display: flex; flex-direction: column; align-items: center; gap: 10px;}
.empty-state svg { width: 70px; height: 70px; stroke-width: 1.5; color: var(--text-muted); opacity: 0.5;}
.empty-text-title { font-size: 16px; font-weight: 900; color: var(--text-main); }
.empty-text-sub { font-size: 13px; color: var(--text-muted); font-weight: bold;}

/* ==========================================
   👤 پروفایل و کیف پول
   ========================================== */
.wallet-card { background: var(--glass-highlight); border: 1px dashed var(--primary); padding: 30px 20px; text-align: center; border-radius: 32px; box-shadow: inset 0 0 20px var(--primary-fade), var(--shadow-soft); margin-bottom: 25px; position: relative; overflow: hidden; }
.wallet-title { font-size: 13px; font-weight: 900; color: var(--text-muted); margin-bottom: 10px;}
.wallet-balance { font-size: 38px; font-weight: 900; color: var(--primary); display: flex; justify-content: center; align-items: baseline; gap: 5px; text-shadow: 0 2px 10px var(--primary-fade);}
.wallet-balance span { font-size: 14px; font-weight: bold; color: var(--text-muted);}
.wallet-limit { font-size: 11px; font-weight: bold; color: var(--text-muted); margin-top: 10px;}

.charge-section { padding: 25px 20px; margin-bottom: 25px; border-radius: 28px;}
.charge-title { font-size: 16px; font-weight: 900; margin-bottom: 20px; display: flex; align-items: center; gap: 8px;}
.charge-title svg { color: var(--primary); }

.tab-buttons { display: flex; gap: 10px; margin-bottom: 20px; }
.btn-tab { flex: 1; background: transparent; border: 1.5px solid var(--glass-border); color: var(--text-main); padding: 14px; border-radius: 16px; font-size: 13px; font-weight: 900; cursor: pointer; transition: var(--transition);}
.btn-tab.active { border-color: var(--primary); background: var(--primary-fade); color: var(--primary); }

.quick-amounts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
.amount-chip { background: var(--glass-highlight); border: 1px solid var(--glass-border); padding: 12px; border-radius: 16px; font-size: 13px; font-weight: bold; cursor: pointer; flex: 1 1 calc(33% - 10px); text-align: center;}
.amount-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-fade);}

.card-info-box { background: var(--glass-bg); border: 1.5px dashed var(--primary); padding: 20px; border-radius: 20px; text-align: center; margin-bottom: 15px; }
.copy-btn { background: var(--primary-fade); border: 1px solid var(--primary); color: var(--primary); border-radius: 12px; padding: 8px 16px; font-size: 12px; cursor: pointer; font-weight: bold; transition: var(--transition);}
.copy-btn:hover { background: var(--primary); color: white;}

.file-upload { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; border: 2px dashed var(--glass-border); padding: 30px 20px; text-align: center; border-radius: 20px; cursor: pointer; margin-bottom: 15px; background: var(--glass-highlight); transition: var(--transition);}
.file-upload:hover { border-color: var(--primary); background: var(--primary-fade);}
.file-upload svg { width: 36px; height: 36px; margin-bottom: 10px; color: var(--text-muted); transition: var(--transition);}
.file-upload:hover svg { color: var(--primary); transform: scale(1.1);}
.file-upload input { display: none; }

.menu-list { overflow: hidden; margin-bottom: 20px; border-radius: 20px;}
.menu-item { padding: 18px 20px; border-bottom: 1px solid var(--glass-border); font-size: 14px; font-weight: bold; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: var(--transition);}
.menu-item:last-child { border-bottom: none; }
.menu-item.danger { color: var(--danger); }

/* تاریخچه */
.history-card { padding: 15px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; border-radius: 16px;}
.history-icon { background: var(--glass-bg); width: 45px; height: 45px; display: flex; justify-content: center; align-items: center; border-radius: 16px; border: 1px solid var(--glass-border);}
.history-title { font-size: 13px; font-weight: bold; color: var(--text-main); margin-bottom: 4px;}
.history-date { font-size: 11px; color: var(--text-muted); }

/* ==========================================
   🌐 نوار پایین شناور
   ========================================== */
.bottom-nav-wrapper { position: fixed; bottom: 20px; left: 0; width: 100%; display: flex; justify-content: center; z-index: 1000; pointer-events: none; padding: 0 20px;}
.bottom-nav { width: 100%; max-width: 380px; display: flex; justify-content: space-between; align-items: center; padding: 8px; border-radius: 32px; background: var(--glass-bg); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border: 1px solid var(--glass-border); box-shadow: var(--shadow-float); pointer-events: auto;}

.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-muted); cursor: pointer; transition: var(--transition); position: relative; flex: 1; padding: 10px 0; border-radius: 24px;}
.nav-item.active { color: var(--text-main); background: var(--glass-highlight); padding-bottom: 16px; padding-top: 4px; box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);}
[data-theme="dark"] .nav-item.active { color: var(--primary); }
.nav-item.active svg { transform: translateY(-6px); stroke-width: 2.5;}
.nav-text { font-size: 10px; font-weight: 900; opacity: 0; transform: translateY(5px); position: absolute; bottom: 4px; transition: var(--transition);}
.nav-item.active .nav-text { opacity: 1; transform: translateY(0); }

.cart-badge { position: absolute; top: 0px; right: 25%; background: var(--danger); color: white; font-size: 10px; font-weight: 900; width: 20px; height: 20px; display: flex; justify-content: center; align-items: center; border-radius: 50%; transition: transform 0.3s cubic-bezier(0.17, 0.89, 0.32, 1.28); box-shadow: 0 4px 10px rgba(244, 63, 94, 0.4); border: 2px solid var(--glass-bg);}
.cart-badge.pop { transform: scale(1.4); }

/* ==========================================
   🚀 لودر و انیمیشن سلام (استیکر سبد خرید)
   ========================================== */
.loader { position: fixed; inset: 0; background: var(--glass-bg); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); z-index: 9999; display: none; justify-content: center; align-items: center; flex-direction: column; gap: 15px;}
.spinner { width: 45px; height: 45px; border: 4px solid var(--glass-border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.welcome-overlay { position: fixed; inset: 0; background: var(--glass-bg); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); z-index: 8000; display: none; flex-direction: column; justify-content: center; align-items: center; text-align: center; }

/* 🌟 انیمیشن بالا و پایین رفتن نرم استیکر */
@keyframes bounceFloat { 
    0%, 100% { transform: translateY(0); } 
    50% { transform: translateY(-18px); } 
}
.welcome-icon { 
    width: 90px; height: 90px; background: var(--primary-fade); color: var(--primary); border-radius: 30px; 
    display: flex; justify-content: center; align-items: center; margin-bottom: 25px; border: 1px dashed var(--primary); 
    box-shadow: var(--shadow-glow); 
    animation: bounceFloat 2.5s ease-in-out infinite; 
}
.welcome-icon svg { width: 45px; height: 45px; stroke-width: 1.5; }

/* ==========================================
   💻 تنظیمات دسکتاپ (وسط‌چین کردن ریشه‌ای)
   ========================================== */
@media (min-width: 768px) {
    .app-container { max-width: 1000px; height: 95dvh; border-radius: 40px; box-shadow: 0 30px 60px -15px rgba(0,0,0,0.2); margin: auto; border: 1px solid var(--glass-border); background: var(--glass-bg); backdrop-filter: blur(40px);}
    header { border-radius: 40px 40px 0 0; padding: 30px 40px 20px;}
    .view-section { padding: 0 40px 140px 40px !important; }
    
    /* 🚀 وسط‌چین کردن منوی دسته‌بندی‌ها */
    .category-nav { justify-content: center; padding: 20px 40px; }
    .section-header { padding: 0 40px 20px;}
    
    /* 🚀 وسط‌چین کردن محصولات برای جلوگیری از چسبیدن به راست */
    .horizontal-list { 
        display: flex; 
        flex-wrap: wrap; 
        justify-content: center; 
        gap: 20px; 
        overflow-x: visible; 
        padding: 5px 40px 30px;
    }
    
    .product-card { flex: 0 0 calc(25% - 15px); max-width: 220px; }
}

select.form-input { color: var(--text-main) !important; background-color: rgba(15, 23, 42, 0.02) !important; }
[data-theme="dark"] select.form-input { background-color: rgba(255, 255, 255, 0.05) !important; }
select.form-input option { background-color: var(--bg-color); color: var(--text-main); padding: 10px; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--primary-fade); border-radius: 10px; }
