/* Shared styling for the free clinical note templates. Loaded after /assets/site.css. */

.tf-intro {
  max-width: 720px;
}

.tf-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 32px;
  align-items: start;
  margin: 32px 0 64px;
}

.tf-form { min-width: 0; }

.tf-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.tf-section h3 {
  margin: 0 0 4px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--teal-deep);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.tf-section .tf-section-note {
  font-size: 0.85rem;
  color: #526c69;
  margin: -8px 0 16px;
  max-width: none;
}

.tf-field { margin-bottom: 18px; }
.tf-field:last-child { margin-bottom: 0; }

.tf-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
}

.tf-field input[type="text"],
.tf-field input[type="date"] {
  width: 100%;
  max-width: 420px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--navy);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tf-field input:focus {
  outline: 2px solid var(--teal-light);
  outline-offset: 1px;
}

.tf-date-quick {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.tf-date-quick-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.tf-date-quick-btn:hover {
  border-color: var(--teal-light);
  background: var(--teal-mid);
  color: #ffffff;
}

/* Pill options */
.tf-option-group { margin-bottom: 10px; }
.tf-option-group:last-child { margin-bottom: 0; }

.tf-option-group-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #526c69;
  margin: 0 0 6px;
}

.tf-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tf-option {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.tf-option:hover { border-color: var(--teal-light); }

.tf-option[aria-pressed="true"] {
  background: var(--teal-mid);
  border-color: var(--teal-mid);
  color: #ffffff;
}

.tf-option[aria-pressed="true"]:hover {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
}

.tf-option--other { border-style: dashed; }

.tf-option--other[aria-pressed="true"] {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  border-style: solid;
}

.tf-other-input {
  margin-top: 8px;
  width: 100%;
  max-width: 320px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--teal-light);
  border-radius: 8px;
  background: #ffffff;
  display: block;
}

.tf-other-input[hidden] { display: none; }

/* Narrative panel */
.tf-narrative-panel {
  position: sticky;
  top: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal-light);
  border-radius: 12px;
  padding: 24px;
}

.tf-narrative-panel h3 {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--teal-deep);
}

.tf-narrative-panel .tf-narrative-hint {
  font-size: 0.8rem;
  color: #526c69;
  margin: 0 0 16px;
  max-width: none;
}

.tf-narrative {
  font-size: 0.92rem;
  color: var(--navy);
  line-height: 1.6;
}

.tf-narrative p {
  margin: 0 0 14px;
  max-width: none;
}

.tf-narrative p:last-child { margin-bottom: 0; }

.tf-blank {
  display: inline-block;
  background: #e9edf1;
  color: #66727e;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82em;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.4;
  cursor: pointer;
}

.tf-blank:hover,
.tf-blank:focus-visible { background: #dde3e9; text-decoration: underline; }

.tf-field { scroll-margin-top: 120px; }

.tf-field-flash { animation: tf-field-flash 5s ease-out; }

@keyframes tf-field-flash {
  0%, 50% { background: #c5ddd1; box-shadow: 0 0 0 8px #c5ddd1; }
  100% { background: transparent; box-shadow: 0 0 0 8px transparent; }
}

.tf-filled { font-weight: 700; }

.tf-copy-button {
  margin-top: 16px;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--teal-mid);
  color: #ffffff;
  transition: background 0.12s ease;
}

.tf-copy-button:hover { background: var(--teal-deep); }

.tf-copy-button.tf-copied { background: var(--teal-deep); }

.tf-copy-status {
  margin: 10px 0 0;
  font-size: 0.85rem;
  min-height: 1.2em;
  max-width: none;
}

/* Reuse site's form-status color conventions */
.tf-copy-status.form-status-success { color: var(--teal-mid); }
.tf-copy-status.form-status-error { color: #b3453f; }

.tf-field .tf-field-hint {
  font-size: 0.8rem;
  color: #526c69;
  margin: 6px 0 0;
  max-width: none;
}

/* Shown after a successful copy until the note changes */
.tf-after-copy { margin-top: 4px; }

.tf-after-copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--teal-deep);
}

.tf-next-patient {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--teal-deep);
  background: #ffffff;
  color: var(--teal-deep);
  cursor: pointer;
}

.tf-next-patient:hover { background: var(--teal-deep); color: #ffffff; }

.tf-after-copy .tf-bookmark-hint {
  font-size: 0.8rem;
  color: #526c69;
  margin: 8px 0 0;
  max-width: none;
}

/* Side column wrapping the narrative panel + CDT panel */
.tf-side-panels {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.tf-side-panels .tf-narrative-panel {
  position: static;
}

/* CDT code picker */
.tf-cdt-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.tf-cdt-panel h3 {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--teal-deep);
}

.tf-cdt-hint {
  font-size: 0.8rem;
  color: #526c69;
  margin: 0 0 16px;
  max-width: none;
}

.tf-cdt-categories {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tf-cdt-categories[hidden] { display: none; }

.tf-cdt-category {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.tf-cdt-category:hover {
  border-color: var(--teal-light);
  background: var(--teal-mid);
  color: #ffffff;
}

.tf-cdt-back {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0;
  border: none;
  background: none;
  color: var(--teal-deep);
  cursor: pointer;
  margin-bottom: 12px;
}

.tf-cdt-back:hover { text-decoration: underline; }

.tf-cdt-category-heading {
  font-size: 0.78rem;
  font-weight: 600;
  color: #526c69;
  margin: 0 0 8px;
}

.tf-cdt-codes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tf-cdt-codes[hidden] { display: none; }

.tf-cdt-code-row {
  font-family: inherit;
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.tf-cdt-code-row:hover:not(:disabled) {
  border-color: var(--teal-light);
  background: var(--teal-mid);
}

.tf-cdt-code-row:hover:not(:disabled) .tf-cdt-code,
.tf-cdt-code-row:hover:not(:disabled) .tf-cdt-description,
.tf-cdt-code-row:hover:not(:disabled) .tf-cdt-row-status {
  color: #ffffff;
}

.tf-cdt-code-row[data-added="true"] {
  background: #f0f3f2;
  cursor: default;
  opacity: 0.7;
}

.tf-cdt-code {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--navy);
  flex-shrink: 0;
}

.tf-cdt-description {
  font-size: 0.85rem;
  color: var(--navy);
  flex: 1;
}

.tf-cdt-row-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--teal-deep);
  flex-shrink: 0;
}

.tf-cdt-code-row[data-added="true"] .tf-cdt-row-status {
  color: #526c69;
}

/* Selected CDT codes, rendered inside the narrative panel */
.tf-cdt-selected {
  margin: 16px 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.tf-cdt-selected[hidden] { display: none; }

.tf-cdt-selected-heading {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--teal-deep);
  margin: 0 0 8px;
}

.tf-cdt-selected-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--navy);
  padding: 6px 0;
}

.tf-cdt-remove {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1;
  border: none;
  background: none;
  color: #b3453f;
  cursor: pointer;
  padding: 2px 6px;
  flex-shrink: 0;
}

.tf-cdt-remove:hover { color: #8a332e; }

/* Mobile: stack narrative below form, drop sticky positioning */
@media (max-width: 860px) {
  .tf-layout {
    grid-template-columns: 1fr;
    padding: 0 20px;
    margin: 24px auto 48px;
  }

  .tf-side-panels {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

/* An editor toolbar that stays available on long notes. */
.tf-toolbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 18px; margin-top: 24px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 4px 16px #183b3010; }
.tf-toolbar label { font-size: .7rem; color: #526c69; font-weight: 600; }
.tf-toolbar select { display: block; max-width: 260px; padding: 7px 30px 7px 0; border: 0; background: white; color: var(--teal-deep); font-size: .85rem; font-weight: 600; }
.tf-progress { font-size: .75rem; color: #526c69; }
.tf-toolbar-actions { display: flex; gap: 8px; margin-left: auto; }
.tf-toolbar button { padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--teal-deep); font-size: .85rem; font-weight: 600; cursor: pointer; }
.tf-toolbar .tf-toolbar-copy { background: var(--teal-deep); color: white; }
.tf-toolbar button:hover { border-color: var(--teal-deep); }
.tf-view-switch { display: none; }
.tf-reset-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex-basis: 100%; border-top: 1px solid var(--border); padding-top: 12px; font-size: .85rem; }
.tf-reset-confirm span { margin-right: auto; }
.tf-report { display: grid; gap: 10px; flex-basis: 100%; border-top: 1px solid var(--border); padding-top: 12px; }
.tf-report[hidden] { display: none; }
.tf-toolbar .tf-report label { display: grid; gap: 4px; font-size: .8rem; color: var(--navy); }
.tf-report textarea, .tf-report input[type="email"] { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: .9rem; color: var(--navy); background: #fff; }
.tf-report textarea { resize: vertical; min-height: 80px; }
.tf-report textarea:focus, .tf-report input[type="email"]:focus { outline: 2px solid var(--teal-light); outline-offset: 1px; }
.tf-report .hp-field { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.tf-report-hint { margin: 0; font-size: .75rem; color: #526c69; }
.tf-report-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tf-toolbar .tf-report-send { background: var(--teal-deep); color: white; }
.tf-toolbar .tf-report-send:disabled { opacity: .7; cursor: default; }
.tf-report .form-status { margin: 0; min-height: 0; }
.tf-section { scroll-margin-top: 120px; padding: 28px; }
.tf-layout { grid-template-columns: minmax(0, 1fr) 390px; gap: 24px; margin-top: 24px; }
.tf-side-panels { top: 105px; max-height: calc(100vh - 130px); }
.tf-section h3 { font-size: .9rem; text-transform: none; letter-spacing: 0; padding-bottom: 16px; }
.tf-field { margin-bottom: 24px; }
.tf-option { border-radius: 8px; min-height: 42px; font-size: .82rem; }
.tf-option[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--teal-deep); }
.tf-narrative-panel { border-left: 1px solid var(--border); border-top: 3px solid var(--teal-mid); }
.tf-narrative-panel h3 { text-transform: none; font-size: 1.05rem; letter-spacing: -.02em; }
.tf-narrative { line-height: 1.8; }
.tf-blank { font-family: inherit; color: #52606c; }
.tf-field input[type="text"], .tf-field input[type="date"] { font-size: 1rem; }
@media (max-width: 860px) {
  .tf-layout { grid-template-columns: minmax(0, 1fr); padding: 0; }
  .tf-side-panels { position: static; max-height: none; }
  .tf-view-switch { display: flex; gap: 4px; }
  .tf-view-switch button[aria-pressed="true"] { background: #e6f0eb; border-color: var(--teal-deep); }
  .tf-layout[data-view="form"] .tf-side-panels { display: none; }
  .tf-layout[data-view="preview"] .tf-form { display: none; }
  .tf-toolbar { gap: 10px; padding: 12px; }
  .tf-progress { flex-basis: 100%; order: 4; }
  .tf-section { scroll-margin-top: 190px; padding: 20px; }
  .tf-reset-confirm { order: 5; }
  .tf-report { order: 6; }
}
@media (max-width: 540px) {
  .tf-toolbar label { flex-basis: 100%; }
  .tf-toolbar select { max-width: 100%; width: 100%; }
  .tf-toolbar button { padding: 10px; font-size: .75rem; }
  .tf-toolbar-actions { gap: 4px; }
  .tf-option { padding: 9px 12px; }
}
