/* ============================================
   TRANSFORM PHASE — Split-View with Diff Highlighting
   ============================================ */

/* Phase layout wrapper */
.phase-transform-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ---- EMPTY STATE ---- */
.transform-empty-state {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.transform-cta-area {
  max-width: 440px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.transform-cta-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1c2e4a 0%, #2d3f5a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #e67e22;
  box-shadow: 0 4px 20px rgba(28, 46, 74, 0.2);
}

.transform-cta-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0;
}

.transform-cta-text {
  font-size: 0.875rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.6;
  margin: 0;
}

.btn-transform-analyse {
  padding: 14px 32px;
  background: #e67e22;
  color: #fff;
  border: none;
  border-radius: var(--radius-lg, 12px);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  width: 100%;
}
.btn-transform-analyse:hover { background: #d4711e; }
.btn-transform-analyse:active { transform: scale(0.98); }

/* ---- COMPARISON LAYOUT ---- */
.transform-comparison {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.transform-comparison.visible {
  display: flex;
}

/* Instruction bar (collapsible, above columns) */
.transform-instruction-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-hover, #f1f5f9);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  flex-shrink: 0;
}
.transform-instruction-input {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 0.8rem;
  background: #fff;
  color: var(--text-primary, #1e293b);
  resize: none;
  min-height: 34px;
  max-height: 80px;
  line-height: 1.4;
}
.transform-instruction-input:focus {
  outline: none;
  border-color: rgba(230, 126, 34, 0.4);
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
}
.btn-transform-reload {
  padding: 6px 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: #fff;
  color: var(--text-secondary, #64748b);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-transform-reload:hover {
  background: var(--bg-hover, #f1f5f9);
  color: var(--text-primary, #1e293b);
}

/* Columns area */
.transform-columns {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.transform-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.transform-col-original {
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.transform-col-header {
  padding: 10px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary, #94a3b8);
  background: var(--bg-hover, #f8fafc);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.transform-col-original .transform-col-header {
  color: #c0392b;
}

.transform-col-proposed .transform-col-header {
  color: #27ae60;
}

.transform-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: 0.875rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary, #1e293b);
}

.transform-col-body[contenteditable="true"] {
  outline: none;
  cursor: text;
}

.transform-col-body[contenteditable="true"]:focus {
  background: rgba(230, 126, 34, 0.02);
}

/* Skeleton loading */
.transform-skeleton {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transform-skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: transformSkeletonPulse 1.4s ease infinite;
}
.transform-skeleton-line.full  { width: 100%; }
.transform-skeleton-line.lg    { width: 88%; }
.transform-skeleton-line.md    { width: 72%; }
.transform-skeleton-line.sm    { width: 55%; }

@keyframes transformSkeletonPulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Diff highlighting */
.diff-removed {
  background: rgba(231, 76, 60, 0.13);
  color: #c0392b;
  text-decoration: line-through;
  border-radius: 3px;
  padding: 0 2px;
}

.diff-added {
  background: rgba(39, 174, 96, 0.13);
  color: #27ae60;
  border-radius: 3px;
  padding: 0 2px;
}

/* Diff stats bar */
.transform-diff-stats {
  padding: 7px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--bg-hover, #f8fafc);
  flex-shrink: 0;
  font-size: 0.78rem;
}
.transform-stat-added {
  color: #27ae60;
  font-weight: 700;
}
.transform-stat-removed {
  color: #c0392b;
  font-weight: 700;
}
.transform-stat-label {
  color: var(--text-secondary, #94a3b8);
}

/* Edited badge */
.transform-edited-badge {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(230, 126, 34, 0.12);
  color: #c26b14;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.transform-edited-badge.visible {
  display: inline-flex;
}

/* Footer actions */
.transform-footer-bar {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  flex-shrink: 0;
}

.btn-transform-reject {
  padding: 9px 20px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary, #64748b);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-transform-reject:hover {
  background: var(--bg-hover, #f1f5f9);
  color: var(--text-primary, #1e293b);
}

.btn-transform-apply {
  padding: 9px 24px;
  background: #e67e22;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-transform-apply:hover { background: #d4711e; }
.btn-transform-apply:active { transform: scale(0.98); }

/* Error state */
.transform-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
  text-align: center;
  color: var(--text-secondary, #64748b);
  font-size: 0.875rem;
}
.transform-error-state .error-msg {
  color: #c0392b;
  font-weight: 600;
}

/* Mobile tabs */
.transform-mobile-tabs {
  display: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}
.transform-tab-btn {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary, #94a3b8);
  transition: all 0.15s;
}
.transform-tab-btn.active {
  border-bottom-color: #e67e22;
  color: #e67e22;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .transform-mobile-tabs {
    display: flex;
  }
  .transform-columns {
    flex-direction: column;
    position: relative;
  }
  .transform-col {
    display: none;
    flex: unset;
    height: 50vh;
  }
  .transform-col.mobile-active {
    display: flex;
  }
  .transform-col-original {
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }
  .transform-footer-bar {
    flex-direction: column;
  }
  .transform-footer-bar .btn-transform-reject,
  .transform-footer-bar .btn-transform-apply {
    width: 100%;
    justify-content: center;
  }
  .btn-transform-analyse {
    font-size: 0.9rem;
    padding: 12px 24px;
  }
  .transform-instruction-bar {
    flex-wrap: wrap;
  }
  .transform-instruction-input {
    width: 100%;
  }
}
