/* =============================================================================
   📱 کامپوننت نوبار شناور و شیت‌های موبایل (MOBILE BOTTOM NAV & BOTTOM SHEETS)
   پلتفرم تخصصی صنایع دستی بقچه - Pinterest Floating Capsule Design
============================================================================= */

/* 🟢 کانتینر نوبار شناور کپسولی */
.bottom-nav {
  position: fixed;
  bottom: 14px;
  bottom: max(14px, env(safe-area-inset-bottom, 14px));
  right: 12px;
  left: 12px;
  margin: 0 auto;
  max-width: 440px;
  height: 64px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 9999px;
  border: 1px solid rgba(221, 211, 199, 0.85);
  box-shadow:
    0 16px 36px rgba(139, 94, 60, 0.16),
    0 4px 12px rgba(0, 0, 0, 0.05),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  z-index: 2000;
  box-sizing: border-box;
  gap: 3px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, box-shadow 0.3s ease, visibility 0.35s ease;
  direction: rtl;
}

/* 🚫 مخفی‌سازی کامل و روان نوبار شناور هنگام باز بودن چت در موبایل */
body.chat-view-active .bottom-nav,
body.has-active-chat .bottom-nav,
body:has(.chat-view-panel.is-open) .bottom-nav {
  transform: translateY(140%) scale(0.92) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* 🔴 دکمه نشان ویژه برند و منوی همبرگری (منوی پلتفرم بقچه) */
.bottom-brand-badge {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary, #C46A2B) 0%, var(--primary, #8B5E3C) 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.18rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(196, 106, 43, 0.38);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  margin-left: 2px;
  -webkit-tap-highlight-color: transparent;
}

.bottom-brand-badge:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px rgba(196, 106, 43, 0.5);
}

.bottom-brand-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

/* 🏷️ آیتم‌های نوبار */
.bottom-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary, #6B7280);
  font-size: 9.5px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 9999px;
  padding: 4px 2px;
  position: relative;
  transition: all 0.25s ease;
  gap: 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.bottom-item span {
  white-space: nowrap;
  font-size: 9.5px;
  line-height: 1.15;
  letter-spacing: -0.2px;
}

.bottom-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
}

.bottom-icon-wrap i,
.bottom-item i {
  font-size: 1.15rem;
  transition: transform 0.2s ease, color 0.2s ease;
  line-height: 1;
}

/* 🌟 حالت فعال (Active State) با رنگ ثانویه و نقطه هوشمند */
.bottom-item.active {
  color: var(--secondary, #C46A2B);
  font-weight: 800;
}

.bottom-item.active i {
  transform: translateY(-1px);
}

.bottom-item .active-indicator-dot {
  position: absolute;
  bottom: 1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--secondary, #C46A2B);
  opacity: 0;
  transform: scale(0);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 6px var(--secondary, #C46A2B);
}

.bottom-item.active .active-indicator-dot {
  opacity: 1;
  transform: scale(1);
}

.bottom-item:active {
  transform: scale(0.92);
}

/* 🔴 نشانگر تعداد کالاهای سبد خرید */
.cart-badge-count.mobile-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: var(--error, #B0413E);
  color: #ffffff;
  font-size: 8.5px;
  font-weight: 900;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 10px;
  border: 1.5px solid #ffffff;
  line-height: 11px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(176, 65, 62, 0.5);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =============================================================================
   📂 لایه‌های زیرین و شیت‌ها (BOTTOM SHEETS & OVERLAY)
============================================================================= */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 2500;
}

.sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.category-sheet,
.cart-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card, #FFFFFF);
  border-radius: 24px 24px 0 0;
  padding: 16px 16px max(36px, calc(16px + env(safe-area-inset-bottom, 20px))) 16px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 2600;
  max-height: 84vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.5);
  direction: rtl;
}

.category-sheet.active,
.cart-sheet.active {
  transform: translateY(0);
}

/* دستگیره شیت */
.sheet-handle {
  width: 44px;
  height: 5px;
  background: var(--border-color, #E5E7EB);
  border-radius: 8px;
  margin: 0 auto 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sheet-handle:hover {
  background: var(--text-muted, #9CA3AF);
}

/* هدر شیت */
.sheet-header-box {
  text-align: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-color, #E5E7EB);
}

.sheet-title {
  margin: 0 0 4px 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary, #1F2937);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted, #6B7280);
}

/* گرید کارت‌های شیت پلتفرم و دسته‌بندی */
.category-sheet-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-sheet-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-muted, #F9FAFB);
  border: 1px solid var(--border-color, #E5E7EB);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary, #1F2937);
  transition: all 0.2s ease;
}

.category-sheet-card:active {
  transform: scale(0.98);
  background: rgba(139, 94, 60, 0.08);
}

.cat-icon-badge {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(139, 94, 60, 0.16);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  flex-shrink: 0;
}

.category-sheet-card:hover .cat-icon-badge,
.category-sheet-card:active .cat-icon-badge {
  transform: scale(1.08) rotate(-4deg);
  box-shadow: 0 6px 16px rgba(139, 94, 60, 0.24);
}

.category-sheet-card.platform-sheet-cta {
  background: linear-gradient(135deg, rgba(196, 106, 43, 0.08) 0%, rgba(139, 94, 60, 0.05) 100%);
  border-color: rgba(196, 106, 43, 0.28);
}

.category-sheet-card.platform-sheet-cta:active {
  background: linear-gradient(135deg, rgba(196, 106, 43, 0.14) 0%, rgba(139, 94, 60, 0.1) 100%);
}

.cat-sheet-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.cat-sheet-text strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary, #1F2937);
}

.cat-sheet-text span {
  font-size: 0.72rem;
  color: var(--text-muted, #6B7280);
}

.category-sheet-card .arrow {
  font-size: 0.8rem;
  color: var(--text-muted, #9CA3AF);
  margin-right: auto;
  transition: transform 0.2s ease, color 0.2s ease;
}

/* 📜 استایل بخش صفحات عمومی و راهنما در شیت پلتفرم موبایل */
.platform-sheet-info-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color, rgba(139, 94, 60, 0.18));
}

.sheet-divider-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary, #8B5E3C);
  margin-bottom: 12px;
  padding: 0 4px;
}

.sheet-divider-title i {
  color: var(--secondary, #c46a2b);
  font-size: 0.9rem;
}

.platform-sheet-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (max-width: 340px) {
  .platform-sheet-info-grid {
    grid-template-columns: 1fr;
  }
}

.sheet-info-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-muted, rgba(139, 94, 60, 0.05));
  border: 1px solid var(--border-color, rgba(139, 94, 60, 0.12));
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary, #2b1810);
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  min-height: 48px;
  box-sizing: border-box;
}

.sheet-info-card:active {
  transform: scale(0.98);
  background: rgba(196, 106, 43, 0.1);
  border-color: var(--secondary, #c46a2b);
}

.sheet-info-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 9px;
  background: rgba(139, 94, 60, 0.1);
  color: var(--primary, #8B5E3C);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
  flex-shrink: 0;
}

.sheet-info-card--pwa .sheet-info-icon.pwa-icon {
  background: linear-gradient(135deg, var(--secondary, #c46a2b), var(--primary, #8B5E3C));
  color: #fff;
}

.sheet-info-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.sheet-info-text strong {
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--text-primary, #2b1810);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-info-text span {
  font-size: 0.65rem;
  color: var(--text-muted, #8a7a70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-badge-pwa {
  font-size: 0.55rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--secondary, #c46a2b), var(--primary, #8B5E3C));
  color: #fff;
  line-height: 1.2;
}

.sheet-info-card .arrow {
  display: none;
}

@media (min-width: 520px) {
  .sheet-info-card .arrow {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--text-muted, #8a7a70);
    margin-right: auto;
    opacity: 0.6;
  }
}

.category-sheet-card:hover .arrow,
.category-sheet-card:active .arrow {
  color: var(--secondary, #C46A2B);
  transform: translateX(-3px);
}

/* =============================================================================
   🎨 پالت رنگی اصیل صنایع دستی (هماهنگ با تم سایت: چوب، سفال، مس، چرم و زر)
============================================================================= */
.icon-feed { background: linear-gradient(135deg, var(--secondary, #C46A2B), var(--primary, #8B5E3C)) !important; color: #ffffff !important; }
.icon-top-booths { background: linear-gradient(135deg, #D4AF37, #B8860B) !important; color: #ffffff !important; }
.icon-market { background: linear-gradient(135deg, var(--primary, #8B5E3C), var(--secondary, #C46A2B)) !important; color: #ffffff !important; }
.icon-licenses { background: linear-gradient(135deg, #A04E17, #6F472E) !important; color: #ffffff !important; }
.icon-reels { background: linear-gradient(135deg, var(--secondary, #C46A2B), #934316) !important; color: #ffffff !important; }
.icon-events { background: linear-gradient(135deg, var(--secondary, #C46A2B), var(--primary, #8B5E3C)) !important; color: #ffffff !important; }
.icon-messages { background: linear-gradient(135deg, var(--primary, #8B5E3C), #5C3D26) !important; color: #ffffff !important; }
.icon-cart { background: linear-gradient(135deg, var(--secondary, #C46A2B), var(--primary, #8B5E3C)) !important; color: #ffffff !important; }
.icon-user { background: linear-gradient(135deg, var(--primary, #8B5E3C), #5C3D26) !important; color: #ffffff !important; }
.icon-seller { background: linear-gradient(135deg, var(--secondary, #C46A2B), var(--primary, #8B5E3C)) !important; color: #ffffff !important; }

.col-rug { background: linear-gradient(135deg, var(--secondary, #C46A2B), var(--primary, #8B5E3C)) !important; color: #ffffff !important; }
.col-pottery { background: linear-gradient(135deg, var(--primary, #8B5E3C), #6F472E) !important; color: #ffffff !important; }
.col-jewelry { background: linear-gradient(135deg, #D4AF37, var(--secondary, #C46A2B)) !important; color: #ffffff !important; }
.col-wood { background: linear-gradient(135deg, #A04E17, #5C3D26) !important; color: #ffffff !important; }
.col-leather { background: linear-gradient(135deg, var(--primary, #8B5E3C), #5C3D26) !important; color: #ffffff !important; }
.col-copper { background: linear-gradient(135deg, var(--secondary, #C46A2B), #934316) !important; color: #ffffff !important; }
.col-souvenirs { background: linear-gradient(135deg, #D4AF37, #B8860B) !important; color: #ffffff !important; }

/* =============================================================================
   🛒 شیت سبد خرید موبایل (MOBILE CART SHEET)
============================================================================= */
.cart-sheet {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 75vh;
  max-height: 560px;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color, #E5E7EB);
}

.cart-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary, #1F2937);
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-cart {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color, #E5E7EB);
  background: var(--bg-muted, #F9FAFB);
  color: var(--text-muted, #6B7280);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-cart:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

.cart-sheet .cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-sheet .cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-muted, #F9FAFB);
  border: 1px solid var(--border-color, #E5E7EB);
  border-radius: 12px;
}

.cart-sheet .cart-item img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
}

.cart-sheet .cart-item .item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cart-sheet .cart-item .item-info h4 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary, #1F2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-sheet .cart-item .item-price {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--secondary, #C46A2B);
}

.cart-sheet .qty-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card, #FFFFFF);
  border: 1px solid var(--border-color, #E5E7EB);
  border-radius: 8px;
  padding: 2px 4px;
  width: fit-content;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.cart-sheet .qty-btn {
  background: none;
  border: none;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-primary, #1F2937);
  padding: 0;
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.cart-sheet .qty-btn:active {
  background: rgba(139, 94, 60, 0.12);
  transform: scale(0.92);
}

.cart-sheet .qty-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.cart-sheet .qty {
  font-size: 0.92rem;
  font-weight: 800;
  min-width: 20px;
  text-align: center;
  color: var(--text-primary, #1F2937);
  transition: opacity 0.2s ease;
}

.cart-sheet .cart-item .remove {
  background: none;
  border: none;
  color: var(--text-muted, #9CA3AF);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 6px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.cart-sheet .cart-item .remove:hover,
.cart-sheet .cart-item .remove:active {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
  transform: scale(1.08);
}

.cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
  color: var(--text-muted, #6B7280);
  gap: 12px;
  text-align: center;
}

.cart-empty-icon {
  font-size: 2.5rem;
  opacity: 0.4;
}

.cart-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color, #E5E7EB);
  background: var(--bg-card, #FFFFFF);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-footer .total {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--text-primary, #1F2937);
}

.cart-footer .total strong {
  font-weight: 900;
  color: var(--secondary, #C46A2B);
}

.checkout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--secondary, #C46A2B), var(--primary, #8B5E3C));
  color: #ffffff !important;
  font-size: 0.92rem;
  font-weight: 800;
  border-radius: 12px;
  text-decoration: none;
  transition: opacity 0.2s;
  border: none;
  cursor: pointer;
}

.checkout-btn:active {
  opacity: 0.9;
}

/* =============================================================================
   🌟 ناوبری اختصاصی شبکه‌اجتماعی (Social / Instagram Style Mobile Nav)
============================================================================= */
.social-bottom-nav {
  justify-content: space-between;
  padding: 5px 8px;
  gap: 3px;
  max-width: 440px;
}

.social-bottom-nav .bottom-item {
  flex: 1;
  min-width: 0;
  padding: 4px 2px;
}

.social-bottom-nav .bottom-item span {
  font-size: 9px;
  line-height: 1.15;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.social-bottom-nav .bottom-icon-wrap {
  width: 26px;
  height: 22px;
}

.social-bottom-nav .bottom-icon-wrap i {
  font-size: 1.15rem;
}

.social-bottom-nav .bottom-icon-wrap--create i {
  font-size: 1.35rem;
  color: var(--secondary, #C46A2B);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.social-bottom-nav .bottom-create-btn:hover .bottom-icon-wrap--create i,
.social-bottom-nav .bottom-create-btn:active .bottom-icon-wrap--create i {
  transform: scale(1.18);
  color: var(--primary, #8B5E3C);
}

.social-bottom-nav .bottom-icon-wrap--avatar {
  width: 26px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-bottom-nav .bottom-nav-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-color, rgba(139, 94, 60, 0.3));
  transition: all 0.22s ease;
}

.social-bottom-nav .bottom-item.active .bottom-nav-avatar {
  border-color: var(--secondary, #C46A2B);
  box-shadow: 0 0 0 1.5px rgba(196, 106, 43, 0.4);
  transform: scale(1.1);
}

@media (max-width: 375px) {
  .social-bottom-nav {
    padding: 4px 6px;
    gap: 2px;
    left: 8px;
    right: 8px;
  }

  .social-bottom-nav .bottom-item {
    padding: 3px 1px;
  }

  .social-bottom-nav .bottom-item span {
    font-size: 8.2px;
    letter-spacing: -0.3px;
  }

  .social-bottom-nav .bottom-icon-wrap i {
    font-size: 1.05rem;
  }

  .social-bottom-nav .bottom-icon-wrap--create i {
    font-size: 1.25rem;
  }
}

/* 🖥️ مخفی‌سازی کامل در دسکتاپ (Hide on Desktop) */
@media (min-width: 768px) {
  .bottom-nav,
  .category-sheet,
  .platform-sheet,
  .cart-sheet,
  .sheet-overlay {
    display: none !important;
  }
}
