/* ── باکس اصلی ── */
.ic-delivery-box {
  margin-top: 14px;
  direction: rtl;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.06);
  font-size: 14px;
  line-height: 1.6;
  color: #111827;
}

.ic-delivery-box.is-ready .ic-delivery-loading {
  display: none;
}

.ic-delivery-box__header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.ic-delivery-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f0fdf4;
  color: #166534;
  font-size: 13px;
  font-weight: 600;
}

.ic-delivery-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.ic-delivery-box__divider {
  height: 1px;
  background: #f3f4f6;
  margin: 12px 0;
}

.ic-delivery-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ic-delivery-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ic-delivery-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #f0f9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ic-delivery-icon {
  font-size: 20px;
  line-height: 1;
}

.ic-delivery-main-row {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ic-delivery-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  font-size: 15px;
  min-width: 0;
}

.ic-delivery-prefix {
  color: #6b7280;
}

.ic-delivery-date,
.ic-delivery-method {
  font-weight: 700;
  color: #111827;
}

.ic-delivery-sep {
  color: #d1d5db;
  margin: 0 2px;
}

.ic-delivery-deadline {
  width: 100%;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 10px;
  box-sizing: border-box;
}

.ic-delivery-deadline__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
}

.ic-delivery-deadline__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.ic-delivery-countdown {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 15px;
  color: #dc2626;
  letter-spacing: 0.02em;
  direction: ltr;
  unicode-bidi: isolate;
}

.ic-delivery-countdown.is-urgent {
  color: #ea580c;
}

.ic-delivery-deadline__hint {
  font-size: 12px;
  font-weight: 500;
  color: #9ca3af;
  line-height: 1.4;
}

.ic-delivery-change-btn {
  flex-shrink: 0;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.ic-delivery-change-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #111827;
}

.ic-delivery-change-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.ic-delivery-loading {
  margin-top: 10px;
  font-size: 13px;
  color: #9ca3af;
  animation: ic-pulse 1.4s ease-in-out infinite;
}

@keyframes ic-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* ── بنر ناموجود ── */
.ic-oos-wrap {
  margin-top: 16px;
}

.ic-oos-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 14px 16px;
  color: #7f1d1d;
}

.ic-oos-banner__icon {
  font-size: 20px;
  line-height: 1.4;
  flex-shrink: 0;
}

.ic-oos-banner__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ic-oos-banner__text strong {
  font-size: 15px;
  color: #991b1b;
}

.ic-oos-banner__text span {
  font-size: 13px;
  color: #b91c1c;
}

.ic-oos-wrap .ic-oos-action {
  margin-top: 12px;
}

/* ── مودال ── */
.ic-delivery-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.5);
  justify-content: center;
  align-items: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ic-delivery-modal.is-open {
  display: flex !important;
  opacity: 1;
}

.ic-delivery-card {
  background: #fff;
  padding: 0 18px 18px;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  max-height: min(88vh, 640px);
  text-align: right;
  direction: rtl;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ic-delivery-modal.is-open .ic-delivery-card {
  transform: scale(1) translateY(0);
}

.ic-delivery-sheet-handle {
  display: none;
  width: 40px;
  height: 4px;
  background: #d1d5db;
  border-radius: 999px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.ic-delivery-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 0 8px;
  flex-shrink: 0;
}

.ic-delivery-modal-header h3 {
  margin: 0;
  padding-top: 4px;
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.ic-delivery-modal-close {
  flex-shrink: 0;
  min-width: 44px;
  height: 44px;
  border: none;
  background: #f3f4f6;
  border-radius: 10px;
  cursor: pointer;
  color: #6b7280;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 12px;
  transition: background 0.15s, color 0.15s;
}

.ic-delivery-modal-close__text {
  font-size: 13px;
  font-weight: 600;
}

.ic-delivery-modal-close:hover {
  background: #fee2e2;
  color: #dc2626;
}

.ic-delivery-modal-subtitle {
  margin: 0 0 8px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
  flex-shrink: 0;
}

.ic-delivery-modal-note {
  margin: 0 0 14px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.55;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  flex-shrink: 0;
}

.ic-delivery-methods-scroll {
  flex: 1;
  min-height: 0;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: 2px;
  margin-left: -2px;
  -webkit-overflow-scrolling: touch;
}

.ic-delivery-methods-scroll::-webkit-scrollbar {
  width: 6px;
}

.ic-delivery-methods-scroll::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 999px;
}

/* ── کارت‌های روش ارسال ── */
.ic-delivery-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid #e5e7eb;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
  background: #fff;
}

.ic-delivery-row:last-child {
  margin-bottom: 4px;
}

.ic-delivery-row.is-confirming {
  transform: scale(0.98);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
}

.ic-delivery-row:hover {
  border-color: #cbd5e1;
  background: #f9fafb;
}

.ic-delivery-row.is-selected {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.ic-delivery-row__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.ic-delivery-row__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 1px solid #e5e7eb;
}

.ic-delivery-row.is-selected .ic-delivery-row__icon {
  border-color: #bfdbfe;
  background: #fff;
}

.ic-delivery-row__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ic-delivery-row__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ic-delivery-row__check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: transparent;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ic-delivery-row.is-selected .ic-delivery-row__check {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.ic-delivery-row__title {
  font-weight: 700;
  font-size: 15px;
  color: #111827;
}

.ic-delivery-row__hint {
  font-size: 12px;
  color: #9ca3af;
}

.ic-delivery-row__timer-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.ic-delivery-row__timer-caption {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
}

.ic-delivery-row__timer-window {
  font-size: 10px;
  line-height: 1.35;
  color: #94a3b8;
  text-align: left;
  max-width: 78px;
}

.ic-delivery-row.is-selected .ic-delivery-row__timer-window {
  color: #64748b;
}

.ic-delivery-row .timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  font-weight: 700;
  color: #9ca3af;
  direction: ltr;
  unicode-bidi: isolate;
  transition: color 0.15s;
}

.ic-delivery-row.is-selected .timer {
  color: #dc2626;
}

.ic-delivery-row.is-selected .timer.is-urgent,
.ic-delivery-countdown.is-urgent {
  color: #ea580c;
}

#delivery-summary {
  display: none;
}

/* ── موبایل: bottom sheet ── */
@media (max-width: 768px) {
  .ic-delivery-modal {
    align-items: flex-end;
    padding: 0;
  }

  .ic-delivery-sheet-handle {
    display: block;
  }

  .ic-delivery-card {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
  }

  .ic-delivery-modal-header {
    padding-top: 12px;
  }

  .ic-delivery-modal-close__text {
    display: none;
  }

  .ic-delivery-methods-scroll {
    max-height: 55vh;
  }

  .ic-delivery-modal.is-open .ic-delivery-card {
    transform: translateY(0);
  }

  .ic-delivery-main-row {
    flex-wrap: wrap;
  }

  .ic-delivery-change-btn {
    margin-right: auto;
  }

  .ic-delivery-deadline__hint {
    width: 100%;
  }
}
