/**
 * HyperMarket M3 — address.css
 * فاز ۷: استایل‌های مودال آدرس و نقشه
 */

/* ══════════════════════════════════════════════
   OVERLAY
══════════════════════════════════════════════ */

.hm-addr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.hm-addr-overlay.open { opacity: 1; pointer-events: all; }

/* ══════════════════════════════════════════════
   MODAL CONTAINER — Bottom Sheet
══════════════════════════════════════════════ */

.hm-addr-modal {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: 28px 28px 0 0;
  z-index: 1200;
  transition: transform .4s cubic-bezier(.25,1,.5,1);
  display: flex;
  flex-direction: column;
  max-height: 92dvh;
  overflow: hidden;
}
.hm-addr-modal.open {
  transform: translateX(-50%) translateY(0);
}
.hm-addr-modal[hidden] { display: none !important; }

/* ══════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════ */

.hm-addr-modal__header {
  display: flex;
  align-items: center;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  gap: 8px;
}
.hm-addr-modal__title {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: #222;
  text-align: center;
}
.hm-addr-modal__back,
.hm-addr-modal__close {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: none;
  background: #f5f5f5;
  display: grid; place-items: center;
  cursor: pointer;
  color: #444;
  transition: background .15s;
  flex-shrink: 0;
}
.hm-addr-modal__back:hover,
.hm-addr-modal__close:hover { background: #eee; }
.hm-addr-modal__back .material-symbols-rounded,
.hm-addr-modal__close .material-symbols-rounded { font-size: 20px; }
.hm-addr-modal__back[hidden] { display: none; }

/* ══════════════════════════════════════════════
   SCREENS
══════════════════════════════════════════════ */

.hm-addr-screen {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #eee transparent;
}
.hm-addr-screen[hidden] { display: none; }

/* ══════════════════════════════════════════════
   SCREEN 1 — لیست آدرس‌ها
══════════════════════════════════════════════ */

.hm-addr-list {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* empty state */
.hm-addr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px;
  text-align: center;
  gap: 10px;
}
.hm-addr-empty__icon { font-size: 52px; color: #ddd; }
.hm-addr-empty__text { font-size: 13px; color: #aaa; }

/* آدرس item */
.hm-addr-item {
  border: 1.5px solid #f0f0f0;
  border-radius: 18px;
  padding: 13px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: border-color .2s, background .2s;
  background: #fff;
}
.hm-addr-item--active {
  border-color: #E8730C;
  background: #fffde8;
}

.hm-addr-item__radio { flex-shrink: 0; padding-top: 2px; }
.hm-addr-item__radio-check { color: #E8730C; font-size: 20px; }
.hm-addr-item__radio-empty { color: #ccc; font-size: 20px; }

.hm-addr-item__body { flex: 1; min-width: 0; }
.hm-addr-item__header {
  display: flex; align-items: center; gap: 5px; margin-bottom: 4px;
}
.hm-addr-item__icon { font-size: 16px; color: #E8730C; }
.hm-addr-item__title { font-size: 13px; font-weight: 700; color: #222; }
.hm-addr-item__address { font-size: 11px; color: #666; line-height: 1.5; }
.hm-addr-item__mobile { font-size: 11px; color: #aaa; margin-top: 3px; direction: ltr; text-align: right; }

.hm-addr-item__actions {
  display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.hm-addr-item__edit,
.hm-addr-item__delete {
  width: 30px; height: 30px;
  border-radius: 8px; border: none;
  display: grid; place-items: center;
  cursor: pointer; transition: background .15s;
}
.hm-addr-item__edit { background: #f5f5f5; color: #555; }
.hm-addr-item__edit:hover { background: #fffde8; color: #b38600; }
.hm-addr-item__delete { background: #fff5f5; color: #E8730C; }
.hm-addr-item__delete:hover { background: #ffe0e0; }
.hm-addr-item__edit .material-symbols-rounded,
.hm-addr-item__delete .material-symbols-rounded { font-size: 16px; }

/* دکمه افزودن */
.hm-addr-add-btn-wrap {
  padding: 12px 14px 24px;
  flex-shrink: 0;
}
.hm-addr-add-btn {
  width: 100%;
  height: 52px;
  background: #E8730C;
  color: #333;
  border: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(232,115,12,.4);
  transition: transform .15s, box-shadow .15s;
}
.hm-addr-add-btn:active {
  transform: scale(.97);
  box-shadow: 0 2px 8px rgba(232,115,12,.3);
}
.hm-addr-add-btn .material-symbols-rounded { font-size: 22px; }

/* ══════════════════════════════════════════════
   SCREEN 2 — نقشه
══════════════════════════════════════════════ */

/* نوار جستجو */
.hm-addr-map-search {
  position: relative;
  padding: 10px 12px 8px;
  flex-shrink: 0;
  z-index: 10;
}
.hm-addr-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid #eee;
  border-radius: 14px;
  padding: 0 12px;
  height: 46px;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
}
.hm-addr-search-bar .material-symbols-rounded { font-size: 20px; color: #aaa; }
.hm-addr-search-input {
  flex: 1;
  border: none; background: transparent;
  font-size: 13px; font-family: inherit; color: #222; outline: none;
}
.hm-addr-search-input::placeholder { color: #bbb; }
.hm-addr-my-location-btn {
  width: 32px; height: 32px;
  border-radius: 8px; border: none;
  background: #fffde8;
  display: grid; place-items: center;
  cursor: pointer; color: #b38600;
  transition: background .15s;
  flex-shrink: 0;
}
.hm-addr-my-location-btn:hover { background: #E8730C; color: #333; }
.hm-addr-my-location-btn .material-symbols-rounded { font-size: 18px; }

/* نتایج جستجو */
.hm-addr-search-results {
  position: absolute;
  top: calc(100% - 8px);
  left: 12px; right: 12px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  max-height: 200px;
  overflow-y: auto;
  z-index: 20;
}
.hm-addr-search-results[hidden] { display: none; }
.hm-addr-search-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  transition: background .15s;
}
.hm-addr-search-result:hover { background: #fffde8; }
.hm-addr-search-result:last-child { border-bottom: none; }
.hm-addr-search-result .material-symbols-rounded { font-size: 16px; color: #E8730C; }
.hm-addr-search-result__text { font-size: 12px; color: #333; }

/* نقشه */
.hm-addr-map-container {
  width: 100%;
  height: 340px;
  position: relative;
  z-index: 1;
  background: #e8f0e8;
  flex-shrink: 0;
}

/* پین ثابت مرکز */
.hm-addr-pin-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -100%);
  z-index: 1000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* مکان‌یابی دقیق — باید نسبت به map container باشه */
}
.hm-addr-pin-icon {
  font-size: 36px;
  color: #E8730C;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.3));
  -webkit-animation:hm-pin-bounce .6s ease infinite alternate;
  animation:hm-pin-bounce .6s ease infinite alternate;
  font-variation-settings: 'FILL' 1;
}
@keyframes hm-pin-bounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-4px); }
}
.hm-addr-pin-shadow {
  width: 10px; height: 4px;
  background: rgba(0,0,0,.25);
  border-radius: 50%;
  margin-top: -2px;
  filter: blur(2px);
}

/* لیبل آدرس زیر نقشه */
.hm-addr-map-label {
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.hm-addr-map-label .material-symbols-rounded { font-size: 16px; color: #E8730C; flex-shrink: 0; margin-top: 2px; }
.hm-addr-map-label #hm-addr-map-label-text { font-size: 12px; color: #555; line-height: 1.5; }

/* دکمه تایید */
.hm-addr-map-confirm-wrap {
  padding: 8px 14px 20px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   SCREEN 3 — فرم
══════════════════════════════════════════════ */

.hm-addr-form {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hm-addr-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hm-addr-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
}
.hm-addr-label .material-symbols-rounded { font-size: 16px; color: #E8730C; }
.hm-addr-required { color: #E8730C; }
.hm-addr-optional { font-size: 10px; font-weight: 400; color: #aaa; }

.hm-addr-input {
  width: 100%;
  height: 46px;
  border: 1.5px solid #eee;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 13px;
  font-family: inherit;
  color: #222;
  background: #f8f8f8;
  outline: none;
  transition: border-color .2s, background .2s;
}
.hm-addr-input:focus {
  border-color: #E8730C;
  background: #fff;
}
.hm-addr-textarea {
  height: auto;
  padding: 12px 14px;
  resize: none;
  line-height: 1.5;
}

.hm-addr-field-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #aaa;
}
.hm-addr-field-hint .material-symbols-rounded { font-size: 13px; }
.hm-addr-field-hint.loading { color: #E8730C; }
.hm-addr-field-hint.done { color: #22c55e; }

/* پیش‌نمایش نقشه کوچک */
.hm-addr-map-preview {
  border: 1.5px solid #eee;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s;
  display: flex;
  flex-direction: column;
}
.hm-addr-map-preview:hover { border-color: #E8730C; }
.hm-addr-mini-map {
  width: 100%;
  height: 100px;
  background: #e8f4e8;
  position: relative;
  overflow: hidden;
}
.hm-addr-map-preview__info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8f8f8;
}
.hm-addr-map-preview__text { font-size: 11px; color: #555; flex: 1; }
.hm-addr-map-preview__change {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: #b38600; font-weight: 600;
}
.hm-addr-map-preview__change .material-symbols-rounded { font-size: 14px; }

/* chip عنوان آدرس */
.hm-addr-title-chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.hm-addr-title-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1.5px solid #eee;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.hm-addr-title-chip--active,
.hm-addr-title-chip:hover {
  background: #E8730C;
  border-color: #E8730C;
  color: #333;
}
.hm-addr-title-chip .material-symbols-rounded { font-size: 14px; }

.hm-addr-form-actions { padding-bottom: 8px; }

/* ══════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════ */

.hm-addr-toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #166534;
  color: #fff;
  padding: 12px 20px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  opacity: 0;
  transition: all .35s cubic-bezier(.25,1,.5,1);
  pointer-events: none;
  white-space: nowrap;
}
.hm-addr-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.hm-addr-toast[hidden] { display: none; }
.hm-addr-toast__icon { font-size: 18px; color: #86efac; }

/* ══════════════════════════════════════════════
   LEAFLET OVERRIDES
══════════════════════════════════════════════ */

.leaflet-container {
  font-family: 'Vazirmatn', sans-serif !important;
  direction: rtl;
}
.leaflet-control-zoom a {
  border-radius: 8px !important;
  font-size: 16px !important;
  line-height: 26px !important;
}
.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  font-family: 'Vazirmatn', sans-serif !important;
  font-size: 12px !important;
}
.leaflet-control-attribution {
  font-size: 9px !important;
  direction: ltr;
}

/* مخفی کردن attribution در حالت mobile */
@media (max-width: 430px) {
  .leaflet-control-attribution { display: none; }
}

/* ══════════════════════════════════════════════
   (پاپ‌آپ خودکار درخواست لوکیشن حذف شد —
   GPS اکنون فقط با اقدام صریح کاربر گرفته می‌شود)
══════════════════════════════════════════════ */
