/* ============================================================
   INTVL-aligned UI components (Stage 2).
   Все классы — с префиксом .vt- чтобы не конфликтовать с существующими.
   Подключается ПОСЛЕ app.css в index.html.

   Подход: новые компоненты — поверх существующего layout,
   старые .card / .nav-bar / .lb-row остаются как были.
   ============================================================ */

/* ============================================================
   Bottom navigation — 5-tab вариант (Ride / Play / Plan / Me / Social).

   В существующей разметке .nav-bar — grid-template-columns: repeat(4,1fr).
   Когда intvl-shell.js добавляет 5-й таб, он навешивает класс
   .nav-bar.vt-nav-5 на корневой <nav> и грид становится 5-колоночным.
   Без этого класса всё работает как раньше.
   ============================================================ */
.nav-bar.vt-nav-5 {
  grid-template-columns: repeat(5, 1fr) !important;
}
@media (min-width: 1024px) {
  .nav-bar.vt-nav-5 {
    grid-template-columns: 1fr !important;
    grid-template-rows: repeat(5, auto) !important;
  }
}

/* Активный таб подсвечивается peach-акцентом */
.nav-btn.vt-tab-active-peach.active {
  color: var(--jtb-dark-peach);
}
.nav-btn.vt-tab-active-peach.active .nav-icon-wrap.boxed {
  background: var(--jtb-peach-15);
}

/* ============================================================
   Layer switcher (bike / run / ski) — segmented chip control.
   Используется в верхней панели Play screen.
   ============================================================ */
.vt-layer-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--vt-radius-full);
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
}
:root[data-theme="light"] .vt-layer-switcher {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(15, 18, 28, 0.10);
}
.vt-layer-chip {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 32px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: var(--vt-radius-full);
  font-size: var(--vt-paragraph);
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition:
    background var(--vt-motion-fast) var(--vt-ease-out),
    color var(--vt-motion-fast) var(--vt-ease-out),
    transform var(--vt-motion-fast) var(--vt-ease-out);
  user-select: none;
}
.vt-layer-chip:active { transform: scale(0.96); }
.vt-layer-chip[aria-pressed="true"] {
  color: #FFFFFF;
}
.vt-layer-chip[data-layer="bike"][aria-pressed="true"] { background: var(--vt-layer-bike); }
.vt-layer-chip[data-layer="run"][aria-pressed="true"]  { background: var(--vt-layer-run); }
.vt-layer-chip[data-layer="ski"][aria-pressed="true"]  { background: var(--vt-layer-ski); }
.vt-layer-chip .vt-layer-icon { font-size: 16px; line-height: 1; }
.vt-layer-chip .vt-layer-label { line-height: 1; }

/* Mini badge — показывает текущий слой как маркер */
.vt-layer-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--vt-layer-current);
  vertical-align: middle;
  margin-right: 6px;
}

/* ============================================================
   Gamification header (top of Play / Me).
   XP bar, level, coins, streak.
   ============================================================ */
.vt-gamify-header {
  display: flex;
  align-items: center;
  gap: var(--vt-space-3);
  padding: var(--vt-space-3) var(--vt-space-4);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--vt-radius-2xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
:root[data-theme="light"] .vt-gamify-header {
  background: rgba(255, 255, 255, 0.92);
}
.vt-gamify-level {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: var(--vt-radius-full);
  background: var(--jtb-peach-20);
  color: var(--jtb-dark-peach);
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
}
.vt-gamify-level small {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  opacity: 0.8;
  display: block;
  margin-bottom: 2px;
}
.vt-gamify-stack { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.vt-gamify-stack-top {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: var(--vt-small-paragraph);
  color: var(--text-dim);
}
.vt-gamify-stack-top b { color: var(--text); font-weight: 700; }
.vt-xp-bar {
  height: 6px;
  border-radius: var(--vt-radius-full);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
:root[data-theme="light"] .vt-xp-bar { background: rgba(15, 18, 28, 0.10); }
.vt-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--vt-xp-color) 0%, var(--jtb-gold) 100%);
  border-radius: inherit;
  transition: width var(--vt-motion-base) var(--vt-ease-out);
}
.vt-gamify-side {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: var(--vt-space-3);
}
.vt-gamify-stat {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--vt-paragraph);
  font-weight: 700;
}
.vt-gamify-stat .icon { font-size: 14px; line-height: 1; }
.vt-gamify-stat.coins  { color: var(--vt-coin-color); }
.vt-gamify-stat.streak { color: var(--vt-streak-color); }

/* ============================================================
   Layer card (used in Play / Plan / Social to label section by layer)
   ============================================================ */
.vt-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--vt-radius-2xl);
  padding: var(--vt-space-4);
  box-shadow: var(--shadow-card);
}
.vt-card-titled {
  display: flex; flex-direction: column; gap: var(--vt-space-2);
}
.vt-card-title {
  font-size: var(--vt-h5);
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 6px;
}
.vt-card-title::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--vt-layer-current);
}

/* ============================================================
   Hex / territory visual chips (used in TerraSummary placeholder)
   ============================================================ */
.vt-hex-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 32px;
  background: var(--vt-layer-current-soft);
  border: 1px solid var(--vt-layer-current);
  clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
}
.vt-hex-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============================================================
   BKRent SuperApp entry card.
   ============================================================ */
.vt-bkrent-entry {
  display: flex; align-items: center; gap: var(--vt-space-3);
  padding: var(--vt-space-3) var(--vt-space-4);
  border-radius: var(--vt-radius-2xl);
  background: linear-gradient(135deg, #FF8581 0%, #FE6F64 100%);
  color: #FFFFFF;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform var(--vt-motion-fast) var(--vt-ease-out);
}
.vt-bkrent-entry:active { transform: scale(0.98); }
.vt-bkrent-entry .vt-bkrent-icon {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: var(--vt-radius-full);
  background: rgba(255, 255, 255, 0.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.vt-bkrent-entry .vt-bkrent-meta { flex: 1 1 auto; min-width: 0; }
.vt-bkrent-entry .vt-bkrent-title {
  font-size: var(--vt-large-paragraph);
  line-height: var(--vt-large-paragraph-lh);
  font-weight: 700;
}
.vt-bkrent-entry .vt-bkrent-sub {
  font-size: var(--vt-small-paragraph);
  line-height: var(--vt-small-paragraph-lh);
  opacity: 0.85;
}
.vt-bkrent-entry .vt-bkrent-cta {
  font-size: 22px; line-height: 1;
  flex: 0 0 auto;
  opacity: 0.9;
}

/* ============================================================
   Placeholder pages (Plan, Social, CompletedRide).
   Помечены как demo через .vt-placeholder + бэйдж.
   ============================================================ */
.vt-placeholder {
  position: relative;
  display: flex; flex-direction: column;
  gap: var(--vt-space-4);
  padding: var(--vt-space-5);
  padding-bottom: calc(var(--nav-h) + var(--vt-space-5));
  max-width: 720px;
  margin: 0 auto;
}
.vt-placeholder-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--vt-space-3);
}
.vt-placeholder-header h1 {
  margin: 0;
  font-size: var(--vt-h2);
  line-height: var(--vt-h2-lh);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.vt-placeholder-header .vt-priority {
  font-size: var(--vt-h6);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}
.vt-placeholder-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--vt-radius-full);
  background: var(--jtb-peach-15);
  color: var(--jtb-dark-peach);
  font-size: var(--vt-notations);
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  width: fit-content;
}
.vt-placeholder-body { color: var(--text); font-size: var(--vt-paragraph); line-height: var(--vt-paragraph-lh); }

.vt-list { display: flex; flex-direction: column; gap: var(--vt-space-3); }
.vt-list-item {
  display: flex; align-items: center; gap: var(--vt-space-3);
  padding: var(--vt-space-3) var(--vt-space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--vt-radius-xl);
}
.vt-list-item .vt-avatar {
  width: 36px; height: 36px;
  border-radius: var(--vt-radius-full);
  background: var(--vt-layer-current);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #FFFFFF; font-size: 13px;
}
.vt-list-item .vt-meta { flex: 1 1 auto; min-width: 0; }
.vt-list-item .vt-meta b { font-size: var(--vt-paragraph); }
.vt-list-item .vt-meta small { display: block; color: var(--text-dim); font-size: var(--vt-small-paragraph); }
.vt-list-item .vt-trail {
  font-size: var(--vt-paragraph);
  font-weight: 700;
}

/* CompletedRide stats grid */
.vt-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--vt-space-3);
}
.vt-stat {
  padding: var(--vt-space-3) var(--vt-space-4);
  border-radius: var(--vt-radius-xl);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.vt-stat .vt-stat-value {
  font-size: var(--vt-h3);
  line-height: var(--vt-h3-lh);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.vt-stat .vt-stat-label {
  font-size: var(--vt-small-paragraph);
  color: var(--text-dim);
  margin-top: 4px;
}

/* Capture animation pulse — used on hex chips when "new" */
@keyframes vt-hex-capture {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1.0);  opacity: 1; }
}
.vt-hex-chip.vt-fresh {
  animation: vt-hex-capture var(--vt-motion-slow) var(--vt-ease-out);
}

/* ============================================================
   CTA peach button — INTVL primary action.
   ============================================================ */
.vt-cta {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: var(--vt-radius-full);
  background: var(--jtb-dark-peach);
  color: #FFFFFF;
  font-size: var(--vt-paragraph);
  font-weight: 700;
  border: 0;
  cursor: pointer;
  transition:
    transform var(--vt-motion-fast) var(--vt-ease-out),
    background var(--vt-motion-fast) var(--vt-ease-out),
    box-shadow var(--vt-motion-fast) var(--vt-ease-out);
  box-shadow: 0 8px 20px rgba(255, 133, 129, 0.32);
}
.vt-cta:hover  { background: var(--jtb-peach-hover); }
.vt-cta:active { transform: scale(0.97); }
.vt-cta.ghost  {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}

/* ============================================================
   Top-of-Play overlay: gamification + layer switcher.
   Позиционируется поверх карты, под .app-top.
   ============================================================ */
.vt-play-overlay {
  position: absolute;
  z-index: 11;
  left: 12px; right: 12px;
  top: calc(var(--top-h, 56px) + 96px);
  display: flex; flex-direction: column; gap: var(--vt-space-3);
  pointer-events: none; /* контейнер не блокирует карту */
}
.vt-play-overlay > * { pointer-events: auto; }

@media (min-width: 1024px) {
  .vt-play-overlay { left: calc(var(--sidebar-w) + 16px); right: 16px; top: 16px; }
}
