/* ===============================
   Otoemdad — صفحهٔ تمام‌صفحه map (نقشه فنی‌کاران)
   =============================== */

html,
body.map-page-body {
  height: 100%;
  margin: 0;
}

body.map-page-body {
  overflow: hidden;
}

.map-main {
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.map-board {
  position: relative;
  height: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #e8edf3;
  box-shadow: none;
}

.map-board__map-wrap {
  position: absolute;
  inset: 0;
  background: #e8edf3;
}

.map-board__map {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.map-board__map .leaflet-container {
  width: 100%;
  height: 100%;
  font-family: var(--oto-font-sans);
}

.map-board__map-controls {
  position: absolute;
  z-index: 500;
  bottom: 1.25rem;
  left: 1.25rem;
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
}

.map-board__zoom {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.map-board__zoom-btn,
.map-board__locate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 0;
  background: #fff;
  color: var(--oto-secondary);
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.map-board__zoom-btn + .map-board__zoom-btn {
  border-top: 1px solid #ededed;
}

.map-board__locate-btn {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.map-board__zoom-btn:hover,
.map-board__locate-btn:hover {
  background: rgba(247, 147, 30, 0.08);
  color: var(--oto-primary);
}

.map-board__zoom-btn:focus-visible,
.map-board__locate-btn:focus-visible {
  outline: 2px solid var(--oto-secondary);
  outline-offset: 2px;
}

/* سایدبار — فیگما node 609:5 (عرض ۴۲۰px) */
.map-board__sidebar {
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  z-index: 600;
  display: flex;
  align-items: stretch;
  height: 100%;
  pointer-events: none;
}

.map-board__sidebar > * {
  pointer-events: auto;
}

.map-board__sidebar-panel {
  display: flex;
  flex-direction: column;
  width: 420px;
  max-width: 100vw;
  height: 100%;
  padding: 1rem 1rem 1.15rem;
  border-inline-start: 1px solid #ededed;
  background: #fff;
  box-shadow: -8px 0 32px rgba(11, 60, 93, 0.1);
  transition:
    transform 0.28s ease,
    opacity 0.28s ease,
    visibility 0.28s ease;
}

.map-board--sidebar-collapsed .map-board__sidebar-panel {
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.map-board__sidebar-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.map-board__controls {
  display: grid;
  align-items: stretch;
  gap: 0.5rem;
  grid-template-columns: 42px 1fr;
  grid-template-areas:
    "home search"
    "menu category";
}

.map-board__menu-btn {
  grid-area: menu;
}

.map-board__home-btn {
  grid-area: home;
}

.map-board__search {
  grid-area: search;
  margin: 0;
  min-width: 0;
}

.map-board__search-field {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  min-height: 42px;
  padding: 0 0.75rem;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #fff;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.map-board__search-field:focus-within {
  border-color: var(--oto-primary);
  box-shadow: 0 0 0 3px var(--oto-focus-ring);
}

.map-board__search-icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
  color: #9ca3af;
}

.map-board__search-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0;
  border: 0;
  background: transparent;
  color: var(--oto-text);
  font-family: inherit;
  font-size: 0.84rem;
  line-height: 1.4;
}

.map-board__search-input::placeholder {
  color: #9ca3af;
}

.map-board__search-input:focus {
  outline: none;
}

.map-board__icon-btn {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.map-board__icon-btn:focus-visible {
  outline: 2px solid var(--oto-secondary);
  outline-offset: 2px;
}

.map-board__home-btn {
  border: 0;
  background: var(--oto-secondary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(11, 60, 93, 0.22);
  text-decoration: none;
}

.map-board__home-btn .bi {
  font-size: 1.15rem;
  line-height: 1;
}

.map-board__home-btn:hover {
  background: #0a3350;
  color: #fff;
}

.map-board__menu-btn .bi {
  font-size: 1.35rem;
  line-height: 1;
}

.map-board__menu-btn:hover {
  border-color: rgba(247, 147, 30, 0.45);
  color: var(--oto-primary);
}

.map-board__category-select {
  grid-area: category;
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 0.45rem 0.65rem 0.45rem 2rem;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background-color: #fff;
  background-position: left 0.65rem center;
  color: #9ca3af;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.35;
}

.map-board__category-select:focus {
  border-color: var(--oto-primary);
  box-shadow: 0 0 0 3px var(--oto-focus-ring);
  color: var(--oto-secondary);
}

.map-board__category-select option {
  color: var(--oto-secondary);
}

.map-board__sidebar-fab {
  position: absolute;
  top: 1rem;
  inset-inline-start: 1rem;
  z-index: 601;
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #fff;
  color: #6b7280;
  box-shadow: 0 2px 10px rgba(11, 60, 93, 0.12);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    color 0.2s ease,
    background-color 0.2s ease;
}

.map-board__sidebar-fab .bi {
  font-size: 1.35rem;
  line-height: 1;
}

.map-board__sidebar-fab:hover {
  border-color: rgba(247, 147, 30, 0.45);
  color: var(--oto-primary);
}

.map-board--sidebar-collapsed .map-board__sidebar-fab {
  display: inline-flex;
}

.map-board__sidebar-head {
  margin-bottom: 0.85rem;
}

.map-board__sidebar-title {
  margin: 0 0 0.35rem;
  color: var(--oto-secondary);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}

.map-board__sidebar-lead {
  margin: 0;
  color: #888;
  font-size: 0.82rem;
  line-height: 1.65;
}

.map-board__list-messages {
  flex-shrink: 0;
}

.map-board__cards-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-inline-end: 0.15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(247, 147, 30, 0.45) transparent;
}

.map-board__cards {
  margin-inline: 0;
  max-width: 100%;
}

.map-board__cards > .col {
  min-width: 0;
}

.map-board__cards-scroll::-webkit-scrollbar {
  width: 5px;
}

.map-board__cards-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(247, 147, 30, 0.45);
}

/* کارت فنی‌کار — مشترک (JS + حالت فعال) */
.map-tech-card {
  cursor: pointer;
}

.map-tech-card--mobile {
  display: none;
}

.map-tech-card--desktop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  height: 100%;
  padding: 1rem 0.85rem 0.9rem;
  border: 1px solid #e8e8e8;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.map-tech-card--desktop:hover,
.map-tech-card--desktop:focus-visible {
  border-color: rgba(247, 147, 30, 0.55);
}

.map-tech-card--desktop.map-tech-card--active {
  border: 2px solid var(--oto-primary);
  padding: calc(1rem - 1px) calc(0.85rem - 1px) calc(0.9rem - 1px);
  box-shadow: none;
}

.map-tech-card--desktop:focus-visible {
  outline: 2px solid var(--oto-secondary);
  outline-offset: 2px;
}

.map-tech-card-d__avatar {
  position: relative;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 2px solid var(--oto-primary);
  border-radius: 50%;
  background: linear-gradient(135deg, #ff8904 0%, #f54900 100%);
  box-shadow: 0 2px 10px rgba(247, 147, 30, 0.35);
}

.map-tech-card-d__avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-tech-card-d__avatar-initials {
  display: none;
}

.map-tech-card-d__avatar-dot {
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
}

.map-tech-card-d__avatar-dot--ready {
  background: #22c55e;
}

.map-tech-card-d__avatar-dot--busy {
  background: #9ca3af;
}

.map-tech-card-d__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
}

.map-tech-card-d__header {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
}

.map-tech-card-d__name {
  margin: 0;
  color: #1e2939;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.map-tech-card-d__rating {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 2px 8px;
  border-radius: 8px;
  background: #fefce8;
  color: #1e2939;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.35;
}

.map-tech-card-d__rating .bi-star-fill {
  font-size: 0.78rem;
  color: #fbbf24;
}

.map-tech-card-d__reviews {
  display: none;
}

.map-tech-card-d__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
}

.map-tech-card-d__specialty {
  color: #4b5563;
  overflow-wrap: anywhere;
}

.map-tech-card-d__distance {
  display: none;
}

.map-tech-card-d__area {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #6a7282;
  font-size: 0.75rem;
}

.map-tech-card-d__area .bi {
  font-size: 0.78rem;
  color: #6a7282;
}

.map-tech-card-d__cta {
  display: block;
  width: 100%;
  margin-top: 0.1rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--oto-primary);
  border-radius: 999px;
  background: #fff;
  color: var(--oto-primary);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.map-tech-card-d__cta.btn-tech-outline {
  border-width: 2px;
  border-radius: 999px;
}

.oto-map-marker {
  display: block;
  width: 34px;
  height: 34px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--oto-primary);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(247, 147, 30, 0.45);
}

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

.oto-map-marker--muted {
  background: #6b7280;
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.35);
}

.oto-map-marker--active {
  transform: scale(1.12);
  box-shadow: 0 6px 16px rgba(247, 147, 30, 0.55);
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  font-family: var(--oto-font-sans);
}

.leaflet-popup-content {
  margin: 0.65rem 0.85rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* دراور پروفایل روی نقشه */
.map-profile-drawer {
  position: absolute;
  inset: 0;
  z-index: 500;
  pointer-events: none;
}

.map-profile-drawer--open {
  pointer-events: auto;
}

.map-profile-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.map-profile-drawer--open .map-profile-drawer__backdrop {
  opacity: 1;
}

.map-profile-drawer__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 0 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  transform: translate3d(0, 100%, 0);
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.map-profile-drawer--open .map-profile-drawer__panel {
  transform: translate3d(0, 0, 0);
  pointer-events: auto;
}

.map-tech-card--drawer {
  position: relative;
  width: 100%;
  max-width: 22rem;
  margin: 0;
  padding: 2.5rem 0.85rem 0.9rem;
  cursor: default;
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.14);
  pointer-events: auto;
}

.map-profile-drawer__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}

.map-profile-drawer__close {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #e8e8e8;
  border-radius: 50%;
  background: #fff;
  color: #4b5563;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.1);
  cursor: pointer;
}

.map-profile-drawer__close:hover,
.map-profile-drawer__close:focus-visible {
  background: #f8fafc;
  color: #1e2939;
}

.map-profile-drawer__close:focus-visible {
  outline: 2px solid var(--oto-secondary);
  outline-offset: 2px;
}

.map-tech-card--drawer .map-tech-card-d__cta {
  pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
  .map-tech-card--desktop:hover {
    box-shadow: 0 4px 14px rgba(11, 60, 93, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-tech-card,
  .map-board__search-field,
  .map-board__zoom-btn,
  .map-board__locate-btn,
  .map-board__sidebar-panel,
  .map-profile-drawer__panel,
  .map-profile-drawer__backdrop {
    transition-duration: 0.01ms !important;
  }
}
