/* Base styles */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: #0a0a0a;
  color: #fff;
}

/* ============================================
   Landing Page
   ============================================ */

body.landing {
  background: #0a0a0a;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.landing-container {
  width: 100%;
  max-width: 400px;
}

.landing-card {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 2rem;
  border: 1px solid #333;
}

.landing-card h1 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  color: #ff8c00;
  text-align: center;
}

.landing-card h2.greeting {
  color: #ff8c00;
  text-align: center;
  margin: 1rem 0;
  font-size: 1.25rem;
}

.landing-card .explain-image {
  display: block;
  margin: 1rem auto;
}

.landing-card .subtitle {
  color: #aaa;
  text-align: center;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.landing-card .hinweis {
  color: #ff8c00;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.explain-card {
  text-align: center;
}

.explain-card h1 {
  font-size: 1.2rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}

.explain-card h2 {
  color: #ff8c00;
  font-size: 1.1rem;
  margin: 1rem 0;
}

.landing-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.875rem;
  color: #ff8c00;
}

.form-group input {
  padding: 0.875rem 1rem;
  border: 2px solid #333;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: #0a0a0a;
  color: #fff;
}

.form-group input:focus {
  outline: none;
  border-color: #ff8c00;
}

.form-group input::placeholder {
  color: #666;
}

.btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #ff8c00;
  color: #000;
}

.btn-primary:hover:not(:disabled) {
  background: #ff9f2e;
}

.btn-primary:disabled {
  background: #444;
  color: #888;
  cursor: not-allowed;
}

.btn-secondary {
  background: #333;
  color: #fff;
}

.btn-secondary:hover {
  background: #444;
}

.btn-image {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 1rem auto;
  display: block;
}

.btn-image:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-image img {
  display: block;
}

.info-text {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: #888;
}

/* ============================================
   Capture Page (Camera)
   ============================================ */

body.capture {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.camera-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

/* Progress bar */
.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  z-index: 10;
}

.progress-fill {
  height: 100%;
  background: #ff8c00;
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  top: 8px;
  right: 12px;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Instruction banner */
.instruction-banner {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  text-align: center;
  z-index: 10;
  max-width: 90%;
  border: 1px solid #ff8c00;
}

.instruction-banner strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: #ff8c00;
}

.instruction-banner p {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.9;
}

/* Video */
#video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  object-fit: contain;
}

@media (orientation: portrait) {
  #video {
    width: 100vw;
    height: auto;
  }
}

@media (orientation: landscape) {
  #video {
    width: auto;
    height: 100vh;
  }
}

/* Overlay wrapper */
#overlay-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 260px;
  height: 260px;
  pointer-events: none;
  z-index: 3;
}

#overlay-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
  transform-origin: center center;
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Shutter button */
#shutter {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  padding: 0.875rem 2.5rem;
  border-radius: 9999px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(200, 0, 0, 0.9);
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
  transition: all 0.2s ease;
  z-index: 4;
}

#shutter.ready:not(:disabled) {
  background: rgba(0, 180, 0, 0.95);
  box-shadow: 0 0 25px rgba(0, 255, 0, 0.7);
}

#shutter:disabled {
  background: rgba(128, 128, 128, 0.35);
  color: #e5e5e5;
  box-shadow: none;
}

#shutter:active:not(:disabled) {
  transform: translateX(-50%) scale(0.96);
}

/* Status text */
.status {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.8rem;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10;
  white-space: nowrap;
}

/* Landscape orientation warning overlay */
.orientation-overlay {
  display: none;
}

@media screen and (orientation: landscape) {
  body.capture {
    overflow: hidden;
  }

  .orientation-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    text-align: center;
    padding: 2rem;
    box-sizing: border-box;
  }

  .orientation-overlay .overlay-box {
    color: #ff8c00;
    font-size: 1.25rem;
    font-weight: 600;
  }
}

/* ============================================
   Preview Page
   ============================================ */

body.preview {
  background: #0a0a0a;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.preview-container {
  width: 100%;
  max-width: 500px;
}

.preview-card {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  border: 1px solid #333;
}

.preview-card h1 {
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  color: #ff8c00;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #333;
  border-top-color: #ff8c00;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  animation: spin 1s linear infinite;
}

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

.status-text {
  color: #aaa;
  margin-bottom: 1.5rem;
}

.preview-image {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

/* ============================================
   Complete Page
   ============================================ */

body.complete {
  background: #0a0a0a;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.complete-container {
  width: 100%;
  max-width: 450px;
}

.complete-card {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  border: 1px solid #333;
}

.success-icon {
  width: 64px;
  height: 64px;
  background: #ff8c00;
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1rem;
}

.complete-card h1 {
  margin: 0 0 1rem 0;
  font-size: 1.75rem;
  color: #ff8c00;
}

.complete-card .message {
  color: #aaa;
  margin-bottom: 1.5rem;
}

.session-info {
  background: #0a0a0a;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid #333;
}

.session-info strong {
  color: #ff8c00;
}

.session-info code {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  word-break: break-all;
  color: #ccc;
}

.next-steps {
  color: #888;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}
