/* ===== mape App — Feature Styles ===== */
/* Auto-mode form, plan card animations, feature-specific overrides */

/* ---- Auto-Mode Gathering Form ---- */

.auto-mode-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-top: 12px;
}

.auto-mode-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auto-mode-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.auto-mode-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.auto-mode-input,
.auto-mode-form select,
.auto-mode-form textarea {
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-light);
    transition: border-color 0.15s ease;
}

.auto-mode-input:focus,
.auto-mode-form select:focus,
.auto-mode-form textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
}

.auto-mode-form textarea {
    min-height: 60px;
    resize: vertical;
}

.auto-mode-submit {
    align-self: flex-start;
    padding: 8px 20px;
    background: var(--accent-coral);
    color: var(--text-inverse);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.auto-mode-submit:hover {
    opacity: 0.9;
}

.auto-mode-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.auto-mode-suggestions button {
    padding: 4px 10px;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease;
}

.auto-mode-suggestions button:hover {
    background: var(--bg-card-hover);
}

/* ---- Plan Card Asset Building Animation ---- */

.plan-asset-status.building.asset-building {
    animation: pulse-building 1.2s ease-in-out infinite;
}

@keyframes pulse-building {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== Email Builder Split Layout ===== */
.email-builder-split {
  display: flex;
  height: 100%;
  min-height: 0;
}

.eb-config-col {
  flex: 0 0 380px;
  max-width: 380px;
  overflow-y: auto;
  padding: var(--space-lg);
  border-right: 1px solid var(--border-color);
  background: var(--bg-white);
  display: flex;
  flex-direction: column;
}

.eb-preview-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-light);
}

.eb-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-white);
  flex-shrink: 0;
}

.eb-preview-frame {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: var(--space-md);
  overflow: auto;
  background: var(--bg-light);
}

.eb-preview-frame iframe {
  width: 100%;
  max-width: 600px;
  height: 100%;
  min-height: 500px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-md);
}

/* ===== Email Builder — Save Bar ===== */
.eb-save-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
}

.eb-draft-name {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  padding: 6px 0;
  outline: none;
  transition: border-color var(--duration-fast);
}

.eb-draft-name:focus {
  border-bottom-color: var(--brand-primary);
}

.eb-draft-name::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.eb-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eb-campaign-type {
  flex: 1;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
}

.eb-campaign-type:focus {
  border-color: var(--brand-primary);
}

.eb-status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.eb-status-badge.draft {
  color: #b8860b;
  background: rgba(184, 134, 11, 0.12);
}

.eb-status-badge.saved {
  color: #2e8b57;
  background: rgba(46, 139, 87, 0.12);
}

.email-save-btn {
  min-height: 40px;
}

.eb-save-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ===== Campaign Wizard ===== */

/* Stepper Bar */
.wizard-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-sm);
  margin-bottom: var(--space-lg);
  gap: 0;
}

.wizard-step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all var(--duration-normal);
  min-width: 50px;
}

.wizard-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-light);
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  transition: all var(--duration-normal);
}

.wizard-step-dot.active .wizard-dot {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-primary);
}

.wizard-step-dot.completed .wizard-dot {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--text-inverse);
}

.wizard-step-dot.past .wizard-dot {
  border-color: var(--text-muted);
  color: var(--text-secondary);
}

.wizard-step-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: normal;
  text-align: center;
  line-height: 1.2;
  max-width: 82px;
  transition: color var(--duration-normal);
}

.wizard-step-dot.active .wizard-step-label {
  color: var(--brand-primary);
  font-weight: 600;
}

.wizard-step-dot.completed .wizard-step-label {
  color: var(--brand-primary);
}

.wizard-step-dot:hover .wizard-step-label {
  color: var(--text-primary);
}

.wizard-line {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 4px;
  margin-bottom: 18px;
  transition: background var(--duration-normal);
  min-width: 12px;
}

.wizard-line.completed {
  background: var(--brand-primary);
}

/* Step Content */
.wizard-step-content {
  padding: 0 var(--space-sm);
}

.wizard-step-header {
  margin-bottom: var(--space-md);
}

.wizard-step-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-step-title-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
}

.wizard-step-title-icon svg {
  width: 16px;
  height: 16px;
  color: var(--brand-primary);
}

.wizard-step-header p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Info Cards */
.wizard-info-card {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.wizard-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.wizard-info-row:last-child {
  border-bottom: none;
}

.wizard-info-label {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}

.wizard-info-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  margin-left: auto;
  max-width: 62%;
  overflow-wrap: anywhere;
}

.wizard-info-value.mono {
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;
  font-size: 12px;
  color: var(--brand-primary);
}

/* Status Badges */
.wizard-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.wizard-status-badge.ready {
  color: var(--brand-primary);
  background: rgba(74, 85, 109, 0.1);
}

.wizard-status-badge.ready.large {
  font-size: 13px;
  padding: 6px 16px;
}

/* Action Buttons */
.wizard-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  border: none;
  transition: all var(--duration-normal);
  background: var(--accent-coral);
  color: var(--text-inverse);
  margin-top: var(--space-sm);
}

.wizard-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-primary);
}

.wizard-action-btn:disabled {
  background: #c8c7c2;
  color: #f8f8f8;
  border-color: #c8c7c2;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.wizard-action-btn svg {
  width: 14px;
  height: 14px;
}

.wizard-rotating-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  animation: wizardPhasePulse 1.2s ease-in-out infinite;
}

.wizard-rotating-icon svg {
  width: 14px;
  height: 14px;
}

@keyframes wizardPhasePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.92); }
}

.typing-indicator-email {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.typing-phase-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  transform: scale(0.9);
  transition: opacity 160ms ease, transform 160ms ease;
}

.typing-phase-icon.active {
  opacity: 1;
  transform: scale(1);
}

.typing-phase-icon svg {
  width: 14px;
  height: 14px;
}

.wizard-action-btn.secondary {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.wizard-action-btn.secondary:hover {
  border-color: var(--brand-primary);
  box-shadow: none;
}

.wizard-action-btn.ghost {
  background: none;
  color: var(--text-secondary);
  padding: 10px 16px;
}

.wizard-action-btn.ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  box-shadow: none;
  transform: none;
}

.wizard-action-btn.danger {
  background: var(--accent-coral);
  color: var(--text-inverse);
}

.wizard-action-btn.danger:disabled {
  background: #c8c7c2;
  color: #f8f8f8;
  border-color: #c8c7c2;
}

.wizard-action-btn.small {
  padding: 6px 14px;
  font-size: 12px;
}

/* Send Configuration Panel */
.wizard-config-panel {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--space-md) 0;
}

.wizard-config-header {
  background: var(--bg-card-hover);
  padding: 10px var(--space-md);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

.wizard-config-body {
  padding: 0;
}

.wizard-config-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.wizard-config-row:last-child {
  border-bottom: none;
}

.wizard-config-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.wizard-config-value {
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;
  font-size: 12px;
  color: var(--brand-primary);
  font-weight: 500;
}

.wizard-config-status {
  padding: 10px var(--space-md);
  border-top: 1px solid var(--border-color);
  background: rgba(74, 85, 109, 0.04);
  text-align: center;
}

/* Form Inputs */
.wizard-form-group {
  margin-bottom: var(--space-md);
}

.wizard-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wizard-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  transition: border-color var(--duration-fast);
  box-sizing: border-box;
}

.wizard-input:focus {
  outline: none;
  border-color: var(--brand-primary);
}

/* Doc Card */
.wizard-doc-card {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-md) 0;
}

/* Send Actions */
.wizard-send-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  flex-wrap: wrap;
}

/* Empty State */
.wizard-empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--text-muted);
}

.wizard-empty-state p {
  font-size: 13px;
  margin-top: var(--space-sm);
}

/* Navigation */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
}

/* Preview Frame */
.wizard-preview-frame {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

/* Builder Switch Cards in Chat */
.builder-switch-cards {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}

.builder-switch-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.builder-switch-card:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: rgba(74, 85, 109, 0.04);
}

.builder-switch-card .switch-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
}

.builder-switch-card .switch-icon svg {
  width: 14px;
  height: 14px;
}

/* ===== Deliverable Panel ===== */
.deliverable-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.deliverable-content {
  padding: 16px;
  overflow: auto;
  flex: 1;
}

.deliverable-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

/* ===== Wizard Documentation View ===== */

.wizard-doc-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.wizard-doc-window {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
}

.wizard-doc-markdown {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.65;
}

.wizard-doc-markdown h1,
.wizard-doc-markdown h2,
.wizard-doc-markdown h3,
.wizard-doc-markdown h4 {
  margin: 12px 0 8px;
  color: var(--text-primary);
}

.wizard-doc-markdown p {
  margin-bottom: 10px;
}

.wizard-doc-markdown ul,
.wizard-doc-markdown ol {
  margin: 8px 0 10px 18px;
}

.wizard-doc-markdown li {
  margin-bottom: 4px;
}

.wizard-doc-markdown pre {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  overflow-x: auto;
  margin: 10px 0;
}

.wizard-doc-markdown code {
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;
  font-size: 12px;
}

.wizard-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: 10px 0 6px;
}

.wizard-inline-actions .wizard-action-btn {
  margin-top: 0;
}

.wizard-sql-output {
  margin: 0 0 var(--space-md);
}

.wizard-sql-output pre {
  max-height: 360px;
}

.wizard-code-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.wizard-de-table-wrap {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  background: var(--bg-white);
  margin: 0 0 var(--space-md);
}

.de-editable-table,
.wizard-de-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

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

.de-editable-table th,
.wizard-de-table th {
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.de-editable-table tbody tr:last-child td,
.wizard-de-table tbody tr:last-child td {
  border-bottom: none;
}

.de-editable-table tbody tr:hover td,
.wizard-de-table tbody tr:hover td {
  background: rgba(74, 85, 109, 0.03);
}

.wizard-de-table th:nth-child(1) {
  width: 30%;
}

.wizard-de-table th:nth-child(2) {
  width: 22%;
}

.wizard-de-table th:nth-child(3) {
  width: 20%;
}

.wizard-de-table th:nth-child(4) {
  width: 28%;
}

.de-field-input,
.de-field-select {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.35;
  padding: 7px 9px;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.de-field-input:focus,
.de-field-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px rgba(74, 85, 109, 0.12);
  outline: none;
}

.de-field-input[readonly],
.de-field-input:read-only,
.de-field-select:disabled {
  background: var(--bg-light);
  color: var(--text-secondary);
  cursor: default;
}

.wizard-flag-cell {
  white-space: nowrap;
}

.wizard-flag-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wizard-flag-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-light);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
}

.wizard-flag-checkbox,
.de-editable-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.de-field-delete {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
}

.de-field-delete:hover {
  color: var(--accent-coral);
  border-color: rgba(255, 87, 87, 0.5);
}

.plan-asset {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
}

.plan-asset:hover {
  background: var(--bg-card-hover);
}

.plan-asset-status {
  margin-left: auto;
  font-size: 10px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.plan-asset-status.building {
  color: #b8860b;
  background: rgba(184, 134, 11, 0.12);
}

.plan-asset-status.ready {
  color: #2e8b57;
  background: rgba(46, 139, 87, 0.12);
}

.plan-asset-status.error {
  color: #d16b6b;
  background: rgba(209, 107, 107, 0.12);
}

.plan-asset-status.pending {
  color: var(--text-secondary);
  background: rgba(74, 85, 109, 0.08);
}

.asset-building {
  animation: assetPulse 1.5s infinite;
}

@keyframes assetPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
