/* st-editor.css — Panels, source editor, target output, Quill overrides, char count, response nav */
/* ===== Panels — Sneat card containers ===== */
.st-panels {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
  gap: var(--space-3);
}

.st-source-panel,
.st-target-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: rgba(0,0,0,0.035) 0px 4px 20px 0px,
              rgba(31,31,30,0.12) 0px 0px 0px 0.5px;
  border: none;
}

.st-source-panel {
  background: var(--color-card);
}

.st-target-panel {
  background: var(--color-bg);
  box-shadow: none;
  border: 0.5px solid rgba(0, 0, 0, 0.06);
}

/* Panel divider — hidden, replaced by gap */
.st-panel-divider {
  display: none;
}

/* Panel toolbar */
.st-panel-toolbar {
  display: flex;
  align-items: center;
  height: 48px;
  min-height: 48px;
  padding: var(--space-2) var(--space-4);
  gap: var(--space-1);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
  background: var(--color-card);
  border-radius: 8px 8px 0 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

/* Toolbar button */
.st-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  background: transparent;
  transition: all var(--transition);
  flex-shrink: 0;
}

.st-toolbar-btn svg {
  width: 18px;
  height: 18px;
}

.st-toolbar-btn:hover:not(:disabled) {
  background: var(--color-card);
  color: var(--color-text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.st-toolbar-btn:active:not(:disabled) {
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-text-primary);
}

.st-toolbar-btn:disabled {
  opacity: 0.35;
}

.st-toolbar-btn.active {
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-text-primary);
}

/* Toolbar divider */
.st-toolbar-divider {
  width: 0.5px;
  height: 24px;
  background: var(--color-border);
  margin: 0 var(--space-1);
  flex-shrink: 0;
}

/* Edit toggle (has label) */
.st-edit-toggle {
  width: auto;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.st-edit-label {
  white-space: nowrap;
}

/* Spinner animation for loading states */
@keyframes st-spin {
  to { transform: rotate(360deg); }
}
.st-spin {
  animation: st-spin 0.8s linear infinite;
}

/* Download wrapper + dropdown */
.st-download-wrap {
  position: relative;
  display: flex;
}
.st-download-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  min-width: 120px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  z-index: 100;
  padding: var(--space-1);
}

.st-download-dropdown.open {
  display: block;
}

/* ===== Segmented Tone Control — Sneat pill style ===== */
.st-tone-segment {
  display: flex;
  align-items: center;
  background: var(--color-bg);
  border: none;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
}

.st-tone-segment .st-tone-preset-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all var(--transition);
}

.st-tone-segment .st-tone-preset-btn:hover:not(.active) {
  color: var(--color-text-primary);
  background: var(--color-bg);
}

.st-tone-segment .st-tone-preset-btn.active {
  background: var(--color-text-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Status bar chat button with label */
.st-status-icon-btn.st-edit-toggle {
  width: auto;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

/* Active state for drawer trigger buttons */
.st-status-icon-btn.active,
.st-toolbar-btn.active.st-drawer-trigger {
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-text-primary);
}

/* ===== Source Editor (contenteditable) ===== */
/* Quill container — fills panel, hides default chrome */
.st-source-editor,
.st-target-output {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.st-source-editor .ql-container,
.st-target-output .ql-container,
.st-source-editor.ql-container,
.st-target-output.ql-container {
  flex: 1;
  overflow-y: auto;
  border: none !important;
  font-family: var(--font-family);
}

/* Override Quill Snow runtime-injected border — needs 3-class specificity to beat .ql-container.ql-snow */
.st-source-panel .ql-container.ql-snow,
.st-target-panel .ql-container.ql-snow {
  border: none !important;
}

/* Target output is read-only — show pointer cursor to indicate clickable segments */
.st-target-output .ql-editor {
  cursor: default !important;
  user-select: text;
}

/* Hide Quill Snow toolbar — created as sibling before .ql-container, not inside it */
.st-source-panel .ql-toolbar,
.st-target-panel .ql-toolbar {
  display: none !important;
}

.st-source-editor .ql-editor,
.st-target-output .ql-editor {
  padding: var(--space-6);
  padding-bottom: 120px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--color-text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.st-source-editor .ql-editor.ql-blank::before,
.st-target-output .ql-editor.ql-blank::before {
  color: var(--color-text-secondary);
  font-style: italic;
  left: var(--space-6);
  right: var(--space-6);
}

/* ===== Target Output ===== */
.st-target-output .ql-editor {
  user-select: text;
}

/* Force uniform content styling — prevents pasted colors/fonts from rendering.
   Matches grammar robot pattern: #inputText * { color/font/size !important } */
.st-source-editor .ql-editor *,
.st-target-output .ql-editor * {
  color: var(--color-text-primary) !important;
  font-family: var(--font-family) !important;
  font-size: 16px !important;
  line-height: 1.8;
  text-align: left !important;
}

.st-source-editor .ql-editor blockquote,
.st-target-output .ql-editor blockquote {
  border-left: 3px solid !important;
}

/* Ensure no background colors leak from pasted content (allow alignment highlights) */
.st-source-editor .ql-editor *:not(.st-align-active),
.st-target-output .ql-editor *:not(.st-align-active) {
  background-color: transparent !important;
}

/* Char count — subtle badge */
.st-char-count {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  background: var(--color-bg);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--color-border);
}

.st-char-warning {
  color: var(--color-warning);
  font-weight: 500;
}

.st-char-error {
  color: var(--color-error);
  font-weight: 600;
}

/* Response navigation (in status bar center) */
.st-response-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.st-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: background var(--transition), color var(--transition);
}

.st-nav-btn:hover:not(:disabled) {
  background: var(--color-bg);
  color: var(--color-text-primary);
}

.st-nav-btn:disabled {
  opacity: 0.4;
}

