/* ============================================================
   TXT → DOCX Converter — Dark Theme CSS
   ============================================================ */

:root {
  --bg-primary: #0f0f14;
  --bg-secondary: #1a1a24;
  --bg-tertiary: #24243a;
  --border-color: #2e2e48;
  --border-hover: #6366f1;
  --text-primary: #e0e0e0;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --success: #22c55e;
  --error: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --max-w: 640px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

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

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

a:hover {
  color: var(--accent-hover);
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

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

/* ---------- Skip Link ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  z-index: 1000;
  font-weight: 600;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 16px;
}

/* ---------- Header / Navbar ---------- */
header[role="banner"] {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.logo:hover {
  color: var(--accent-hover);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
}

.nav-links a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

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

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-glow);
  font-weight: 600;
}

/* ---------- Main ---------- */
main {
  flex: 1;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}

/* ---------- Converter Wrapper ---------- */
.converter-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px 24px;
}

/* ---------- Upload Zone ---------- */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

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

.upload-icon {
  color: var(--text-muted);
  width: 48px;
  height: 48px;
  transition: color 0.25s;
}

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

.upload-text {
  font-size: 15px;
  color: var(--text-primary);
}

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

/* ---------- File List ---------- */
.file-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-list:empty {
  display: none;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  gap: 12px;
}

.file-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.file-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-size {
  font-size: 12px;
  color: var(--text-muted);
}

.file-item-remove {
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.file-item-remove:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* ---------- Buttons ---------- */
.actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
  flex: 1;
  text-align: center;
}

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

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

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

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

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

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

/* ---------- Progress Bar ---------- */
.progress-bar {
  margin-top: 20px;
  background: var(--bg-tertiary);
  border-radius: 100px;
  height: 28px;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 100px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

/* ---------- Results ---------- */
.results {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.results:empty {
  display: none;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  gap: 12px;
}

.result-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.result-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--success);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-item-size {
  font-size: 12px;
  color: var(--text-muted);
}

.result-download {
  background: var(--success);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.result-download:hover {
  opacity: 0.85;
  color: #fff;
}

/* ---------- Error Message ---------- */
.error-msg {
  margin-top: 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--error);
  font-size: 14px;
}

/* ---------- Info Section ---------- */
.info-section {
  margin-top: 48px;
}

.info-section h2 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.step {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.step p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---------- Footer ---------- */
footer[role="contentinfo"] {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    gap: 4px 8px;
  }

  .page-title {
    font-size: 22px;
  }

  .converter-wrapper {
    padding: 24px 16px;
  }

  .upload-zone {
    padding: 28px 16px;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .actions {
    flex-direction: column;
  }
}
