/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  background: #f0f2f5;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────────────── */
header {
  background: #1a3c6e;
  color: #fff;
  padding: 1.5rem 1rem;
  text-align: center;
}
header h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.4rem; }
header .tagline { font-size: 0.85rem; opacity: 0.85; max-width: 520px; margin: 0 auto; }

/* ── Main ─────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 600px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* ── Privacy Banner ───────────────────────────────────────────────────── */
.privacy-banner {
  background: #fff8e1;
  border-left: 4px solid #f39c12;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.privacy-banner.hidden {
  display: none;
}
.privacy-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.privacy-text {
  flex: 1;
  font-size: 0.9rem;
  color: #7d5a00;
  line-height: 1.5;
}
.privacy-text strong {
  color: #5d4100;
}
.privacy-text a {
  color: #1a3c6e;
  text-decoration: underline;
  font-weight: 600;
}
.privacy-text a:hover {
  color: #14305a;
}
.dismiss-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.dismiss-btn:hover {
  background: rgba(0,0,0,0.05);
  color: #666;
}

/* ── Sections ─────────────────────────────────────────────────────────── */
section {
  background: #fff;
  border-radius: 10px;
  padding: 2rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.hidden { display: none !important; }

/* ── Drop Zone ────────────────────────────────────────────────────────── */
#drop-zone {
  border: 2px dashed #a0b4cc;
  border-radius: 8px;
  padding: 2.5rem 1rem;
  text-align: center;
  transition: background 0.2s, border-color 0.2s;
  cursor: default;
}
#drop-zone.drag-over {
  background: #eef4fb;
  border-color: #1a3c6e;
}
#drop-zone .drop-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
#drop-zone p { margin-bottom: 0.5rem; color: #444; }
#drop-zone .or { color: #999; font-size: 0.9rem; }
#drop-zone .hint { font-size: 0.8rem; color: #888; margin-top: 0.75rem; }
#drop-zone input[type="file"] { display: none; }

/* ── File Preview (after selection) ──────────────────────────────────── */
#file-preview {
  margin-top: 1.5rem;
  text-align: center;
}
#preview-thumb {
  width: 120px;
  height: 80px;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f7fa;
  border-radius: 6px;
  overflow: hidden;
}
#img-thumb {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
#pdf-thumb { font-size: 2.5rem; }
#file-name-display {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 1rem;
  word-break: break-all;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  background: #1a3c6e;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, opacity 0.2s;
  min-height: 44px;
}
.btn:hover:not(:disabled) { background: #14305a; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.secondary {
  background: #fff;
  color: #1a3c6e;
  border: 1.5px solid #1a3c6e;
}
.btn.secondary:hover { background: #eef4fb; }
.btn.link {
  background: none;
  color: #1a3c6e;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: underline;
  padding: 0.5rem 0;
}
.btn.link:hover { color: #14305a; }

/* ── File Info Bar ────────────────────────────────────────────────────── */
#file-info-bar {
  background: #eef4fb;
  border-left: 3px solid #1a3c6e;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: #333;
  border-radius: 0 4px 4px 0;
  margin-bottom: 1.5rem;
  word-break: break-all;
}

/* ── Form ─────────────────────────────────────────────────────────────── */
.field {
  margin-bottom: 1.1rem;
  position: relative;
}
.field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.3rem;
}
.field .req { color: #c0392b; }
.field .optional { font-weight: 400; color: #888; font-size: 0.82rem; }

.field input[type="text"],
.field input[type="date"],
.field select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #c8d0db;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #1a1a1a;
  background: #fafbfc;
  transition: border-color 0.2s;
  min-height: 44px;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: #1a3c6e;
  background: #fff;
}

.counter {
  position: absolute;
  right: 0;
  bottom: -1.2rem;
  font-size: 0.75rem;
  color: #999;
}
.field { padding-bottom: 0.5rem; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: space-between;
}
.form-actions #back-btn {
  margin-right: auto;
}

/* ── Preview ──────────────────────────────────────────────────────────── */
#preview-wrap {
  position: relative;
  width: 100%;
  height: 70vh;
  max-height: 800px;
  min-height: 500px;
  background: #e8eaed;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
}
#pdf-object {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
#pdf-object .hint {
  padding: 2rem;
  text-align: center;
  color: #666;
}

.preview-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.reset-wrap { text-align: center; }

/* ── Warnings / Errors ────────────────────────────────────────────────── */
.warning, .error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.88rem;
}
.warning {
  background: #fff8e1;
  border-left: 3px solid #f39c12;
  color: #7d5a00;
}
.error {
  background: #fdecea;
  border-left: 3px solid #c0392b;
  color: #922b21;
}

/* ── Footer ───────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  font-size: 0.8rem;
  color: #888;
  padding: 1.5rem 1rem;
}
footer a {
  color: #1a3c6e;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
footer a:hover {
  color: #14305a;
  text-decoration: underline;
}

/* ── Mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  main { margin: 1rem auto; }
  section { padding: 1.5rem 1rem; }
  header h1 { font-size: 1.2rem; }
  #preview-wrap { height: 60vh; min-height: 400px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; text-align: center; }
  .preview-actions { flex-direction: column; }
  .preview-actions .btn { width: 100%; text-align: center; }
}
