/* Unorthodox Ops member app — Strava-style dark athletic theme (black/red).
   Faithful to the unorthodox-ops-app design language. Mobile-first. */

:root {
  --bg: #0a0a0c;
  --surface: #141417;
  --surface-2: #1b1b20;
  --line: rgba(255, 255, 255, 0.08);
  --red: #e10600;
  --red-dark: #a80400;
  --orange: #ea580c;
  --text: #f5f5f5;
  --muted: #9aa0ab;
  --green: #22c55e;
  --radius: 14px;
  --tabbar-h: 68px;
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100dvh;
}

body {
  max-width: 520px;
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

/* ---------- auth ---------- */
.auth-view {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(600px 300px at 50% -80px, rgba(225, 6, 0, 0.18), transparent),
    var(--bg);
}
.auth-inner { width: 100%; max-width: 380px; text-align: center; }
.brand-mark {
  width: 72px; height: 72px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 30px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border-radius: 18px; letter-spacing: 1px;
  box-shadow: 0 8px 28px rgba(225, 6, 0, 0.35);
}
.brand-word {
  font-family: var(--font-display); font-weight: 800; font-size: 34px;
  letter-spacing: 2px; margin: 0;
}
.brand-word span { color: var(--red); }
.brand-sub { color: var(--muted); margin: 6px 0 26px; font-size: 14px; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.auth-tab.on { background: var(--surface-2); color: var(--text); border-color: var(--red); }

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.field input {
  width: 100%; padding: 13px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font-size: 16px; font-family: var(--font-body);
}
.field input:focus { outline: none; border-color: var(--red); }

.auth-error {
  color: #ff6b61; font-size: 13px; margin: 0 0 12px;
}
.auth-note { color: var(--muted); font-size: 12px; text-align: center; margin: 14px 0 0; }

/* ---------- buttons ---------- */
.btn-red {
  display: inline-block; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff; font-weight: 700; font-size: 15px;
  padding: 13px 22px; border-radius: 12px; letter-spacing: 0.5px;
  box-shadow: 0 6px 20px rgba(225, 6, 0, 0.3);
  font-family: var(--font-body);
}
.btn-red:active { transform: scale(0.98); }
.btn-block { width: 100%; }

/* ---------- app frame ---------- */
.app-view { min-height: 100dvh; display: flex; flex-direction: column; }
.app-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: rgba(10, 10, 12, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.head-brand {
  font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: 1.5px;
}
.head-brand span { color: var(--red); }
.head-right { display: flex; align-items: center; gap: 10px; }
.member-badge {
  font-size: 11px; font-weight: 800; letter-spacing: 1.5px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.member-badge.pro { background: rgba(225, 6, 0, 0.15); color: #ff6b61; border-color: var(--red); }
.logout-btn {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  padding: 6px 10px; border-radius: 999px;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  cursor: pointer;
}
.logout-btn:active { transform: scale(0.96); }

.app-main {
  flex: 1;
  padding: 16px 16px calc(var(--tabbar-h) + 90px);
}
.view { display: none; animation: fadeUp 0.25s ease; }
.view.on { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-title {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  letter-spacing: 1.5px; text-transform: uppercase;
  margin: 22px 2px 10px; color: var(--text);
}

/* ---------- track ---------- */
.activity-chips, .target-chips { display: flex; gap: 8px; margin-bottom: 14px; }
.chip {
  flex: 1; padding: 10px 0; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-weight: 700; font-size: 13px; letter-spacing: 0.5px;
  font-family: var(--font-body);
}
.chip.on { background: rgba(225, 6, 0, 0.14); border-color: var(--red); color: #fff; }

.track-stage {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 6px;
}
.map-placeholder {
  height: 150px; border-radius: 10px; margin-bottom: 14px;
  background:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
    #0d0d10;
  background-size: 28px 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; border: 1px dashed var(--line);
}
.map-placeholder.live { border: 1px solid var(--red); color: #ff8a80; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px;
}
.stat-card small {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: var(--muted); margin-bottom: 4px;
}
.stat-card b {
  font-family: var(--font-display); font-weight: 800; font-size: 32px;
  letter-spacing: 0.5px; line-height: 1;
}
.stat-card .unit { font-size: 15px; color: var(--muted); margin-left: 3px; }

.record-btn {
  width: 108px; height: 108px; border-radius: 50%; border: none; cursor: pointer;
  display: block; margin: 4px auto 10px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  box-shadow: 0 10px 32px rgba(225, 6, 0, 0.4);
  color: #fff; font-family: var(--font-display); font-weight: 800;
  font-size: 22px; letter-spacing: 2px;
  transition: transform 0.15s ease;
}
.record-btn:active { transform: scale(0.95); }
.record-btn.recording {
  background: linear-gradient(135deg, #1b1b20, #2a2a30);
  border: 3px solid var(--red);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(225, 6, 0, 0.12); } }
.gps-status { text-align: center; color: var(--muted); font-size: 12px; margin: 0; }
.gps-status.live { color: var(--green); }

/* ---------- feed / cards ---------- */
.feed { display: flex; flex-direction: column; gap: 10px; }
.activity-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.activity-card .row-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.activity-ico {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(225, 6, 0, 0.14); color: var(--red);
  font-family: var(--font-display); font-weight: 800; font-size: 18px;
}
.activity-card h4 { margin: 0; font-size: 15px; font-weight: 700; }
.activity-card .date { margin-left: auto; color: var(--muted); font-size: 12px; }
.activity-stats { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }
.activity-stats b { color: var(--text); font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.empty-note { color: var(--muted); font-size: 14px; text-align: center; padding: 26px 10px; }

/* ---------- plans ---------- */
.plan-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.plan-card.active { border-color: var(--red); }
.plan-card h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; }
.plan-card .meta { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.plan-card .plan-desc { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.plan-card .btn-red { width: 100%; }
.plan-day {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.check {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--line); background: transparent; cursor: pointer; padding: 0;
}
.check.done { background: var(--green); border-color: var(--green); }
.plan-day small { color: var(--muted); display: block; font-size: 12px; }

/* ---------- fasting ---------- */
.fast-card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
}
.fast-ring { width: 210px; height: 210px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 12; }
.ring-fg {
  fill: none; stroke: var(--red); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 553; stroke-dashoffset: 553;
  transition: stroke-dashoffset 1s linear;
}
.fast-center { position: absolute; text-align: center; }
.fast-center b { font-family: var(--font-display); font-weight: 800; font-size: 42px; display: block; }
.fast-center small { color: var(--muted); font-size: 12px; }

/* ---------- coach ---------- */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 260px); min-height: 380px; }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; }
.msg {
  max-width: 85%; padding: 11px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.5;
}
.msg.user { align-self: flex-end; background: rgba(225, 6, 0, 0.18); border: 1px solid rgba(225,6,0,.4); }
.msg.coach { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.msg.coach b { color: var(--red); font-family: var(--font-display); letter-spacing: 1px; display: block; margin-bottom: 4px; font-size: 13px; }
.chat-typing { display: flex; gap: 6px; padding: 10px 4px; }
.chat-typing span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
  animation: blink 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 50% { opacity: 0.25; } }
.chat-remaining { font-size: 12px; color: var(--muted); padding: 2px 4px 6px; min-height: 18px; }
.chat-bar { display: flex; gap: 8px; padding-top: 8px; }
.chat-bar input {
  flex: 1; padding: 13px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 15px; font-family: var(--font-body);
}
.chat-bar input:focus { outline: none; border-color: var(--red); }

.lock-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px 22px; text-align: center;
}
.lock-card h3 { font-family: var(--font-display); font-size: 24px; letter-spacing: 1px; margin: 0 0 8px; }
.lock-card p { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

/* ---------- progress ---------- */
.stat-band {
  display: flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 10px; margin-bottom: 6px;
}
.stat-band > div { flex: 1; text-align: center; }
.stat-band > div + div { border-left: 1px solid var(--line); }
.stat-band b { font-family: var(--font-display); font-weight: 800; font-size: 34px; display: block; }
.stat-band .unit { font-size: 16px; color: var(--muted); }
.stat-band small { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 2px; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 10px 4px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar i {
  width: 100%; border-radius: 6px 6px 3px 3px; min-height: 4px;
  background: linear-gradient(180deg, var(--red), var(--red-dark));
}
.bar small { color: var(--muted); font-size: 10px; font-weight: 700; }

/* ---------- join banner + tabbar ---------- */
.join-banner {
  position: fixed; bottom: var(--tabbar-h); left: 50%; transform: translateX(-50%);
  width: min(520px, 100%); z-index: 9;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(20, 20, 23, 0.97); border-top: 1px solid var(--red);
}
.join-banner b { display: block; font-size: 13px; letter-spacing: 1px; }
.join-banner small { color: var(--muted); font-size: 12px; }

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(520px, 100%); height: var(--tabbar-h); z-index: 10;
  display: flex;
  background: rgba(10, 10, 12, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  font-family: var(--font-body);
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.tab.on { color: var(--red); }
