/* ── Reset & Base ──────────────────────────────────────────── */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
  padding: 16px;
}

/* ── Demo Banner ─────────────────────────────────────────── */

.demo-banner {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.88rem;
  text-align: center;
  margin-bottom: 12px;
}

/* ── Container ────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* ── Header ───────────────────────────────────────────────── */

header {
  text-align: center;
  margin-bottom: 24px;
}

h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 8px;
}

.privacy-notice {
  font-size: 0.85rem;
  color: #666;
  background: #f0f7f0;
  border: 1px solid #d4ead4;
  border-radius: 6px;
  padding: 10px 14px;
  line-height: 1.5;
}

/* ── Form Groups ──────────────────────────────────────────── */

.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #222;
}

.required {
  color: #d32f2f;
}

input[type="text"],
input[type="number"],
input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[type="file"] {
  padding: 10px;
  font-size: 0.9rem;
  cursor: pointer;
}

input[type="file"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.hint {
  display: block;
  font-size: 0.78rem;
  color: #888;
  margin-top: 4px;
}

/* ── Checkbox ─────────────────────────────────────────────── */

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-group label {
  margin-bottom: 0;
  font-weight: 500;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #2563eb;
  flex-shrink: 0;
}

/* ── File Cards ───────────────────────────────────────────── */

#file-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

/* Only add top margin when cards are present */
#file-cards:empty {
  margin-bottom: 0;
}

.file-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
}

.file-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.file-card-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #111;
  word-break: break-all;
  min-width: 0;
}

.file-card-remove {
  flex-shrink: 0;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #888;
  font-size: 0.78rem;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  line-height: 1;
}

.file-card-remove:hover {
  color: #b91c1c;
  border-color: #f5c6c6;
  background: #fef2f2;
}

.file-card-remove:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.5);
  outline-offset: 1px;
}

.file-card .form-group {
  margin-bottom: 10px;
}

.file-card .form-group:last-child {
  margin-bottom: 0;
}

.file-card label {
  font-size: 0.82rem;
}

.file-card input[type="text"],
.file-card input[type="number"] {
  padding: 9px 12px;
  font-size: 0.92rem;
}

/* ── Submit Button ────────────────────────────────────────── */

button[type="submit"] {
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background-color: #2563eb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

button[type="submit"]:hover {
  background-color: #1d4ed8;
}

button[type="submit"]:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.5);
  outline-offset: 2px;
}

button[type="submit"]:disabled {
  background-color: #93b4f5;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ── Loading Indicator ────────────────────────────────────── */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  font-size: 0.95rem;
  color: #555;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #e0e0e0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Messages ─────────────────────────────────────────────── */

.message {
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.message.error {
  background: #fef2f2;
  border: 1px solid #f5c6c6;
  color: #b91c1c;
  margin-bottom: 16px;
}

.message.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  text-align: center;
  padding: 32px 20px;
}

.success-icon {
  font-size: 2.5rem;
  color: #22c55e;
  margin-bottom: 12px;
}

/* ── Conversion Warning (post-upload) ────────────────────── */

.conversion-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  color: #92400e;
  font-size: 0.88rem;
  line-height: 1.55;
  padding: 12px 16px;
  margin-top: 16px;
  text-align: left;
}

.conversion-warning strong {
  color: #78350f;
}

/* ── Status Button (shown after successful upload) ────────── */

.status-btn {
  display: inline-block;
  margin-top: 18px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background-color: #2563eb;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.status-btn:hover {
  background-color: #1d4ed8;
}

.status-btn:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.5);
  outline-offset: 2px;
}

/* ── Hidden utility ───────────────────────────────────────── */

[hidden] {
  display: none !important;
}

/* ── Error Page ──────────────────────────────────────────── */

.error-page {
  text-align: center;
  padding: 32px 20px;
}

.error-icon {
  font-size: 3rem;
  color: #f59e0b;
  margin-bottom: 16px;
  line-height: 1;
}

.error-page h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 12px;
}

.error-page p {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 8px;
}

.error-help {
  font-size: 0.88rem;
  color: #888;
  margin-top: 4px;
}

.error-home-link {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background-color: #2563eb;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.2s;
}

.error-home-link:hover {
  background-color: #1d4ed8;
}

/* ── Responsive: Tablet & Desktop ─────────────────────────── */

@media (min-width: 600px) {
  body {
    padding: 40px 20px;
  }

  .container {
    padding: 36px 32px;
  }

  h1 {
    font-size: 1.5rem;
  }
}

@media (min-width: 900px) {
  body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
  }

  .container {
    max-width: 520px;
    padding: 40px 40px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  }
}