/* Stylesheet for wohnflaeche-berechnung.de — customer-facing upload page.
   No framework, no CDN/external assets except Google Fonts (CSP-friendly).

   Design direction: technical drawing / land-survey aesthetic — the product
   reads floor plans, so the page borrows from blueprint paper, graph-paper
   grids and architectural dimension lines instead of a generic SaaS look.

   Colors, fonts, radius and the light/dark palette live in tokens.css,
   shared with the admin tool (admin.css) so both surfaces read as one
   product — see tokens.css for the palette table and contrast ratios.
*/

@import url("tokens.css");

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  /* Faint graph-paper grid — a technical-drawing cue, not a texture image,
     so it stays crisp on every screen and costs nothing to load. */
  background-image:
    repeating-linear-gradient(to right, color-mix(in srgb, var(--line) 55%, transparent) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(to bottom, color-mix(in srgb, var(--line) 55%, transparent) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(to right, color-mix(in srgb, var(--line) 28%, transparent) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(to bottom, color-mix(in srgb, var(--line) 28%, transparent) 0 1px, transparent 1px 22px);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(1.75rem, 5vw, 3rem) 1.25rem 4rem;
}

/* ---------- Header ---------- */

.eyebrow {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 6vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  margin: 0 0 0.85rem;
  color: var(--ink);
}

.lead {
  font-size: 1.05rem;
  color: var(--ink-muted);
  margin: 0 0 1.25rem;
  max-width: 46ch;
}

.trust-note {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin: 0;
  max-width: 52ch;
}

.trust-note strong {
  color: var(--ink);
}

/* A horizontal "dimension line" divider, like the measurement lines on an
   architectural drawing — dashed rule with small perpendicular ticks at
   each end. Purely decorative. */
.dimension-rule {
  position: relative;
  height: 1px;
  margin: 2rem 0 1.75rem;
  background-image: repeating-linear-gradient(to right, var(--line) 0 6px, transparent 6px 12px);
}

.dimension-rule::before,
.dimension-rule::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 1px;
  height: 11px;
  background: var(--line);
}

.dimension-rule::before {
  left: 0;
}

.dimension-rule::after {
  right: 0;
}

/* ---------- Steps ---------- */

.steps ol {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.step-index {
  flex: none;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  margin-top: 0.05rem;
}

.steps strong {
  display: block;
  font-size: 1rem;
  color: var(--ink);
}

.steps p {
  margin: 0.15rem 0 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

/* ---------- Disclaimer ---------- */

.disclaimer {
  font-size: 0.88rem;
  color: var(--ink-muted);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 2rem;
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 0 1.15rem;
  font-size: 1.3rem;
  color: var(--ink);
}

.card-index {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-contrast);
  background: var(--accent);
  border-radius: 3px;
  padding: 0.2rem 0.4rem;
}

/* ---------- Upload form ---------- */

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.6rem;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  padding: clamp(1.5rem, 6vw, 2.25rem) 1rem;
  margin-bottom: 1.1rem;
  border: 2px dashed var(--ink-muted);
  border-radius: var(--radius);
  background: var(--surface-alt);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

/* Corner registration marks — the small crosshair ticks used on
   architectural/print layouts to mark alignment corners. */
.dropzone::before,
.dropzone::after,
.dropzone-icon {
  pointer-events: none;
}

.dropzone::before,
.dropzone::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  opacity: 0.55;
}

.dropzone::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}

.dropzone::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-alt));
}

.dropzone:focus-within {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.dropzone-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--ink-muted);
  margin-bottom: 0.25rem;
}

.dropzone-text {
  margin: 0;
  font-size: 0.98rem;
  color: var(--ink);
}

.dropzone-cta {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}

.dropzone-meta {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* Plain text input (currently just the email field) — styled to match the
   dropzone's surface/border language rather than the browser default. */
.text-input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  font: inherit;
  color: var(--ink);
  padding: 0.75rem 0.9rem;
  margin-bottom: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.text-input::placeholder {
  color: var(--ink-muted);
}

/* The real, functional file input covers the whole dropzone invisibly, so
   the entire area is clickable/keyboard-focusable/droppable — the visible
   icon+text above is decorative, the input remains the accessible control
   (labelled via .field-label's for/id, still reachable by keyboard, native
   file picker semantics untouched). */
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

/* ---------- Selected file list ---------- */
/* Below the dropzone: one row per selected file (name, human-readable
   size, remove button), populated by public/app.js. Multiple files can be
   added across several dialog/drag-and-drop interactions and removed
   individually — see addSelectedFiles()/removeSelectedFile() in app.js. */

.file-list {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.file-list:empty {
  display: none;
}

.file-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem 0.55rem 0.85rem;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.file-list-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list-size {
  flex: none;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* Remove button uses the copper accent, like the other interactive
   controls on the page (dropzone-cta, btn-primary, links). */
.file-list-remove {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  font: inherit;
  line-height: 1;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.file-list-remove:hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: var(--accent);
}

.file-list-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font: inherit;
  font-family: var(--font-body);
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  min-width: 11rem;
}

.btn-primary {
  color: var(--accent-contrast);
  background: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 85%, black);
}

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

.btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.btn-spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent-contrast) 40%, transparent);
  border-top-color: var(--accent-contrast);
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn-spinner {
  display: inline-block;
}

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

@media (prefers-reduced-motion: reduce) {
  .btn-spinner {
    animation-duration: 1.4s;
  }
}

/* ---------- Upload progress (indeterminate) ---------- */
/* There is no real progress signal from the server during analysis — the
   wait is a single AI pre-scan call, not a multi-step process that could
   report interim steps. So this is deliberately an indeterminate bar: a
   continuously sliding segment that communicates "something is happening",
   never a fabricated percentage that would imply the server reports real
   progress. */
.upload-progress {
  margin-top: 1.1rem;
}

.upload-progress-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  overflow: hidden;
}

.upload-progress-bar {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 40%;
  border-radius: 999px;
  background: var(--accent);
  animation: upload-progress-slide 1.4s ease-in-out infinite;
}

@keyframes upload-progress-slide {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}

.upload-progress-text {
  margin: 0.6rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

@media (prefers-reduced-motion: reduce) {
  .upload-progress-bar {
    animation-duration: 2.8s;
  }
}

/* ---------- Result / price ---------- */

.result-readout {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 0 0 1.25rem;
}

.result-tier {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  color: var(--ink-muted);
}

.price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
}

/* ---------- Status note (post-upload, no CTA at this step) ---------- */

.status-note {
  font-size: 0.92rem;
  color: var(--ink-muted);
  margin: 0;
}

/* ---------- Error ---------- */

.error {
  color: var(--error-text);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1.5rem;
  font-size: 0.92rem;
}

/* ---------- Footer ---------- */

.page-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

.page-footer a {
  color: var(--ink-muted);
  margin-right: 1rem;
  text-decoration: underline;
}

.page-footer a:hover {
  color: var(--accent);
}

a {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Small screens ---------- */

@media (max-width: 420px) {
  .btn {
    width: 100%;
  }

  .steps li {
    padding: 0.75rem 0.85rem;
  }
}
