/* ============================================================
   styles.css — PlagiarismCheck
   Theme: Dark editorial / technical — Syne + JetBrains Mono
   ============================================================ */

/* ─── Reset & Custom Properties ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette */
  --bg-base:        #0d0f14;
  --bg-surface:     #141720;
  --bg-card:        #1a1e2a;
  --bg-card-hover:  #1f2333;
  --bg-input:       #111318;

  --border:         #252a38;
  --border-focus:   #3d4663;

  --text-primary:   #e8eaf2;
  --text-secondary: #8b91aa;
  --text-muted:     #545968;

  --accent:         #5b8fff;
  --accent-dim:     #2a3d6e;
  --accent-glow:    rgba(91, 143, 255, 0.18);

  --green:          #3ddc84;
  --green-dim:      #1a3d2e;
  --amber:          #f5a623;
  --amber-dim:      #3d2c0d;
  --red:            #ff5b5b;
  --red-dim:        #3d1515;

  --match-high:     rgba(255, 91, 91,  0.18);
  --match-mid:      rgba(245, 166, 35, 0.18);
  --match-low:      rgba(91, 143, 255, 0.15);

  --match-high-border: rgba(255, 91, 91,  0.6);
  --match-mid-border:  rgba(245, 166, 35, 0.6);
  --match-low-border:  rgba(91, 143, 255, 0.5);

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-body:    'Lora', serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Layout */
  --max-width: 1200px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-focus); border-radius: 3px; }

/* ─── HEADER ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 1.4rem;
  color: var(--accent);
  line-height: 1;
}

.logo em {
  color: var(--accent);
  font-style: normal;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-api {
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  margin-left: 0.5rem;
}

.nav-api:hover {
  background: var(--accent-glow);
  color: var(--accent);
}

/* Health dot */
.health-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: default;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.4s;
}

.health-indicator.online .dot  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.health-indicator.offline .dot { background: var(--red); }

/* ─── HERO ───────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5rem 2rem 4rem;
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 1.2rem;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.chip-accent {
  background: var(--accent-glow);
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* Background grid art */
.hero-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grid-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.4;
  mask-image: radial-gradient(ellipse 80% 60% at 70% 50%, black 0%, transparent 100%);
}

/* ─── MAIN ───────────────────────────────────────────────── */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ─── Mode Tabs ──────────────────────────────────────────── */
.mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab-btn {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.75rem 1.25rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tab-icon { font-size: 1rem; }

.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─── Panels ─────────────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }

/* ─── Editors Grid ───────────────────────────────────────── */
.editors-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.75rem;
}

@media (max-width: 768px) {
  .editors-grid {
    grid-template-columns: 1fr;
  }
  .editor-divider { display: none; }
}

.editor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s;
}

.editor-card:focus-within { border-color: var(--border-focus); }

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.editor-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.btn-ghost {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.btn-ghost:hover {
  color: var(--red);
  border-color: var(--red);
  background: rgba(255, 91, 91, 0.08);
}

.editor-area {
  width: 100%;
  min-height: 260px;
  padding: 1.25rem;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  border: none;
  resize: vertical;
  outline: none;
  transition: background 0.2s;
}

.editor-area::placeholder { color: var(--text-muted); }
.editor-area:focus { background: var(--bg-base); }

.char-count {
  padding: 0.5rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  text-align: right;
}

/* Divider */
.editor-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 3rem;
}

.divider-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.3rem 0.6rem;
}

/* ─── Upload Zone ────────────────────────────────────────── */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 220px;
  background: var(--bg-input);
  border: 2px dashed var(--border);
  border-radius: 0;
  cursor: pointer;
  padding: 2rem;
  text-align: center;
  transition: all 0.2s var(--ease);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-icon {
  font-size: 2.2rem;
  color: var(--text-muted);
  line-height: 1;
  transition: color 0.2s;
}

.upload-zone:hover .upload-icon { color: var(--accent); }

.upload-text {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.upload-text u { color: var(--accent); }

.upload-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.upload-filename {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--green);
  font-weight: 500;
  min-height: 1.2em;
}

/* ─── Action Bar ─────────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  padding: 0.5rem 0;
}

.btn-primary {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.9rem 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s var(--ease);
  box-shadow: 0 4px 20px rgba(91, 143, 255, 0.35);
}

.btn-primary:hover {
  background: #7aa3ff;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(91, 143, 255, 0.45);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon { font-size: 1rem; }

.btn-secondary {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

/* ─── Loader ─────────────────────────────────────────────── */
.loader-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 4rem 2rem;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.loader-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.loader-sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ─── Error Banner ───────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--red-dim);
  border: 1px solid var(--red);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  animation: slideDown 0.25s var(--ease);
}

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

.error-icon { color: var(--red); font-size: 1.1rem; }

.error-msg {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.83rem;
  color: var(--text-primary);
}

.error-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.4rem;
  transition: color 0.15s;
}

.error-close:hover { color: var(--red); }

/* ─── RESULTS ────────────────────────────────────────────── */
.results-section {
  animation: fadeUp 0.4s var(--ease);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Score Row */
.score-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 700px) {
  .score-row { grid-template-columns: 1fr; }
}

.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  min-width: 220px;
}

.score-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.score-value {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 1.25rem;
  transition: color 0.4s;
}

.score-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.score-bar {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: width 1s var(--ease);
}

.score-verdict {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Colours by score level — applied by JS */
.level-low    .score-value,
.level-low    .score-verdict  { color: var(--green); }
.level-low    .score-bar      { background: var(--green); }

.level-mid    .score-value,
.level-mid    .score-verdict  { color: var(--amber); }
.level-mid    .score-bar      { background: var(--amber); }

.level-high   .score-value,
.level-high   .score-verdict  { color: var(--red); }
.level-high   .score-bar      { background: var(--red); }

/* Breakdown panel */
.score-breakdown {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.breakdown-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.metric-row {
  display: grid;
  grid-template-columns: 160px 1fr 60px;
  align-items: center;
  gap: 1rem;
}

.metric-name {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.metric-bar-wrap {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.metric-bar {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.9s var(--ease);
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.meta-key {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ─── Matches Section ────────────────────────────────────── */
.matches-section {
  margin-bottom: 2.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.match-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 100px;
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.section-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toggle-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-label input { accent-color: var(--accent); }

/* Match cards */
.matches-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s;
}

.match-card:hover { border-color: var(--border-focus); }

.match-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.match-score-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  border: 1px solid;
}

/* Colour variants by score tier */
.pill-high   { color: var(--red);   background: var(--red-dim);   border-color: var(--match-high-border); }
.pill-mid    { color: var(--amber); background: var(--amber-dim); border-color: var(--match-mid-border); }
.pill-low    { color: var(--accent); background: var(--accent-glow); border-color: var(--match-low-border); }

.match-method {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.match-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
}

.match-col {
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.match-col-sep {
  width: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}

.no-matches {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.no-matches-icon {
  font-size: 2rem;
  color: var(--green);
}

/* ─── Highlight Section ──────────────────────────────────── */
.highlight-section { margin-bottom: 2.5rem; }

.highlight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

@media (max-width: 700px) {
  .highlight-grid { grid-template-columns: 1fr; }
}

.highlight-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pane-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.pane-body {
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-height: 420px;
  overflow-y: auto;
}

/* Highlighted spans inside pane-body */
.hl {
  border-radius: 3px;
  padding: 0.1em 0;
  border-bottom: 2px solid;
  cursor: pointer;
  transition: opacity 0.15s;
}

.hl:hover { opacity: 0.75; }

.hl-high   { background: var(--match-high); border-color: var(--match-high-border); color: #ffadad; }
.hl-mid    { background: var(--match-mid);  border-color: var(--match-mid-border);  color: #ffd98a; }
.hl-low    { background: var(--match-low);  border-color: var(--match-low-border);  color: #a0bfff; }

/* ─── Reset bar ──────────────────────────────────────────── */
.reset-bar {
  display: flex;
  justify-content: center;
  padding: 1rem 0 2rem;
}

/* ─── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  background: var(--bg-surface);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-stack { opacity: 0.6; }

/* ─── Utility ────────────────────────────────────────────── */
[hidden] { display: none !important; }
