:root {
  --primary: #4F46E5;
  --bg: #0F172A;
  --surface: #1E293B;
  --text: #E2E8F0;
  --muted: #94A3B8;
  --border: #334155;
}

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

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 90vh;
  display: flex;
  flex-direction: column;
}

/* Navigation */
nav {
  padding: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--surface);
}

nav .logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

nav .links {
  display: flex;
  gap: 24px;
  align-items: center;
}

nav .links a {
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}

nav .links a:hover {
  color: var(--text);
}

/* Main content */
#app {
  flex: 1;
  padding: 24px 0;
}

/* Footer */
footer {
  text-align: center;
  padding: 40px 0;
  color: var(--muted);
  border-top: 1px solid var(--surface);
  margin-top: auto;
}

footer .footer-links {
  margin-top: 8px;
  font-size: 0.875rem;
}

footer .footer-links a {
  color: var(--muted);
  text-decoration: none;
}

footer .footer-links a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Legal pages (terms / privacy / refund) */
.legal {
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.7;
}

.legal h2 {
  margin-bottom: 8px;
}

.legal .legal-updated {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 24px;
}

.legal h3 {
  margin-top: 28px;
  margin-bottom: 8px;
  color: var(--text);
}

.legal p {
  margin-bottom: 12px;
  color: var(--text);
}

.legal ul {
  margin: 8px 0 12px 24px;
  color: var(--text);
}

.legal li {
  margin-bottom: 6px;
}

.legal a {
  color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 12px 32px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn:hover {
  opacity: 0.9;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 8px 20px;
  font-size: 0.875rem;
}

.btn-danger {
  background: #DC2626;
}

.btn-danger:hover {
  background: #B91C1C;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 80px 0;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 16px;
}

.hero p {
  font-size: 1.25rem;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 32px;
}

/* Features grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  padding: 40px 0;
}

.feature {
  background: var(--surface);
  padding: 32px;
  border-radius: 12px;
}

.feature h3 {
  margin-bottom: 8px;
}

.feature p {
  color: var(--muted);
}

/* Upload section */
.upload-section {
  max-width: 600px;
  margin: 40px auto;
  text-align: center;
}

/* Convert wizard — three sliding panels gated by user choices. */
.wizard {
  max-width: 720px;
  margin: 40px auto;
}

.wizard-steps {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  font-size: 0.875rem;
  color: var(--muted);
}

.wizard-steps .step {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--muted);
}

.wizard-steps .step.active {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.wizard-steps .step.done {
  border-color: var(--primary);
  color: var(--text);
}

.wizard-viewport {
  overflow: hidden;
  border-radius: 12px;
}

.wizard-track {
  display: flex;
  width: 300%;
  transition: transform 0.4s ease;
}

.wizard-panel {
  width: 33.3333%;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 8px;
  text-align: center;
}

.wizard-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.wizard-choices.single {
  grid-template-columns: 1fr;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.wizard-choice {
  border: 2px solid var(--muted);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
  text-align: center;
}

.wizard-choice:hover {
  border-color: var(--primary);
}

.wizard-choice.selected {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
}

.wizard-choice .title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.wizard-choice .sub {
  color: var(--muted);
  font-size: 0.875rem;
}

.wizard-back {
  margin-top: 16px;
  text-align: center;
}

.upload-zone {
  border: 2px dashed var(--muted);
  border-radius: 12px;
  padding: 48px;
  margin: 24px 0;
  cursor: pointer;
  transition: border-color 0.2s;
}

.upload-zone:hover {
  border-color: var(--primary);
}

.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
}

/* Pricing */
.pricing {
  padding: 60px 0;
  text-align: center;
}

.pricing h2 {
  font-size: 2rem;
  margin-bottom: 40px;
}

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 700px;
  margin: 0 auto;
}

.plan {
  background: var(--surface);
  padding: 32px;
  border-radius: 12px;
  text-align: left;
}

.plan.featured {
  border: 2px solid var(--primary);
}

.plan h3 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.plan .price {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 16px 0;
}

.plan .price span {
  font-size: 1rem;
  color: var(--muted);
}

.plan ul {
  list-style: none;
  text-align: left;
  margin: 24px 0;
}

.plan ul li {
  padding: 8px 0;
  color: var(--muted);
}

.plan ul li::before {
  content: "\2713 ";
  color: var(--primary);
}

/* Auth */
.auth-section {
  max-width: 400px;
  margin: 60px auto;
}

.auth-section h2 {
  margin-bottom: 24px;
}

.auth-form {
  background: var(--surface);
  padding: 32px;
  border-radius: 12px;
}

/* Form elements */
input, select, textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--muted);
  padding: 10px 16px;
  border-radius: 8px;
  width: 100%;
  margin: 8px 0;
  font-size: 1rem;
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Messages */
.msg {
  padding: 12px;
  border-radius: 8px;
  margin: 12px 0;
}

.msg.error {
  background: #FEE2E2;
  color: #991B1B;
}

.msg.success {
  background: #D1FAE5;
  color: #065F46;
}

.error-msg {
  color: #ef4444;
  font-size: 0.875rem;
  margin: 8px 0;
}

/* Disclaimer */
.disclaimer {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(79, 70, 229, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

/* Dashboard */
.dashboard {
  max-width: 700px;
  margin: 0 auto;
}

.dashboard h2 {
  margin-bottom: 16px;
}

.dash-section {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.dash-section h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.dash-table thead tr {
  text-align: left;
  color: var(--muted);
  border-bottom: 1px solid var(--muted);
}

.dash-table th,
.dash-table td {
  padding: 8px 4px;
}

.dash-table tbody tr {
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.dash-table code {
  font-family: monospace;
}

/* Alert (e.g. newly created API key) */
.alert {
  background: #1a1a2e;
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 16px;
}

/* Feedback FAB & modal */
.feedback-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 14px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
}

.feedback-fab:hover {
  opacity: 0.9;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1001;
  justify-content: center;
  align-items: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: 12px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
}

.modal h3 {
  margin-bottom: 16px;
}

.modal .close-btn {
  float: right;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Google OAuth & Datastore pull (reserved for future use) */
.google-section {
  background: var(--surface);
  padding: 24px;
  border-radius: 12px;
  margin: 24px 0;
  text-align: left;
}

.google-section h3 {
  margin-bottom: 12px;
}

.google-connected {
  display: flex;
  align-items: center;
  gap: 12px;
}

.google-connected .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22C55E;
}

.divider {
  text-align: center;
  color: var(--muted);
  margin: 24px 0;
  position: relative;
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--muted);
  opacity: 0.3;
}

.divider::before { left: 0; }
.divider::after { right: 0; }

.pull-section {
  background: var(--surface);
  padding: 24px;
  border-radius: 12px;
  margin: 24px 0;
  text-align: left;
}

.pull-section h3 {
  margin-bottom: 12px;
}

.kind-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.kind-chip {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  background: rgba(79, 70, 229, 0.15);
  color: var(--primary);
  cursor: pointer;
  border: 1px solid transparent;
}

.kind-chip.selected {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.3);
}

/* Progress bar */
.progress-bar-container {
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  height: 8px;
  margin-bottom: 8px;
}

.progress-bar {
  background: var(--primary);
  height: 100%;
  width: 0%;
  transition: width 0.3s;
}

/* Toast — transient error/status messages */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
  min-width: 220px;
  max-width: 360px;
  pointer-events: auto;
  animation: toast-in 0.25s ease-out;
}

.toast.success {
  background: rgba(34, 197, 94, 0.95);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinner-rotate 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* Rating group */
.rating-group {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.rating-group label {
  cursor: pointer;
  padding: 6px 14px;
  border: 1px solid var(--muted);
  border-radius: 6px;
  font-size: 0.875rem;
}

.rating-group input[type="radio"] {
  display: none;
}

.rating-group input[type="radio"]:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Hidden utility */
.hidden {
  display: none;
}
