:root {
  --ink: #15202b;
  --muted: #5c6b7a;
  --paper: rgba(248, 251, 253, 0.94);
  --line: rgba(21, 32, 43, 0.1);
  --accent: #0b6b63;
  --accent-soft: #d8efec;
  --shadow: 0 12px 32px rgba(21, 32, 43, 0.14);
  --font: "IRANSans", "Tahoma", sans-serif;
  --radius: 4px;
}

@font-face {
  font-family: "IRANSans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/IRANSans.woff2") format("woff2"),
    url("/assets/fonts/IRANSans.ttf") format("truetype");
}

@font-face {
  font-family: "IRANSans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/IRANSans-Bold.woff2") format("woff2"),
    url("/assets/fonts/IRANSans-Bold.ttf") format("truetype");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: #d9e3ec;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
}

.brand-bar {
  position: absolute;
  z-index: 1100;
  top: 14px;
  right: 14px;
  left: auto;
  width: min(360px, calc(100% - 28px));
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  pointer-events: none;
  animation: rise-in 0.55s ease both;
}

.brand {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  line-height: 1.15;
}

.hint {
  margin: 6px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  cursor: crosshair;
}

/* پنل پایین-چپ تا دکمه موقعیت پایین-راست دیده شود */
.pin-panel {
  position: absolute;
  z-index: 1100;
  bottom: 16px;
  left: 16px;
  right: auto;
  width: min(520px, calc(100% - 88px));
  padding: 14px 14px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise-in 0.65s ease 0.08s both;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.panel-state {
  font-size: 0.8rem;
  color: var(--muted);
}

.coord-field,
.link-field {
  display: block;
  margin: 0;
}

.link-field {
  margin-top: 10px;
}

.coord-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.coord-control {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.coord-control input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  font-size: 0.88rem;
  direction: ltr;
  text-align: left;
}

.coord-control input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.copy-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.copy-btn .icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.copy-btn:hover:not(:disabled) {
  background: #095750;
}

.copy-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.copy-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.copy-btn.is-copied {
  background: #1f7a3a;
  border-color: #1f7a3a;
}

.locate-btn {
  position: absolute;
  z-index: 1200;
  right: 16px;
  bottom: 16px;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
  animation: rise-in 0.65s ease 0.12s both;
}

.locate-btn .icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.locate-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  color: #095750;
}

.locate-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.locate-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.locate-btn.is-loading .icon {
  animation: spin 0.9s linear infinite;
}

.toast {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--accent);
  min-height: 1.2em;
}

.my-location-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #1a73e8;
  border: 2px solid #fff;
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.25);
  pointer-events: none;
}

.maplibregl-map {
  font-family: var(--font);
}

.maplibregl-ctrl-attrib {
  font-size: 10px;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .brand-bar {
    top: 8px;
    right: 8px;
    left: 8px;
    width: auto;
    padding: 12px 14px;
  }

  .pin-panel {
    bottom: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    padding: 12px;
  }

  .locate-btn {
    right: 14px;
    bottom: 220px;
  }

  .hint {
    font-size: 0.8rem;
  }
}

@media (min-width: 900px) {
  .pin-panel {
    bottom: 24px;
    left: 24px;
    width: min(520px, calc(100% - 100px));
  }

  .brand-bar {
    top: 24px;
    right: 24px;
  }

  .locate-btn {
    right: 24px;
    bottom: 24px;
  }
}
