/* ═══════════════════════════════════════════════════════════════════
   Olya's PT — Base Styles
   Warm & encouraging theme
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS Reset & Box-Sizing ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Custom Properties ──────────────────────────────────────────── */
:root {
  --bg:            #fef9f0;   /* soft cream */
  --card:          #ffffff;
  --card-border:   #f0e6d4;
  --primary:       #e8a87c;   /* warm coral */
  --success:       #85cdca;   /* soft teal */
  --text:          #5a4a3a;   /* warm dark brown */
  --text-secondary:#a08b6e;   /* muted gold */
  --pain:          #d4a5a5;   /* dusty rose */

  --radius-card:   12px;
  --radius-btn:    8px;
  --nav-height:    64px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          Helvetica, Arial, sans-serif, "Apple Color Emoji",
          "Segoe UI Emoji", "Segoe UI Symbol";
}

/* ── Base ───────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* ── Screen Positioning ─────────────────────────────────────────── */
.screen {
  display: none;           /* hidden by default */
  position: absolute;
  inset: 0;
  bottom: var(--nav-height);
  overflow-y: auto;
  flex-direction: column;
  background: var(--bg);
}

.screen.active {
  display: flex;
}

/* Login screen extends to full height (no nav) */
#screen-login {
  bottom: 0;
}

/* ── Login Screen ────────────────────────────────────────────────── */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 2rem 1.5rem;
  text-align: center;
  gap: 1rem;
}

.login-logo {
  font-size: 56px;
  line-height: 1;
}

.login-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 260px;
}

.btn-google {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btn-google:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.btn-google:active {
  transform: scale(0.98);
}

.google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.login-error {
  font-size: 0.875rem;
  color: var(--pain);
  min-height: 1.25rem; /* reserve space so layout doesn't jump */
}

/* ── Bottom Nav ─────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: var(--card);
  border-top: 1px solid var(--card-border);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}

/* [hidden] on the nav — browsers hide it but we want flex when visible */
.bottom-nav[hidden] {
  display: none;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  position: relative;
  transition: color 0.15s ease;
  padding: 0.25rem 0;
}

.nav-tab.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 1.375rem;
  line-height: 1;
}

.nav-label {
  line-height: 1;
}

/* Nav badge — small coral dot (e.g. active session indicator) */
.nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--card);
}

.nav-badge[hidden] {
  display: none;
}

/* ── Screen Content Placeholder ─────────────────────────────────── */
.screen-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ── Shared Card Component ──────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
}

.card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-btn);
  background: var(--primary);
  color: #fff;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-btn);
  background: var(--card);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.btn-secondary:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.btn-secondary:active {
  transform: scale(0.97);
}

/* ── Dashboard ──────────────────────────────────────────────────── */
.dashboard-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.dashboard-name { font-size: 20px; font-weight: 600; }
.week-pills { display: flex; gap: 6px; margin-bottom: 8px; }
.week-pill { flex: 1; text-align: center; padding: 8px 0; background: var(--card-border); border-radius: 6px; font-size: 12px; color: var(--text-secondary); }
.week-pill.completed { background: var(--success); color: white; }
.week-pill.today { background: var(--primary); color: white; }
.week-pill.missed { background: var(--pain); color: white; opacity: 0.7; }
.week-progress { font-size: 13px; color: var(--success); font-weight: 500; }
.pain-picker { display: flex; gap: 8px; }
.pain-btn { font-size: 28px; background: none; border: 2px solid transparent; border-radius: 8px; padding: 4px 8px; cursor: pointer; transition: border-color 0.2s, transform 0.2s; }
.pain-btn:active { transform: scale(1.1); }
.pain-btn.selected { border-color: var(--primary); }

/* Exercise Session */
.exercise-nav { display: flex; justify-content: space-between; margin-bottom: 12px; }
.exercise-demo { background: var(--card-border); border-radius: var(--radius-card); min-height: 180px; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; overflow: hidden; }
.exercise-gif { width: 100%; height: auto; max-height: 220px; object-fit: contain; }
.exercise-placeholder { font-size: 48px; }
.video-container { position: relative; width: 100%; padding-top: 56.25%; }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: var(--radius-card); border: none; }
.exercise-info { text-align: center; margin-bottom: 16px; }
.exercise-name { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.exercise-prescription { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.exercise-cues { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.timer-area { text-align: center; min-height: 60px; margin-bottom: 12px; }
.timer-display { font-size: 42px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.timer-rest { color: var(--success); }
.timer-label { font-size: 12px; color: var(--text-secondary); }
.set-tracker { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.set-circle { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.set-done { background: var(--success); color: white; }
.set-current { background: var(--primary); color: white; }
.set-pending { background: var(--card-border); color: var(--text-secondary); }
.exercise-buttons { display: flex; gap: 8px; }
.taping-reminder { border-left: 4px solid var(--primary); }

/* Summary */
.summary-container { text-align: center; padding-top: 40px; }
.summary-emoji { font-size: 56px; margin-bottom: 12px; }
.summary-title { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.summary-stat { font-size: 15px; color: var(--text-secondary); }

/* Settings */
.day-picker { display: flex; gap: 4px; }
.day-btn { flex: 1; padding: 10px 0; text-align: center; border: none; background: var(--card-border); border-radius: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; transition: background 0.2s, color 0.2s; }
.day-btn.active { background: var(--success); color: white; }
.setting-row { display: flex; justify-content: space-between; align-items: center; }
.toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--card-border); border-radius: 12px; cursor: pointer; transition: background 0.3s; }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; background: white; border-radius: 50%; transition: transform 0.3s; }
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.time-input { border: 1px solid var(--card-border); border-radius: var(--radius-btn); padding: 8px 12px; font-size: 14px; color: var(--text); background: var(--bg); }

/* Progress */
.screen-title { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.heatmap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; margin-bottom: 8px; }
.heatmap-cell { aspect-ratio: 1; border-radius: 3px; }
.cell-done { background: var(--success); }
.cell-missed { background: var(--pain); opacity: 0.6; }
.cell-current { background: var(--primary); }
.cell-future { background: var(--card-border); opacity: 0.5; }
.stats-row { display: flex; gap: 8px; margin-bottom: 12px; }
.stat-card { flex: 1; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-card); padding: 12px; text-align: center; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-secondary); }
.chart-bars { display: flex; align-items: flex-end; gap: 2px; height: 80px; }
.chart-bar-wrapper { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; border-radius: 2px 2px 0 0; min-height: 4px; transition: height 0.3s; }
.chart-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-secondary); margin-top: 4px; }
.forecast-row { display: flex; gap: 8px; justify-content: space-between; }
.forecast-day { text-align: center; flex: 1; }
.forecast-icon { font-size: 24px; }
.forecast-temp { font-size: 14px; font-weight: 600; }
.forecast-label { font-size: 11px; color: var(--text-secondary); }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (min-width: 480px) {
  .screen-content { max-width: 420px; margin: 0 auto; }
}

/* ── Animations ───────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, .pain-btn, .day-btn, .week-pill {
  transition: transform 0.1s, opacity 0.2s;
}
.btn-primary:active, .btn-secondary:active { transform: scale(0.97); }

/* ── Scrollbar ────────────────────────────────────────────────────── */
.screen::-webkit-scrollbar { width: 0; }
