/* 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: #6b8583;
  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: #6b8583;
  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: #6b8583;
  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;
}

.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; }

/* 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: #6b8583;
  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: #6b8583;
  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: #6b8583;
}

/* 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;
  }
}
