/* ========== BUTTONS ==========
   Canonical button system. All variants share one metric base; new variants
   are added HERE, never restyled per view. */
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-control);
  font-size: var(--fs-lg);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  min-height: 50px;
  transition: transform 0.1s, background var(--dur-fast);
}
.btn-primary:active,
.btn-secondary:active,
.btn-outline:active,
.btn-danger:active { transform: scale(0.97); }
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-outline:disabled,
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* filled lime — the one high-emphasis action on a screen */
.btn-primary {
  background: var(--lime);
  color: var(--text-on-lime);
}
.btn-primary:hover {
  background: var(--lime-hover);
  box-shadow: var(--shadow-lime);
}

/* quiet neutral — the "other" choice next to a primary/danger */
.btn-secondary {
  background: var(--fill-soft);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
}
.btn-secondary:active { background: var(--fill-medium); }

/* solid neutral (legacy; prefer .btn-secondary in new work) */
.btn-outline {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.btn-outline:active { background: var(--fill-medium); }

/* destructive */
.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 8px 16px;
  font-size: var(--fs-md);
  min-height: 38px;
  border-radius: 10px;
}

.btn-full { width: 100%; }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-lg);
  font-size: var(--fs-xl);
  transition: color var(--dur-fast), background var(--dur-fast);
}

.btn-icon:hover {
  color: var(--lime);
  background: var(--lime-tint-soft);
}

.btn-text {
  background: none;
  border: none;
  color: var(--lime);

  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
  padding: var(--space-xs) 0;
  text-transform: none;
  letter-spacing: 0.04em;
}

.btn-demo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 6px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0;
  text-transform: none;
  letter-spacing: 0;
  flex-shrink: 0;
}

.btn-demo:active { background: rgba(255,255,255,0.1); }

.demo-video-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  margin: var(--space-sm) 0;
}

.demo-video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ========== TOP BAR (Native Nav Bar) ========== */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--top-bar-height) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(40px) saturate(1.8) brightness(1.1);
  -webkit-backdrop-filter: blur(40px) saturate(1.8) brightness(1.1);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
  z-index: 100;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.top-bar-view-title {

  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1;
}

.top-bar-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.top-bar-title {

  font-size: 1.375rem;
  font-weight: 400;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.streak-badge {
  display: none !important;
  font-variant-numeric: tabular-nums;
}

.profile-avatar-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.profile-avatar-btn:active {
  background: rgba(255,255,255,0.15);
}

.profile-avatar-btn span {

  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

/* Top bar icon button (messages) */
.top-bar-icon-btn {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.top-bar-icon-btn:active {
  color: var(--lime);
}

.top-bar-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.top-bar-badge:not(:empty) {
  display: flex;
}

/* Inbox unread pill for the coach bottom-nav Inbox tab. */
.coach-nav-msg-badge {
  position: absolute;
  top: 4px;
  right: 50%;
  transform: translateX(18px);
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  pointer-events: none;
}
.coach-nav-msg-badge:not(:empty) { display: flex; }

/* ========== VIEWS ========== */
.view {
  position: fixed;
  top: calc(var(--top-bar-height) + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(140px + env(safe-area-inset-bottom, 34px));
}

/* View enter/exit transitions */
.view.view-enter {
  animation: viewFadeIn 0.25s ease-out both;
}
.view.view-enter-forward {
  animation: viewSlideInRight 0.3s cubic-bezier(0.32, 0.72, 0, 1) both;
}
.view.view-enter-back {
  animation: viewSlideInLeft 0.3s cubic-bezier(0.32, 0.72, 0, 1) both;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes viewSlideInRight {
  from { opacity: 0; transform: translateX(60px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes viewSlideInLeft {
  from { opacity: 0; transform: translateX(-60px); }
  to { opacity: 1; transform: translateX(0); }
}

.view-content {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-md);
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

/* Fade content out at bottom — fixed overlay above content, below nav */
#appContainer.fullscreen-active::after,
#appContainer.chat-active::after { display: none; }
#appContainer::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(100px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, transparent 0%, var(--bg-primary) 60%);
  pointer-events: none;
  z-index: 99;
}


