:root {
  --blue-accent: #4A9EF5;
  --blue-deep: #2D7DD2;
  --blue-pale: #EBF4FF;
  --blue-mist: #F5F9FF;
  --ink: #1A1A2E;
  --ink-light: #4A4A5A;
  --ink-muted: #8A8A9A;
  --surface: #FAFBFD;
}

html, body { height: 100%; margin: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── App shell ──────────────────────────────────────── */
.app-shell { display: flex; flex-direction: column; height: 100vh; background: var(--surface); }
.app-header { flex-shrink: 0; padding: 0 1.25rem; height: 3.25rem; border-bottom: 1px solid #E8E8F0; display: flex; align-items: center; justify-content: space-between; background: white; }
.app-header.dark { background: #25252e; border-bottom-color: #35353f; }
.app-header.dark span { color: #fff; }
.app-header.dark .btn-secondary { color: #fff; border-color: #555; background: transparent; }
.app-header.dark .btn-secondary:hover { border-color: var(--blue-accent); color: white; background: rgba(74,158,245,0.15); }
.app-header-left { display: flex; align-items: center; gap: 0.625rem; }
.app-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.app-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* ── Buttons ────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border-radius: 0.75rem;
  color: white; font-size: 0.875rem; font-weight: 500;
  transition: all 0.2s;
  background: var(--blue-accent);
  box-shadow: 0 1px 2px rgba(45, 125, 210, 0.2), 0 4px 12px rgba(45, 125, 210, 0.15);
  border: none; cursor: pointer; text-decoration: none;
}
.btn-primary:hover {
  background: var(--blue-deep);
  box-shadow: 0 2px 4px rgba(45, 125, 210, 0.25), 0 8px 24px rgba(45, 125, 210, 0.2);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn-primary:disabled:hover { transform: none; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem; border-radius: 0.75rem;
  font-size: 0.875rem; font-weight: 500; transition: all 0.2s;
  color: var(--ink); border: 1px solid #E0E0E8; background: white;
  cursor: pointer; text-decoration: none;
}
.btn-secondary:hover {
  border-color: var(--blue-accent); color: var(--blue-deep); background: var(--blue-pale);
}

/* ── Template select ────────────────────────────────── */
.template-select {
  font-size: 0.8125rem; font-weight: 500; padding: 0.5rem 2rem 0.5rem 1rem;
  border-radius: 0.75rem; border: 1px solid #E0E0E8; background: white;
  cursor: pointer; color: var(--ink);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234A4A5A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
}
.template-select:hover { border-color: var(--blue-accent); }
.template-select.dark {
  background-color: transparent; color: #fff; border-color: #555;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.template-select.dark:hover { border-color: var(--blue-accent); background-color: rgba(74,158,245,0.15); }

/* ── File badge ─────────────────────────────────────── */
.file-badge {
  font-size: 0.75rem; font-weight: 500; padding: 0.25rem 0.625rem;
  border-radius: 9999px; background: rgba(74,158,245,0.2); color: #a0c8f5;
}

/* ── Drop zone ──────────────────────────────────────── */
.drop-zone-area {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; max-width: 32rem; padding: 4rem 2rem;
  border: 2px dashed #D0D0D8; border-radius: 1rem;
  background: white; cursor: pointer; transition: all 0.2s;
}
.drop-zone:hover {
  border-color: var(--blue-accent); background: var(--blue-pale);
}
.drop-zone.drag-over {
  border-color: var(--blue-accent); background: var(--blue-pale);
  box-shadow: 0 0 0 4px rgba(74, 158, 245, 0.1);
}
.drop-zone-icon {
  width: 3rem; height: 3rem; color: var(--ink-muted); margin-bottom: 1rem;
}
.drop-zone:hover .drop-zone-icon,
.drop-zone.drag-over .drop-zone-icon { color: var(--blue-accent); }
.drop-zone-text {
  font-size: 1rem; font-weight: 500; color: var(--ink); margin: 0 0 0.25rem;
}
.drop-zone-hint {
  font-size: 0.8125rem; color: var(--ink-muted); margin: 0;
}

/* ── Loading overlay ────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: var(--surface); z-index: 100;
}

/* ── Spinner ────────────────────────────────────────── */
@keyframes spin-smooth { to { transform: rotate(360deg); } }
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid #E8E8F0; border-top-color: var(--blue-accent);
  border-radius: 50%; animation: spin-smooth 0.7s linear infinite;
}

/* ── Error banner ───────────────────────────────────── */
.error-banner {
  margin-bottom: 1.25rem; padding: 0.75rem 1rem; border-radius: 0.75rem;
  font-size: 0.875rem; display: flex; align-items: center; justify-content: space-between;
  background: #FEF2F2; border: 1px solid #FECACA; color: #DC2626;
}
