/* ============================================
   Vidpros Spell Check — Dark Theme
   Matches Premiere Pro's panel aesthetic
   ============================================ */

:root {
  --bg-primary: #1e1e1e;
  --bg-surface: #2d2d2d;
  --bg-surface-hover: #363636;
  --bg-surface-active: #404040;
  --bg-error: #3d2020;
  --bg-success: #1e3d1e;

  --text-primary: #e0e0e0;
  --text-secondary: #999999;
  --text-muted: #666666;

  --color-error: #ff6b6b;
  --color-success: #81c784;
  --color-accent: #4a90e2;
  --color-accent-hover: #5ba0f2;
  --color-warning: #ffb74d;
  --color-border: #444444;

  --radius: 6px;
  --radius-lg: 10px;
  --font: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- Layout ---- */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

header .status {
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.status-dot.loading { background: var(--color-warning); }
.status-dot.ready { background: var(--color-success); }
.status-dot.error { background: var(--color-error); }

/* ---- Drop Zone ---- */

.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 20px;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--color-accent);
  background: rgba(74, 144, 226, 0.05);
}

.drop-zone-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.drop-zone-text {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.drop-zone-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.drop-zone.compact {
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.drop-zone.compact .drop-zone-icon,
.drop-zone.compact .drop-zone-hint {
  display: none;
}

.drop-zone.compact .drop-zone-text {
  font-size: 13px;
  margin: 0;
}

.drop-zone input[type="file"] {
  display: none;
}

/* ---- Paste Area ---- */

.paste-toggle {
  display: inline-block;
  font-size: 12px;
  color: var(--color-accent);
  cursor: pointer;
  margin-bottom: 12px;
  border: none;
  background: none;
  font-family: var(--font);
}

.paste-toggle:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

.paste-area {
  display: none;
  margin-bottom: 20px;
}

.paste-area.visible {
  display: block;
}

.paste-area textarea {
  width: 100%;
  height: 120px;
  background: var(--bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  padding: 12px;
  resize: vertical;
}

.paste-area textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.paste-area textarea::placeholder {
  color: var(--text-muted);
}

.paste-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

/* ---- Tabs ---- */

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 3px;
}

.tab {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 500;
}

.tab .badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  text-align: center;
}

.tab .badge.errors {
  background: var(--color-error);
  color: #fff;
}

.tab .badge.clean {
  background: var(--color-success);
  color: #1e1e1e;
}

/* ---- Results Header ---- */

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius);
}

.results-summary {
  font-size: 14px;
}

.results-summary strong {
  color: var(--color-error);
}

.results-summary .clean {
  color: var(--color-success);
}

.results-actions {
  display: flex;
  gap: 8px;
}

/* ---- Error Cards ---- */

.error-card {
  background: var(--bg-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-error);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}

.error-card.resolved {
  border-left-color: var(--color-success);
  opacity: 0.6;
}

.error-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.error-timecode {
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 12px;
  color: var(--color-accent);
  background: rgba(74, 144, 226, 0.1);
  padding: 2px 8px;
  border-radius: 3px;
}

.error-card-actions {
  display: flex;
  gap: 6px;
}

.error-text {
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 10px;
  word-break: break-word;
}

.error-word {
  color: var(--color-error);
  background: var(--bg-error);
  padding: 1px 4px;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  text-decoration: underline wavy var(--color-error);
  text-underline-offset: 3px;
}

.error-word:hover {
  background: rgba(255, 107, 107, 0.2);
}

.error-word.fixed {
  color: var(--color-success);
  background: var(--bg-success);
  text-decoration: none;
  cursor: default;
}

.error-word.ignored {
  color: var(--text-secondary);
  background: transparent;
  text-decoration: none;
  cursor: default;
}

/* ---- Suggestions Dropdown ---- */

.suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  background: var(--bg-surface-active);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 4px 0;
  min-width: 150px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  margin-top: 4px;
}

.suggestions.visible {
  display: block;
}

.suggestion-item {
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.1s;
}

.suggestion-item:hover {
  background: var(--color-accent);
  color: #fff;
}

.suggestion-item.add-dict {
  border-top: 1px solid var(--color-border);
  color: var(--color-warning);
  font-size: 12px;
}

/* ---- Clean Entries Collapsible ---- */

.clean-toggle {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  margin-bottom: 10px;
  transition: background 0.15s;
}

.clean-toggle:hover {
  background: var(--bg-surface-hover);
}

.clean-entries {
  display: none;
}

.clean-entries.visible {
  display: block;
}

.clean-card {
  background: var(--bg-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.clean-card .clean-timecode {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 10px;
}

/* ---- Dictionary Section ---- */

.dictionary-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.dictionary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dictionary-header h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.dictionary-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dict-word {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.dict-word .remove-word {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
}

.dict-word .remove-word:hover {
  color: var(--color-error);
}

.dict-add {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.dict-add input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 12px;
  padding: 6px 10px;
}

.dict-add input:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn-success {
  background: var(--color-success);
  color: #1e1e1e;
}

.btn-copy {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn-copy:hover:not(:disabled) {
  background: var(--color-accent);
  color: #fff;
}

.btn-copy.copied {
  background: var(--color-success);
  color: #1e1e1e;
}

/* ---- Loading Spinner ---- */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-muted);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Success State ---- */

.success-message {
  text-align: center;
  padding: 40px 24px;
  color: var(--color-success);
}

.success-message .success-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.success-message p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  .container {
    padding: 16px 12px;
  }

  .drop-zone {
    padding: 32px 16px;
  }

  .error-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .results-header {
    flex-direction: column;
    gap: 10px;
  }

  .results-actions {
    width: 100%;
  }

  .results-actions .btn {
    flex: 1;
    justify-content: center;
  }
}
