/* SQLReveal — Upload page styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a1a4e;
  --primary-light: #2d2d7e;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --bg: #f8f9fa;
  --white: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --success: #065f46;
  --success-bg: #d1fae5;
  --error: #991b1b;
  --error-bg: #fee2e2;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0 16px 40px;
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  width: 100%;
  background: var(--primary);
  color: white;
  padding: 14px 24px;
  text-align: center;
  margin-bottom: 0;
  border-radius: 0 0 0 0;
}
.hero-inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { font-size: 22px; color: var(--accent); }
.brand-name { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.tagline { font-size: 14px; color: #94a3b8; margin: 0; }
.features-bar {
  width: 100%;
  max-width: 592px;
  margin: 0 auto 28px;
  padding: 0 16px;
}
.features { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--text-muted); padding: 14px 0; border-bottom: 1px solid var(--border); }
.features li::before { content: ''; }

/* ── Upload card ─────────────────────────────────────────────────────────── */
.main-card {
  width: 100%;
  max-width: 560px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--bg);
  margin-bottom: 20px;
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--accent);
  background: #fffbeb;
}
.drop-zone.has-files {
  border-color: var(--primary);
  background: #f0f0fa;
}
.drop-icon { font-size: 40px; color: var(--text-muted); margin-bottom: 12px; }
.drop-label { font-size: 15px; color: var(--text); margin-bottom: 6px; line-height: 1.5; }
.drop-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* Analyze button */
.form-actions { text-align: center; }
.btn-analyze {
  padding: 12px 36px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-analyze:hover:not(:disabled) { background: var(--accent-hover); }
.btn-analyze:disabled { opacity: .45; cursor: not-allowed; }

/* Spinner (htmx indicator) */
.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
.htmx-request .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Status area ─────────────────────────────────────────────────────────── */
.status-area { margin-top: 24px; }

/* Progress */
.progress-container { text-align: center; }
.progress-message { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; }
.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .4s ease;
}
.progress-pct { font-size: 12px; color: var(--text-muted); }

/* Result card */
.result-card { border: 1px solid var(--border); border-radius: 10px; padding: 24px; }
.result-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.result-icon { font-size: 22px; color: var(--success); background: var(--success-bg); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.result-header h2 { font-size: 16px; font-weight: 700; color: var(--text); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.summary-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
}
.stat-num { display: block; font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-lbl { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.warning-note {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 20px;
}

.download-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-download {
  flex: 1;
  min-width: 160px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: opacity .15s;
}
.btn-download:hover { opacity: .85; }
.btn-excel { background: var(--primary); color: white; }
.btn-html  { background: var(--accent);  color: white; }

/* Error card */
.error-card {
  border: 1px solid #fca5a5;
  background: var(--error-bg);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
}
.error-icon { font-size: 28px; color: var(--error); display: block; margin-bottom: 8px; }
.error-card h2 { font-size: 16px; font-weight: 700; color: var(--error); margin-bottom: 8px; }
.error-msg { font-size: 13px; color: var(--error); margin-bottom: 6px; word-break: break-word; }
.error-hint { font-size: 12px; color: var(--text-muted); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 560px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .main-card { padding: 20px 16px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .download-buttons { flex-direction: column; }
}
