/* ============================================================
   JT MAP (update 46)
   Company location maps and the Near me page. Loaded only on pages
   that draw a map, after Leaflet's own stylesheet.
   ============================================================ */

.jtm-map {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-inset);
  isolation: isolate;
}
.jtm-map .leaflet-tile-pane { filter: saturate(.82) contrast(.98); }
[data-theme="dark"] .jtm-map .leaflet-tile-pane { filter: invert(.92) hue-rotate(180deg) saturate(.55) brightness(.92); }
.jtm-map .leaflet-control-attribution { font-size: .62rem; background: var(--bg-card); color: var(--text-tertiary); opacity: .85; }
.jtm-map .leaflet-control-attribution a { color: var(--text-secondary); }
.jtm-map .leaflet-bar a { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-subtle); width: 34px; height: 34px; line-height: 34px; }
.jtm-map .leaflet-bar { border: 1px solid var(--border-default); box-shadow: var(--shadow-sm); border-radius: 10px; overflow: hidden; }

/* ---------- Pins: dropped in one after the other ---------- */
.jtm-pin-wrap { background: none; border: 0; }
.jtm-pin {
  position: relative; width: 40px; height: 48px;
  animation: jtm-drop .62s cubic-bezier(.22,1.4,.36,1) both;
  transform-origin: 50% 100%;
  cursor: pointer;
}
.jtm-pin__head {
  position: absolute; left: 2px; top: 0; width: 36px; height: 36px;
  border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: var(--text-primary);
  box-shadow: 0 6px 14px rgba(0,0,0,.28);
  transition: transform .2s var(--ease-out, ease), background .2s ease;
}
.jtm-pin__face {
  position: absolute; left: 6px; top: 4px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-card); color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem; overflow: hidden;
}
.jtm-pin__face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jtm-pin__shadow {
  position: absolute; left: 13px; bottom: 0; width: 14px; height: 5px; border-radius: 50%;
  background: rgba(0,0,0,.25); filter: blur(1px);
  animation: jtm-shadow .62s ease both;
}
.jtm-pin.is-active .jtm-pin__head { background: var(--brand); transform: rotate(-45deg) scale(1.12); }
@keyframes jtm-drop {
  0%   { opacity: 0; transform: translateY(-46px) scale(.7); }
  60%  { opacity: 1; transform: translateY(3px) scale(1.04, .94); }
  100% { opacity: 1; transform: none; }
}
@keyframes jtm-shadow { 0% { opacity: 0; transform: scale(.3); } 100% { opacity: 1; transform: none; } }

/* ---------- You are here: a dot with a soft ring ---------- */
.jtm-you-wrap { background: none; border: 0; }
.jtm-you { position: relative; width: 22px; height: 22px; }
.jtm-you__dot {
  position: absolute; inset: 4px; border-radius: 50%;
  background: var(--brand); border: 3px solid var(--bg-card);
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.jtm-you__ring {
  position: absolute; inset: -14px; border-radius: 50%;
  background: var(--brand); opacity: .22;
  animation: jtm-ring 2.2s ease-out infinite;
}
@keyframes jtm-ring { 0% { transform: scale(.35); opacity: .45; } 100% { transform: scale(1.6); opacity: 0; } }

/* The straight line between the visitor and the company, drawn on. */
.jtm-line { stroke-dasharray: 6 9; animation: jtm-dash 1.2s linear infinite; }
@keyframes jtm-dash { to { stroke-dashoffset: -30; } }

/* Locating: a radar sweep over the map while the phone looks for a fix. */
.jtm-radar {
  position: absolute; inset: 0; z-index: 500; pointer-events: none;
  display: none; align-items: center; justify-content: center;
}
.jtm-radar.is-on { display: flex; }
.jtm-radar__ring {
  position: absolute; width: 60px; height: 60px; border-radius: 50%;
  border: 2px solid var(--brand); opacity: 0;
  animation: jtm-radar 1.8s ease-out infinite;
}
.jtm-radar__ring:nth-child(2) { animation-delay: .6s; }
.jtm-radar__ring:nth-child(3) { animation-delay: 1.2s; }
.jtm-radar__label {
  position: relative; background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-default); border-radius: 999px;
  padding: 8px 14px; font-size: .8rem; font-weight: 600; box-shadow: var(--shadow-md);
}
@keyframes jtm-radar { 0% { transform: scale(.4); opacity: .8; } 100% { transform: scale(5); opacity: 0; } }

/* Popups */
.jtm-map .leaflet-popup-content-wrapper { border-radius: 14px; background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-lg); }
.jtm-map .leaflet-popup-tip { background: var(--bg-card); }
.jtm-map .leaflet-popup-content { margin: 12px 14px; font-size: .84rem; line-height: 1.45; min-width: 190px; }
.jtm-pop__n { font-weight: 700; font-size: .92rem; }
.jtm-pop__s { color: var(--text-tertiary); font-size: .76rem; margin-top: 2px; }
.jtm-pop__a { display: flex; gap: 6px; margin-top: 10px; }

/* ---------- Buttons ---------- */
.jtm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 14px; border-radius: 10px;
  font-size: .82rem; font-weight: 700; line-height: 1; white-space: nowrap;
  border: 1px solid var(--border-default); background: var(--bg-card); color: var(--text-primary);
  cursor: pointer; text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.jtm-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.jtm-btn:active { transform: scale(.97); }
.jtm-btn--main { background: var(--text-primary); color: var(--bg-card); border-color: var(--text-primary); }
.jtm-btn--main:hover { background: var(--accent-hover, var(--text-secondary)); color: var(--bg-card); }
.jtm-btn--sm { min-height: 34px; padding: 0 11px; font-size: .76rem; border-radius: 9px; }
.jtm-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.jtm-popup .jtm-btn { color: var(--text-primary); }
.jtm-popup .jtm-btn--main { color: var(--bg-card); }

.jtm-dist {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600;
  color: var(--text-secondary); min-height: 20px;
}
.jtm-dist:empty { display: none; }
.jtm-dist b { color: var(--text-primary); }

/* ---------- Chooser sheet: Apple Maps or Google Maps on iPhone ---------- */
.jtm-sheet-ov {
  position: fixed; inset: 0; z-index: 10050; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: jtm-fade .18s ease both;
}
.jtm-sheet {
  width: 100%; max-width: 420px; background: var(--bg-card); color: var(--text-primary);
  border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  animation: jtm-up .28s cubic-bezier(.22,1,.36,1) both;
}
@media (min-width: 640px) { .jtm-sheet-ov { align-items: center; } .jtm-sheet { border-radius: 20px; } }
.jtm-sheet__t { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.jtm-sheet__s { font-size: .8rem; color: var(--text-tertiary); margin-bottom: 14px; }
.jtm-sheet__o {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px;
  border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface);
  color: var(--text-primary); font-weight: 600; font-size: .9rem; text-decoration: none; margin-bottom: 8px;
}
.jtm-sheet__o:hover { background: var(--bg-hover); color: var(--text-primary); }
.jtm-sheet__x { width: 100%; min-height: 46px; border: 0; background: none; color: var(--text-secondary); font-weight: 600; font-size: .88rem; cursor: pointer; }
@keyframes jtm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes jtm-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .jtm-pin, .jtm-pin__shadow, .jtm-you__ring, .jtm-line, .jtm-radar__ring, .jtm-sheet, .jtm-sheet-ov { animation: none !important; }
}
