/* Interactive Text Cleaner & Editor Experience */

.editor-app {
  width: 100%;
  max-width: var(--max-w-editor);
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.editor-app:focus-within {
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-xl), 0 0 0 3px rgba(0, 113, 227, 0.12);
}

/* Toolbar Header */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--hairline);
  gap: 8px;
  flex-wrap: wrap;
}

.editor-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.editor-btn:hover:not(:disabled) {
  background: var(--panel-hover);
  border-color: var(--hairline-strong);
  color: var(--ink);
}

.editor-btn:active:not(:disabled) {
  background: var(--panel-active);
  transform: translateY(1px);
}

.editor-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: var(--hairline);
}

.editor-btn-primary {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #FFFFFF;
  font-weight: 600;
}

.editor-btn-primary:hover:not(:disabled) {
  background: var(--accent-blue-hover);
  border-color: var(--accent-blue-hover);
  color: #FFFFFF;
}

.editor-btn-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Main Textarea Area */
.editor-body {
  position: relative;
  background: var(--paper);
}

.editor-textarea {
  width: 100%;
  min-height: 220px;
  padding: 20px;
  border: none;
  outline: none;
  resize: vertical;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  caret-color: var(--accent-blue);
  tab-size: 2;
}

.editor-textarea::placeholder {
  color: var(--muted-light);
}

/* Findings Bar (Audit Pills) */
.editor-findings {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--tag-green-bg);
  border-top: 1px solid var(--tag-green-border);
  font-size: 12px;
  color: var(--tag-green-text);
  flex-wrap: wrap;
  animation: findingsFadeIn 0.25s ease-out;
}

.editor-findings.visible {
  display: flex;
}

@keyframes findingsFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.finding-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(36, 138, 61, 0.12);
  border: 1px solid rgba(36, 138, 61, 0.25);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--tag-green-text);
}

/* Stats Counter Bar */
.editor-stats {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding: 10px 20px;
  background: var(--panel);
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  user-select: none;
  flex-wrap: wrap;
}

.stat-item {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
}

/* Actions Section & Tactile Chip Buttons */
.editor-actions {
  padding: 20px;
  background: var(--panel);
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.action-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--hairline-subtle);
}

.action-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.action-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Tactile Chip Button Styles */
.chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  background: var(--paper);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  white-space: nowrap;
}

.chip-btn:hover {
  background: var(--panel-hover);
  border-color: var(--ink-secondary);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.chip-btn:active {
  background: var(--panel-active);
  transform: translateY(1px);
  box-shadow: none;
}

.chip-glyph {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}

/* Featured Star Chip: Clean Pasted Text */
.chip-btn-featured {
  background: var(--primary-chip-bg);
  border-color: var(--primary-chip-bg);
  color: var(--primary-chip-text);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: 0 16px;
}

.chip-btn-featured:hover {
  background: var(--primary-chip-hover);
  border-color: var(--primary-chip-hover);
  color: var(--primary-chip-text);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.chip-btn-featured:active {
  transform: translateY(1px);
}

.chip-btn-featured .chip-glyph {
  font-size: 14px;
  opacity: 1;
}

/* Copy Toast Feedback */
.copy-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--ink-inverse);
  padding: 10px 22px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .editor-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .editor-toolbar-group {
    justify-content: space-between;
    width: 100%;
  }

  .editor-toolbar-group .editor-btn {
    flex: 1;
    justify-content: center;
  }

  .editor-textarea {
    min-height: 180px;
    padding: 14px;
    font-size: 14px;
  }

  .editor-actions {
    padding: 14px;
    gap: 16px;
  }

  .chip-btn-featured {
    width: 100%;
    height: 38px;
  }

  .chip-btn {
    font-size: 12.5px;
    padding: 0 10px;
    height: 32px;
  }
}
