:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-tertiary: #242936;
  --bg-hover: #2d3344;
  --text-primary: #f0f2f5;
  --text-secondary: #9ca3b0;
  --text-muted: #6b7280;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-subtle: rgba(96, 165, 250, 0.12);
  --error: #ef4444;
  --error-subtle: rgba(239, 68, 68, 0.12);
  --success: #10b981;
  --success-subtle: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-subtle: rgba(245, 158, 11, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 400px;
  min-height: 280px;
  max-height: 600px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.5;
}

.container {
  padding: 20px;
}

/* ===== Header ===== */
header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 4px;
}

.settings-btn {
  position: absolute;
  right: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  opacity: 0.5;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-btn:hover {
  opacity: 1;
  background: var(--bg-tertiary);
}

.settings-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-secondary);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

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

.tagline {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Debug Indicator ===== */
.debug-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 10px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.debug-indicator.hidden {
  display: none;
}

.debug-indicator svg {
  width: 12px;
  height: 12px;
}

/* ===== Sections ===== */
#status-section {
  display: none;
}

.section {
  margin-bottom: 16px;
}

.section.hidden {
  display: none;
}

/* ===== Status Card ===== */
.status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: 0;
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.status-card.clickable {
  cursor: pointer;
}

.status-card.clickable:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.status-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-secondary);
}

.status-icon.ready svg {
  stroke: var(--success);
}

.status-icon.error svg {
  stroke: var(--error);
}

.status-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-secondary);
}

.view-text-hint {
  font-size: 12px;
  color: var(--accent);
  opacity: 0.8;
}

.view-text-hint.hidden {
  display: none;
}

/* ===== Buttons ===== */
.btn-primary, .btn-secondary {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-subtle);
}

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

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

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

/* ===== Article Actions (Compact) ===== */
#article-actions-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-detected-icon {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 0 0 auto;
}

.article-detected-icon:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-strong);
}

.article-detected-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--success);
  flex-shrink: 0;
}

.article-wordcount {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.btn-sidepanel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 1;
  justify-content: center;
}

.btn-sidepanel:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sidepanel svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

.btn-sidepanel span {
  white-space: nowrap;
}

/* ===== Loading ===== */
.loader {
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.loader-bar {
  height: 100%;
  width: 30%;
  background: var(--accent);
  border-radius: 2px;
  animation: loading 1.2s ease-in-out infinite;
}

@keyframes loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

.loading-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Results ===== */
h2 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

#results-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  max-height: 350px;
  overflow-y: auto;
}

#results-content::-webkit-scrollbar {
  width: 6px;
}

#results-content::-webkit-scrollbar-track {
  background: transparent;
}

#results-content::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 3px;
}

/* ===== Analysis Summary ===== */
.analysis-summary {
  background: var(--bg-tertiary);
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.issue-count {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.severity-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 100px;
}

.severity-badge.significant {
  background: var(--error-subtle);
  color: var(--error);
}

.severity-badge.moderate {
  background: var(--warning-subtle);
  color: var(--warning);
}

.severity-badge.minor {
  background: var(--success-subtle);
  color: var(--success);
}

.severity-badge.none {
  background: var(--bg-hover);
  color: var(--text-muted);
}

/* ===== Central Gap Box ===== */
.central-gap-box {
  background: var(--error-subtle);
  border-left: 3px solid var(--error);
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
}

.central-gap-header {
  font-weight: 600;
  color: var(--error);
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.central-gap-content {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}

/* ===== Fallacy Items ===== */
.fallacy-item {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.fallacy-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.fallacy-item.critical {
  border-left: 3px solid var(--error);
  padding-left: 14px;
  background: var(--error-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-left: -14px;
  margin-right: -14px;
}

.fallacy-item.significant {
  border-left: 3px solid var(--warning);
  padding-left: 14px;
  background: var(--warning-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-left: -14px;
  margin-right: -14px;
}

.fallacy-item.minor {
  border-left: 3px solid var(--text-muted);
  padding-left: 14px;
}

.fallacy-name,
.fallacy-header {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.importance-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 100px;
}

.importance-badge.critical {
  background: var(--error-subtle);
  color: var(--error);
}

.importance-badge.significant {
  background: var(--warning-subtle);
  color: var(--warning);
}

.importance-badge.minor {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.fallacy-quote {
  background: var(--bg-tertiary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent);
  margin: 10px 0;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 13px;
}

.fallacy-explanation {
  color: var(--text-primary);
}

.fallacy-gap-simple {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
}

.fallacy-item.critical .fallacy-gap-simple {
  border-left-color: var(--error);
}

.fallacy-item.significant .fallacy-gap-simple {
  border-left-color: var(--warning);
}

.fallacy-item.minor .fallacy-gap-simple {
  border-left-color: var(--text-muted);
}

/* ===== No Fallacies ===== */
.no-fallacies {
  text-align: center;
  padding: 24px;
  color: var(--success);
}

.no-fallacies .checkmark {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  background: var(--success-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.no-fallacies .checkmark svg {
  width: 20px;
  height: 20px;
  stroke: var(--success);
}

/* ===== Error Card ===== */
.error-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--error-subtle);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius);
}

.error-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.error-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--error);
}

#error-message {
  font-size: 13px;
  color: var(--error);
  line-height: 1.5;
}

/* ===== Article Text Display ===== */
.article-text-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.article-text-header h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.article-text-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.article-text-content::-webkit-scrollbar {
  width: 6px;
}

.article-text-content::-webkit-scrollbar-track {
  background: transparent;
}

.article-text-content::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 3px;
}

/* ===== Form Elements ===== */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="password"],
input[type="text"] {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="password"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

input[type="password"]::placeholder,
input[type="text"]::placeholder {
  color: var(--text-muted);
}

.input-group {
  display: flex;
  gap: 8px;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.hint a {
  color: var(--accent);
  text-decoration: none;
}

.hint a:hover {
  text-decoration: underline;
}

/* ===== Scrollbar ===== */
body::-webkit-scrollbar {
  width: 8px;
}

body::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

body::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
