/* ============================================================
   PDF-to-TXT Converter — Mobile-First Dark Theme
   ============================================================ */

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --border:    #30363d;
  --text:      #c9d1d9;
  --text-dim:  #8b949e;
  --accent:    #58a6ff;
  --accent-h:  #79c0ff;
  --success:   #3fb950;
  --danger:    #f85149;
  --radius:    8px;
  --font:      system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono:      'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 640px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ---- Header ---- */
header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.logo:hover, .logo:focus-visible { color: var(--accent-h); }
header h1 { font-size: 1rem; font-weight: 500; color: var(--text-dim); }

/* ---- Main ---- */
main { flex: 1; }

/* ---- Upload zone ---- */
.upload-zone { margin-bottom: 1.5rem; }

.upload-inner {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}
.upload-inner:hover,
.upload-inner:focus-visible,
.upload-inner.dragover {
  border-color: var(--accent);
  background: rgba(88,166,255,.06);
  outline: none;
}

.upload-icon { width: 48px; height: 48px; color: var(--text-dim); }
.dragover .upload-icon { color: var(--accent); }

.upload-text { font-size: 1rem; color: var(--text); }
.browse-link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.upload-hint { font-size: .8rem; color: var(--text-dim); }

/* ---- Error ---- */
.error {
  background: rgba(248,81,73,.12);
  border: 1px solid rgba(248,81,73,.3);
  color: var(--danger);
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: 1rem;
}

/* ---- Progress ---- */
.progress-bar {
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: .5rem;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .3s ease;
}
.progress-text { font-size: .85rem; color: var(--text-dim); text-align: center; }

/* ---- Preview ---- */
.preview-section { margin-bottom: 1.5rem; }

.preview-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .75rem;
}
.preview-header h2 { font-size: 1rem; font-weight: 600; }

.badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .1rem .5rem;
  color: var(--text-dim);
}

.preview-actions { display: flex; gap: .5rem; }

.text-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.5;
  max-height: 400px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  tab-size: 4;
}

.preview-footer { margin-top: 1rem; text-align: center; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 500;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-h); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
footer p { font-size: .8rem; color: var(--text-dim); }

/* ---- Responsive ---- */
@media (min-width: 480px) {
  .app { padding: 1.5rem; }
  .upload-inner { padding: 3rem 2rem; }
}

@media (min-width: 640px) {
  .app { padding: 2rem; }
}

/* ---- Focus visible (keyboard nav) ---- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Scrollbar styling ---- */
.text-preview::-webkit-scrollbar { width: 6px; }
.text-preview::-webkit-scrollbar-track { background: var(--surface); }
.text-preview::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
