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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ── Layout ───────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

header {
  text-align: center;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 0.4rem;
}

.subtitle {
  color: #5c6270;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ── Card ─────────────────────────────────────────────────────── */
.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: #1a1a2e;
}

/* ── Drop zone ────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed #c5cad6;
  border-radius: 10px;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1rem;
}

.drop-zone.drag-over {
  border-color: #4361ee;
  background: #eef1fd;
}

.drop-icon {
  font-size: 2.5rem;
  margin-bottom: 0.6rem;
}

.drop-zone p {
  color: #5c6270;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.file-label {
  color: #4361ee;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
}

.hint {
  font-size: 0.8rem;
  color: #9aa0af;
}

#file-input { display: none; }

/* ── Selected file banner ─────────────────────────────────────── */
.file-selected {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #eef1fd;
  border: 1px solid #bfc8f8;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #2d3a8c;
}

.file-icon { font-size: 1.1rem; flex-shrink: 0; }

.file-selected span:nth-child(2) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #7a86b8;
  font-size: 1rem;
  padding: 0 0.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.btn-clear:hover { color: #e63946; }

/* ── Form group ───────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: #1a1a2e;
}

.optional {
  font-weight: 400;
  color: #9aa0af;
  font-size: 0.82rem;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #1a1a2e;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input[type="text"]:focus {
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: #4361ee;
  color: #ffffff;
  width: 100%;
}

.btn-primary:disabled {
  background: #b0baee;
  cursor: not-allowed;
  transform: none;
}

.btn-success {
  background: #2dc653;
  color: #ffffff;
  width: 100%;
  margin-bottom: 0.75rem;
}

.btn-secondary {
  background: #f0f2f5;
  color: #5c6270;
  border: 1.5px solid #d1d5db;
  width: 100%;
}

.btn:hover:not(:disabled) { opacity: 0.88; }

/* ── Status states ────────────────────────────────────────────── */
#processing-state,
#complete-state,
#error-state {
  text-align: center;
  padding: 0.5rem 0;
}

#processing-state h2,
#complete-state h2,
#error-state h2 {
  margin-bottom: 0.5rem;
}

#processing-state p,
#complete-state p,
#error-state p {
  color: #5c6270;
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.result-icon { font-size: 2.8rem; margin-bottom: 0.75rem; }

.result-filename {
  font-weight: 500;
  color: #1a1a2e !important;
  word-break: break-all;
}

.error-message { color: #e63946 !important; }

/* ── Spinner ──────────────────────────────────────────────────── */
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e2e6f0;
  border-top-color: #4361ee;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ── Footer ───────────────────────────────────────────────────── */
footer {
  text-align: center;
  font-size: 0.8rem;
  color: #9aa0af;
  padding-bottom: 1rem;
}

/* ── Utility ──────────────────────────────────────────────────── */
.hidden { display: none !important; }
