:root {
  --navy: #0b1f3a;
  --navy-2: #12325c;
  --gold: #f5b301;
  --bg: #f4f6f9;
  --live: #2ecc71;
  --stale: #e67e22;
  --wait: #95a5a6;
  --page-bg: #ffffff; /* matches xtego.com light --bg-primary */
}
/* Theme synced from the parent site; map background is transparent so this shows through */
[data-theme="dark"] { --page-bg: #000000; } /* matches xtego.com dark --bg-primary */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* ---------- Viewer ---------- */
body.viewer { display: flex; flex-direction: column; height: 100%; background: var(--page-bg); overscroll-behavior: none; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--navy); color: #fff;
}
.brand { font-weight: 700; letter-spacing: .2px; }
.status { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--wait); }
.dot-live { background: var(--live); box-shadow: 0 0 0 0 rgba(46,204,113,.6); animation: pulse 1.6s infinite; }
.dot-stale { background: var(--stale); }
.dot-wait { background: var(--wait); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(46,204,113,0); } 100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); } }

.map-wrap { position: relative; flex: 1 1 auto; min-height: 320px; display: flex; background: var(--page-bg); }
#map { flex: 1 1 auto; min-height: 320px; background: var(--page-bg); }

/* Floating proximity pill + locate button */
.distance-badge { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 500;
  background: var(--navy); color: #fff; font-size: 14px; font-weight: 700; padding: 7px 14px; border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.locate-btn { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 500;
  background: var(--gold); color: var(--navy); font-size: 15px; font-weight: 700; border: 0; padding: 12px 20px;
  border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.25); cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* Bottom bar (status + Xtego Creative branding) — replaces the top header in-iframe */
.botbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--navy); color: #fff; padding: 9px 12px;
  padding-bottom: calc(9px + env(safe-area-inset-bottom, 0px)); }
.botbar .status { font-size: 13px; }

.request { background: #fff; padding: 18px 16px; border-top: 3px solid var(--gold); }
.request h2 { margin: 0 0 4px; color: var(--navy); font-size: 18px; }
.request p { margin: 0 0 12px; color: #555; font-size: 14px; }

/* Cart marker (XC mark + tagline) */
.cart-marker, .user-marker { position: relative; }
.cart-xc { position: absolute; width: 40px; height: 40px; transform: translate(-50%, -50%); z-index: 2;
  background: #fff; padding: 4px; border-radius: 11px; box-shadow: 0 2px 5px rgba(0,0,0,.3); }
.cart-pulse { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: rgba(245,140,1,.45);
  transform: translate(-50%, -50%); animation: ring 1.8s infinite; }
@keyframes ring { 0% { width:22px; height:22px; opacity:.7; } 100% { width:80px; height:80px; opacity:0; } }
.cart-label { position: absolute; transform: translate(-50%, 28px); white-space: nowrap; background: var(--navy);
  color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 10px; z-index: 3; }

/* User ("You") marker */
.user-dot { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #2d8cff;
  border: 3px solid #fff; transform: translate(-50%, -50%); z-index: 2; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.user-ring { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: rgba(45,140,255,.35);
  transform: translate(-50%, -50%); animation: ring 2.4s infinite; }
.user-label { position: absolute; transform: translate(-50%, -170%); white-space: nowrap; background: var(--navy);
  color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 10px; }

/* ---------- Cart broadcaster ---------- */
body.cart { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; padding: 20px; }
.cart-shell { width: 100%; max-width: 420px; }
.brand-lg { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 18px; }
.card { background: #fff; color: #14233b; border-radius: 16px; padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.card h2 { margin: 0 0 6px; }
.card p { margin: 0 0 14px; color: #5a6a82; font-size: 14px; }
input[type=tel], input[type=text] { width: 100%; padding: 14px; font-size: 18px; border: 2px solid #d7deea;
  border-radius: 10px; margin-bottom: 12px; }
.btn { width: 100%; padding: 14px; font-size: 16px; font-weight: 700; color: var(--navy); background: var(--gold);
  border: 0; border-radius: 10px; cursor: pointer; }
.btn.big { padding: 18px; font-size: 18px; margin-bottom: 16px; }
.btn.on { background: #e74c3c; color: #fff; }
.err { color: #e74c3c; font-size: 14px; min-height: 18px; margin-top: 8px; }
.readout { list-style: none; margin: 0 0 12px; padding: 0; }
.readout li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eef1f6; font-size: 14px; }
.readout span { color: #7a8aa3; }
.sim { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #5a6a82; }
.hint { margin-top: 14px; font-size: 13px; color: #7a8aa3; }

/* ---------- Calibration ---------- */
body.calibrate { display: flex; flex-direction: column; height: 100%; background: var(--bg); }
.cal-toolbar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: #fff; border-bottom: 1px solid #e3e8ef; flex-wrap: wrap; }
.cal-toolbar select { flex: 1 1 120px; padding: 8px; border: 1px solid #cfd8e3; border-radius: 8px; font-size: 14px; }
.upload-btn, .seg-btn { padding: 8px 12px; border: 1px solid #cfd8e3; border-radius: 8px; background: #fff; font-size: 14px; cursor: pointer; color: var(--navy); }
.seg { display: flex; gap: 0; }
.seg .seg-btn { border-radius: 0; }
.seg .seg-btn:first-child { border-radius: 8px 0 0 8px; }
.seg .seg-btn:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.seg-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
#export { background: var(--gold); border-color: var(--gold); font-weight: 700; }

.cal-panel { background: #fff; border-top: 1px solid #e3e8ef; padding: 12px 14px; max-height: 42vh; overflow-y: auto; }
.cal-instructions { margin: 0 0 10px; font-size: 14px; color: #44546a; }
.cal-fit { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: #7a8aa3; margin-bottom: 8px; }
.cal-fit strong { color: var(--navy); }
.gcp-list { list-style: none; margin: 0; padding: 0; }
.gcp-list li { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 6px 0; border-bottom: 1px solid #f0f3f7; }
.gcp-list .del { border: 0; background: none; color: #c0392b; font-size: 16px; cursor: pointer; padding: 0 6px; }
.link-btn { border: 0; background: none; color: #c0392b; font-size: 13px; cursor: pointer; padding: 8px 0 0; }
.export-box { width: 100%; height: 160px; margin-top: 10px; font-family: monospace; font-size: 12px; border: 1px solid #cfd8e3; border-radius: 8px; padding: 8px; }

.gcp-pin .gcp-num { width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; border: 2px solid var(--gold); }

/* Add-point modal */
.cal-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(11,31,58,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.cal-modal[hidden] { display: none; }
.cal-modal-card { background: #fff; color: #14233b; width: 100%; max-width: 380px; border-radius: 16px;
  padding: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.cal-modal-card h3 { margin: 0 0 6px; }
.cal-modal-card p { margin: 0 0 14px; font-size: 14px; color: #5a6a82; }
.m-coord { width: 100%; padding: 12px; font-size: 16px; border: 2px solid #d7deea; border-radius: 10px; margin-bottom: 12px; }
.seg-btn.wide { width: 100%; padding: 12px; margin-top: 2px; }
.cal-modal-card .btn { margin-bottom: 8px; }
.cal-modal-card .link-btn { display: block; margin: 6px auto 0; }
