/**
 * Representative Map – Frontend styles
 */

.rm-map {
  --rm-primary: #0f766e;
  --rm-primary-hover: #0d9488;
  --rm-primary-soft: color-mix(in srgb, var(--rm-primary) 12%, transparent);
  --rm-border: #e8ecf1;
  --rm-text: inherit;
  --rm-muted: #64748b;
  --rm-background: #f4f7fa;
  --rm-surface: #ffffff;
  --rm-province: #dbe4ee;
  --rm-province-stroke: #94a3b8;
  --rm-province-hover: #9ec5c1;
  --rm-province-active: var(--rm-primary);
  --rm-province-disabled: #eef1f4;
  --rm-radius: 16px;
  --rm-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);

  direction: rtl;
  font-family: inherit;
  color: inherit;
  line-height: 1.7;
  max-width: 1200px;
  margin: 0 auto;
}

.rm-map *,
.rm-map *::before,
.rm-map *::after {
  box-sizing: border-box;
}

.rm-map__header {
  margin-bottom: 1.35rem;
}

.rm-map__title {
  margin: 0 0 0.35rem;
  font-family: inherit;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  color: inherit;
}

.rm-map__desc {
  margin: 0;
  color: var(--rm-muted);
  font-size: 0.95rem;
  font-family: inherit;
}

.rm-map__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1.25rem;
  align-items: start;
}

.rm-map__canvas,
.rm-map__panel {
  min-width: 0;
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius);
  box-shadow: var(--rm-shadow);
}

.rm-map__canvas {
  padding: 1rem;
  position: relative;
  background:
    radial-gradient(circle at 18% 12%, var(--rm-primary-soft), transparent 42%),
    var(--rm-surface);
}

.rm-map__svg-wrap {
  position: relative;
  width: 100%;
}

.rm-map__markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.rm-marker {
  position: absolute;
  pointer-events: auto;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.25));
  transition: transform 0.18s ease, filter 0.18s ease;
  z-index: 4;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}

.rm-marker img,
.rm-marker__icon {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
}

.rm-marker__icon {
  background-color: var(--rm-icon-color, #0f766e);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.rm-marker:hover,
.rm-marker.is-active {
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.35));
  z-index: 5;
}

.rm-marker:focus,
.rm-marker:focus-visible {
  outline: none !important;
}

.rm-iran-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  outline: none !important;
}

.rm-iran-svg:focus,
.rm-iran-svg:focus-visible {
  outline: none !important;
}

.rm-seas {
  color: #cfe8f5;
  opacity: 0.85;
  pointer-events: none;
}

.rm-province {
  fill: var(--rm-province);
  stroke: var(--rm-province-stroke);
  stroke-width: 1;
  cursor: pointer;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
  transition: fill 0.2s ease, stroke 0.2s ease, opacity 0.2s ease;
}

.rm-province:focus,
.rm-province:focus-visible,
.rm-province:active,
.rm-province:-moz-focusring {
  outline: none !important;
  stroke: var(--rm-province-stroke) !important;
}

.rm-province:hover,
.rm-province.is-hover {
  fill: var(--rm-province-hover);
}

.rm-province.is-active {
  fill: var(--rm-province-active);
  stroke: var(--rm-province-stroke);
  stroke-width: 1;
  outline: none !important;
}

.rm-province.is-disabled {
  fill: var(--rm-province-disabled);
  stroke: #cbd5e1;
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: none;
}

.rm-province.is-hidden {
  display: none;
}

.rm-province.is-empty {
  fill: #edf2f7;
}

.rm-map__tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.rm-map__tooltip.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Panel */
.rm-map__panel {
  padding: 0;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rm-map__panel-head {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.15rem 1rem;
  background: linear-gradient(180deg, #fafbfc 0%, var(--rm-surface) 100%);
  border-bottom: 1px solid var(--rm-border);
}

.rm-map__province-select-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rm-map__province-select,
.rm-map__search-input {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid var(--rm-border);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  font: inherit;
  font-family: inherit;
  font-size: 0.9375rem;
  color: inherit;
  background: var(--rm-surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.rm-map__province-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.9rem center;
  padding-left: 2.2rem;
  cursor: pointer;
}

.rm-map__search {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.rm-map__search-input {
  background-color: var(--rm-background);
}

.rm-map__province-select:focus,
.rm-map__search-input:focus {
  outline: none;
  border-color: var(--rm-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rm-primary) 18%, transparent);
}

.rm-map__search-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.rm-map__selection {
  padding: 0.15rem 0.1rem 0;
}

.rm-map__province-name {
  margin: 0;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: inherit;
  line-height: 1.45;
}

.rm-map__province-count {
  display: inline-flex;
  align-items: center;
  margin: 0.45rem 0 0;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rm-primary) 12%, #fff);
  color: var(--rm-primary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
}

.rm-map__list {
  flex: 1;
  display: grid;
  gap: 0.75rem;
  align-content: start;
  max-height: 560px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1rem 1.15rem 1.15rem;
  min-width: 0;
}

.rm-map__placeholder,
.rm-map__empty,
.rm-map__loading,
.rm-map__error {
  margin: 0;
  color: var(--rm-muted);
  font-family: inherit;
  font-size: 0.92rem;
  padding: 1.25rem 0.25rem;
  text-align: center;
}

.rm-map__list.is-loading {
  opacity: 0.7;
}

.rm-card {
  border: 1px solid var(--rm-border);
  border-radius: 14px;
  background: var(--rm-surface);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  animation: rm-fade-up 0.28s ease both;
}

.rm-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--rm-primary) 30%, var(--rm-border));
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.07);
}

.rm-card__body {
  padding: 0.95rem 1rem 0.75rem;
}

.rm-card__title {
  margin: 0;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: inherit;
}

.rm-card__city {
  margin: 0.2rem 0 0.7rem;
  color: var(--rm-muted);
  font-family: inherit;
  font-size: 0.88rem;
}

.rm-card__meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.rm-card__meta-item {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  font-family: inherit;
  font-size: 0.86rem;
  color: inherit;
  word-break: break-word;
}

.rm-card__meta-item a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}

.rm-card__meta-item a:hover {
  color: var(--rm-primary);
  border-bottom-color: currentColor;
}

.rm-card__icon {
  color: var(--rm-primary);
  flex: 0 0 auto;
  margin-top: 0.15rem;
  line-height: 1;
}

.rm-card__footer {
  border-top: 1px solid var(--rm-border);
  padding: 0.7rem 1rem;
  background: var(--rm-background);
}

.rm-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--rm-primary);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}

.rm-card__link:hover {
  color: var(--rm-primary-hover);
}

@keyframes rm-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .rm-map__layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .rm-map__panel {
    min-height: 0;
  }

  .rm-map__list {
    max-height: none;
  }
}
