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

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --border: #e7e5e4;
  --border-hover: #d6d3d1;
  --text: #1c1917;
  --text-2: #57534e;
  --text-3: #a8a29e;
  --accent: #c2410c;
  --accent-bg: #fff7ed;
  --accent-hover: #9a3412;
  --green: #15803d;
  --green-bg: #f0fdf4;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --radius: 10px;
  --mono: 'JetBrains Mono', monospace;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- NAV ---- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.nav-brand {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-icon {
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-toggle {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.6rem;
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  letter-spacing: 0.03em;
}

.lang-toggle:hover {
  border-color: var(--text-3);
  color: var(--text);
}

.nav-donate {
  font-size: 0.8rem;
  color: var(--text-2);
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s, color 0.15s;
}

.nav-donate:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- HERO ---- */
.main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
}

.hero {
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text);
}

.highlight {
  color: var(--accent);
}

.hero-sub {
  margin-top: 0.75rem;
  font-size: 1.05rem;
  color: var(--text-2);
}

/* ---- CONVERTER ---- */
.converter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* Drop zone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.dropzone-icon {
  color: var(--text-3);
  margin-bottom: 0.75rem;
  transition: color 0.15s;
}

.dropzone:hover .dropzone-icon,
.dropzone.dragover .dropzone-icon {
  color: var(--accent);
}

.dropzone-label {
  font-size: 0.95rem;
  color: var(--text-2);
}

.dropzone-browse {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dropzone-hint {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 0.35rem;
}

/* File row */
.file-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.file-badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  background: var(--accent);
  color: white;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.file-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.75rem;
  color: var(--text-3);
}

.file-remove {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-3);
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.file-remove:hover {
  color: var(--red);
  background: var(--red-bg);
}

/* Buttons */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

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

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

.btn-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
}

.btn-outline:hover {
  border-color: var(--text-3);
}

.btn-text, .btn-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

/* Dot loader */
.dot-loader {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.dot-loader span {
  width: 5px;
  height: 5px;
  background: white;
  border-radius: 50%;
  animation: dotPulse 1.2s ease-in-out infinite;
}

.dot-loader span:nth-child(2) { animation-delay: 0.15s; }
.dot-loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Progress */
.progress {
  margin-top: 1rem;
}

.progress-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

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

.progress-label {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 0.5rem;
}

/* Result */
.result {
  margin-top: 0.75rem;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: var(--green-bg);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
}

.result-check {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  background: var(--green);
  color: white;
  border-radius: 4px;
}

.result-pages {
  font-size: 0.9rem;
  color: var(--text-2);
}

.result-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.result-buttons .btn-primary,
.result-buttons .btn-outline {
  margin-top: 0.5rem;
}

.result-buttons .btn-primary {
  background: var(--green);
}

.result-buttons .btn-primary:hover {
  background: #166534;
}

/* Alert */
.alert {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--red-bg);
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--red);
}

/* Info banner */
.info-banner {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--accent-bg);
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
}

.info-item {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.6;
}

.info-item strong {
  color: var(--text);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s ease;
  z-index: 100;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem 2rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 640px;
  margin: 0 auto;
}

.footer-note {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.6;
}

.footer-note a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-fine {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.35rem;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
  .nav {
    padding: 0.85rem 1.25rem;
  }

  .main {
    padding: 2rem 1.25rem 1.5rem;
  }

  .hero h1 {
    font-size: 1.65rem;
  }

  .result-buttons {
    grid-template-columns: 1fr;
  }
}
