/* GPX QR Tracker — Plugin Styles */

.gpxqr-root {
  display: flex;
  flex-direction: column;
  /* overflow:hidden removed — would trap position:fixed children (lightbox) */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: relative;
}

.gpxqr-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg, #1a1a2e);
  color: #e8eaf6;
  /* No transform/filter/backdrop-filter here — would create new stacking context
     and break position:fixed on lightbox */
}

/* ── Header ── */
.gpxqr-header {
  background: rgba(0,0,0,0.3);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  z-index: 100;
}
.gpxqr-title { font-size: 15px; font-weight: 600; flex: 1; }
.gpxqr-offline-badge {
  display: none;
  font-size: 10px;
  background: #1a2a0a;
  color: #80c060;
  border: 1px solid #3a5a1a;
  border-radius: 6px;
  padding: 2px 8px;
}
.gpxqr-hbtn {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: #a0a8e0;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
.gpxqr-hbtn:hover { background: rgba(255,255,255,0.06); }

/* ── Screens ── */
.gpxqr-screen {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.gpxqr-active { display: flex !important; }

/* Scan screen scrollable */
#scan { overflow-y: auto; }
.gpxqr-screen:first-of-type { /* scan */
  align-items: center;
  justify-content: flex-start;
  padding: 16px;
  gap: 14px;
  overflow-y: auto;
}

/* ── Cards ── */
.gpxqr-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 18px;
}
.gpxqr-card h2 { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.gpxqr-card p  { font-size: 12px; color: #8090c0; line-height: 1.5; margin: 0 0 14px; }

/* ── Video ── */
.gpxqr-video-wrap {
  display: none;
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #0a0a14;
  margin-bottom: 12px;
}
.gpxqr-video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.gpxqr-video-wrap .sc {
  position: absolute; width: 26px; height: 26px;
  border-style: solid; border-width: 0;
  border-color: var(--accent, #7c83ff);
}
.sc.tl { top:6px;left:6px;border-top-width:3px;border-left-width:3px;border-radius:3px 0 0 0 }
.sc.tr { top:6px;right:6px;border-top-width:3px;border-right-width:3px;border-radius:0 3px 0 0 }
.sc.bl { bottom:6px;left:6px;border-bottom-width:3px;border-left-width:3px;border-radius:0 0 0 3px }
.sc.br { bottom:6px;right:6px;border-bottom-width:3px;border-right-width:3px;border-radius:0 0 3px 0 }
.gpxqr-scanline {
  display: none;
  position: absolute; left: 10px; right: 10px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, #7c83ff), transparent);
  animation: gpxqr-scan 2s linear infinite;
}
@keyframes gpxqr-scan { 0% { top: 10px } 100% { top: calc(100% - 12px) } }

/* ── Buttons ── */
.gpxqr-btn {
  width: 100%; padding: 12px;
  border: none; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center; gap: 6px;
}
.gpxqr-btn:active { opacity: 0.8; transform: scale(0.99); }
.gpxqr-btn-primary   { background: var(--accent, #7c83ff); color: #fff; }
.gpxqr-btn-secondary { background: rgba(255,255,255,0.07); color: #a0a8e0; border: 1px solid rgba(255,255,255,0.1); }
.gpxqr-btn-danger    { background: rgba(255,60,60,0.1); color: #f08080; border: 1px solid rgba(255,60,60,0.2); }
.gpxqr-btn-gps       { background: rgba(80,192,80,0.1); color: #80c880; border: 1px solid rgba(80,192,80,0.2); }
.gpxqr-btn-gps.gpxqr-gps-active { background: rgba(60,180,60,0.2); color: #50e050; }

/* ── Input / Label ── */
.gpxqr-label { font-size: 11px; color: #8090c0; display: block; margin-bottom: 6px; font-weight: 500; }
.gpxqr-input {
  width: 100%; background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e8eaf6; border-radius: 8px;
  padding: 9px 11px; font-size: 13px; outline: none;
}
.gpxqr-input:focus { border-color: var(--accent, #7c83ff); }

/* ── Divider ── */
.gpxqr-divider {
  display: flex; align-items: center; gap: 8px;
  width: 100%; max-width: 380px;
}
.gpxqr-divider::before,
.gpxqr-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.08); }
.gpxqr-divider span { font-size: 11px; color: #4a5080; white-space: nowrap; }

/* ── QR result ── */
.gpxqr-qr-result { display: none; margin-top: 14px; text-align: center; }
.gpxqr-qr-result canvas { border-radius: 8px; background: #fff; padding: 8px; }
.gpxqr-qr-url { font-size: 11px; color: #6070a0; margin-top: 6px; word-break: break-all; }

/* ── Loading ── */
.gpxqr-screen[id$="-loading"] {
  align-items: center; justify-content: center; gap: 14px;
}
.gpxqr-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent, #7c83ff);
  border-radius: 50%;
  animation: gpxqr-spin 0.8s linear infinite;
}
@keyframes gpxqr-spin { to { transform: rotate(360deg); } }
.gpxqr-loading-text { color: #8090c0; font-size: 13px; }

/* ── Map ── */
.gpxqr-screen[id$="-map"] { position: relative; }
.gpxqr-map { width: 100%; flex-shrink: 0; }

/* ── Bottom panel ── */
.gpxqr-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(26,26,46,0.94);
  border-top: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  z-index: 400;
}
.gpxqr-tabs { display: flex; border-bottom: 1px solid rgba(255,255,255,0.07); }
.gpxqr-tab {
  flex: 1; padding: 9px; font-size: 12px; font-weight: 500;
  text-align: center; cursor: pointer; background: none;
  border: none; color: #5060a0;
}
.gpxqr-tab-active { color: var(--accent, #7c83ff); border-bottom: 2px solid var(--accent, #7c83ff); }
.gpxqr-tab-content { padding: 12px 14px; }

/* ── Track stats ── */
.gpxqr-track-name {
  font-size: 13px; font-weight: 600; margin-bottom: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e8eaf6;
}
.gpxqr-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; margin-bottom: 10px; }
.gpxqr-stat { background: rgba(0,0,0,0.25); border-radius: 7px; padding: 7px 4px; text-align: center; }
.gpxqr-stat .sv { display: block; font-size: 14px; font-weight: 700; color: var(--accent, #7c83ff); }
.gpxqr-stat .sl { display: block; font-size: 9px; color: #5060a0; margin-top: 1px; }

/* ── Progress ── */
.gpxqr-prog-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.gpxqr-prog-bg  { flex: 1; height: 6px; background: rgba(255,255,255,0.07); border-radius: 3px; overflow: hidden; }
.gpxqr-prog-fill { height: 100%; background: var(--accent, #7c83ff); border-radius: 3px; width: 0%; transition: width 0.5s ease; }
.gpxqr-prog-pct { font-size: 12px; font-weight: 700; color: var(--accent, #7c83ff); min-width: 36px; text-align: right; }

/* ── Elevation ── */
.gpxqr-elev-wrap { position: relative; height: 130px; }
.gpxqr-elev-wrap canvas { width: 100%; height: 100%; border-radius: 6px; cursor: crosshair; }

/* ── Toast ── */
.gpxqr-toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #2a1a1a; color: #f08080; padding: 9px 18px;
  border-radius: 10px; font-size: 13px; border: 1px solid rgba(255,100,100,0.3);
  z-index: 99999; max-width: 90%; text-align: center;
  opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.gpxqr-toast.gpxqr-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ── */
@media (max-width: 480px) {
  .gpxqr-stats { grid-template-columns: repeat(2,1fr); }
}

/* ── Detail pills (header row) ── */
.gpxqr-detail-pills {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 6px 14px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.gpxqr-pill {
  font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 2px 10px; color: #c0c8f0;
}

/* ── Description tab ── */
.gpxqr-desc-tab {
  overflow-y: auto;
  max-height: 260px;
}
.gpxqr-description {
  font-size: 13px; line-height: 1.7; color: #c8d0e8;
  padding-bottom: 12px;
}
.gpxqr-description p  { margin: 0 0 10px; }
.gpxqr-description h2,
.gpxqr-description h3 { color: #e8eaf6; margin: 12px 0 6px; font-size: 14px; }
.gpxqr-description ul,
.gpxqr-description ol { padding-left: 18px; margin: 0 0 10px; }
.gpxqr-description a  { color: var(--accent, #7c83ff); }

/* ── Gallery strip ── */
.gpxqr-gallery-section { padding-top: 10px; }
.gpxqr-gallery-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}
.gpxqr-gthumb {
  aspect-ratio: 1; border-radius: 6px; overflow: hidden;
  cursor: pointer; background: rgba(255,255,255,0.05);
  border: 2px solid transparent; transition: border-color .15s, transform .15s;
}
.gpxqr-gthumb:hover { border-color: var(--accent, #7c83ff); transform: scale(1.04); }
.gpxqr-gthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Lightbox ── */
.gpxqr-lightbox {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(0,0,0,0.95);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  /* No backdrop-filter here — keeps stacking context clean */
}
.gpxqr-lb-img {
  max-width: 92vw; max-height: 78vh;
  border-radius: 8px; object-fit: contain;
  box-shadow: 0 4px 40px rgba(0,0,0,.6);
}
.gpxqr-lb-close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none; color: #fff;
  font-size: 28px; cursor: pointer; line-height: 1; padding: 4px 8px;
}
.gpxqr-lb-prev,
.gpxqr-lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  font-size: 32px; cursor: pointer; padding: 8px 14px;
  border-radius: 6px; line-height: 1;
}
.gpxqr-lb-prev { left: 12px; }
.gpxqr-lb-next { right: 12px; }
.gpxqr-lb-prev:hover,
.gpxqr-lb-next:hover { background: rgba(255,255,255,0.25); }
.gpxqr-lb-counter {
  position: absolute; bottom: 18px;
  color: rgba(255,255,255,.6); font-size: 13px;
}

/* ── Activity pills (distinct style) ── */
.gpxqr-pill-activity {
  background: rgba(80,192,130,0.12);
  border-color: rgba(80,192,130,0.25);
  color: #80e8b0;
}
