@font-face {
  font-family: "VazirmatnLocal";
  src: url("/static/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  direction: rtl;
  text-align: right;
  font-family: "VazirmatnLocal", Tahoma, "Segoe UI", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
}

.container {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 96px;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
}

.brand-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--surface-soft);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.92rem;
  background: #fff;
  color: var(--text);
}

.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid rgba(29, 78, 216, 0.25);
  border-color: var(--primary);
}

.grid-products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 640px) {
  .grid-products {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (min-width: 920px) {
  .grid-products {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
  }
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.product-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.product-thumb-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.product-thumb-wrap > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.product-collage {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 2px;
  background: var(--border);
  padding: 2px;
}

.collage-cell {
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.collage-cell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
}

.cart-qty-corner {
  position: absolute;
  top: 5px;
  left: 5px;
  background: var(--success);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
  z-index: 2;
}

.product-placeholder {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 8px;
}

.product-body {
  padding: 6px 6px 8px;
  text-align: center;
}

.product-title {
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.35;
  margin: 0;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.floating-cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  z-index: 45;
}

.floating-cart-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.qty-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.qty-input {
  width: 78px;
  text-align: center;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 700;
}

.qty-presets, .color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qty-chip, .color-chip {
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.qty-chip:hover, .color-chip:hover {
  border-color: var(--primary);
}

.qty-chip.active, .color-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: middle;
}

th {
  background: var(--surface-soft);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.edit-add-box {
  background: var(--surface-soft);
  border: 1px dashed var(--primary);
  border-radius: 12px;
  padding: 12px;
  margin-top: 14px;
}

/* ===== استایل‌های بسته دوم: دسته‌بندی، فروشگاه همکار و آیتم سفارشی ===== */
.cat-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 10px 2px;
  margin-bottom: 12px;
  scrollbar-width: thin;
}

.cat-chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.cat-chip:hover {
  border-color: var(--primary);
}

.cat-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.partner-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 12px;
  margin-top: 14px;
}

.custom-item-box {
  background: #faf5ff;
  border: 1px dashed #9333ea;
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
}

.custom-thumb {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.badge-purple {
  background: #f3e8ff;
  color: #7e22ce;
}

/* ===== استایل ستاره پرتکرارها و برچسب ویژه ===== */
.fav-star-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  padding: 0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
  transition: transform 0.12s ease, background-color 0.15s ease, color 0.15s ease;
}

.fav-star-btn:hover {
  transform: scale(1.08);
  border-color: #f59e0b;
  color: #d97706;
}

.fav-star-btn.is-fav {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #f59e0b;
}

.cat-chip-fav {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.cat-chip-fav:hover {
  border-color: #d97706;
}

.cat-chip-fav.active {
  background: #d97706;
  border-color: #d97706;
  color: #fff;
}

.product-parent-sub {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.3;
  margin-bottom: 2px;
}

/* ===== مرکز اعلان داخلی و پنل کشویی زنگوله ===== */
.notif-bell-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.notif-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 38px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.notif-bell-btn:hover {
  background: var(--surface-soft);
  border-color: var(--primary);
}

.notif-bell-btn.ringing {
  animation: notifBellRing 0.55s ease;
}

@keyframes notifBellRing {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-16deg); }
  40% { transform: rotate(14deg); }
  60% { transform: rotate(-10deg); }
  80% { transform: rotate(6deg); }
}

.notif-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #cbd5e1;
  display: inline-block;
}

.notif-live-dot.connected {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.22);
}

.notif-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

.notif-drawer {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 350px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
  z-index: 80;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.notif-drawer.open {
  display: flex;
}

@media (max-width: 540px) {
  .notif-drawer {
    position: fixed;
    top: 66px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}

.notif-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.notif-drawer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-drawer-list {
  max-height: 380px;
  overflow-y: auto;
}

.notif-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.notif-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.notif-item:hover {
  background: var(--surface-soft);
}

.notif-item.unread {
  background: #eff6ff;
}

.notif-item.urgent.unread {
  background: #fff7ed;
  border-right: 3px solid #ea580c;
}

.notif-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.notif-item-title {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text);
}

.notif-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  flex-shrink: 0;
}

.notif-item-msg {
  font-size: 0.8rem;
  color: #334155;
  line-height: 1.5;
}

.notif-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
  font-size: 0.74rem;
  color: var(--muted);
}

.notif-mark-btn {
  border: 1px solid #bfdbfe;
  background: #fff;
  color: var(--primary);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.notif-mark-btn:hover {
  background: #dbeafe;
}

.notif-toast-container {
  position: fixed;
  bottom: 76px;
  left: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 310px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.notif-toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid #bfdbfe;
  border-right: 4px solid var(--primary);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.notif-toast.urgent {
  background: #fff7ed;
  border-color: #fdba74;
  border-right-color: #ea580c;
}

.notif-toast.fade-out {
  opacity: 0;
  transform: translateY(8px);
}

.notif-toast-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  margin-bottom: 3px;
}

.notif-toast-msg {
  font-size: 0.79rem;
  color: #334155;
  line-height: 1.45;
}

/* ===== PWA و دکمه فعال‌سازی اعلان موبایل ===== */
.pwa-push-btn {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
  white-space: nowrap;
}

.pwa-install-btn {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  white-space: nowrap;
}

.notif-push-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.notif-push-status {
  font-weight: 600;
  color: #334155;
}

.pwa-ios-guide {
  font-size: 0.88rem;
  color: var(--text);
}

