/* BCorrect — Two-Panel DeepL-style UI */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface2: #f5f5f5;
  --border: rgba(0,0,0,0.08);
  --border-focus: rgba(59,130,246,0.4);
  --accent: #3b82f6;
  --accent2: #06b6d4;
  --text: #1a1a2a;
  --text-muted: #6b7280;
  --green: #16a34a;
  --red: #dc2626;
  --yellow: #d97706;
  --blue: #2563eb;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── HUD Nav ── */
.hud-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.6rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.hud-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: all 0.15s;
}
.hud-nav a:hover { color: var(--accent); background: rgba(59,130,246,0.06); }
.hud-nav a.active { color: var(--accent); }

/* ── Main Layout ── */
.bcorrect-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.25rem 1.5rem;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Header ── */
.layout-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.layout-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.2rem;
}

.model-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* ── Test Buttons ── */
.test-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.test-buttons button {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.test-buttons button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59,130,246,0.06);
}

/* ── Two-Panel Grid ── */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

/* ── Pane ── */
.pane {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 420px;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.pane-header h2 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.word-count {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Textarea ── */
.editor-textarea {
  flex: 1;
  width: 100%;
  min-height: 300px;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.75;
  resize: none;
  outline: none;
}
.editor-textarea::placeholder { color: var(--text-muted); }
.left-pane:focus-within { border-color: var(--border-focus); }

/* ── Output Area ── */
.output-area {
  flex: 1;
  padding: 1rem 1.25rem;
  min-height: 300px;
  position: relative;
  font-size: 1rem;
  line-height: 1.75;
}

.placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.humanized-text {
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Highlighted corrections */
.corrected-word {
  color: var(--green);
  font-weight: 600;
  border-bottom: 2px solid var(--green);
  padding-bottom: 1px;
}

/* ── Processing Overlay ── */
.processing-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(255,255,255,0.9);
  border-radius: 0 0 12px 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(59,130,246,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.processing-text {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.progress-bar-container {
  width: 200px;
  height: 4px;
  background: rgba(59,130,246,0.15);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
}

/* ── Copy Button ── */
.copy-btn {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.copy-btn:hover:not(:disabled) {
  border-color: var(--accent2);
  color: var(--accent2);
}
.copy-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Suggestions Panel ── */
.tells-panel {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  max-height: 220px;
  overflow-y: auto;
}
.tells-panel.hidden { display: none; }
.tells-panel h3 {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.suggestions-list { display: flex; flex-direction: column; gap: 0.5rem; }

.suggestion-item {
  padding: 0.6rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
}

.suggestion-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.original-word {
  color: var(--red);
  text-decoration: line-through;
  font-weight: 600;
}

.arrow { color: var(--text-muted); }

.suggestion-word {
  color: var(--green);
  font-weight: 700;
}

.suggestion-explanation {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.suggestion-actions { margin-top: 0.4rem; }

.ignore-btn {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.ignore-btn:hover { border-color: var(--red); color: var(--red); }

/* ── Stats Footer ── */
.stats-footer {
  border-top: 1px solid var(--border);
  padding: 0.6rem 1rem;
  background: var(--surface2);
}

.stats-row {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-item { display: flex; align-items: center; gap: 0.3rem; }
.stat-item strong { font-weight: 700; }

/* ── Layout Footer ── */
.layout-footer {
  padding: 0.5rem 0;
  text-align: center;
}

.status {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .editor-grid { grid-template-columns: 1fr; }
  .bcorrect-layout { padding: 0.75rem; }
  .layout-header h1 { font-size: 1.1rem; }
}

/* ── Session Timeout Overlay ── */
.session-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  max-width: 380px;
}
.session-card h2 { margin-bottom: 0.75rem; color: var(--accent); }
.session-card p { color: var(--text-muted); font-size: 0.9rem; }

/* ── Slow Tick Loading Bar ── */
.slow-tick-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  background: rgba(59,130,246,0.1);
}
.slow-tick-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.3s ease;
}

/* ── Free Tools Hub (fallback) ── */
.free-tools-platform { min-height: 100vh; padding: 2rem; }
.hero-section {
  padding: 4rem 2rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 12px;
  text-align: center;
  margin-bottom: 2rem;
}
.splash-title { font-size: 3rem; font-weight: 800; color: #fff; margin-bottom: 1rem; }
.splash-subtitle { color: var(--text-muted); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }
.catalog-section { padding: 2rem 0; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
