/* Address modal + repair-shop style Leaflet selector (menu_demo) */

.md-address-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.md-address-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.md-address-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 14, 0.45);
}

.md-address-sheet {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(92vh, 760px);
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  animation: md-sheet-in 0.22s ease;
}

@keyframes md-sheet-in {
  from { transform: translateY(12px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.md-address-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.md-address-header h2 {
  margin: 0;
  flex: 1;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: #222;
}

.md-address-back,
.md-address-header-spacer {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.md-address-back {
  border: 0;
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  color: #333;
}

.md-address-back:hover {
  background: rgba(0, 0, 0, 0.05);
}

.md-address-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.md-address-list-label {
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
  color: #777;
}

.md-address-select-form {
  margin: 0;
}

.md-address-card {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  text-align: right;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  border-radius: 0.75rem;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
}

.md-address-card-wrap {
  position: relative;
}

.md-address-card-wrap .md-address-card {
  padding-left: 3.2rem; /* room for edit/delete buttons */
}

.md-address-card-actions {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  display: flex;
  gap: 0.35rem;
  z-index: 2;
}

.md-address-edit,
.md-address-delete {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #A50021;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.md-address-edit:hover,
.md-address-delete:hover {
  background: rgba(165, 0, 33, 0.06);
}

.md-address-card.is-selected {
  border-color: #A50021;
  background: rgba(165, 0, 33, 0.06);
}

.md-address-card i {
  color: #A50021;
  margin-top: 0.15rem;
}

.md-address-card strong {
  display: block;
  font-size: 0.95rem;
}

.md-address-card small {
  display: block;
  color: #777;
  margin-top: 0.15rem;
  line-height: 1.4;
}

.md-address-add-new {
  width: 100%;
  border: 1px dashed rgba(165, 0, 33, 0.45);
  background: transparent;
  color: #A50021;
  border-radius: 0.75rem;
  padding: 0.7rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.md-address-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.md-step.is-hidden,
.md-address-form.is-hidden,
.md-address-list.is-hidden {
  display: none;
}

.md-address-list-body {
  padding: 0.85rem 1rem 1rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.md-preview-map {
  width: 100%;
  height: 140px;
  min-height: 140px;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #e8eef2;
  margin-bottom: 1rem;
}

.md-preview-map .leaflet-container {
  width: 100%;
  height: 100%;
  background: #e8eef2;
}

.md-preview-map .leaflet-container img,
.md-preview-map .leaflet-tile-container img {
  max-width: none !important;
  max-height: none !important;
}

.md-details-fields {
  display: grid;
  gap: 0.9rem;
}

.md-field input[type="text"],
.md-field input[type="tel"] {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.65rem;
  padding: 0.7rem 0.85rem;
  background: #fff;
  font-size: 0.95rem;
  font-family: inherit;
}

.md-field input::placeholder,
.md-field textarea::placeholder {
  color: #9ca3af;
}

.md-address-scroll {
  flex: 1;
  overflow: auto;
  padding: 0.85rem 1rem;
  min-height: 0;
}

.md-location-card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(249, 250, 251, 0.7);
  border-radius: 0.85rem;
  padding: 0.95rem;
  display: grid;
  gap: 0.9rem;
}

.md-section-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #A50021;
  text-transform: uppercase;
}

.md-field label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #374151;
}

.md-field textarea,
.md-field select {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.65rem;
  padding: 0.6rem 0.75rem;
  background: #fff;
  font-size: 0.92rem;
  font-family: inherit;
  resize: vertical;
}

.md-field-hint {
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.5;
}

.md-address-city {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.md-address-footer {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

/* Delete confirmation overlay (inside the address modal) */
.md-delete-confirm {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.md-delete-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 14, 0.35);
}

.md-delete-confirm-card {
  position: absolute;
  left: 1.2rem;
  right: 1.2rem;
  top: 35%;
  transform: translateY(-50%);
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  padding: 1rem 1rem 0.9rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.md-delete-confirm-title {
  margin: 0 0 0.9rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 800;
  color: #222;
}

.md-delete-confirm-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.md-delete-confirm-no,
.md-delete-confirm-yes {
  min-width: 6rem;
  height: 2.3rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  background: #fff;
  color: #333;
}

.md-delete-confirm-no:hover {
  background: rgba(0, 0, 0, 0.04);
}

.md-delete-confirm-yes {
  background: rgba(165, 0, 33, 0.08);
  border-color: rgba(165, 0, 33, 0.35);
  color: #A50021;
}

.md-delete-confirm-yes:hover {
  background: rgba(165, 0, 33, 0.12);
}

.md-address-error {
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
  color: #c62828;
}

.md-map-stage {
  position: relative;
}

.md-service-notice {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(20, 16, 14, 0.48);
  backdrop-filter: blur(2px);
  animation: md-notice-in 0.2s ease;
  border-radius: 0.85rem;
}

.md-service-notice[hidden] {
  display: none !important;
}

@keyframes md-notice-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.md-service-notice-card {
  width: min(100%, 320px);
  background: #fff;
  border-radius: 1rem;
  padding: 1.25rem 1.1rem 1.1rem;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  animation: md-sheet-in 0.22s ease;
}

.md-service-notice-icon {
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 0.75rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fdecea;
  color: #A50021;
  font-size: 1.35rem;
}

.md-service-notice-title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #222;
}

.md-service-notice-text {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: #555;
}

.md-service-notice-btn {
  width: 100%;
  border: 0;
  border-radius: 0.75rem;
  background: #A50021;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

.md-service-notice-btn:hover {
  background: #8a001b;
}

/* ——— Location card (main menu only) ——— */
.md-loc-card {
  --loc-ink: #1a1a1a;
  --loc-muted: #6b6b6b;
  --loc-brand: #A50021;
  --loc-brand-soft: rgba(165, 0, 33, 0.08);
  --loc-ok: #1b7a4e;
  --loc-warn: #9a6700;

  position: fixed;
  left: 50%;
  bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 1100;
  width: min(92vw, 380px);
  display: grid;
  gap: 0.85rem;
  padding: 1rem 1rem 1rem;
  border-radius: 1.35rem;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.98) 0%, #fff 48%, #fffaf9 100%);
  box-shadow:
    0 18px 40px rgba(26, 26, 26, 0.14),
    0 2px 0 rgba(255, 255, 255, 0.9) inset,
    0 0 0 1px rgba(165, 0, 33, 0.06);
  animation: md-loc-in 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.md-loc-card.is-dismissed {
  display: none !important;
}

@keyframes md-loc-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.md-loc-card__dismiss {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  width: 1.85rem;
  height: 1.85rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  color: #888;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: background 0.15s ease, color 0.15s ease;
  z-index: 2;
}

.md-loc-card__dismiss:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #333;
}

.md-loc-card__body {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding-left: 1.6rem;
  text-align: right;
}

.md-loc-card__icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.95rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--loc-brand-soft);
  color: var(--loc-brand);
  font-size: 1.15rem;
  box-shadow: inset 0 0 0 1px rgba(165, 0, 33, 0.08);
}

.md-loc-card__icon--ok {
  background: rgba(27, 122, 78, 0.1);
  color: var(--loc-ok);
  box-shadow: inset 0 0 0 1px rgba(27, 122, 78, 0.12);
}

.md-loc-card__icon--warn {
  background: rgba(154, 103, 0, 0.12);
  color: var(--loc-warn);
  box-shadow: inset 0 0 0 1px rgba(154, 103, 0, 0.14);
}

.md-loc-card__copy {
  flex: 1;
  min-width: 0;
  padding-top: 0.1rem;
}

.md-loc-card__eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--loc-muted);
}

.md-loc-card__title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--loc-ink);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.md-loc-card__hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--loc-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.md-loc-card__branch-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--loc-ok);
  box-shadow: 0 0 0 3px rgba(27, 122, 78, 0.15);
  flex-shrink: 0;
}

.md-loc-card__actions {
  display: flex;
  gap: 0.5rem;
}

.md-loc-card__cta {
  flex: 1;
  border: 0;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #b8002a 0%, #A50021 55%, #8a001b 100%);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 750;
  font-family: inherit;
  padding: 0.78rem 1rem;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(165, 0, 33, 0.28);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.md-loc-card__cta:hover {
  filter: brightness(1.04);
}

.md-loc-card__cta:active {
  transform: scale(0.985);
}

.md-loc-card__cta--ghost {
  background: #fff;
  color: var(--loc-brand);
  box-shadow: none;
  border: 1px solid rgba(165, 0, 33, 0.22);
}

.md-loc-card__cta--ghost:hover {
  background: var(--loc-brand-soft);
  filter: none;
}

.md-loc-card.is-warning {
  box-shadow:
    0 18px 40px rgba(26, 26, 26, 0.12),
    0 0 0 1px rgba(154, 103, 0, 0.14);
}

.md-loc-reopen {
  position: fixed;
  left: 1rem;
  bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
  z-index: 1100;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--loc-brand, #A50021);
  box-shadow: 0 10px 28px rgba(26, 26, 26, 0.16);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  animation: md-loc-in 0.3s ease;
}

.md-loc-reopen[hidden] {
  display: none !important;
}

.md-loc-reopen:hover {
  background: #fff5f4;
}

/* فضای پایین منو تا کارت روی محصولات ننشیند */
body:has(#md-location-dock:not(.is-dismissed)) .menu-page {
  padding-bottom: 11.5rem !important;
}

@media (max-width: 480px) {
  .md-loc-card {
    bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px));
    width: min(94vw, 380px);
    border-radius: 1.2rem;
  }

  .md-loc-reopen {
    bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px));
  }
}

.md-address-confirm {
  width: 100%;
  border: 0;
  border-radius: 0.75rem;
  background: #A50021;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
  cursor: pointer;
}

.md-address-confirm:disabled {
  opacity: 0.6;
  cursor: wait;
}

.md-address-confirm:hover:not(:disabled) {
  background: #8a001b;
}

/* --- Repair-shop style leaflet selector --- */
.leaflet-address-selector {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Leaflet RTL cleanup (controls position + text direction) */
.las-map .leaflet-container,
.md-preview-map .leaflet-container {
  direction: rtl;
  font-family: inherit;
}

.las-map .leaflet-control-attribution,
.md-preview-map .leaflet-control-attribution {
  direction: rtl;
  text-align: right;
}

/* Default zoom control is on the left in LTR; move it to the right in RTL */
.las-map .leaflet-left,
.md-preview-map .leaflet-left {
  left: auto !important;
  right: 10px !important;
}

.las-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(90deg, #eff6ff 0%, #eef2ff 100%);
}

.las-header-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.65rem;
  background: #A50021;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.las-title {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.las-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: #4b5563;
  line-height: 1.45;
}

.las-body {
  padding: 1rem 1.15rem 1.15rem;
}

.las-map {
  width: 100%;
  height: 256px;
  min-height: 256px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.85rem;
  overflow: hidden;
  position: relative;
  background: #e8eef2;
}

.las-map-search {
  position: relative;
  z-index: 1;
  margin: 0 0 0.6rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.85rem;
  padding: 0.45rem 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.las-map-search * {
  position: relative;
}

.las-map-search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  direction: rtl;
}

.las-map-search-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.las-map-search-input {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.65rem;
  padding: 0.65rem 0.7rem;
  background: #ffffff;
  font-size: 0.9rem;
  outline: none;
  width: 100%;
}

.las-map-search-city {
  flex: 0 0 38%;
}

.las-map-search-icon {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #A50021;
  font-size: 0.95rem;
  pointer-events: none;
}

.las-map-search-field .las-map-search-input {
  padding-right: 2.1rem;
}

.las-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #4b5563;
  font-size: 0.85rem;
}

.las-loading.hidden {
  display: none;
}

.las-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid #bfdbfe;
  border-top-color: #A50021;
  border-radius: 50%;
  animation: las-spin 0.7s linear infinite;
}

@keyframes las-spin {
  to { transform: rotate(360deg); }
}

.las-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.las-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  border-radius: 0.65rem;
  padding: 0.6rem 0.95rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.las-btn-primary {
  background: #A50021;
  color: #fff;
  box-shadow: 0 1px 2px rgba(165, 0, 33, 0.35);
}

.las-btn-primary:hover {
  background: #8a001b;
}

.las-btn-muted {
  background: #f3f4f6;
  color: #374151;
}

.las-btn-muted:hover {
  background: #e5e7eb;
}

.leaflet-address-selector .leaflet-container {
  width: 100%;
  height: 100%;
  font: inherit;
  background: #e8eef2;
}

.leaflet-address-selector .leaflet-tile-container,
.leaflet-address-selector .leaflet-pane,
.leaflet-address-selector .leaflet-map-pane {
  direction: ltr;
}

.leaflet-address-selector .leaflet-container img,
.leaflet-address-selector .leaflet-tile-container img {
  max-width: none !important;
  max-height: none !important;
}

.leaflet-address-selector [dir="rtl"] .leaflet-control-zoom {
  left: auto;
  right: 10px;
}

@media (max-width: 640px) {
  .md-address-modal {
    padding: 0;
    align-items: flex-end;
  }

  .md-address-sheet {
    width: 100%;
    max-height: 94vh;
    border-radius: 1rem 1rem 0 0;
  }

  .las-map {
    height: 220px;
    min-height: 220px;
  }
}
