/* حداقل فونت 12px مطابق INSTRUCTIONS.md — پایه body 14px؛ کوچک‌ترین کلاس text-xs (12px) برای خوانایی */
body {
  font-family: 'Vazirmatn', sans-serif;
  background-color: #f8fafc;
  font-size: 14px;
}

.touch-manipulation {
  touch-action: manipulation;
}
.dark body {
  background-color: #0f172a;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
.dark ::-webkit-scrollbar-track { background: #1e293b; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.dark .custom-scrollbar::-webkit-scrollbar-thumb { background: #475569; }

/* موبایل‌فرست: کاهش حداقل ابعاد تاچ‌تارگت دکمه‌ها از 44px به 34px */
@media (max-width: 767px) {
  .min-w-\[44px\] {
    min-width: 34px;
  }
  .min-h-\[44px\] {
    min-height: 34px;
  }
}

/* فشرده‌سازی: margin عمودی md:space-y-6 خاموش — override space-y-6 */

.md\:space-y-6 > :not([hidden]) ~ :not([hidden]) {
  margin-top: 0 !important;
}

/* در تب سفارشات: فیلتر کشوایی وضعیت در دستتاپ (order-filter-select با min/max-width از 8rem برای فشردگی) */
@media (min-width: 1024px) {
  body .order-filter-select-wrap {
    min-width: 8rem !important;
    max-width: 10rem !important;
  }
}

/* یکنواخت‌سازی ارتفاع/پدینگ فیلدهای مودال سفارش جدید (asc-new-order layout) */
.asc-new-order-modal .asc-new-order-form input[type="text"],
.asc-new-order-modal .asc-new-order-form input[type="number"],
.asc-new-order-modal .asc-new-order-form select {
  min-height: 2.25rem;
  padding: 0.5rem 0.625rem;
  line-height: 1.25rem;
  border-color: #cbd5e1;
}

.dark .asc-new-order-modal .asc-new-order-form input[type="text"],
.dark .asc-new-order-modal .asc-new-order-form input[type="number"],
.dark .asc-new-order-modal .asc-new-order-form select {
  border-color: #334155;
}

/* فشرده‌تر کردن فیلدهای تاریخ (روز/ماه/سال) بدون هم‌ترازی با سایر inputهای فرم */
.asc-new-order-modal .asc-new-order-form input.asc-nos-jalali-input[type="text"] {
  min-height: 1.25rem;
  padding: 0.2rem 0.3rem;
  line-height: 1rem;
  border-color: #cbd5e1;
}

.dark .asc-new-order-modal .asc-new-order-form input.asc-nos-jalali-input[type="text"] {
  border-color: #475569;
}

.asc-new-order-modal .asc-new-order-form button {
  line-height: 1.25rem;
}

.asc-new-order-modal .asc-new-order-form button:not(.asc-new-order-close-btn):not(.asc-new-order-footer-btn) {
  min-height: 2.25rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.5rem;
}

.asc-new-order-modal .asc-new-order-form .asc-nos-field-box {
  min-height: 2.25rem;
  line-height: 1.25rem;
}

/* چیدمان دو ستونه مودال سفارش جدید بر اساس breakpoint: stack؛ lg+: grid 60% / 40% (ترتیب DOM: چپ راست) */
.asc-new-order-modal .asc-nos-layout {
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .asc-new-order-modal .asc-nos-layout {
    display: grid;
    grid-template-columns: minmax(0, 60%) minmax(0, 40%);
    align-items: stretch;
  }

  .asc-new-order-modal .asc-nos-col-left {
    grid-column: 1;
    min-width: 0;
    scroll-behavior: smooth;
  }

  .asc-new-order-modal .asc-nos-col-right {
    grid-column: 2;
    min-width: 0;
    scroll-behavior: smooth;
  }

  .asc-new-order-modal .asc-nos-col-right-inner {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
  }

  .asc-new-order-modal .asc-nos-items-panel {
    flex: 1 1 auto;
    min-height: 0;
  }

  .asc-new-order-modal .asc-nos-items-scroll {
    max-height: none;
  }

  .asc-new-order-modal .asc-nos-items-panel .asc-nos-footer-summary {
    margin-top: auto;
  }

  .asc-new-order-modal .asc-nos-col-left > .rounded-xl > h4 {
    letter-spacing: 0.04em;
    line-height: 1.2;
  }

  .asc-new-order-modal .asc-nos-col-left .grid.gap-2 {
    gap: 0.375rem;
  }

  .asc-new-order-modal .asc-nos-col-left input.p-3 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

/* سایه پاپ‌آور جستجوی محصول در مودال سفارش جدید */
.asc-new-order-modal .asc-nos-product-search-popover {
  box-shadow: 0 8px 24px -6px rgb(15 23 42 / 0.18);
}

.dark .asc-new-order-modal .asc-nos-product-search-popover {
  box-shadow: 0 8px 24px -6px rgb(0 0 0 / 0.45);
}

/* مودال ارسال سفارش (Curly) */
.curly-order-shipping-modal .curly-osm-field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgb(100 116 139);
}

.dark .curly-order-shipping-modal .curly-osm-field-label {
  color: rgb(148 163 184);
}

.curly-order-shipping-modal .curly-osm-input {
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid rgb(226 232 240);
  background: rgb(255 255 255);
  outline: none;
}

.curly-order-shipping-modal .curly-osm-input:focus {
  box-shadow: 0 0 0 2px rgb(99 102 241);
}

.dark .curly-order-shipping-modal .curly-osm-input {
  border-color: rgb(51 65 85);
  background: rgb(15 23 42);
  color: rgb(248 250 252);
}

/* پیشنهاد خودکار فیلدهای تکراری (SuggestTextInput) */
.asc-suggest-wrap {
  position: relative;
  width: 100%;
}

.asc-suggest-dropdown {
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 12rem;
  overflow-y: auto;
  border-radius: 0.625rem;
  border: 1px solid rgb(226 232 240);
  background: rgb(255 255 255);
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.12);
}

.dark .asc-suggest-dropdown {
  border-color: rgb(51 65 85);
  background: rgb(30 41 59);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}

.asc-suggest-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.375rem;
}

.asc-suggest-item + .asc-suggest-item {
  margin-top: 0.125rem;
}

.asc-suggest-select {
  flex: 1;
  min-width: 0;
  min-height: 2.25rem;
  padding: 0.375rem 0.5rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  text-align: right;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: rgb(30 41 59);
  cursor: pointer;
}

.asc-suggest-select:hover,
.asc-suggest-select:focus-visible {
  background: rgb(238 242 255);
  outline: none;
}

.dark .asc-suggest-select {
  color: rgb(248 250 252);
}

.dark .asc-suggest-select:hover,
.dark .asc-suggest-select:focus-visible {
  background: rgb(49 46 129 / 0.35);
}

.asc-suggest-remove {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: rgb(148 163 184);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
}

.asc-suggest-remove:hover,
.asc-suggest-remove:focus-visible {
  background: rgb(254 226 226);
  color: rgb(220 38 38);
  outline: none;
}

.dark .asc-suggest-remove:hover,
.dark .asc-suggest-remove:focus-visible {
  background: rgb(127 29 29 / 0.35);
  color: rgb(252 165 165);
}

/* بازتعریف استایل dropdown پیشنهاد — نسخه فشرده (SuggestTextInput) */
.asc-suggest-wrap {
  position: relative;
  width: 100%;
}

.asc-suggest-dropdown {
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 10rem;
  overflow-y: auto;
  border-radius: 0.625rem;
  border: 1px solid rgb(226 232 240);
  background: rgb(255 255 255);
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.12);
}

.dark .asc-suggest-dropdown {
  border-color: rgb(51 65 85);
  background: rgb(30 41 59);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}

.asc-suggest-item {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  padding: 0 0.25rem;
}

.asc-suggest-item + .asc-suggest-item {
  margin-top: 0.125rem;
}

.asc-suggest-select {
  flex: 1;
  min-width: 0;
  min-height: 2.25rem;
  padding: 0.375rem 0.625rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: rgb(30 41 59);
  font-size: 0.75rem;
  line-height: 1.25rem;
  text-align: right;
  cursor: pointer;
}

.asc-suggest-select:hover,
.asc-suggest-select:focus-visible {
  background: rgb(238 242 255);
  outline: none;
}

.dark .asc-suggest-select {
  color: rgb(248 250 252);
}

.dark .asc-suggest-select:hover,
.dark .asc-suggest-select:focus-visible {
  background: rgb(49 46 129 / 0.35);
}

.asc-suggest-remove {
  flex-shrink: 0;
  width: 2rem;
  min-height: 2.25rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: rgb(148 163 184);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.asc-suggest-remove:hover,
.asc-suggest-remove:focus-visible {
  background: rgb(254 226 226);
  color: rgb(220 38 38);
  outline: none;
}

.dark .asc-suggest-remove:hover,
.dark .asc-suggest-remove:focus-visible {
  background: rgb(127 29 29 / 0.35);
  color: rgb(252 165 165);
}


/* ویرایشگر متن غنی (rich-text-editor.js) */
.asc-rich-editor {
  border-radius: 0.75rem;
  border: 1px solid rgb(226 232 240);
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s ease;
}

.asc-rich-editor:focus-within {
  box-shadow: 0 0 0 2px rgb(99 102 241);
}

.dark .asc-rich-editor {
  border-color: rgb(71 85 105);
  background: rgb(15 23 42);
}

.asc-rich-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
}

.dark .asc-rich-editor__toolbar {
  border-bottom-color: rgb(71 85 105);
  background: rgb(30 41 59 / 0.8);
}

.asc-rich-editor__separator {
  flex-shrink: 0;
  width: 1px;
  height: 1.5rem;
  margin: 0 2px;
  background: rgb(203 213 225);
}

.dark .asc-rich-editor__separator {
  background: rgb(71 85 105);
}

.asc-rich-editor__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid rgb(203 213 225);
  border-radius: 0.5rem;
  background: #fff;
  color: rgb(51 65 85);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.asc-rich-editor__btn:hover {
  background: rgb(241 245 249);
  border-color: rgb(148 163 184);
}

.asc-rich-editor__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgb(99 102 241);
}

.dark .asc-rich-editor__btn {
  border-color: rgb(71 85 105);
  background: rgb(30 41 59);
  color: rgb(226 232 240);
}

.dark .asc-rich-editor__btn:hover {
  background: rgb(51 65 85);
  border-color: rgb(100 116 139);
}

.asc-rich-editor__btn-label {
  font: inherit;
}

.asc-rich-editor__btn-label--bold {
  font-weight: 800;
}

.asc-rich-editor__btn-label--italic {
  font-style: italic;
}

.asc-rich-editor__btn-label--underline {
  text-decoration: underline;
}

.asc-rich-editor__btn-icon {
  font-size: 14px;
  line-height: 1;
}

.asc-rich-editor__format-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.asc-rich-editor__format-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.asc-rich-editor__format-select {
  min-width: 6.5rem;
  min-height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid rgb(203 213 225);
  border-radius: 0.5rem;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 8px center;
  color: rgb(51 65 85);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
  appearance: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.asc-rich-editor__format-select:hover {
  background-color: rgb(241 245 249);
  border-color: rgb(148 163 184);
}

.asc-rich-editor__format-select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgb(99 102 241);
}

.dark .asc-rich-editor__format-select {
  border-color: rgb(71 85 105);
  background-color: rgb(30 41 59);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  color: rgb(226 232 240);
}

.dark .asc-rich-editor__format-select:hover {
  background-color: rgb(51 65 85);
  border-color: rgb(100 116 139);
}

@media (max-width: 639px) {
  .asc-rich-editor__btn,
  .asc-rich-editor__format-select {
    min-width: 44px;
    min-height: 44px;
    font-size: 12px;
  }

  .asc-rich-editor__format-select {
    min-width: 7.5rem;
  }
}

.asc-rich-editor__body {
  width: 100%;
  min-height: 100px;
  max-height: 360px;
  padding: 10px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  outline: none;
  font-size: 14px;
  line-height: 1.625;
  color: rgb(30 41 59);
  word-break: break-word;
}

.dark .asc-rich-editor__body {
  color: rgb(241 245 249);
}

.asc-rich-editor__body h1 {
  display: block;
  margin: 0.75rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  color: rgb(15 23 42);
}

.asc-rich-editor__body h2 {
  display: block;
  margin: 0.625rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  color: rgb(15 23 42);
}

.asc-rich-editor__body h3 {
  display: block;
  margin: 0.5rem 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.4;
  color: rgb(15 23 42);
}

.asc-rich-editor__body h4 {
  display: block;
  margin: 0.5rem 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  color: rgb(15 23 42);
}

.dark .asc-rich-editor__body h1,
.dark .asc-rich-editor__body h2,
.dark .asc-rich-editor__body h3,
.dark .asc-rich-editor__body h4 {
  color: rgb(248 250 252);
}

.asc-rich-editor__body p {
  margin: 0.25rem 0;
}

.asc-rich-editor__body ul,
.asc-rich-editor__body ol {
  margin: 0.25rem 0;
  padding-right: 1.5rem;
}

.asc-rich-editor__body ul {
  list-style-type: disc;
}

.asc-rich-editor__body ol {
  list-style-type: decimal;
}

.asc-rich-editor__body li {
  margin: 0.125rem 0;
}

.asc-rich-editor__body a {
  color: rgb(79 70 229);
  text-decoration: underline;
  font-weight: 600;
}

.dark .asc-rich-editor__body a {
  color: rgb(129 140 248);
}

.asc-rich-editor__body strong {
  font-weight: 700;
}

.asc-rich-editor__body em {
  font-style: italic;
}

.asc-rich-editor__body--empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}

.dark .asc-rich-editor__body--empty::before {
  color: #64748b;
}

.asc-rich-editor__footer {
  padding: 6px 12px;
  border-top: 1px solid rgb(241 245 249);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: rgb(148 163 184);
}

.dark .asc-rich-editor__footer {
  border-top-color: rgb(51 65 85);
}
