/* ============================================================
   PDF-to-Excel Converter — Mobile-first dark theme
   ============================================================ */

:root {
  --bg:         #0f1117;
  --surface:    #18181b;
  --surface-2:  #1e1e22;
  --border:     #27272a;
  --border-focus: #3b82f6;
  --text:       #e4e4e7;
  --text-muted: #a1a1aa;
  --accent:     #3b82f6;
  --accent-hover:#2563eb;
  --danger:     #ef4444;
  --success:    #22c55e;
  --radius:     12px;
  --radius-sm:  8px;
  --font:       system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.app {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem 0;
}

/* --- Header --- */
header { text-align: center; }
header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.35rem;
}

/* --- Drop Zone --- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--surface-2);
}
.drop-zone:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}
.drop-zone-icon {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.drop-zone-text {
  font-size: 1.1rem;
  font-weight: 500;
}
.drop-zone-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}
.drop-zone-limit {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.75rem;
  opacity: 0.7;
}

/* --- Error --- */
.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  color: #fca5a5;
  font-size: 0.9rem;
  text-align: center;
}

/* --- Progress --- */
.progress-container {
  width: 100%;
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.progress-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* --- Preview --- */
#preview-section h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.disclaimer {
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  color: #fbbf24;
  margin-bottom: 1rem;
}
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
}
.table-wrapper:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}
#preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
#preview-table th,
#preview-table td {
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
#preview-table th {
  background: var(--surface-2);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}
#preview-table tr:hover td {
  background: rgba(59,130,246,0.06);
}

/* --- Buttons --- */
.actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.btn {
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: var(--font);
}
.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }

/* --- Footer --- */
footer {
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}
footer p {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}
footer nav {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
footer nav a {
  color: var(--accent);
  font-size: 0.8rem;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s;
}
footer nav a:hover { background: rgba(59,130,246,0.1); }

/* --- Responsive --- */
@media (min-width: 640px) {
  body { padding: 2rem; }
  .app { padding: 3rem 0; }
  header h1 { font-size: 2.25rem; }
  .drop-zone { padding: 3.5rem 2rem; }
}
