@use '../variables' as v;
@use '../mixins' as m;

// ── Templates list page ──────────────────────────────────────────────
// (uses existing .card, .data-table, .table-footer, .pagination, .btn classes)

// ── Template Create / Edit page ──────────────────────────────────────

.tc-main {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tc-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: v.$gray-500;
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;

  svg { width: 14px; height: 14px; }

  &:hover { color: v.$gray-800; }
}

// ── Top fields strip (title, subject, preheader) ──

.tc-fields-strip {
  flex-shrink: 0;
  padding: 16px 24px 12px;
  border-bottom: 1px solid v.$border-color;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tc-page-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tc-page-title {
  font-size: 18px;
  font-weight: 700;
  color: v.$gray-900;
  margin: 0;
}

// Fields in a horizontal row
.tc-fields-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
  align-items: end;

  @include m.max-md { grid-template-columns: 1fr; }
}

.tc-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;

  &--title { /* wider col */ }
}

.tc-label {
  font-size: v.$font-size-xs;
  font-weight: 600;
  color: v.$gray-600;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.tc-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid v.$border-color;
  border-radius: v.$radius;
  font-size: v.$font-size-sm;
  color: v.$gray-800;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  @include m.focus-ring;

  &::placeholder { color: v.$gray-400; }
  &--subject { padding-right: 40px; }
}

.tc-subject-wrap {
  position: relative;
}

.tc-subject-personalize {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: 1px solid v.$border-color;
  border-radius: 4px;
  background: v.$gray-50;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: v.$gray-500;

  svg { width: 14px; height: 14px; }
  &:hover { background: #fff; color: v.$gray-800; }
}

// ── Full-height editor area (3-panel: palette + canvas + settings) ──

.tc-editor-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  // Reuse .cw-editor-toolbar, .cw-editor-body, .cw-palette,
  // .cw-canvas-wrap, .cw-email-frame, .cw-settings from campaigns-create SCSS.
  // Only overrides needed:

  .cw-editor-body {
    flex: 1;
    min-height: 0;
  }
}
