/* PDF to Images – clean, readable UI */
:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-hover: #243044;
  --border: #2d3a4d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --primary: #58a6ff;
  --primary-hover: #79b8ff;
  --secondary: #30363d;
  --success: #3fb950;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.main {
  flex: 1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Upload zone */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.upload-text {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.upload-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Options */
.options-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.option-label {
  min-width: 120px;
  font-weight: 500;
}

.option select {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.option input[type="range"] {
  width: 120px;
  accent-color: var(--primary);
}

.option input[type="number"] {
  width: 80px;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.option-hint {
  width: 100%;
  margin-left: 120px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.actions {
  margin-top: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

/* Progress */
.progress-bar {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.2s;
}

.progress-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Results */
.results-summary {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.preview-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}

.preview-item:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(0, 174, 239, 0.45);
  box-shadow: 0 8px 24px rgba(0, 174, 239, 0.15);
}

.preview-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3/4;
  object-fit: cover;
  transition: transform .25s;
}

.preview-item:hover img {
  transform: scale(1.03);
}

.preview-item .page-num {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.25rem 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  font-size: 0.75rem;
  text-align: center;
}

.preview-item a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer {
  text-align: center;
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer p {
  margin: 0;
}
