/* ══════════════════════════════════════════
   CPA Logger -- Shared Styles
   ══════════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f5f7fa; color: #1a1a2e; line-height: 1.5;
  padding: 0 0 4rem;
}

/* ── Layout ── */
.container { max-width: 480px; margin: 0 auto; padding: 1rem; }
header {
  background: #2E75B6; color: #fff; padding: 1.25rem 1rem;
  text-align: center; position: sticky; top: 0; z-index: 100;
}
header h1 { font-size: 1.25rem; font-weight: 600; }
header .date { font-size: 0.85rem; opacity: 0.85; margin-top: 0.25rem; }

/* ── Back link ── */
.back-link {
  display: inline-block; margin-bottom: 0.75rem;
  font-size: 0.9rem; color: #2E75B6; text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

/* ── Auth screen ── */
#auth-screen { text-align: center; padding: 3rem 1rem; }
#auth-screen h2 { font-size: 1.2rem; margin-bottom: 0.5rem; }
#auth-screen p { color: #555; font-size: 0.9rem; margin-bottom: 1.5rem; }
#auth-screen input {
  font-size: 1.5rem; text-align: center; letter-spacing: 0.3em;
  text-transform: uppercase; width: 10rem; padding: 0.75rem;
  border: 2px solid #ccc; border-radius: 8px; outline: none;
}
#auth-screen input:focus { border-color: #2E75B6; }
#auth-error { color: #d32f2f; font-size: 0.85rem; margin-top: 0.75rem; min-height: 1.25rem; }
#auth-btn {
  display: block; margin: 1.25rem auto 0; padding: 0.75rem 2.5rem;
  background: #2E75B6; color: #fff; border: none; border-radius: 8px;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  min-height: 44px; min-width: 44px;
}
#auth-btn:disabled { opacity: 0.5; }

/* ── Sections ── */
.section {
  background: #fff; border-radius: 12px; padding: 1.25rem;
  margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.section-title {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: #2E75B6; margin-bottom: 1rem;
}

/* ── Field groups ── */
.field { margin-bottom: 1.25rem; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.4rem;
}
.field .hint { font-size: 0.8rem; color: #777; margin-bottom: 0.4rem; }

/* ── Inputs ── */
input[type="number"], input[type="text"], input[type="date"], textarea {
  width: 100%; padding: 0.7rem 0.75rem; font-size: 1rem;
  border: 1.5px solid #d0d5dd; border-radius: 8px; outline: none;
  background: #fff; appearance: none; -webkit-appearance: none;
  min-height: 44px;
}
input:focus, textarea:focus { border-color: #2E75B6; box-shadow: 0 0 0 3px rgba(46,117,182,0.12); }
textarea { resize: vertical; min-height: 5rem; }

/* ── Slider (1-10 scale) ── */
.scale-group { display: flex; flex-direction: column; gap: 0.35rem; }
.scale-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: #888; }
.scale-row { display: flex; align-items: center; gap: 0.5rem; }
.scale-row input[type="range"] { flex: 1; min-height: 44px; accent-color: #2E75B6; }
.scale-value {
  min-width: 2rem; text-align: center; font-weight: 700;
  font-size: 1.1rem; color: #2E75B6;
}

/* ── Toggle (Yes/No) ── */
.toggle-group { display: flex; gap: 0.5rem; }
.toggle-group button {
  flex: 1; padding: 0.65rem; border: 2px solid #d0d5dd;
  border-radius: 8px; background: #fff; font-size: 0.95rem;
  font-weight: 600; cursor: pointer; min-height: 44px;
  transition: all 0.15s;
}
.toggle-group button.active-yes { border-color: #2E75B6; background: #e8f0fe; color: #2E75B6; }
.toggle-group button.active-no { border-color: #888; background: #f0f0f0; color: #444; }

/* ── Radio group ── */
.radio-group { display: flex; flex-direction: column; gap: 0.4rem; }
.radio-option {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.75rem; border: 1.5px solid #d0d5dd;
  border-radius: 8px; cursor: pointer; min-height: 44px;
  transition: all 0.15s;
}
.radio-option.selected { border-color: #2E75B6; background: #e8f0fe; }
.radio-option input[type="radio"] { display: none; }
.radio-dot {
  width: 20px; height: 20px; border: 2px solid #bbb; border-radius: 50%;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.radio-option.selected .radio-dot { border-color: #2E75B6; }
.radio-option.selected .radio-dot::after {
  content: ""; width: 10px; height: 10px; background: #2E75B6; border-radius: 50%;
}
.radio-label { font-size: 0.95rem; }

/* ── Checkbox pain areas ── */
.pain-area-list { display: flex; flex-direction: column; gap: 0.4rem; }
.pain-area-item {
  border: 1.5px solid #d0d5dd; border-radius: 8px;
  overflow: hidden; transition: all 0.15s;
}
.pain-area-item.checked { border-color: #2E75B6; background: #f0f6ff; }
.pain-area-toggle {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.75rem; cursor: pointer; min-height: 44px;
}
.pain-area-toggle input[type="checkbox"] { display: none; }
.check-box {
  width: 22px; height: 22px; border: 2px solid #bbb; border-radius: 4px;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.pain-area-item.checked .check-box {
  background: #2E75B6; border-color: #2E75B6;
}
.pain-area-item.checked .check-box::after {
  content: "\2713"; color: #fff; font-size: 0.85rem; font-weight: 700;
}
.pain-area-name { font-size: 0.95rem; }
.pain-area-detail {
  display: none; padding: 0.4rem 0.75rem 0.65rem;
  border-top: 1px solid #e8ecf0;
}
.pain-area-item.checked .pain-area-detail { display: block; }
.pain-area-rating {
  display: flex; align-items: center; gap: 0.5rem;
}
.pain-area-rating input[type="range"] { flex: 1; min-height: 36px; accent-color: #2E75B6; }
.pain-area-rating .pain-val {
  min-width: 1.8rem; text-align: center; font-weight: 700;
  font-size: 1rem; color: #2E75B6;
}
.pain-area-descriptor {
  display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem;
}
.pain-area-descriptor .desc-chip {
  padding: 0.3rem 0.65rem; font-size: 0.8rem; border: 1.5px solid #d0d5dd;
  border-radius: 16px; background: #fff; cursor: pointer; transition: all 0.15s;
}
.pain-area-descriptor .desc-chip.selected {
  border-color: #2E75B6; background: #e8f0fe; color: #2E75B6; font-weight: 600;
}

/* ── Other text input inside radio/checkbox ── */
.other-text {
  margin-top: 0.35rem; padding: 0.5rem 0.75rem; font-size: 0.9rem;
  border: 1.5px solid #d0d5dd; border-radius: 6px; width: 100%;
  display: none;
}
.radio-option.selected .other-text, .pain-area-item.checked .other-text { display: block; }

/* ── Conditional sections ── */
.conditional { display: none; }
.conditional.visible { display: block; }

/* ── Submit ── */
.submit-btn {
  display: block; width: 100%; padding: 1rem; margin-top: 0.5rem;
  background: #2E75B6; color: #fff; border: none; border-radius: 12px;
  font-size: 1.1rem; font-weight: 700; cursor: pointer; min-height: 52px;
  transition: opacity 0.15s;
}
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.submit-error {
  color: #d32f2f; text-align: center; font-size: 0.9rem;
  margin-top: 0.75rem; min-height: 1.25rem;
}

/* ── Success screen ── */
#success-screen {
  display: none; text-align: center; padding: 4rem 1rem;
}
#success-screen .checkmark {
  width: 80px; height: 80px; border-radius: 50%; background: #4caf50;
  margin: 0 auto 1.5rem; display: flex; align-items: center; justify-content: center;
}
#success-screen .checkmark::after {
  content: "\2713"; color: #fff; font-size: 2.5rem; font-weight: 700;
}
#success-screen h2 { font-size: 1.4rem; margin-bottom: 0.5rem; }
#success-screen p { color: #555; font-size: 1rem; }
#success-screen a { color: #2E75B6; text-decoration: none; font-weight: 600; }
#success-screen a:hover { text-decoration: underline; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Chooser grid ── */
.chooser-grid {
  display: flex; flex-direction: column; gap: 0.75rem;
  margin-top: 1rem;
}
.chooser-card {
  display: flex; align-items: center; gap: 1rem;
  background: #fff; border-radius: 12px; padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-decoration: none; color: #1a1a2e;
  border: 1.5px solid transparent;
  transition: all 0.15s; min-height: 72px;
}
.chooser-card:hover, .chooser-card:active {
  border-color: #2E75B6; background: #f0f6ff;
}
.chooser-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.chooser-icon.check-in { background: #e8f0fe; color: #2E75B6; }
.chooser-icon.activity { background: #e8f5e9; color: #388e3c; }
.chooser-icon.visit { background: #fff3e0; color: #e65100; }
.chooser-text h2 { font-size: 1rem; font-weight: 600; }
.chooser-text p { font-size: 0.8rem; color: #777; margin-top: 0.15rem; }

.welcome-name {
  font-size: 1.1rem; font-weight: 600; color: #1a1a2e;
  margin-bottom: 0.25rem;
}

/* ── Suggestion chips (for activity/practitioner seeded lists) ── */
.suggestion-chips {
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem;
}
.suggestion-chip {
  padding: 0.35rem 0.75rem; font-size: 0.85rem;
  border: 1.5px solid #d0d5dd; border-radius: 16px;
  background: #fff; cursor: pointer; transition: all 0.15s;
}
.suggestion-chip:hover { border-color: #2E75B6; background: #f0f6ff; }
.suggestion-chip.selected {
  border-color: #2E75B6; background: #e8f0fe; color: #2E75B6; font-weight: 600;
}
