/* ============================================================
   Trakr Site Plan Creator — Styles
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #214b62;
  --primary-light: #386d8a;
  --primary-dark: #1a3d50;
  --accent: #2A9D8F;
  --bg: #f8f8f8;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --danger: #dc2626;
  --font: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --header-h: 52px;
  --toolbar-w: 52px;
  --promo-h: 46px;
}

html, body { height: 100%; font-family: var(--font); color: var(--text); background: var(--bg); }

/* --- Header --- */
#header {
  position: fixed; top: var(--promo-h); left: 0; right: 0; z-index: 1000;
  height: var(--header-h);
  display: flex; flex-wrap: wrap; align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  gap: 12px;
}

.header-left { display: flex; align-items: center; flex-shrink: 0; }
.logo { display: flex; align-items: center; gap: 8px; color: var(--primary); }
.logo-img { height: 26px; width: auto; display: block; }
.logo-text { font-weight: 700; font-size: 16px; letter-spacing: -0.3px; }
.logo-sub { font-size: 13px; color: var(--text-secondary); font-weight: 400; }
.header-center { flex: 1; display: flex; justify-content: center; }
.header-right { flex-shrink: 0; }

/* --- Search --- */
.search-container { position: relative; width: 100%; max-width: 420px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; }
#search-input {
  width: 100%; height: 34px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
#search-input:focus { border-color: var(--primary); background: var(--surface); }
#search-input::placeholder { color: var(--text-secondary); }

.search-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 2000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 280px; overflow-y: auto;
  display: none;
}
.search-dropdown.active { display: block; }
.search-result {
  padding: 8px 14px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result.highlighted { background: #f0f4f8; }
.search-result .result-type { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }

/* Loading / empty states inside the search dropdown */
.search-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
.search-loading { color: var(--text-secondary); }
.search-empty { font-style: italic; }
.search-error {
  color: var(--danger);
  gap: 7px;
}
.search-error svg { flex-shrink: 0; }

/* Compact spinner — matches the header's visual weight */
.search-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: search-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes search-spin {
  to { transform: rotate(360deg); }
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border: none; border-radius: var(--radius);
  font-family: var(--font); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

/* --- Main Layout --- */
#main {
  position: fixed; top: calc(var(--header-h) + var(--promo-h)); left: 0; right: 0; bottom: 0;
}

/* --- Legal footer bar (bottom of page) --- */
#legal-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 999;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: var(--primary-dark);
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}
.legal-disclaimer { font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 12px; }
.legal-links { display: flex; gap: 12px; flex-shrink: 0; }
.legal-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: color 0.12s;
}
.legal-links a:hover { color: #fff; text-decoration: underline; }

/* Legal footer sits directly at the bottom; promo now lives at the top */
#main { bottom: 24px; }
body.promo-dismissed { --promo-h: 0px; }

/* --- Map --- */
#map-container { width: 100%; height: 100%; }

/* Maplibre overrides — controls sit above the measurement bar (36px) */
.maplibregl-ctrl-bottom-left { bottom: 44px !important; }
.maplibregl-ctrl-bottom-right { bottom: 44px !important; }
.maplibregl-ctrl-attrib { font-size: 10px !important; }

/* --- Floating Toolbar --- */
#toolbar {
  position: absolute; left: 12px; top: 12px; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  padding: 6px 4px; gap: 2px;
}

.tool-group-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); padding: 4px 0 2px; }

.tool-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px;
  background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: all 0.12s;
}
.tool-btn:hover { background: #f0f4f8; color: var(--text); }
.tool-btn.active { background: var(--primary); color: white; }
.tool-btn:disabled { opacity: 0.3; cursor: default; }

.tool-divider { width: 24px; height: 1px; background: var(--border); margin: 4px 0; }

/* --- Map Controls (style/satellite) --- */
#map-controls {
  position: absolute; right: 12px; top: 12px; z-index: 10;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 8px;
  min-width: 150px;
}

.control-group { display: flex; align-items: center; gap: 8px; }
.control-label { font-size: 11px; color: var(--text-secondary); min-width: 50px; align-self: flex-start; margin-top: 2px; }

/* --- Style grid (thumbnail cards) --- */
.style-grid {
  display: flex; gap: 6px; flex: 1;
}
.style-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px; border: 2px solid var(--border); border-radius: 6px;
  cursor: pointer; transition: all 0.12s; background: var(--bg);
}
.style-card:hover { border-color: var(--text-secondary); }
.style-card.active { border-color: var(--primary); background: rgba(33, 75, 98, 0.06); }
.style-thumb {
  width: 100%; aspect-ratio: 4/3; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: rgba(0,0,0,0.25);
  letter-spacing: 0.5px;
}
.style-thumb-block { background: linear-gradient(135deg, #f7f5ed 0%, #e8e3d8 100%); }
.style-thumb-3d { background: linear-gradient(135deg, #e8eef5 0%, #c8d8e8 100%); }
.style-thumb-label { font-size: 14px; font-weight: 700; }
.style-name { font-size: 9px; color: var(--text-secondary); text-align: center; line-height: 1.1; }

#sat-slider { flex: 1; height: 4px; cursor: pointer; accent-color: var(--primary); }
.sat-value { font-size: 11px; color: var(--text-secondary); min-width: 30px; text-align: right; }

.control-divider { height: 1px; background: var(--border); margin: 2px 0; }

.btn-sm { font-size: 11px; height: 26px; padding: 0 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text); cursor: pointer; font-family: var(--font); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; flex: 1; }
.btn-sm:hover { background: var(--border); }
.btn-sm.active { background: var(--primary); color: white; border-color: var(--primary); }

#pa-aspect { flex: 0; width: auto; font-size: 11px; height: 26px; padding: 0 4px; }

.title-input { flex: 1; font-size: 11px; height: 24px; padding: 0 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text); font-family: var(--font); min-width: 0; }
.title-input:focus { outline: none; border-color: var(--primary); }

/* --- Brand colour pickers --- */
.brand-colours { display: flex; gap: 6px; flex: 1; }
.brand-picker {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.brand-picker input[type="color"] {
  width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 4px;
  padding: 0; cursor: pointer; display: block;
}
.brand-picker input[type="color"]:hover { border-color: var(--primary); }
.brand-label { font-size: 8px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; }

/* --- Map colour presets --- */
.preset-grid {
  display: flex; gap: 4px; flex-wrap: wrap; flex: 1;
}
.preset-swatch {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border);
  cursor: pointer; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.12s, transform 0.12s;
}
.preset-swatch:hover { border-color: var(--text-secondary); transform: scale(1.1); }
.preset-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.preset-color { display: block; width: 100%; height: 100%; border-radius: 50%; }
.preset-custom-icon {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); background: var(--bg);
}
.preset-custom-picker {
  width: 20px; height: 20px; border: 1px solid var(--border); border-radius: 50%;
  padding: 0; cursor: pointer; flex-shrink: 0;
}
.preset-custom-picker.hidden { display: none; }

/* --- Measurement Bar --- */
#measurement-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: 36px; padding: 0 14px;
  background: var(--surface); border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary);
}
.meas-disclaimer { font-size: 11px; color: #9ca3af; font-style: italic; }

/* --- Drawing Instructions --- */
#draw-instructions {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10;
  background: rgba(0,0,0,0.75); color: white; padding: 8px 18px;
  border-radius: 20px; font-size: 13px; pointer-events: none;
  transition: opacity 0.2s;
}
#draw-instructions.hidden { opacity: 0; }

/* --- Text label input popup --- */
.text-label-popup {
  position: absolute; z-index: 20;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  padding: 8px;
}
.text-label-popup input {
  width: 180px; height: 32px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 13px; font-family: var(--font); outline: none;
}
.text-label-popup input:focus { border-color: var(--primary); }
.text-label-popup .popup-actions { display: flex; gap: 4px; margin-top: 4px; }
.text-label-popup .popup-actions button {
  flex: 1; height: 28px; border: none; border-radius: 4px;
  font-size: 12px; cursor: pointer; font-family: var(--font);
}
.text-label-popup .popup-actions .btn-confirm { background: var(--primary); color: white; }
.text-label-popup .popup-actions .btn-cancel { background: var(--bg); color: var(--text); border: 1px solid var(--border); }

/* --- Color picker popup (for editing) --- */
.color-popup {
  position: absolute; z-index: 20;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  padding: 10px; display: flex; flex-direction: column; gap: 6px;
}
.color-popup .color-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.color-popup input[type="color"] { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 4px; padding: 0; cursor: pointer; }
.color-popup input[type="range"] { width: 80px; accent-color: var(--primary); }

/* --- Responsive tweaks --- */
@media (max-width: 640px) {
  .logo-sub { display: none; }
  .logo-img { height: 20px; }
  .search-container { max-width: 200px; }
  #map-controls { right: 8px; top: 8px; padding: 8px 10px; min-width: 130px; }
  #toolbar { left: 8px; top: 8px; padding: 4px 3px; }
  .tool-btn { width: 32px; height: 32px; }
  #measurement-bar { font-size: 11px; }
  .header-legal { height: 20px; font-size: 10px; padding: 0 8px; }
  .legal-links { gap: 8px; }
  #main { top: calc(var(--header-h) + var(--promo-h) + 20px); }
  .legal-disclaimer { display: none; }
  #legal-footer { height: 20px; font-size: 10px; padding: 0 8px; }
  .legal-links { gap: 8px; }
  #main { bottom: 20px; }
  #trakr-promo { top: 0; }   /* pinned to the top on mobile too */
  #cookie-banner { bottom: 20px; }
}

/* --- Feature List Panel --- */
#feature-panel {
  position: absolute; left: 64px; top: 12px; z-index: 10;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  min-width: 160px; max-width: 220px; max-height: calc(100% - 80px);
  display: flex; flex-direction: column;
}
.feature-panel-header {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-secondary); padding: 8px 12px 4px;
  border-bottom: 1px solid var(--border);
}
#feature-list {
  overflow-y: auto; max-height: 300px;
}
#feature-list:empty::after {
  content: 'No layers yet'; display: block; padding: 12px;
  font-size: 11px; color: var(--text-secondary); font-style: italic;
}
.feature-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; cursor: pointer; font-size: 12px;
  border-bottom: 1px solid var(--border); transition: background 0.1s;
}
.feature-item:last-child { border-bottom: none; }
.feature-item:hover { background: #f0f4f8; }
.feature-item.selected { background: rgba(33, 75, 98, 0.1); border-left: 3px solid var(--primary); }
.feature-item .feat-icon { flex-shrink: 0; color: var(--text-secondary); }
.feature-item .feat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feature-item .feat-delete {
  opacity: 0; flex-shrink: 0; border: none; background: none; cursor: pointer;
  color: var(--danger); padding: 2px; display: flex; align-items: center;
}
.feature-item:hover .feat-delete { opacity: 0.6; }
.feature-item .feat-delete:hover { opacity: 1; }



/* --- Cookie Consent Banner --- */
#cookie-banner {
  position: fixed;
  /* Sits directly above the legal footer; promo no longer occupies the
     bottom of the page. */
  bottom: 24px; left: 0; right: 0;
  z-index: 600;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
  padding: 14px 20px;
  animation: tp-fade-in 0.3s ease;
  transition: bottom 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
#cookie-banner.hidden { display: none !important; }
.cookie-banner-content {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.cookie-banner-content p {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  min-width: 200px;
  line-height: 1.4;
}
.cookie-banner-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.cookie-banner-actions .btn {
  height: 30px;
  font-size: 11px;
  padding: 0 12px;
}

/* --- Utility --- */
.hidden { display: none !important; }

/* --- Mobile Device Overlay --- */
#mobile-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
#mobile-overlay.hidden { display: none !important; }
#mobile-overlay.visible { display: flex !important; }

.mobile-overlay-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 32px 24px;
  max-width: 360px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.mobile-overlay-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  opacity: 0.6;
}
.mobile-overlay-card h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.mobile-overlay-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
#mobile-dismiss {
  margin-top: 4px;
}

/* Mobile overlay hidden by default, shown via JS */
#mobile-overlay.hidden { display: none !important; }
#mobile-overlay.visible { display: flex !important; }

/* --- Print area controls --- */
#btn-print-area.active { background: var(--primary); color: white; border-color: var(--primary); }

/* --- Style Panel --- */
#style-panel {
  position: absolute; right: 12px; z-index: 10;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  padding: 8px 12px; display: flex; flex-direction: column; gap: 6px;
  min-width: 170px;
}
#style-panel.hidden { display: none; }
.style-header { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); }
.style-row { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary); }
.style-row label { min-width: 24px; font-size: 10px; }
.style-row input[type="color"] { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 4px; padding: 0; cursor: pointer; flex-shrink: 0; }
.style-row input[type="range"] { flex: 1; height: 3px; accent-color: var(--primary); cursor: pointer; min-width: 50px; }
.style-value { font-size: 10px; min-width: 28px; text-align: right; color: var(--text-secondary); }

/* --- Export Loading Overlay --- */
.export-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 500;
  background: rgba(248, 248, 248, 0.88);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tp-fade-in 0.2s ease;
}
.export-overlay.hidden { display: none !important; }

.export-loading-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 32px 40px;
  text-align: center;
  min-width: 300px;
  max-width: 380px;
}

.export-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: tp-spin 0.8s linear infinite;
}

.export-loading-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.export-loading-message {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  min-height: 16px;
  transition: opacity 0.15s;
}

.export-loading-progress {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.export-loading-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}

@keyframes tp-spin { to { transform: rotate(360deg); } }
@keyframes tp-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Respect users who set prefers-reduced-motion (vestibular sensitivity).
   Disable all animations — the spinner becomes a static ring, fades are instant. */
@media (prefers-reduced-motion: reduce) {
  .export-spinner { animation: none; }
  #cookie-banner, .export-overlay { animation: none; }
  * { scroll-behavior: auto; }
}

/* ============================================================
   Trakr Promo Banner — slim dismissible upsell above the
   legal footer. Collapses to a floating chip when dismissed.
   ============================================================ */

#trakr-promo {
  position: fixed;
  left: 0; right: 0;
  top: 0;                   /* pinned to the top of the viewport */
  height: var(--promo-h);
  z-index: 1100;           /* above header (1000), cookie banner (600) */
  background:
    radial-gradient(120% 140% at 0% 50%, rgba(42, 157, 143, 0.55) 0%, transparent 55%),
    linear-gradient(90deg, #1a3d50 0%, #214b62 50%, #2c6280 100%);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
  transition:
    height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.24s ease,
    transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
  opacity: 1;
}
/* Thin teal accent stripe on the leading edge */
#trakr-promo::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #2A9D8F 0%, #386d8a 100%);
}
/* Subtle slow shimmer sweeping across the banner — eye-catching but not noisy */
#trakr-promo::after {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.08) 50%, transparent 100%);
  transform: skewX(-18deg);
  animation: promo-shimmer 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes promo-shimmer {
  0%   { left: -60%; }
  55%  { left: 130%; }
  100% { left: 130%; }
}

body.promo-dismissed #trakr-promo {
  height: 0;
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

.promo-inner {
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px 0 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.promo-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.promo-logo {
  height: 24px;
  width: auto;
  display: block;
}

.promo-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.promo-tagline {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.promo-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.74);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin-top: 1px;
}

.promo-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 28px;
  padding: 0 14px;
  border-radius: 14px;
  background: #fff;
  color: var(--primary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
}
.promo-cta:hover {
  background: #f0f4f8;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}
.promo-cta:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.promo-cta svg {
  width: 12px;
  height: 12px;
  transition: transform 0.15s ease;
}
.promo-cta:hover svg { transform: translateX(2px); }
/* Gentle attention pulse so the CTA reads as the primary action */
@keyframes promo-cta-pulse {
  0%, 100% { box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22); }
  50%      { box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22), 0 0 0 4px rgba(42, 157, 143, 0.28); }
}
.promo-cta { animation: promo-cta-pulse 3.2s ease-in-out infinite; }

.promo-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.promo-close:hover {
  background: rgba(255, 255, 255, 0.26);
  color: #fff;
}
.promo-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.promo-close svg { width: 12px; height: 12px; }

/* Floating re-open chip — only visible when the banner is dismissed */
#promo-chip {
  position: fixed;
  right: 12px;
  bottom: 32px;
  z-index: 500;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(33, 75, 98, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: tp-fade-in 0.24s ease;
}
#promo-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(33, 75, 98, 0.6);
}
#promo-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#promo-chip svg { width: 18px; height: 18px; }
body.promo-dismissed #promo-chip { display: flex; }

/* --- Promo banner mobile tweaks --- */
@media (max-width: 640px) {
  :root { --promo-h: 42px; }
  .promo-sub { display: none; }
  .promo-tagline { font-size: 12px; }
  .promo-inner { gap: 10px; padding: 0 10px 0 12px; }
  .promo-cta { padding: 0 10px; height: 26px; font-size: 11px; }
  #promo-chip { right: 8px; bottom: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  #trakr-promo,
  #trakr-promo::after,
  .promo-cta,
  #promo-chip { animation: none; transition: none; }
}
