/* ==========================================================================
   Szkielet aplikacji Vantageness (faza 2)
   --------------------------------------------------------------------------
   Pasek zakładek (dolny na telefonie, górny od 768 px), nagłówek strony,
   przełącznik segmentów, awatar z menu profilu oraz widoki Tydzień i Dziś.
   Wg design-handoff: Trening-tydzien, Dzis, Desktop-Dzis.
   ========================================================================== */

/* ── Pasek zakładek: telefon (dół) ───────────────────────────────────── */
.vt-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-nav);
  background: var(--vt-nav);
  border-top: 1px solid var(--vt-line);
  padding: 8px max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

.vt-nav-brand,
.vt-nav-end {
  display: none;
}

.vt-nav-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.vt-nav-tab {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 12px;
  color: var(--vt-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: color var(--transition), background-color var(--transition);
}

.vt-nav-tab:hover {
  color: var(--vt-text);
}

.vt-nav-tab.active {
  color: var(--vt-accent);
  background: var(--vt-surface-2);
}

.vt-nav-tab:focus-visible,
.vt-nav-brand:focus-visible,
.vt-segment:focus-visible,
.vt-avatar:focus-visible,
.vt-page-add:focus-visible,
.vt-profile-item:focus-visible {
  outline: 2px solid var(--vt-accent);
  outline-offset: 2px;
}

/* Treść nie może chować się pod dolnym paskiem; 16 px marginesu bocznego */
#app-content {
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

/* ── Pasek zakładek: od 768 px (góra) ────────────────────────────────── */
@media (min-width: 768px) {
  .vt-nav {
    top: 0;
    bottom: auto;
    border-top: 0;
    border-bottom: 1px solid var(--vt-line);
    background: rgb(var(--vt-nav-rgb) / 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: calc(12px + env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 12px max(24px, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .vt-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--vt-text);
    text-decoration: none;
    font-family: var(--vt-font-display);
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -0.03em;
    border-radius: var(--vt-radius-sm);
    flex: 1 1 0;
  }

  .vt-nav-tabs {
    display: flex;
    gap: 4px;
  }

  .vt-nav-tab {
    min-height: 44px;
    flex-direction: row;
    gap: 8px;
    padding: 0 14px;
    font-size: 14px;
  }

  .vt-nav-tab svg {
    width: 18px;
    height: 18px;
  }

  .vt-nav-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 1 1 0;
  }

  #app-content {
    padding-top: calc(92px + env(safe-area-inset-top));
    padding-bottom: 2rem;
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
  }
}

/* Między 768 a 900 px trzy elementy paska nie mieszczą się z nazwą marki */
@media (min-width: 768px) and (max-width: 900px) {
  .vt-nav-brand span { display: none; }
}

/* ── Znacznik pracy offline ──────────────────────────────────────────── */
.nav-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--vt-warn-tint);
  border: 1px solid rgb(var(--vt-warn-rgb) / 0.35);
  color: var(--vt-warn);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
}

.nav-sync-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vt-warn);
}

/* ── Awatar i menu profilu ───────────────────────────────────────────── */
.vt-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 0;
  padding: 0;
  overflow: hidden;
  background: var(--vt-surface-2);
  color: var(--vt-text);
  font: 600 16px var(--vt-font-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vt-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vt-avatar[aria-expanded="true"] {
  box-shadow: 0 0 0 2px var(--vt-accent);
}

.vt-avatar--static {
  width: 36px;
  height: 36px;
  font-size: 14px;
  cursor: default;
}

/* Na telefonie awatar jest w nagłówku strony, od 768 px w górnym pasku */
@media (min-width: 768px) {
  .vt-avatar--page { display: none; }
}

.vt-profile-menu {
  position: fixed;
  z-index: calc(var(--z-modal) + 1);
  min-width: 220px;
  padding: 6px;
  background: var(--vt-surface);
  border: 1px solid var(--vt-line);
  border-radius: var(--vt-radius-md);
  box-shadow: var(--shadow);
}

.vt-profile-menu[hidden] {
  display: none;
}

.vt-profile-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 12px;
  border-bottom: 1px solid var(--vt-line);
  margin-bottom: 6px;
}

.vt-profile-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vt-profile-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--vt-radius-sm);
  background: transparent;
  color: var(--vt-text);
  font: 500 15px var(--vt-font-body);
  cursor: pointer;
  text-align: left;
}

.vt-profile-item:hover {
  background: var(--vt-surface-2);
}

/* ── Nagłówek strony i segmenty ──────────────────────────────────────── */
.vt-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
}

.vt-page-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.vt-page-eyebrow {
  font-size: 13px;
  color: var(--vt-muted);
}

.vt-page-title {
  margin: 0;
  font-family: var(--vt-font-display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.vt-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vt-page-add {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: var(--vt-accent);
  color: var(--vt-accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.vt-page-add:hover {
  background: var(--vt-accent-hover);
}

.vt-segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--vt-surface);
  border: 1px solid var(--vt-line);
  border-radius: var(--vt-radius-md);
  padding: 4px;
  margin-bottom: 20px;
}

.vt-segment {
  min-height: 40px;
  border-radius: var(--vt-radius-sm);
  color: var(--vt-muted);
  font-size: 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vt-segment:hover {
  color: var(--vt-text);
}

.vt-segment[aria-selected="true"] {
  background: var(--vt-line);
  color: var(--vt-text);
  font-weight: 600;
}

@media (min-width: 768px) {
  .vt-segments {
    max-width: 420px;
  }
}

/* ── Trening › Tydzień ───────────────────────────────────────────────── */
.wk {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 720px;
}

.wk-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.wk-range {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.wk-arrow {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--vt-radius-sm);
  background: transparent;
  color: var(--vt-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.wk-arrow:hover {
  background: var(--vt-surface);
  color: var(--vt-text);
}

.wk-range-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wk-range-title {
  font-weight: 600;
  font-size: 16px;
}

.wk-range-sub {
  font-size: 13px;
  color: var(--vt-muted);
}

.wk-prev {
  font-size: 12px;
  color: var(--vt-muted);
  text-align: right;
  flex-shrink: 0;
}

.wk-prev-val {
  color: var(--vt-text);
}

.wk-back {
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--vt-radius-sm);
  border: 1px solid var(--vt-line);
  background: transparent;
  color: var(--vt-text);
  font: 500 13px var(--vt-font-body);
  cursor: pointer;
}

.wk-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wk-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: stretch;
}

.wk-row--empty {
  align-items: center;
}

.wk-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 14px;
}

.wk-row--empty .wk-day {
  padding-top: 0;
}

.wk-day-name {
  font-size: 11px;
  color: var(--vt-muted);
}

.wk-day-num {
  font-family: var(--vt-font-data);
  font-weight: 600;
  font-size: 17px;
}

.wk-day--empty .wk-day-num {
  color: var(--vt-muted);
}

.wk-day--today .wk-day-name,
.wk-day--today .wk-day-num {
  color: var(--vt-accent);
}

.wk-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.wk-card {
  width: 100%;
  min-height: 44px;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font: inherit;
  color: var(--vt-text);
  background: var(--vt-surface);
  border: 1px solid var(--vt-line);
  cursor: pointer;
}

button.wk-card:hover {
  background: var(--vt-surface-2);
}

.wk-card--planned {
  background: transparent;
  border-style: dashed;
}

.wk-card--today {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--vt-surface-2);
  border-color: var(--vt-accent);
  cursor: default;
}

.wk-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.wk-card-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.wk-name {
  font-weight: 600;
  font-size: 16px;
}

.wk-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--vt-accent-ink);
  background: var(--vt-accent);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

.wk-status {
  font-size: 12px;
  color: var(--vt-muted);
  white-space: nowrap;
}

.wk-status--missed {
  color: var(--vt-warn);
}

.wk-line {
  font-family: var(--vt-font-data);
  font-size: 12px;
  color: var(--vt-muted);
}

.wk-line--cardio {
  color: var(--vt-cardio);
}

.wk-up {
  color: var(--vt-accent);
}

.wk-down {
  color: var(--vt-warn);
}

.wk-start {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--vt-accent);
  color: var(--vt-accent-ink);
  font: 600 14px var(--vt-font-body);
  cursor: pointer;
  flex-shrink: 0;
}

.wk-start:hover {
  background: var(--vt-accent-hover);
}

.wk-empty {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px dashed var(--vt-line);
  background: transparent;
  color: var(--vt-muted);
  font: 13px var(--vt-font-body);
  text-align: left;
  padding: 0 14px;
  cursor: pointer;
}

.wk-empty:hover {
  color: var(--vt-text);
  border-color: var(--vt-muted);
}

/* ── Wspólne komponenty ekranów ──────────────────────────────────────── */
.vt-btn-primary,
.vt-btn-secondary,
.vt-btn-ghost {
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--vt-radius-md);
  font: 600 14px var(--vt-font-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition), border-color var(--transition);
}

.vt-btn-primary {
  border: 0;
  background: var(--vt-accent);
  color: var(--vt-accent-ink);
}

.vt-btn-primary:hover { background: var(--vt-accent-hover); }

.vt-btn-secondary {
  border: 1px solid var(--vt-line);
  background: var(--vt-surface-2);
  color: var(--vt-text);
}

.vt-btn-secondary:hover { border-color: var(--vt-muted); }

.vt-btn-ghost {
  border: 1px solid var(--vt-line);
  background: transparent;
  color: var(--vt-text);
  font-weight: 500;
  font-size: 13px;
}

.vt-btn-ghost:hover { background: var(--vt-surface-2); }

.vt-btn-lg {
  min-height: 52px;
  font-size: 16px;
  width: 100%;
}

.vt-btn-primary:disabled,
.vt-btn-ghost:disabled {
  opacity: 0.5;
  cursor: default;
}

.vt-link-btn {
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--vt-muted);
  font: 500 13px var(--vt-font-body);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.vt-link-btn:hover { color: var(--vt-text); }

.vt-btn-primary:focus-visible,
.vt-btn-secondary:focus-visible,
.vt-btn-ghost:focus-visible,
.vt-link-btn:focus-visible {
  outline: 2px solid var(--vt-accent);
  outline-offset: 2px;
}

/* Kropka statusu: dobrze / w normie / uwaga / brak danych */
.vt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--vt-faint);
}

.vt-dot--good { background: var(--vt-accent); }
.vt-dot--ok { background: var(--vt-muted); }
.vt-dot--warn { background: var(--vt-warn); }
.vt-dot--none { background: transparent; box-shadow: inset 0 0 0 1.5px var(--vt-faint); }

/* Pasek postępu do celu */
.vt-progress {
  height: 8px;
  border-radius: 4px;
  background: var(--vt-line);
  overflow: hidden;
}

.vt-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--vt-accent);
}

/* Karta wniosku — ten sam wygląd na Dziś, w treningu, Ciele i Regeneracji */
.vt-insight {
  background: var(--vt-surface);
  border: 1px solid var(--vt-line);
  border-radius: var(--vt-radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vt-insight--action {
  background: var(--vt-surface-2);
}

.vt-insight--compact {
  padding: 12px 14px;
  border-radius: var(--vt-radius-md);
}

.vt-insight-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--vt-font-data);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--vt-accent);
}

.vt-insight--action .vt-insight-label { color: var(--vt-warn); }

.vt-insight-metric {
  margin-left: auto;
  letter-spacing: 0;
  text-transform: none;
  font-size: 12px;
  color: var(--vt-text);
}

.vt-insight-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--vt-text);
}

.vt-insight-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--vt-muted);
}

.vt-insight-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

/* ── Trening › Miesiąc: boczna kolumna „Dziś” od 1200 px ─────────────── */
.mo { display: block; }
.mo-aside { display: none; }

@media (min-width: 1200px) {
  .mo {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    align-items: start;
  }

  .mo-aside {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 100px;
  }
}

.mo-card {
  background: var(--vt-surface);
  border: 1px solid var(--vt-line);
  border-radius: var(--vt-radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mo-ready { display: flex; align-items: center; gap: 14px; }
.mo-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mo-title { font-weight: 600; font-size: 16px; }
.mo-small { font-size: 12px; }
.mo-muted { color: var(--vt-muted); }
.mo-cardio { color: var(--vt-cardio); }

.mo-plan {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--vt-radius-md);
  background: var(--vt-surface-2);
}

.mo-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mo-stat { display: flex; flex-direction: column; gap: 2px; }
.mo-stat-v { font-size: 18px; font-weight: 600; }

/* ── Wybór języka w menu profilu (faza 1b) ───────────────────────────── */
.vt-profile-section {
  display: flex;
  flex-direction: column;
  padding: 4px 0 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--vt-line);
}

.vt-profile-label {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--vt-muted);
}

.vt-profile-lang {
  justify-content: space-between;
}

.vt-profile-lang[aria-checked="true"] {
  color: var(--vt-accent);
  font-weight: 600;
}
