/**
 * Email Templates Page
 */

.et-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1100px;
}

.et-muted {
  color: var(--text-secondary);
}

/* ── Toolbar ─────────────────────────────────────────── */

.et-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}

.et-toolbar-actions,
.et-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.et-checking {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.et-spinner-inline {
  width: 14px;
  height: 14px;
  margin: 0;
  border-width: 2px;
}

.et-howto summary {
  cursor: pointer;
  font-weight: 600;
}

.et-howto ol {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.et-note {
  background: var(--bg-warning-subtle);
}

/* ── Template cards ──────────────────────────────────── */

.et-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.et-template {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.et-template-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.et-template-title h2 {
  margin: 0 0 2px;
  font-size: 18px;
}

.et-template-title .et-muted {
  font-size: 13px;
}

.et-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px 24px;
  margin: 0;
  font-size: 13px;
}

.et-meta dt {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.et-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

/* ── Badges ──────────────────────────────────────────── */

.et-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.et-badge-good {
  background: var(--bg-success-subtle);
  color: var(--text-primary);
  border-color: rgba(16, 185, 129, 0.45);
}

.et-badge-bad {
  background: var(--bg-danger-subtle);
  color: var(--text-primary);
  border-color: rgba(239, 68, 68, 0.45);
}

.et-badge-warn {
  background: var(--bg-warning-subtle);
  color: var(--text-primary);
  border-color: rgba(245, 158, 11, 0.45);
}

.et-badge-info {
  background: var(--color-primary-light);
  color: var(--text-primary);
}

.et-badge-muted {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
  border-style: dashed;
}

/* ── Levels table ────────────────────────────────────── */

.et-unchecked {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.et-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed; /* long diff lines wrap instead of widening the table */
}

.et-table th:nth-child(2) { width: 150px; }
.et-table th:nth-child(3) { width: 120px; }
.et-table th:nth-child(4) { width: 90px; }

.et-table th,
.et-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.et-table th {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.et-cell-action {
  text-align: right;
}

@media (max-width: 640px) {
  .et-table th:nth-child(3),
  .et-table td:nth-child(3):not([colspan]) {
    display: none;
  }
}

.et-detail td {
  background: var(--bg-secondary);
  white-space: normal; /* shared table styles set nowrap */
}

.et-detail p {
  margin: 0 0 8px;
}

/* ── Diff ────────────────────────────────────────────── */

.et-diff,
.et-subject-diff {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
  font-size: 12px;
  max-height: 320px;
  overflow: auto;
}

.et-diff-git,
.et-diff-wa {
  padding: 3px 8px 3px 44px;
  border-radius: 4px;
  overflow-wrap: anywhere;
  text-indent: -36px;
}

.et-diff-git span,
.et-diff-wa span {
  display: inline-block;
  width: 36px;
  text-indent: 0;
  font-weight: 700;
}

.et-diff-git {
  background: var(--bg-success-subtle);
}

.et-diff-wa {
  background: var(--bg-danger-subtle);
}

.et-diff-key {
  font-size: 12px;
}

/* ── Preview modal ───────────────────────────────────── */

.modal-container:has(.et-preview) {
  max-width: 900px;
}

.et-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.et-preview-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}

.et-preview-sizes {
  display: flex;
  gap: 6px;
}

.et-preview-sizes button[aria-pressed="true"] {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.et-preview-frame {
  display: flex;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 8px;
}

.et-preview-frame iframe {
  width: 100%;
  height: 65vh;
  border: 0;
  border-radius: 4px;
  background: #ffffff;
  transition: width var(--transition-normal);
}

@media (max-width: 640px) {
  .et-template-head {
    flex-direction: column;
  }
}
