/* PDF to DOCX Converter — Mobile-first Dark Theme */
:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2333;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --danger: #f85149;
  --success: #3fb950;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: 1.75rem;
  line-height: 1.3;
  margin-bottom: .25rem;
}

header h1 span { color: var(--accent); }

header p {
  color: var(--text-muted);
  font-size: .95rem;
}

.back-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: .85rem;
  margin-bottom: .75rem;
}

.back-link:hover { text-decoration: underline; }

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--surface);
  position: relative;
}

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

.upload-zone:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,.25);
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: .75rem;
  display: block;
}

.upload-zone p {
  color: var(--text-muted);
  font-size: .95rem;
  margin-bottom: .5rem;
}

.upload-zone .hint {
  font-size: .8rem;
  color: #6e7681;
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* File info */
.file-info {
  display: none;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-top: 1rem;
}

.file-info.visible { display: flex; }

.file-info .file-icon { font-size: 1.5rem; flex-shrink: 0; }

.file-info .file-details { flex: 1; min-width: 0; }

.file-info .file-name {
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-info .file-size { color: var(--text-muted); font-size: .8rem; }

.file-info .remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.2rem;
  cursor: pointer;
  padding: .25rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.file-info .remove-btn:hover { background: rgba(248,81,73,.15); }
.file-info .remove-btn:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

/* Preview */
.preview-section {
  display: none;
  margin-top: 1.25rem;
}

.preview-section.visible { display: block; }

.preview-section h2 {
  font-size: 1rem;
  margin-bottom: .5rem;
  color: var(--text);
}

.preview-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 260px;
  overflow-y: auto;
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-box:empty::before {
  content: "No text content found in this PDF.";
  color: var(--danger);
}

.preview-stats {
  display: flex;
  gap: 1rem;
  margin-top: .5rem;
  font-size: .8rem;
  color: var(--text-muted);
}

.preview-stats span { display: flex; align-items: center; gap: .25rem; }

/* Progress */
.progress-section {
  display: none;
  margin-top: 1.25rem;
  text-align: center;
}

.progress-section.visible { display: block; }

.progress-bar-track {
  background: var(--border);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
  margin-bottom: .75rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0%;
  transition: width .3s ease;
}

.progress-text { font-size: .85rem; color: var(--text-muted); }

/* Buttons */
.actions {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-top: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .85rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .2s, transform .1s;
  font-family: var(--font);
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active { transform: scale(.98); }

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

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

.btn-primary:disabled {
  background: #21262d;
  color: #484f58;
  cursor: not-allowed;
  transform: none;
}

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

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

/* Error / Success Messages */
.message {
  display: none;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-top: 1rem;
  align-items: center;
  gap: .5rem;
}

.message.visible { display: flex; }

.message.error {
  background: rgba(248,81,73,.1);
  border: 1px solid rgba(248,81,73,.3);
  color: var(--danger);
}

.message.success {
  background: rgba(63,185,80,.1);
  border: 1px solid rgba(63,185,80,.3);
  color: var(--success);
}

/* Footer */
footer {
  text-align: center;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: #6e7681;
}

footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

.footer-links { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-top: .5rem; }

/* Accessibility: focus-visible for keyboard users */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Responsive: tablet+ */
@media (min-width: 640px) {
  .container { padding: 2.5rem 1.5rem; }
  header h1 { font-size: 2.25rem; }
  .actions { flex-direction: row; }
  .upload-zone { padding: 3rem 2rem; }
}

/* Responsive: desktop */
@media (min-width: 960px) {
  header h1 { font-size: 2.5rem; }
}
