/* =========================================================
   QUICKFILETOOLS - PDF TO JPG STYLES
   All colors derived from tokens.css ("the desk" design tokens).
   Supports Light & Dark themes, accessibility, touch targets.
========================================================= */

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

.converter-wrapper {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 16px 64px;
  text-align: center;
}

.page-title {
  font-family: var(--font-sans);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 16px;
  color: var(--ink-muted);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.6;
}

.device-note {
  margin: 16px auto 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.device-note-mark {
  background: var(--marker);
  color: var(--on-marker, var(--ink));
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-control);
}

.converter-card {
  background: var(--sheet);
  border-radius: var(--radius-sheet);
  padding: 24px;
  margin-top: 24px;
  border: 1px solid var(--hairline);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  text-align: left;
}

[data-theme="dark"] .converter-card {
  box-shadow: none;
}

/* Drop Zone */
.drop-box {
  border: 2px dashed var(--rule);
  border-radius: var(--radius-sheet);
  padding: 48px 20px;
  cursor: pointer;
  background: var(--paper);
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.drop-box:hover {
  border-color: var(--action);
}

.drop-box.dragover {
  border-color: var(--action);
  background: var(--marker);
  color: var(--on-marker, var(--ink));
}

.drop-box.dragover .drop-heading,
.drop-box.dragover p {
  color: var(--on-marker, var(--ink)) !important;
}

.drop-icon {
  font-size: 44px;
  margin-bottom: 12px;
  line-height: 1;
  display: flex;
  justify-content: center;
}

.drop-icon svg {
  width: 48px;
  height: 48px;
  stroke: var(--ink);
}

.drop-heading {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
}

.drop-divider {
  margin: 4px 0 14px;
  color: var(--ink-muted);
  font-size: 14px;
}

.drop-hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: var(--action);
  color: var(--on-action);
  padding: 12px 28px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  text-decoration: none;
  max-width: 260px;
  width: 100%;
  box-sizing: border-box;
  transition: background-color 0.15s ease;
}

.upload-btn:hover {
  background: color-mix(in srgb, var(--action) 88%, var(--ink));
}

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

/* File Selected Card */
.file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  margin-bottom: 20px;
}

.file-info-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.file-name-row {
  font-weight: 600;
  color: var(--ink);
  font-size: 15px;
  word-break: break-all;
}

.file-meta-row {
  font-size: 13px;
  color: var(--ink-muted);
}

/* Options Fieldsets */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 20px 0;
}

.settings-group {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  padding: 14px 16px;
  background: var(--paper);
}

.settings-legend {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  padding: 0 6px;
}

.settings-options {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
}

.option-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
  min-height: 36px;
}

.option-label input[type="radio"] {
  accent-color: var(--action);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.range-input-wrapper {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.range-text-input {
  max-width: 300px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--rule);
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  box-sizing: border-box;
}

.range-text-input:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.range-hint {
  font-size: 12px;
  color: var(--ink-muted);
}

.range-error-msg {
  font-size: 13px;
  color: var(--error);
  font-weight: 600;
}

/* Thumbnails Strip */
.thumbnails-strip {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

.thumbnails-strip h3 {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0 0 10px;
  font-weight: 600;
}

.thumbnails-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  border-radius: var(--radius-control);
}

.thumbnails-grid:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.thumb-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--sheet);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 6px;
  width: 70px;
}

.thumb-canvas-box {
  width: 60px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1px solid var(--hairline);
  overflow: hidden;
}

.thumb-canvas-box canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.thumb-page-num {
  font-size: 11px;
  color: var(--ink-muted);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: var(--action);
  color: var(--on-action);
  padding: 12px 32px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background-color 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--action) 88%, var(--ink));
}

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

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: var(--paper);
  color: var(--ink);
  padding: 10px 20px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--hairline);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
  background: var(--sheet);
  border-color: var(--rule);
}

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

.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  background: transparent;
  color: var(--action);
  padding: 6px 14px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--hairline);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.btn-quiet:hover {
  background: var(--paper);
  border-color: var(--action);
}

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

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 20px;
}

/* Status & Progress */
.status-box {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  font-size: 14px;
  line-height: 1.5;
  display: none;
  color: var(--ink);
}

.status-box.info {
  background: var(--paper);
  border: 1px solid var(--hairline);
  color: var(--ink);
}

.status-box.error {
  background: color-mix(in srgb, var(--error) 10%, var(--sheet));
  border: 1px solid var(--error);
  color: var(--ink);
}

.status-box.success {
  background: color-mix(in srgb, var(--ok) 10%, var(--sheet));
  border: 1px solid var(--ok);
  color: var(--ink);
}

.progress-container {
  margin-top: 14px;
  display: none;
  flex-direction: column;
  gap: 6px;
}

.progress-bar-outer {
  width: 100%;
  height: 8px;
  background: var(--paper);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--hairline);
}

.progress-bar-inner {
  height: 100%;
  width: 0%;
  background: var(--action);
  transition: width 0.15s ease;
}

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

/* Results Section */
.results-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  display: none;
}

.results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.results-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.result-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  gap: 10px;
}

.result-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 200px;
}

.result-item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  word-break: break-all;
}

.result-item-details {
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-item-note {
  font-size: 11px;
  color: var(--warn);
  font-weight: 600;
}

.result-item.is-error {
  border-color: var(--error);
  background: color-mix(in srgb, var(--error) 5%, var(--sheet));
}

.is-error {
  border-color: var(--error);
}

.result-item-error-text {
  color: var(--error);
  font-weight: 600;
}

.download-item-btn {
  background: var(--action);
  color: var(--on-action);
  border: 1px solid var(--action);
  padding: 8px var(--space-4, 16px);
  border-radius: var(--radius-control);
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  min-height: 44px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.download-item-btn:hover {
  opacity: 0.92;
}

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

/* Trust Strip */
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 24px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--ink-muted);
}

.trust-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ui-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Content & Information */
.content-info {
  margin-top: 48px;
  text-align: left;
  line-height: 1.7;
  color: var(--ink);
}

.content-info h2 {
  font-family: var(--font-sans);
  font-size: 22px;
  color: var(--ink);
  margin: 36px 0 12px;
}

.content-info h2:first-child {
  margin-top: 0;
}

.content-info ol {
  color: var(--ink-muted);
  padding-left: 20px;
  margin: 0;
}

.content-info ol li {
  margin-bottom: 6px;
}

.content-info ol strong {
  color: var(--ink);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.feature-card {
  background: var(--sheet);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  padding: 18px;
}

.feature-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
}

.feature-card p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.related-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius-control);
  background: var(--sheet);
  border: 1px solid var(--hairline);
  color: var(--action);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.related-link:hover {
  border-color: var(--action);
  background: var(--paper);
}

.related-link:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.faq-card {
  border-bottom: 1px solid var(--hairline);
  padding: 14px 0;
}

.faq-card summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.faq-card p {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.6;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
