/* ============================================
   فونت Vazirmatn (فونت اصلی سایت)
   ============================================ */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;      /* پشتیبانی از همه وزن‌ها (Variable Font) */
  font-style: normal;
  font-display: swap;        /* متن سریع نشون داده بشه، بعد فونت لود بشه */
}

/* اگه فایل جدا برای هر وزن داری، این‌ها رو هم اضافه کن: */
/*
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
*/
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
  margin: 0;
  background: #f4f6f9;
  color: #222;
  overscroll-behavior: none;
  font-feature-settings: 'ss01'; /* اگه استایل خاصی داری */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-page { padding-bottom: 100px; }
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: #4f46e5; color: #fff;
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center;
  font-weight: bold;
}
.app-header a { color: #fff; text-decoration: none; font-size: 20px; }
.app-main { padding: 16px; max-width: 720px; margin: auto; }

/* Auth */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg,#4f46e5,#7c3aed); }
.auth-card { background: #fff; padding: 28px; border-radius: 20px; width: 90%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.auth-card h1 { margin-top: 0; text-align: center; }
.auth-card input, .auth-card button { width: 100%; padding: 14px; margin: 8px 0; border-radius: 12px; border: 1px solid #ddd; font-family: inherit; font-size: 15px; }
.auth-card button { background: #4f46e5; color: #fff; border: none; font-weight: bold; }
.auth-card p { text-align: center; font-size: 14px; }
.alert { background: #fee; color: #b00; padding: 10px; border-radius: 10px; margin-bottom: 10px; }

/* Dashboard */
.btn-connect {
  width: 100%; padding: 18px; border-radius: 16px;
  background: #fff; border: 2px dashed #4f46e5; color: #4f46e5;
  font-size: 16px; font-weight: bold; display: flex; flex-direction: column; gap: 6px; align-items: center;
  margin-bottom: 16px;
}
.btn-connect small { color: #888; font-weight: normal; }
.grid-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-btn {
  background: #fff; padding: 22px 10px; text-align: center; border-radius: 16px;
  text-decoration: none; color: #222; font-weight: bold;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.link-box, .quota-box { background: #fff; padding: 14px; border-radius: 14px; margin-top: 16px; }
.link-box input { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid #eee; font-size: 12px; direction: ltr; }
.btn-buy { display: inline-block; margin-top: 8px; background: #16a34a; color: #fff; padding: 8px 14px; border-radius: 10px; text-decoration: none; }

/* Forms */
.form-row, .form-col { display: flex; flex-direction: column; gap: 10px; background: #fff; padding: 14px; border-radius: 14px; margin-bottom: 14px; }
.form-row { flex-direction: row; flex-wrap: wrap; }
.form-row input { flex: 1; }
input, select, button { padding: 12px; border-radius: 10px; border: 1px solid #ddd; font-family: inherit; font-size: 14px; }
button { background: #4f46e5; color: #fff; border: none; font-weight: bold; }

.list { list-style: none; padding: 0; }
.list li { background: #fff; padding: 12px; border-radius: 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.del { color: #e11d48; text-decoration: none; font-weight: bold; }

/* Menu view */
.items-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.item-card { background: #fff; border-radius: 14px; overflow: hidden; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.06); transition: transform .1s; }
.item-card:active { transform: scale(.96); }
.item-card img { width: 100%; height: 110px; object-fit: cover; }
.item-info { padding: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.cat-title { margin: 16px 0 8px; color: #4f46e5; }

/* Floating cart */
.floating-cart {
  position: fixed; bottom: 16px; left: 16px; right: 16px;
  background: #4f46e5; color: #fff; padding: 16px;
  border-radius: 16px; border: none; font-weight: bold; font-size: 15px;
  box-shadow: 0 10px 30px rgba(79,70,229,.4); z-index: 90;
}
.cart-panel {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.2);
  z-index: 100; max-height: 75vh; display: flex; flex-direction: column;
}
.cart-panel.hidden { display: none; }
.cart-header { padding: 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; font-weight: bold; }
.cart-header button { background: none; color: #222; font-size: 20px; padding: 0; }
.cart-items { padding: 12px; overflow-y: auto; flex: 1; }
.cart-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 32px; height: 32px; padding: 0; border-radius: 50%; font-size: 18px; }
.cart-footer { padding: 16px; border-top: 1px solid #eee; display: flex; flex-direction: column; gap: 10px; }
.btn-print { width: 100%; padding: 14px; font-size: 15px; background: #16a34a; }

/* Packages */
.package-card { background: #fff; padding: 18px; border-radius: 16px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
/* Placeholder برای آیتم بدون عکس */
.item-placeholder {
  width: 100%; height: 110px;
  display: flex; align-items: center; justify-content: center;
  background: #f0f0f5; font-size: 40px;
}

/* Empty state */
.empty-state {
  text-align: center; color: #888; padding: 40px 20px;
  background: #fff; border-radius: 14px; font-size: 14px;
}

/* Public menu */
.public-header { background: #4f46e5; }
.public-item { transition: transform .12s ease; }

/* Price highlight */
.item-info .price { color: #16a34a; font-weight: bold; margin-top: 4px; }

/* Responsive: در موبایل ۲ ستون، در دسکتاپ ۳ ستون */
@media (min-width: 600px) {
  .items-grid { grid-template-columns: repeat(3, 1fr); }
}

/* سبد خرید - اسکرول بهتر */
.cart-items { max-height: 40vh; }
.cart-row span:last-child { color: #16a34a; font-weight: bold; }
.mini-connect {
  background: rgba(255,255,255,.2);
  border: none; color: #fff; font-size: 18px;
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; padding: 0;
}
.mini-connect.connected { background: #16a34a; }
/* =============================================
   منوی مشترک (menu-view + public-menu)
   ============================================= */

/* هدر */
.app-header {
  gap: 10px;
  min-height: 56px;
}
.app-header .back-btn { font-size: 22px !important; }
.header-title { flex: 1; display: flex; flex-direction: column; line-height: 1.3; text-align: center; }
.header-main  { font-weight: bold; font-size: 15px; }
.header-sub   { opacity: .8; font-size: 11px; font-weight: normal; }

/* 🔥 نوار دسته‌بندی افقی - مشترک */
.cat-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 14px 16px;
  background: #fff;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  position: sticky;
  top: 56px;
  z-index: 40;
}
.cat-scroll::-webkit-scrollbar { display: none; }

.cat-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #f7f7fb;
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 8px 10px;
  min-width: 84px;
  max-width: 84px;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  position: relative;
}
.cat-chip.active {
  background: #eef2ff;
  border-color: #4f46e5;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79,70,229,.2);
}

/* ✅ اندازه یکسان برای همه تصاویر دسته */
.cat-chip-img {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg,#4f46e5,#7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,.1);
  box-sizing: border-box;
}
.cat-chip-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cat-chip-name {
  font-size: 12px;
  font-weight: bold;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 76px;
  text-align: center;
}
.cat-chip.active .cat-chip-name { color: #4f46e5; }
.cat-chip-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #4f46e5;
  color: #fff;
  font-size: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-sizing: border-box;
}

/* 🎯 گرید آیتم‌ها - ۳ ستون در موبایل */
.items-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
}
@media (min-width: 500px) { .items-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 800px) { .items-grid { grid-template-columns: repeat(5, 1fr); } }

.item-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  transition: transform .1s;
  display: flex;
  flex-direction: column;
}
.item-card:active { transform: scale(.95); }
.item-card img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}
.item-placeholder {
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f5;
  font-size: 32px;
}
.item-info {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}
.item-info b {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-info small {
  color: #888;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-info .price {
  color: #16a34a;
  font-weight: bold;
  margin-top: 2px;
}

.loading { text-align: center; padding: 40px; color: #888; }

/* 🛒 دکمه شناور سبد خرید - مشترک */
.floating-cart {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  padding: 14px 18px;
  border-radius: 16px;
  border: none;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(79,70,229,.4);
  z-index: 90;
  cursor: pointer;
  font-family: inherit;
}
.floating-cart .cart-icon { font-size: 20px; }
.floating-cart .cart-badge {
  background: #ef4444;
  color: #fff;
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
  min-width: 20px;
  text-align: center;
}
.floating-cart .cart-badge.hidden { display: none; }
.floating-cart .cart-text { flex: 1; text-align: right; }
.floating-cart .cart-total {
  background: rgba(255,255,255,.2);
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 13px;
}

/* سبد خرید */
.cart-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.2);
  z-index: 100;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
}
.cart-panel.hidden { display: none; }
.cart-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  font-weight: bold;
}
.cart-header button {
  background: none;
  color: #222;
  font-size: 20px;
  padding: 0;
  border: none;
  cursor: pointer;
}
.cart-items { padding: 12px; overflow-y: auto; flex: 1; max-height: 40vh; }
.cart-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}
.cart-row span:last-child { color: #16a34a; font-weight: bold; }
.cart-row .qty { display: flex; align-items: center; gap: 8px; }
.cart-row .qty button {
  width: 32px; height: 32px;
  padding: 0; border-radius: 50%;
  font-size: 18px; border: none;
  background: #4f46e5; color: #fff;
  cursor: pointer;
}
.cart-footer {
  padding: 16px;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-print {
  width: 100%; padding: 14px;
  font-size: 15px;
  background: #16a34a; color: #fff;
  border: none; border-radius: 12px;
  font-weight: bold; cursor: pointer;
  font-family: inherit;
}

.empty-state {
  text-align: center;
  color: #888;
  padding: 40px 20px;
  background: #fff;
  border-radius: 14px;
  font-size: 14px;
  margin: 12px;
}
.empty-state p { margin: 8px 0 0; }

/* دکمه اتصال مینی */
.mini-connect {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: background .2s;
}
.mini-connect.connected { background: #16a34a; }
/* هدر با اطلاعات فروشگاه */
.public-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}
.shop-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-align: center;
  line-height: 1.4;
}
.shop-name {
  font-weight: bold;
  font-size: 15px;
}
.shop-phone {
  font-size: 12px;
  color: inherit;
  opacity: .9;
  text-decoration: none;
  margin-top: 2px;
}
.shop-phone:hover { opacity: 1; text-decoration: underline; }
.info-btn {
  background: rgba(255,255,255,.2);
  border: none;
  color: inherit;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

/* مودال اطلاعات */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .2s;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--card-bg, #fff);
  color: var(--text, #222);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp .3s ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  position: sticky;
  top: 0;
  background: var(--card-bg, #fff);
  border-radius: 24px 24px 0 0;
}
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close {
  background: #f0f0f5;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}

.modal-body { padding: 16px 20px; }

.info-desc {
  background: rgba(0,0,0,.03);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.8;
  margin: 0 0 16px;
}

.info-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,.05);
}
.info-item:last-child { border-bottom: none; }
.info-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary, #4f46e5) 12%, transparent);
  color: var(--primary, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.info-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.info-text small { color: #888; font-size: 11px; }
.info-text b, .info-text a { font-size: 14px; color: inherit; text-decoration: none; line-height: 1.5; }
.info-text a:hover { color: var(--primary, #4f46e5); }

.modal-footer {
  padding: 16px 20px 24px;
  display: flex;
  gap: 10px;
  border-top: 1px solid rgba(0,0,0,.05);
}
.modal-btn {
  flex: 1;
  padding: 14px;
  border-radius: 14px;
  text-align: center;
  text-decoration: none;
  font-weight: bold;
  font-size: 14px;
  transition: transform .15s;
}
.modal-btn:active { transform: scale(.97); }
.modal-btn.primary {
  background: var(--primary, #4f46e5);
  color: #fff;
}
.modal-btn.secondary {
  background: rgba(0,0,0,.06);
  color: inherit;
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}