/* WhatsApp template catalog page */

.wt-page {

  max-width: 900px;

  margin: 0 auto;

  padding: 2rem clamp(1rem, 3vw, 1.75rem) 3rem;

}



.wt-title {

  font-weight: 600;

  font-size: clamp(1.25rem, 2.5vw, 1.6rem);

  margin: 0 0 0.35rem;

  color: var(--color-ink-slate);

}



.wt-lede {

  margin: 0;

  color: var(--color-text-muted);

  font-size: var(--font-size-md);

}



.wt-help-panel {

  border: 1px solid var(--color-border);

  border-radius: var(--radius-sm);

  margin-bottom: 1.25rem;

  background: var(--color-surface-2);

}



.wt-help-panel__summary {

  cursor: pointer;

  padding: 0.75rem 1rem;

  font-weight: 600;

  font-size: var(--font-size-sm);

  color: var(--color-text-emphasis);

  list-style: none;

}



.wt-help-panel__summary::-webkit-details-marker {

  display: none;

}



.wt-help-panel__body {

  padding: 0 1rem 0.85rem;

  font-size: var(--font-size-sm);

  color: var(--color-text-secondary);

  line-height: 1.55;

}



.wt-help-steps {

  margin: 0;

  padding-left: 1.2rem;

}



.wt-help-steps li {

  margin-bottom: 0.35rem;

}



.wt-suggestions-intro {

  font-size: var(--font-size-sm);

  color: var(--color-text-muted);

  line-height: 1.5;

  margin: 0 0 1rem;

  padding: 0.75rem 1rem;

  background: var(--media-step-violet-soft);

  border: 1px solid var(--color-success-border);

  border-radius: var(--radius-sm);

}



.wt-card--suggestion {

  border-style: dashed;

}



.wt-banner {

  border-radius: var(--radius-sm);

  padding: 0.85rem 1rem;

  margin-bottom: 1.25rem;

  font-size: var(--font-size-sm);

}



.wt-banner--warn {

  background: var(--color-warning-surface);

  border: 1px solid var(--color-warning-soft);

  color: var(--color-warning-deep);

}



.wt-tabs {

  display: flex;

  gap: 0.5rem;

  margin-bottom: 1.25rem;

}



.wt-tab {

  border: 1px solid var(--color-border);

  background: var(--color-surface);

  border-radius: var(--radius-sm);

  padding: 0.45rem 1rem;

  font-size: var(--font-size-sm);

  cursor: pointer;

  color: var(--color-text-secondary);

}



.wt-tab.is-active {

  background: var(--brand-green-50);

  border-color: var(--brand-green);

  color: var(--brand-green-strong);

  font-weight: 600;

}



.wt-card {

  border: 1px solid var(--color-border-google);

  border-radius: var(--radius-md);

  padding: 1rem 1.1rem;

  margin-bottom: 0.75rem;

  background: var(--color-surface);

}



.wt-card-header {

  display: flex;

  justify-content: space-between;

  align-items: flex-start;

  gap: 0.75rem;

  margin-bottom: 0.5rem;

}



.wt-card-title {

  font-weight: 600;

  font-size: var(--font-size-base);

  margin: 0;

  color: var(--color-ink-slate);

}



.wt-card-meta {

  font-size: var(--font-size-xs);

  color: var(--color-text-faint);

}



.wt-card-body {

  font-size: var(--font-size-sm);

  color: var(--color-text-secondary);

  line-height: 1.45;

  white-space: pre-wrap;

}



.wt-status {

  font-size: var(--font-size-2xs);

  font-weight: 600;

  text-transform: uppercase;

  letter-spacing: 0.03em;

  padding: 0.2rem 0.5rem;

  border-radius: var(--radius-xs);

}



.wt-status--draft { background: var(--color-surface-3); color: var(--color-text-muted); }

.wt-status--pending { background: var(--color-warning-tint); color: var(--color-warning-ink-strong); }

.wt-status--approved { background: var(--brand-green-100); color: var(--brand-green-strong); }

.wt-status--rejected { background: var(--color-danger-tint); color: var(--color-danger-ink-deep); }



.wt-reject-reason {

  margin-top: 0.5rem;

  padding: 0.5rem 0.65rem;

  background: var(--color-danger-surface);

  border-radius: var(--radius-sm);

  font-size: var(--font-size-caption);

  color: var(--color-danger-ink-bright);

}



.wt-card-actions {

  display: flex;

  flex-wrap: wrap;

  gap: 0.35rem;

  margin-top: 0.75rem;

}



.wt-empty {

  text-align: center;

  padding: 2.5rem 1rem;

  color: var(--color-text-faint);

}



/* Drawer */

body.wt-drawer-open {
  overflow: hidden;
}

.wt-drawer-overlay {
  position: fixed;

  inset: 0;

  background: rgba(var(--rgb-ink), 0.45);

  z-index: 1040;

  opacity: 0;

  visibility: hidden;

  transition: opacity 0.2s ease;

}



.wt-drawer-overlay.is-open {

  opacity: 1;

  visibility: visible;

}



.wt-drawer {

  position: fixed;

  top: 0;

  right: 0;

  width: min(480px, 100vw);

  height: 100%;

  height: 100dvh;

  background: var(--color-surface);

  z-index: 1050;

  transform: translateX(100%);

  transition: transform 0.25s ease;

  display: flex;

  flex-direction: column;

  box-shadow: var(--shadow-popover);

}



.wt-drawer-overlay.is-open .wt-drawer {

  transform: translateX(0);

}



.wt-drawer-header {

  padding: 1rem 1.25rem;

  border-bottom: 1px solid var(--color-border-google);

  display: flex;

  align-items: center;

  justify-content: space-between;

}



.wt-drawer-body {

  flex: 1;

  overflow-y: auto;

  padding: 1.25rem;

}



.wt-drawer-footer {

  padding: 1rem 1.25rem;

  padding-bottom: calc(1rem + env(safe-area-inset-bottom));

  border-top: 1px solid var(--color-border-google);

  display: flex;

  flex-wrap: wrap;

  gap: 0.5rem;

}



.wt-ph-badges {

  display: flex;

  flex-wrap: wrap;

  gap: 0.35rem;

  margin-bottom: 0.75rem;

}



.wt-preview-box {

  background: var(--color-surface-2);

  border: 1px solid var(--color-border);

  border-radius: var(--radius-sm);

  padding: 0.75rem;

  font-size: var(--font-size-sm);

  white-space: pre-wrap;

  min-height: 3rem;

}



.wt-var-row {

  display: flex;

  gap: 0.35rem;

  margin-bottom: 0.35rem;

  align-items: center;

}



.wt-var-row .input-group-text {

  min-width: 2.75rem;

  justify-content: center;

  font-family: ui-monospace, monospace;

  font-size: var(--font-size-xs);

}



.wt-drawer-section {

  margin-bottom: 1.25rem;

  padding-bottom: 1rem;

  border-bottom: 1px solid var(--color-surface-3);

}



.wt-drawer-section:last-of-type {

  border-bottom: none;

}



.wt-drawer-section__title {

  font-weight: 600;

  font-size: var(--font-size-sm);

  color: var(--color-ink-slate);

  margin-bottom: 0.35rem;

}



.wt-drawer-section__hint {

  font-size: var(--font-size-caption);

  color: var(--color-text-muted);

  margin-bottom: 0.5rem;

  line-height: 1.45;

}

.wt-drawer-section__hint p {

  margin: 0 0 0.5rem;

}

.wt-live-preview__bubble {

  margin-top: 0.35rem;

}

.wt-submit-checklist {

  padding: 0.75rem 0.85rem;

  border-radius: var(--radius-pill);

  border: 1px solid var(--color-border-muted);

  background: var(--color-surface-2);

}

.wt-submit-checklist__title {

  font-size: var(--font-size-caption);

  font-weight: 600;

  margin-bottom: 0.5rem;

  color: var(--color-text);

}

.wt-submit-checklist__list {

  list-style: none;

  margin: 0;

  padding: 0;

  font-size: var(--font-size-xs);

  line-height: 1.45;

}

.wt-submit-checklist__item {

  display: flex;

  align-items: flex-start;

  gap: 0.4rem;

  margin-bottom: 0.35rem;

  color: var(--color-text-muted);

}

.wt-submit-checklist__item:last-child {

  margin-bottom: 0;

}

.wt-submit-checklist__item i {

  flex-shrink: 0;

  margin-top: 0.1rem;

  font-size: var(--font-size-sm);

}

.wt-submit-checklist__item.is-ok {

  color: var(--color-text);

}

.wt-submit-checklist__item.is-ok i {

  color: var(--brand-green-hover);

}

.wt-submit-checklist__item.is-warn i {

  color: var(--bs-warning);

}

.wt-submit-checklist__item a {

  font-size: inherit;

}



.wt-ph-badge {

  font-size: var(--font-size-xs);

}



.wt-toast {

  position: fixed;

  bottom: 1.25rem;

  left: 50%;

  transform: translateX(-50%) translateY(12px);

  background: var(--color-ink-slate);

  color: var(--color-surface);

  padding: 0.5rem 1rem;

  border-radius: var(--radius-sm);

  font-size: var(--font-size-sm);

  z-index: 2000;

  opacity: 0;

  pointer-events: none;

  transition: opacity 0.2s ease, transform 0.2s ease;

}



.wt-toast.is-visible {

  opacity: 1;

  transform: translateX(-50%) translateY(0);

}

/* ── Chip editor ──────────────────────────────────────── */
.wt-body-editor {
  min-height: 5.5rem;
  max-height: 14rem;
  overflow-y: auto;
  border: 1px solid var(--color-border-form);
  border-radius: var(--radius-xs);
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-md);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wt-body-editor:focus {
  outline: none;
  border-color: var(--color-info-focus);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.wt-body-editor[contenteditable="false"] {
  background: var(--color-surface-form);
  cursor: default;
  opacity: 0.8;
}

.wt-body-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--color-text-form-muted);
  pointer-events: none;
}

.wt-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  background: var(--color-info-tint);
  color: var(--color-info-ink);
  border: 1px solid var(--color-info-border-light);
  border-radius: var(--radius-xs);
  padding: 0.05em 0.35em 0.05em 0.5em;
  font-size: 0.85em;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: baseline;
  cursor: default;
  user-select: none;
  line-height: 1.45;
}

.wt-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-info-ink);
  padding: 0 0.15rem;
  font-size: 1em;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
  border-radius: var(--radius-xs);
  transition: opacity 0.1s, background 0.1s;
}

.wt-chip-remove:hover {
  opacity: 1;
  background: rgba(30, 64, 175, 0.15);
}

.wt-body-editor[contenteditable="false"] .wt-chip-remove {
  display: none;
}

.wt-add-var-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.wt-add-var-form {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.wt-add-var-form .form-control-sm {
  width: 180px;
}


/* ── Two-pane drawer: form left, phone preview right (wide screens) ──────────────────────────── */
.wt-phone {
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-xl);
  background: var(--color-surface-2);
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.wt-phone__bar {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  background: var(--brand-green-strong);
  color: var(--white);
  font-size: var(--font-size-sm);
}
.wt-phone__screen { padding: 0.85rem; min-height: 8rem; }
.wt-phone .wt-live-preview__bubble { background: var(--color-surface); max-width: 92%; }
/* Header / footer / buttons: the bubble keeps line breaks only in the body. */
.wt-phone .wt-live-preview__bubble { white-space: normal; }
.wt-preview-body { white-space: pre-wrap; }
.wt-preview-header { font-weight: 600; margin-bottom: 0.3rem; }
.wt-preview-footer { font-size: var(--font-size-caption); color: var(--color-text-muted); margin-top: 0.35rem; }
.wt-preview-buttons { display: flex; flex-direction: column; gap: 0.25rem; max-width: 92%; margin-top: 0.25rem; }
.wt-preview-buttons span {
  display: flex; align-items: center; justify-content: center; gap: 0.35rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.5rem;
  color: var(--color-info-sky-ink);
  font-size: var(--font-size-sm);
  font-weight: 500;
}
.wt-buttons-editor { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }
.wt-button-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0.35rem; align-items: center; }
.wt-button-row .wt-button-value.d-none + .wt-button-remove { grid-column: 4; }
@media (max-width: 576px) {
  .wt-button-row { grid-template-columns: minmax(0, 1fr) auto; }
  .wt-button-row .wt-button-type { grid-column: 1 / -1; }
}
/* The checklist's pill radius turns into a circle in the narrow preview column. */
.wt-drawer-preview .wt-submit-checklist { border-radius: var(--radius-md); }

@media (min-width: 992px) {
  .wt-drawer { width: min(980px, 100vw); }
  .wt-drawer-body--split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1.5rem;
    align-items: start;
  }
  .wt-drawer-preview { position: sticky; top: 0; }
}
@media (max-width: 992px) {
  /* Below the two-pane width: one column, and the Scrivi / Anteprima switch in the header shows one pane at a time. */
  .wt-drawer-body--split:not(.is-preview) .wt-drawer-preview,
  .wt-drawer-body--split.is-preview .wt-drawer-form { display: none; }
  .wt-drawer-header { gap: 0.5rem; }
  .wt-drawer-header .wt-pane-switch { margin-left: auto; }
}
@media (max-width: 768px) {
  /* Under 16px iOS zooms the page on focus. */
  .wt-drawer .form-control-sm,
  .wt-drawer .form-select-sm { font-size: var(--font-size-base); }
}
