/* styles-additions-v27.css — MB10: Single-screen drafts redesign
 *
 * Loaded AFTER v26.css. Cache buster v=210.
 *
 * Supersedes MB9 G6's 3-stage state machine. The composer is now a single
 * screen where drafts, body editor, and intake controls all coexist.
 *
 * Sections:
 *   1. Override v26.css stage visibility (no more stages)
 *   2. Inline drafts section (between TO field and body editor)
 *   3. Tab expand/minimize states
 *   4. Selected-tab green highlight
 *   5. Auto-fill body editor
 *   6. Intake controls compact state
 */


/* =============================================================
 * 1. Override v26.css stage visibility — drafts and intake coexist
 * ============================================================= */

/* Stage-based visibility rules from v26 are obsolete. Show all sections
 * unconditionally; JS controls expand/minimize. */
.ec-modal[data-stage="intake"] .ec-form > .ec-intake,
.ec-modal[data-stage="intake"] .ec-form > .ec-body-editor-wrap,
.ec-modal[data-stage="intake"] .ec-form > .ec-attachments,
.ec-modal[data-stage="drafts"] .ec-form > .ec-intake,
.ec-modal[data-stage="drafts"] .ec-form > .ec-body-editor-wrap,
.ec-modal[data-stage="drafts"] .ec-form > .ec-attachments,
.ec-modal[data-stage="edit"]   .ec-form > .ec-intake,
.ec-modal[data-stage="edit"]   .ec-form > .ec-body-editor-wrap,
.ec-modal[data-stage="edit"]   .ec-form > .ec-attachments {
  display: block;
}
/* Drafts view is now inline, no longer full-screen replacement */
.ec-modal[data-stage="intake"] .ec-drafts-inline,
.ec-modal[data-stage="drafts"] .ec-drafts-inline,
.ec-modal[data-stage="edit"]   .ec-drafts-inline {
  display: block;
}
/* Hide the v26 full-screen drafts view if it still exists */
.ec-modal .ec-drafts-view {
  display: none !important;
}
/* Send bar always visible (was hidden in drafts stage by v26) */
.ec-modal[data-stage="drafts"] .ec-send-bar {
  display: flex;
}


/* =============================================================
 * 2. Inline drafts section
 * ============================================================= */

.ec-drafts-inline {
  /* Sits between the intake controls and the body editor */
  margin: var(--space-4, 16px) 0;
  border: 1px solid var(--border-default, #e5e5e5);
  border-radius: 8px;
  background: var(--surface-card, #fff);
  overflow: hidden;
  transition: max-height 200ms ease-out;
}
.ec-drafts-inline.is-empty {
  display: none;
}

/* Header strip with tabs + minimize toggle */
.ec-drafts-header {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border-default, #e5e5e5);
  background: var(--surface-subtle, #f8f8f7);
}
.ec-drafts-tabs-row {
  flex: 1;
  display: flex;
  overflow-x: auto;
}
.ec-drafts-tab {
  flex: 1 1 0;
  min-width: 120px;
  padding: var(--space-2, 8px) var(--space-3, 12px);
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-default, #e5e5e5);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  position: relative;
  transition: background 120ms ease-out;
}
.ec-drafts-tab:last-child { border-right: none; }
.ec-drafts-tab:hover { background: rgba(255, 213, 0, 0.06); }

.ec-drafts-tab-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #171717);
  display: block;
  margin-bottom: 2px;
}
.ec-drafts-tab-score {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ec-drafts-tab-score-pass { color: var(--color-pass, #16a34a); }
.ec-drafts-tab-score-warn { color: var(--color-warn, #d97706); }
.ec-drafts-tab-score-fail { color: var(--color-critical, #dc2626); }

/* Selected tab — green highlight per Juston's spec */
.ec-drafts-tab.is-selected {
  background: rgba(22, 163, 74, 0.06);
  box-shadow: inset 0 -3px 0 0 var(--color-pass, #16a34a);
}
.ec-drafts-tab.is-selected .ec-drafts-tab-label {
  color: var(--color-pass, #16a34a);
}

/* "Winner" badge — auto-picked highest-scored draft on first render */
.ec-drafts-tab-winner-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 600;
  background: var(--color-pass, #16a34a);
  color: #fff;
  border-radius: 2px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Minimize / expand toggle */
.ec-drafts-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-default, #e5e5e5);
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary, #525252);
  font-family: inherit;
  transition: transform 200ms ease-out;
}
.ec-drafts-toggle:hover { background: var(--surface-card, #fff); }


/* =============================================================
 * 3. Tab expand/minimize states
 * ============================================================= */

.ec-drafts-inline[data-minimized="false"] .ec-drafts-body {
  display: block;
}
.ec-drafts-inline[data-minimized="true"] .ec-drafts-body {
  display: none;
}
.ec-drafts-inline[data-minimized="true"] .ec-drafts-toggle::before {
  content: '▾';
}
.ec-drafts-inline[data-minimized="false"] .ec-drafts-toggle::before {
  content: '▴';
}

.ec-drafts-body {
  padding: var(--space-3, 12px) var(--space-4, 16px);
}

.ec-drafts-body-subject-row {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary, #a3a3a3);
  margin-bottom: 4px;
}
.ec-drafts-body-subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #171717);
  margin-bottom: var(--space-3, 12px);
}
.ec-drafts-body-preview {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary, #525252);
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
  padding: var(--space-2, 8px);
  background: var(--surface-subtle, #f8f8f7);
  border-radius: 4px;
  margin-bottom: var(--space-3, 12px);
}

.ec-drafts-body-meta {
  display: flex;
  gap: var(--space-4, 16px);
  font-size: 11px;
  color: var(--text-tertiary, #a3a3a3);
  margin-bottom: var(--space-3, 12px);
  flex-wrap: wrap;
}
.ec-drafts-body-meta-item {
  font-family: var(--font-mono, ui-monospace, monospace);
}
.ec-drafts-body-meta-item strong {
  color: var(--text-secondary, #525252);
  font-weight: 600;
}

/* Checks list — compact inline */
.ec-drafts-body-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 11px;
  line-height: 1.4;
}
@media (max-width: 600px) {
  .ec-drafts-body-checks { grid-template-columns: 1fr; }
}
.ec-drafts-body-check {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.ec-drafts-body-check-icon {
  flex-shrink: 0;
  width: 12px;
  font-weight: 700;
}
.ec-drafts-body-check.is-pass .ec-drafts-body-check-icon { color: var(--color-pass, #16a34a); }
.ec-drafts-body-check.is-fail .ec-drafts-body-check-icon { color: var(--color-critical, #dc2626); }
.ec-drafts-body-check-text { color: var(--text-secondary, #525252); }

/* "Use this draft" action — appears in expanded view */
.ec-drafts-body-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-3, 12px);
  gap: var(--space-2, 8px);
}
.ec-drafts-use-btn {
  padding: 6px 14px;
  background: var(--color-pass, #16a34a);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ec-drafts-use-btn:hover { background: #15803d; }
.ec-drafts-use-btn.is-applied {
  background: var(--surface-card, #fff);
  color: var(--color-pass, #16a34a);
  border: 1px solid var(--color-pass, #16a34a);
  cursor: default;
}
.ec-drafts-use-btn.is-applied::before {
  content: '✓ ';
}


/* =============================================================
 * 4. Intake compact state (after drafts generated)
 * ============================================================= */

/* When drafts have been generated at least once, the intake controls
 * shrink to a compact accordion-style section so the focus shifts to
 * the body editor + drafts. */
.ec-modal[data-drafts-present="true"] .ec-intake {
  /* Compact mode — hide carousel slide indicator, smaller padding */
  padding: var(--space-2, 8px) var(--space-3, 12px);
  background: var(--surface-subtle, #f8f8f7);
  border-radius: 6px;
  margin-bottom: var(--space-3, 12px);
}
.ec-modal[data-drafts-present="true"] .ec-intake-slide-indicator {
  /* The • • • • dots */
  display: none;
}

/* Re-generate button styling — visible alongside intake */
.ec-regenerate-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border-strong, #d4d4d4);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-primary, #171717);
}
.ec-regenerate-btn:hover {
  background: var(--surface-card, #fff);
  border-color: var(--text-primary, #171717);
}
.ec-regenerate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


/* =============================================================
 * 5. Body editor — prime real estate
 * ============================================================= */

.ec-modal[data-drafts-present="true"] .ec-body-editor-wrap {
  /* Body editor gets prominence after drafts are generated */
  border: 2px solid var(--color-accent, #FFD500);
  border-radius: 8px;
  padding: var(--space-3, 12px);
  margin: var(--space-3, 12px) 0;
}
.ec-modal[data-drafts-present="true"] .ec-body-editor-wrap label {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary, #525252);
  display: block;
  margin-bottom: 4px;
}

/* Source indicator: which draft is currently loaded */
.ec-body-source-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: rgba(22, 163, 74, 0.1);
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--color-pass, #16a34a);
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
