/**
 * استایل صفحه جستجوی نقشه — چیدمان شبیه نشان (سایدبار + نقشه تمام‌ارتفاع).
 *
 * @package JobsDirectoryModern
 */

.jdm-map-search-page .site-footer,
.jdm-map-search-page .jdm-site-footer {
  display: none !important;
}

.jdm-map-search-page #site-content {
  padding: 0;
  max-width: none;
}

.jdm-map-search-page .site-nav__inner {
  max-width: none;
}

.jdm-mapapp {
  --jdm-map-sidebar: min(400px, 100%);
  display: grid;
  grid-template-columns: var(--jdm-map-sidebar) 1fr;
  height: calc(100dvh - 4.25rem);
  min-height: 420px;
  background: var(--color-jdm-bg, #ecfdf5);
  overflow: hidden;
}

.jdm-mapapp__sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--color-jdm-surface, #fff);
  border-inline-end: 1px solid var(--color-jdm-border, #a7f3d0);
  z-index: 2;
}

/* سرچ + متا ثابت؛ فقط لیست اسکرول می‌خورد */
.jdm-mapapp__head {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--color-jdm-surface, #fff);
  box-shadow: 0 6px 16px rgba(6, 78, 59, 0.06);
}

.jdm-mapapp__search {
  padding: 0.875rem 1rem 0.5rem;
}

.jdm-mapapp__search-label {
  position: relative;
  display: flex;
  align-items: center;
}

.jdm-mapapp__search-icon {
  position: absolute;
  inset-inline-start: 0.75rem;
  display: inline-flex;
  color: var(--color-jdm-muted-text, #047857);
  pointer-events: none;
}

.jdm-mapapp__input {
  width: 100%;
  border: 1px solid var(--color-jdm-border, #a7f3d0);
  border-radius: 14px;
  background: var(--color-jdm-soft, #f0fdf4);
  color: var(--color-jdm-fg, #064e3b);
  font: inherit;
  font-size: 0.9375rem;
  padding: 0.75rem 2.5rem 0.75rem 2.5rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.jdm-mapapp__input:focus {
  border-color: var(--color-jdm-primary, #059669);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-jdm-primary, #059669) 25%, transparent);
  background: #fff;
}

.jdm-mapapp__clear {
  position: absolute;
  inset-inline-end: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--color-jdm-muted-text, #047857);
  cursor: pointer;
}

.jdm-mapapp__clear:hover {
  background: var(--color-jdm-soft, #f0fdf4);
}

.jdm-mapapp__meta {
  padding: 0.5rem 1rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--color-jdm-muted-text, #047857);
  border-bottom: 1px solid color-mix(in oklab, var(--color-jdm-border, #a7f3d0) 60%, transparent);
}

.jdm-mapapp__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0.5rem 1rem;
}

.jdm-mapapp__item {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.75rem;
  width: 100%;
  text-align: start;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  padding: 0.625rem;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.jdm-mapapp__item:hover,
.jdm-mapapp__item.is-active {
  background: var(--color-jdm-soft, #f0fdf4);
  border-color: var(--color-jdm-border, #a7f3d0);
}

.jdm-mapapp__item:focus-visible {
  outline: 2px solid var(--color-jdm-primary, #059669);
  outline-offset: 2px;
}

.jdm-mapapp__thumb {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(145deg, #d1fae5, #a7f3d0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-jdm-primary, #059669);
}

.jdm-mapapp__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.jdm-mapapp__thumb-ph {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50% 50% 50% 0;
  background: var(--color-jdm-primary, #059669);
  transform: rotate(-45deg);
  opacity: 0.85;
}

.jdm-mapapp__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.jdm-mapapp__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-jdm-fg, #064e3b);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.jdm-mapapp__tagline {
  font-size: 0.75rem;
  color: var(--color-jdm-muted-text, #047857);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jdm-mapapp__address {
  font-size: 0.75rem;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.jdm-mapapp__rating {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-jdm-accent, #d97706);
}

.jdm-mapapp__empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--color-jdm-muted-text, #047857);
  font-size: 0.875rem;
}

.jdm-mapapp__map-wrap {
  position: relative;
  min-width: 0;
  background: #d1fae5;
}

.jdm-mapapp__map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.jdm-mapapp__search-area {
  position: absolute;
  top: 0.875rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-jdm-primary, #059669);
  box-shadow: 0 8px 24px rgba(6, 78, 59, 0.22);
  transition: transform 0.15s ease, background 0.15s ease;
}

.jdm-mapapp__search-area:hover {
  background: var(--color-jdm-secondary, #10b981);
  transform: translateX(-50%) translateY(-1px);
}

.jdm-mapapp__search-area[hidden] {
  display: none !important;
}

.jdm-mapapp__mobile-tabs {
  display: none;
}

/* پین لوکیشن روی نقشه */
.jdm-map-pin-wrap {
  background: transparent !important;
  border: 0 !important;
}

.jdm-map-pin {
  display: block;
  width: 32px;
  height: 48px;
  line-height: 0;
  filter: drop-shadow(0 3px 6px rgba(6, 78, 59, 0.35));
  transition: transform 0.18s ease;
  transform-origin: 50% 100%;
  cursor: pointer;
}

.jdm-map-pin__svg {
  display: block;
  overflow: visible;
}

.jdm-map-pin__body {
  fill: var(--color-jdm-primary, #059669);
  stroke: #fff;
  stroke-width: 1.25;
}

.jdm-map-pin__dot {
  fill: #fff;
}

.jdm-map-pin__shadow {
  fill: rgba(6, 78, 59, 0.28);
}

.jdm-map-pin.is-active {
  transform: scale(1.18);
  filter: drop-shadow(0 4px 10px rgba(217, 119, 6, 0.45));
  z-index: 2;
}

.jdm-map-pin.is-active .jdm-map-pin__body {
  fill: var(--color-jdm-accent, #d97706);
}

.jdm-map-popup {
  min-width: 160px;
  max-width: 220px;
  font-family: inherit;
}

.jdm-map-popup__title {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #064e3b;
}

.jdm-map-popup__link {
  font-size: 0.75rem;
  font-weight: 600;
  color: #059669;
  text-decoration: none;
}

.jdm-map-popup__link:hover {
  text-decoration: underline;
}

/* کارت غنی کنار مارکر */
.leaflet-popup.jdm-leaflet-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 16px;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.leaflet-popup.jdm-leaflet-popup .leaflet-popup-content {
  margin: 0;
  width: auto !important;
  overflow: visible;
}

.leaflet-popup.jdm-leaflet-popup .leaflet-popup-tip {
  background: #fff;
  box-shadow: 0 2px 8px rgba(6, 78, 59, 0.12);
}

.jdm-map-card {
  position: relative;
  width: max-content;
  max-width: min(620px, 94vw);
  font-family: inherit;
}

/* ستون اصلی کارت کسب‌وکار */
.jdm-map-card:not(.has-tips) {
  width: 240px;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.jdm-map-card__detail {
  box-sizing: border-box;
  width: 240px;
  height: 260px;
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(6, 78, 59, 0.2);
  overflow: hidden;
}

.jdm-map-card.has-tips {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.jdm-map-card.has-tips .jdm-map-card__detail {
  align-self: center;
}

.jdm-map-card.has-tips .jdm-map-card__tips {
  flex: 0 0 296px;
  align-self: center;
}

.jdm-map-card__banner {
  display: block;
  flex: 0 0 110px;
  width: 100%;
  height: 110px;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
}

.jdm-map-card__banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.jdm-map-card__banner--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.jdm-map-card__banner-ph {
  width: 2rem;
  height: 2rem;
  border-radius: 50% 50% 50% 0;
  background: var(--color-jdm-primary, #059669);
  transform: rotate(-45deg);
  opacity: 0.7;
}

.jdm-map-card__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.75rem 0.875rem 0.875rem;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.jdm-map-card__title {
  margin: 0 0 0.35rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #064e3b;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.jdm-map-card__stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: #047857;
}

.jdm-map-card__count {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--color-jdm-accent, #d97706);
}

.jdm-map-card__link {
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 700;
  color: #059669;
  text-decoration: none;
}

.jdm-map-card__link:hover {
  text-decoration: underline;
}

/* ستون نظرات — دو باکس هم‌عرض (عرض دوبرابر) زیر هم؛ ارتفاع مطابق متن کامل */
.jdm-map-card__tips {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 296px;
}

.jdm-map-card__tip {
  box-sizing: border-box;
  width: 296px;
  min-height: 148px;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.75rem 0.7rem 0.8rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--color-jdm-border, #a7f3d0);
  box-shadow: 0 10px 28px rgba(6, 78, 59, 0.14);
  overflow: visible;
  animation: jdm-tip-in 0.35s ease both;
}

.jdm-map-card__tip--2 {
  animation-delay: 0.1s;
}

.jdm-map-card__tip-avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.4rem;
  background: linear-gradient(145deg, #059669, #10b981);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
  border: 2px solid #fff;
}

.jdm-map-card__tip-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.jdm-map-card__tip-avatar-fallback {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.jdm-map-card__tip-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.jdm-map-card__tip-name {
  display: block;
  width: 100%;
  margin: 0 0 0.15rem;
  font-weight: 700;
  color: #064e3b;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jdm-map-card__tip-stars {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.625rem;
  letter-spacing: 0.05em;
  color: var(--color-jdm-accent, #d97706);
  line-height: 1;
}

.jdm-map-card__tip-text {
  margin: 0;
  flex: 0 0 auto;
  width: 100%;
  font-size: 0.75rem;
  line-height: 1.55;
  color: #475569;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  text-align: center;
}

@keyframes jdm-tip-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 900px) {
  .jdm-map-card.has-tips {
    flex-direction: column;
    align-items: center;
    width: min(296px, 78vw);
    gap: 0.55rem;
  }

  .jdm-map-card.has-tips .jdm-map-card__detail {
    width: 100%;
    max-width: 296px;
    height: 260px;
    flex: 0 0 auto;
  }

  .jdm-map-card.has-tips .jdm-map-card__tips {
    width: 100%;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
  }

  .jdm-map-card__tip {
    width: 100%;
    max-width: 296px;
    height: auto;
    min-height: 0;
  }

  .leaflet-popup.jdm-leaflet-popup .leaflet-popup-content {
    width: auto !important;
  }
}

.leaflet-container {
  font-family: inherit;
  background: #d1fae5;
}

@media (max-width: 900px) {
  .jdm-mapapp {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    position: relative;
  }

  .jdm-mapapp__sidebar,
  .jdm-mapapp__map-wrap {
    grid-column: 1;
    grid-row: 1;
  }

  .jdm-mapapp__sidebar {
    border-inline-end: 0;
    z-index: 3;
  }

  .jdm-mapapp.is-map-view .jdm-mapapp__sidebar {
    visibility: hidden;
    pointer-events: none;
  }

  .jdm-mapapp:not(.is-map-view) .jdm-mapapp__map-wrap {
    visibility: hidden;
    pointer-events: none;
  }

  .jdm-mapapp.is-map-view .jdm-mapapp__map-wrap {
    visibility: visible;
    pointer-events: auto;
    z-index: 4;
  }

  .jdm-mapapp__mobile-tabs {
    display: flex;
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 28px rgba(6, 78, 59, 0.15);
    border: 1px solid var(--color-jdm-border, #a7f3d0);
  }

  .jdm-mapapp__tab {
    cursor: pointer;
    border: 0;
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-jdm-muted-text, #047857);
  }

  .jdm-mapapp__tab.is-active {
    background: var(--color-jdm-primary, #059669);
    color: #fff;
  }

  .jdm-mapapp__search-area {
    top: auto;
    bottom: 4.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jdm-mapapp__item,
  .jdm-mapapp__input,
  .jdm-mapapp__search-area,
  .jdm-map-pin,
  .jdm-map-card__tip {
    transition: none;
    animation: none;
  }
}
