/* پر پروانه - Global Styles */

:root {
  /* Color palette - fresh natural green marketplace */
  --rose-50: #eafaf0;
  --rose-100: #cdf0db;
  --rose-200: #9ce0b8;
  --rose-300: #5fc98c;
  --rose-400: #2faf68;
  --rose-500: #1f9d57;
  --rose-600: #178049;
  --rose-700: #11623a;

  --wine-500: #0f5132;
  --wine-600: #0b3f27;
  --wine-700: #072d1c;

  --cream-50: #f5f8f5;
  --cream-100: #eaf1ec;
  --cream-200: #dde8e0;
  --cream-300: #c6d6ca;

  --gold-400: #e0a93f;
  --gold-500: #c2882a;

  --ink-900: #18201a;
  --ink-800: #28322a;
  --ink-700: #45504a;
  --ink-600: #6b766f;
  --ink-500: #909a93;
  --ink-400: #b4bdb7;
  --ink-300: #d6ded9;
  --ink-200: #e9efeb;
  --ink-100: #f3f7f4;

  --success: #2e7d57;
  --danger: #c63d3d;
  --warning: #d99e3a;
  --info: #3a73c6;

  --shadow-sm: 0 1px 2px rgba(31, 26, 26, 0.04), 0 1px 3px rgba(31, 26, 26, 0.06);
  --shadow-md: 0 2px 6px rgba(31, 26, 26, 0.05), 0 6px 14px rgba(31, 26, 26, 0.07);
  --shadow-lg: 0 6px 16px rgba(31, 26, 26, 0.08), 0 16px 32px rgba(31, 26, 26, 0.10);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Vazirmatn", system-ui, sans-serif;
  background: var(--cream-50);
  color: var(--ink-900);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
}

#root { min-height: 100vh; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* utility */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 768px) { .container { padding: 0 24px; } }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn-primary { background: var(--rose-500); color: white; }
.btn-primary:hover { background: var(--rose-600); }
.btn-primary:disabled { background: var(--ink-300); cursor: not-allowed; }
.btn-secondary { background: var(--ink-900); color: white; }
.btn-secondary:hover { background: var(--ink-800); }
.btn-outline { background: transparent; border-color: var(--ink-300); color: var(--ink-900); }
.btn-outline:hover { border-color: var(--rose-500); color: var(--rose-500); }
.btn-ghost { background: transparent; color: var(--ink-700); }
.btn-ghost:hover { background: var(--ink-100); }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}
.badge-rose { background: var(--rose-100); color: var(--rose-700); }
.badge-gold { background: #f5ebd9; color: var(--gold-500); }
.badge-wine { background: var(--wine-500); color: white; }
.badge-success { background: #def0e3; color: var(--success); }
.badge-danger { background: #fdd9d9; color: var(--danger); }

input[type="text"], input[type="tel"], input[type="email"], input[type="number"],
input[type="password"], input[type="search"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-md);
  background: white;
  font-size: 14px;
  outline: none;
  color: var(--ink-900);
  transition: border-color 0.15s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--rose-400); }

label { font-size: 13px; color: var(--ink-700); font-weight: 500; }

/* digits */
.num { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--cream-100); }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* product card */
.product-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--ink-200);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.product-card:hover { border-color: var(--rose-300); box-shadow: var(--shadow-md); }

/* image placeholder */
.img-placeholder {
  background-image:
    repeating-linear-gradient(135deg, rgba(217, 122, 103, 0.08) 0 8px, transparent 8px 16px),
    linear-gradient(180deg, var(--cream-100), var(--rose-50));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-500);
  font-family: ui-monospace, monospace;
  font-size: 11px;
}

/* Mobile bottom nav */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--ink-200);
  display: flex;
  justify-content: space-around;
  padding: 8px 4px env(safe-area-inset-bottom, 8px);
  z-index: 50;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
@media (min-width: 1024px) { .mobile-bottom-nav { display: none; } }

.mobile-bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  flex: 1;
  font-size: 10px;
  color: var(--ink-600);
}
.mobile-bottom-nav button.active { color: var(--rose-500); }

/* page transitions */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pageIn { from { transform: translateY(8px); } to { transform: translateY(0); } }
.page-enter { animation: pageIn 0.25s ease; }

/* drawer */
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideInLeft { from { transform: translateX(-100%); } to { transform: translateX(0); } }

/* admin sidebar collapsed on mobile */
.admin-shell { display: flex; min-height: 100vh; }

/* hide on mobile */
.desktop-only { display: none; }
@media (min-width: 1024px) { .desktop-only { display: initial; } }
.mobile-only { display: initial; }
@media (min-width: 1024px) { .mobile-only { display: none; } }

/* sticky add-to-cart */
.sticky-cart-bar {
  position: fixed;
  bottom: 56px;
  left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--ink-200);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 40;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}
@media (min-width: 1024px) { .sticky-cart-bar { display: none; } }

/* category chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: white;
  border: 1px solid var(--ink-200);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--rose-300); }
.chip.active { background: var(--rose-500); color: white; border-color: var(--rose-500); }

/* divider with text */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 14px;
}
.section-title h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
@media (min-width: 768px) { .section-title h2 { font-size: 22px; } }
.section-title .more {
  color: var(--rose-500);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* table */
table.tbl {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 13px;
}
table.tbl th {
  text-align: right;
  padding: 12px 14px;
  background: var(--cream-100);
  font-weight: 600;
  color: var(--ink-700);
  border-bottom: 1px solid var(--ink-200);
  font-size: 12px;
}
table.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ink-100);
  vertical-align: middle;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: var(--cream-50); }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(31, 26, 26, 0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  animation: fadeIn 0.2s ease;
}

/* spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }

/* responsive helpers */
.pd-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 900px) {
  .pd-grid { grid-template-columns: 0.9fr 1.1fr; gap: 36px; align-items: start; }
  .pd-grid > div:first-child { position: sticky; top: 150px; }
}
.shop-2col { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 960px) {
  .shop-2col { grid-template-columns: 1fr 360px; align-items: start; }
  .shop-2col > .shop-side { position: sticky; top: 150px; }
}
/* give desktop more product columns */
@media (min-width: 700px) { .auto-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important; } }

/* carousels - thin scrollbar */
.cat-carousel::-webkit-scrollbar, .flash-row::-webkit-scrollbar { height: 5px; }
.cat-carousel::-webkit-scrollbar-thumb, .flash-row::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 3px; }
.flash-row::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.4); }

/* hero banner - responsive, spans up to container width (max 1280) */.hero-banner { width: 100%; height: 190px; }
.hero-slide { padding: 22px; }
.hero-title { font-size: 22px; }
.hero-sub { font-size: 13px; max-width: 340px; }
@media (min-width: 600px) {
  .hero-banner { height: 250px; }
  .hero-title { font-size: 28px; }
  .hero-sub { font-size: 15px; max-width: 420px; }
}
@media (min-width: 1024px) {
  .hero-banner { height: 340px; }
  .hero-slide { padding: 48px; }
  .hero-title { font-size: 40px; }
  .hero-sub { font-size: 17px; max-width: 480px; }
}
.drawer-right {
  position: fixed;
  top: 0; right: 0;
  bottom: 0;
  width: 88%;
  max-width: 380px;
  background: white;
  z-index: 91;
  animation: slideInRight 0.25s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ===== تضمین ریسپانسیو روی موبایل‌های کوچک ===== */
@media (max-width: 480px) {
  .container { padding: 0 12px; }
  /* فرم‌های دو ستونه چک‌اوت و ادمین روی موبایل تک‌ستونه شوند */
  .pd-grid { grid-template-columns: 1fr !important; }
  h1 { font-size: 17px !important; }
  /* جلوگیری از سرریز افقی */
  body { overflow-x: hidden; }
  img, .product-card { max-width: 100%; }
}
@media (max-width: 360px) {
  .btn { padding: 9px 12px; font-size: 13px; }
  .btn-lg { padding: 12px 16px; }
}
/* جدول‌های ادمین روی موبایل اسکرول افقی داشته باشند */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
