/* ════════════════════════════════════════════════════════════════
   profile.css — Profile / account page
   Visual language follows the approved mockup (profile-1a.html),
   implemented on the app's shared design tokens (:root in style.css)
   so it stays theme-aware and consistent with the rest of the app.
   Namespaced under .pf-. Inputs are ≥16px to avoid iOS focus-zoom.
   ════════════════════════════════════════════════════════════════ */

.pf-view {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px max(20px, 4vw) 96px;
}

/* ── Page header ──────────────────────────────────────────────────── */
.pf-head { margin-bottom: 22px; }
.pf-head h1 {
  margin: 0 0 4px;
  font-weight: 800; font-size: 26px; color: var(--ink);
  letter-spacing: -.02em;
}
.pf-head p { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); }

/* ── Card ─────────────────────────────────────────────────────────── */
.pf-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.pf-label {
  margin: 0 0 16px;
  font-size: 11px; font-weight: 800; letter-spacing: .12em;
  color: var(--muted); text-transform: uppercase;
}

/* ── Account (avatar + fields) ────────────────────────────────────── */
.pf-account { display: flex; gap: 20px; align-items: flex-start; }
.pf-avatar-wrap { position: relative; flex: none; }
.pf-avatar {
  width: 76px; height: 76px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  color: #fff; font-family: var(--mono); font-weight: 700; font-size: 26px;
  letter-spacing: -.02em;
}
.pf-avatar-edit {
  position: absolute; right: -3px; bottom: -3px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line-strong);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-sm);
}
.pf-fields { flex: 1; min-width: 0; }

/* ── Fields ───────────────────────────────────────────────────────── */
.pf-field { margin-bottom: 14px; }
.pf-field:last-child { margin-bottom: 0; }
.pf-field-label {
  display: block; margin: 0 0 7px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.pf-input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 11px;
  background: var(--surface-2); color: var(--ink);
  font-family: var(--font); font-size: 16px; font-weight: 600;
  outline: none; transition: border .15s, background .15s;
}
.pf-input:focus { border-color: var(--accent); background: var(--surface); }
.pf-input[readonly] { color: var(--muted); cursor: default; }
select.pf-input { cursor: pointer; }
.pf-actions-right { display: flex; justify-content: flex-end; margin-top: 18px; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.pf-btn {
  padding: 11px 18px; border-radius: 11px;
  font-family: var(--font); font-size: 14px; font-weight: 800;
  cursor: pointer; touch-action: manipulation;
  transition: opacity .15s, background .15s, border-color .15s;
}
.pf-btn-primary {
  border: none; background: var(--accent); color: #fff;
  box-shadow: 0 8px 18px -8px var(--accent);
}
.pf-btn-primary:hover { background: var(--accent-strong); }
.pf-btn-gold {
  border: none; background: #F6C066; color: #3A2500; font-weight: 800;
  white-space: nowrap;
}
.pf-btn-gold:hover { background: #F2B24A; }
.pf-btn-ghost {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.pf-btn-ghost:hover { background: var(--surface-2); }
.pf-btn-ghost:disabled { opacity: .5; cursor: not-allowed; }
.pf-btn-sm { padding: 8px 14px; font-size: 13px; }

/* ── Settings rows (icon tile + text + right-aligned control) ──────── */
.pf-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.pf-row:first-of-type { padding-top: 4px; }
.pf-row:last-child { border-bottom: none; padding-bottom: 2px; }
.pf-row-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pf-icon {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.pf-icon-accent  { background: var(--accent-soft); color: var(--accent-strong); }
.pf-icon-neutral { background: var(--surface-2);   color: var(--ink-2); }
.pf-row-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.pf-row-sub   {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-row-control { flex: none; }
.pf-select {
  height: 42px; padding: 0 12px; max-width: 46vw;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-family: var(--font); font-size: 16px; font-weight: 600;
  cursor: pointer; outline: none;
}
.pf-select:focus { border-color: var(--accent); }

/* ── Subscription (premium dark card — intentional in both themes) ── */
.pf-sub {
  position: relative; overflow: hidden;
  border-radius: 16px; padding: 24px 26px; margin-bottom: 16px;
  background: linear-gradient(145deg, #13315B 0%, #0B1D34 100%);
  box-shadow: 0 16px 34px -22px rgba(11, 29, 52, .9);
}
.pf-sub::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 100% 0%, rgba(59, 77, 224, .28), transparent 60%);
}
.pf-sub-inner {
  position: relative;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.pf-sub-label {
  margin: 0 0 10px;
  font-size: 11px; font-weight: 800; letter-spacing: .12em;
  color: #8FA2C4; text-transform: uppercase;
}
.pf-flex { display: flex; align-items: center; gap: 10px; }
.pf-sub-title { font-weight: 800; font-size: 22px; color: #fff; letter-spacing: -.01em; }
.pf-pill {
  padding: 4px 10px; border-radius: 999px;
  background: #F6C066; color: #5A3B00;
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.pf-sub-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.pf-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #34D399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .22);
}
.pf-sub-status span:last-child { font-size: 13.5px; color: #C6D2E6; }

/* ── Sidebar user row: clickable affordance ───────────────────────── */
.nav-user-main {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  background: none; border: none; padding: 0; margin: 0;
  cursor: pointer; text-align: left;
  font-family: var(--font); touch-action: manipulation;
}

/* ── Mobile ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .pf-view { padding: 20px 16px 96px; }
  .pf-head h1 { font-size: 23px; }
  .pf-account { flex-direction: column; align-items: center; text-align: center; }
  .pf-fields { width: 100%; text-align: left; }
  .pf-actions-right .pf-btn-primary { width: 100%; }
  /* Stack the language dropdowns under their label so they never overflow
     the screen on narrow phones (inline max-width clipped on the right). */
  .pf-row-select { flex-wrap: wrap; }
  .pf-row-select .pf-row-main { width: 100%; }
  .pf-row-select .pf-select { width: 100%; max-width: none; margin-top: 10px; }
  .pf-sub-inner { flex-direction: column; }
  .pf-sub-inner .pf-btn-gold { width: 100%; }
}

/* ── Legal links ───────────────────────────────────────────────────
   Sits at the very bottom of the profile page. Deliberately quiet — it
   is there so a coach (or a payment reviewer) can always reach the
   terms from inside the app, not to compete with the real controls. */
.pf-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 0;
  font-size: 12.5px;
  color: #9aa1ad;
}
.pf-legal a {
  color: #6b7280;
  text-decoration: none;
  font-weight: 600;
}
.pf-legal a:hover { color: #3a55e6; text-decoration: underline; }

/* ── Delete account ────────────────────────────────────────────────
   The one destructive control in the app, so it looks like one: red
   ink, red button, and a card that reads as a warning rather than
   another settings row. */
.pf-danger { border-color: var(--bad-soft); }
.pf-label-danger { color: var(--bad); }
.pf-icon-danger { background: var(--bad-soft); color: var(--bad); }
.pf-btn-danger {
  border: 1px solid var(--bad); background: var(--bad); color: #fff;
}
.pf-btn-danger:hover { background: #b8352f; border-color: #b8352f; }
.pf-btn-danger:disabled { opacity: .45; cursor: not-allowed; }

/* On a phone the button drops under the text instead of being squeezed
   into a column beside it. */
@media (max-width: 560px) {
  .pf-row-stack { flex-direction: column; align-items: stretch; gap: 12px; }
  .pf-row-stack .pf-row-control { width: 100%; }
}

/* ── Confirmation modal ────────────────────────────────────────────
   Built in profile.js, same overlay pattern as the upgrade gate. */
.pf-modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(20, 23, 31, .55);
  backdrop-filter: blur(2px);
}
.pf-modal {
  width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 26px;
}
.pf-modal h2 {
  margin: 0 0 10px; font-size: 20px; font-weight: 800; color: var(--ink);
}
.pf-modal p { margin: 0 0 10px; font-size: 14px; color: var(--muted); line-height: 1.55; }
.pf-modal-list {
  margin: 0 0 14px; padding-left: 20px;
  font-size: 14px; color: var(--muted); line-height: 1.75;
}
.pf-modal-fine {
  padding: 11px 13px; margin-bottom: 16px;
  background: var(--bad-soft); border-radius: var(--radius-xs);
  font-size: 13px; color: #8f2f2a;
}
.pf-modal .pf-field-label { display: block; margin-bottom: 6px; }
.pf-modal .pf-input { width: 100%; }
.pf-modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px;
}
@media (max-width: 460px) {
  .pf-modal-actions { flex-direction: column-reverse; }
  .pf-modal-actions .pf-btn { width: 100%; }
}
