/* ======================================== */
/* scan.css – RESPONSIVE VERSION */
/* Für scan.html – Mobile-first, flexibel */
/* ======================================== */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 300;
  src: url('./fonts/poppins-v24-latin-300.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  src: url('./fonts/poppins-v24-latin-regular.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  src: url('./fonts/poppins-v24-latin-500.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  src: url('./fonts/poppins-v24-latin-600.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  src: url('./fonts/poppins-v24-latin-700.woff2') format('woff2');
  font-display: swap;
}

:root {
  --gutter: 1rem;
  --header-h: 70px;
  --tab-w: clamp(140px, 25vw, 200px);
  --tab-h: 28px;
  --tab-radius: 8px;
  --body-bg: #e9e9e9;
  --card-bg: #fefefe;
  --tab-bg: #ffffff;
  --tab-border: rgba(0, 0, 0, 0.06);
  --accent: #7398cf;
  --text-primary: #333;
  --text-secondary: #444;
  --text-muted: #666;
  --border-light: rgba(0, 0, 0, 0.02);
  --border-medium: #ccc;
  --hover-bg: rgba(0, 0, 0, 0.05);
  --focus-ring: rgba(115, 152, 207, 0.25);
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--body-bg);
  color: var(--text-primary);
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ======================================== */
/* HEADER */
/* ======================================== */
.header {
  height: var(--header-h);
  border-radius: 8px;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  box-shadow: 0 0 0 1px var(--border-light) inset;
  transition: background 0.3s ease;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.header-left img {
  height: 42px;
  width: auto;
  object-fit: contain;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.circle-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2.5px solid var(--accent);
  border-radius: 50%;
  box-sizing: border-box;
}

.circle-btn::after {
  content: "";
  position: absolute;
  inset: 7px;
  background: var(--accent);
  border-radius: 50%;
}

.circle-btn:hover::after {
  background: #0056b3;
}

.cta-btn {
  background: var(--accent);
  color: #fff !important;
  font-weight: 600;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.cta-btn:hover {
  background: #0056b3;
}

/* ======================================== */
/* MAIN LAYOUT */
/* ======================================== */
.main {
  min-height: calc(100vh - var(--header-h) - var(--gutter) * 2);
  margin-top: var(--gutter);
  padding: 0 var(--gutter);
}

.card-wrapper {
  position: relative;
  height: 100%;
}

.card-box {
  height: 100%;
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 0 0 1px var(--border-light) inset;
  padding: 1.5rem;
  box-sizing: border-box;
  transition: background 0.3s ease;
}

/* Tab oben */
.card-wrapper .tab {
  position: absolute;
  top: 0;
  left: 1.5rem;
  transform: translateY(-50%);
  width: var(--tab-w);
  height: var(--tab-h);
  background: var(--card-bg);
  border-radius: var(--tab-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  z-index: 5;
  box-shadow: 0 0 0 1px var(--border-light) inset;
  transition: all 0.3s ease;
}

/* Canvas Wrapper */
.canvas-wrapper {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  aspect-ratio: 800 / 480;
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.canvas-wrapper canvas,
#dummyOverlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.5rem;
}

#dummyOverlay {
  pointer-events: none;
  transition: opacity 0.42s ease;
  opacity: 1;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

#analyzeBtn {
  transition: opacity 0.25s ease, transform 0.25s ease;
  opacity: 0;
  transform: scale(0.98);
}

#analyzeBtn:not(.d-none) {
  opacity: 1;
  transform: scale(1);
}

/* ======================================== */
/* ANALYSIS CONTAINER – BILD LINKS, ERGEBNIS RECHTS */
/* ======================================== */
.analysis-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 2rem;
  align-items: flex-start;
  justify-content: flex-start;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1rem;
}

.result-panel {
  flex: 0 1 280px;
  max-width: 300px;
  min-width: 240px;
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--border-light) inset;
  font-size: 1rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  order: 2;
}

.result-panel.show {
  opacity: 1;
  transform: translateY(0);
}

.result-panel h4 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.1rem;
}

.result-panel p {
  margin: 0.5rem 0;
  font-size: 1rem;
}

.result-panel strong {
  color: var(--accent);
  font-weight: 600;
}

.image-section {
  flex: 1 1 400px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  order: 1;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  width: 100%;
}

/* ======================================== */
/* TOOLTIP */
/* ======================================== */
.tooltip-inner {
  background-color: #1a1a1a !important;
  color: #fff !important;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-family: 'Quicksand', sans-serif;
}

.bs-tooltip-top .tooltip-arrow::before {
  border-top-color: #1a1a1a !important;
}

/* Puls-Animation */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(115, 152, 207, 0.6); }
  70% { box-shadow: 0 0 0 14px rgba(115, 152, 207, 0); }
  100% { box-shadow: 0 0 0 0 rgba(115, 152, 207, 0); }
}

.circle-btn:hover {
  transform: scale(1.1);
  animation: pulse 1.5s infinite;
}

/* ======================================== */
/* DARK MODE */
/* ======================================== */
[data-theme="dark"] {
  --body-bg: #0f0f0f;
  --card-bg: #1a1a1a;
  --tab-bg: #2d2d2d;
  --accent: #5c9eff;
  --text-primary: #e0e0e0;
  --text-secondary: #ccc;
  --text-muted: #aaa;
  --border-light: rgba(255, 255, 255, 0.05);
  --border-medium: #444;
  --hover-bg: rgba(255, 255, 255, 0.1);
  --focus-ring: rgba(92, 158, 255, 0.25);
}

[data-theme="dark"] .header,
[data-theme="dark"] .card-box,
[data-theme="dark"] .tab,
[data-theme="dark"] .result-panel {
  background: var(--card-bg);
  box-shadow: 0 0 0 1px var(--border-light) inset;
}

[data-theme="dark"] .cta-btn {
  background: var(--accent);
}

[data-theme="dark"] .cta-btn:hover {
  background: #3a7cff;
}

[data-theme="dark"] .result-panel strong {
  color: var(--accent);
}

[data-theme="dark"] .tooltip-inner {
  background-color: #333 !important;
}

[data-theme="dark"] .bs-tooltip-top .tooltip-arrow::before {
  border-top-color: #333 !important;
}

/* ======================================== */
/* RESPONSIVE BREAKPOINTS */
/* ======================================== */

/* ========================================
   iPad Pro 11" BREAKPOINTS
   Portrait & Landscape
   ======================================== */

/* -------- Portrait -------- */
@media (min-width: 810px) and (max-width: 834px) and (orientation: portrait) {

  :root {
    --header-h: 70px;
    --gutter: 1.25rem;
  }

  /* Header */
  .header {
    padding: 0 1.25rem;
  }
  .header-left img {
    height: 36px;
  }

  /* Analysis Container */
  .analysis-container {
    flex-wrap: nowrap;
    gap: 1.5rem;
    padding: 0 1rem;
  }

  /* Canvas Wrapper */
  .canvas-wrapper {
    max-width: 520px;
    width: calc(100% - 2rem);
    aspect-ratio: 800 / 480;
    margin: 0 auto;
  }

  /* Image Section */
  .image-section {
    flex: 1 1 400px;
    min-width: 350px;
    order: 1;
  }

  /* Result Panel */
  .result-panel {
    flex: 0 1 300px;
    max-width: 300px;
    min-width: 250px;
    order: 2;
    padding: 1.5rem;
  }

  /* Buttons */
  .cta-btn {
    font-size: 1rem;
    padding: 0.6rem 1.2rem;
  }

  /* Überschriften */
  h2.h3 {
    font-size: 1.6rem;
    margin: 2rem 0 1.5rem;
  }
}

/* -------- Landscape -------- */
@media (min-width: 1024px) and (max-width: 1194px) and (orientation: landscape) {

  :root {
    --header-h: 70px;
    --gutter: 1.5rem;
  }

  /* Header */
  .header {
    padding: 0 1.5rem;
  }
  .header-left img {
    height: 28px;
  }

  /* Analysis Container */
  .analysis-container {
    flex-wrap: nowrap;
    gap: 1.75rem;
    padding: 0 1rem;
  }

  /* Canvas Wrapper */
  .canvas-wrapper {
    max-width: 720px;
    width: calc(100% - 2rem);
    aspect-ratio: 16 / 9;
    margin: 0 auto;
  }

  /* Image Section */
  .image-section {
    flex: 1 1 450px;
    min-width: 400px;
    order: 1;
  }

  /* Result Panel */
  .result-panel {
    flex: 0 1 320px;
    max-width: 320px;
    min-width: 280px;
    order: 2;
    padding: 1.5rem;
  }

  /* Buttons */
  .cta-btn {
    font-size: 1rem;
    padding: 0.6rem 1.2rem;
  }

  /* Überschriften */
  h2.h3 {
    font-size: 1.7rem;
    margin: 0 0 0.5rem;
  }
}


/* Mobile: ≤ 640px → Ergebnis oben, Bild unten */
@media (max-width: 640px) {
  :root {
    --header-h: 64px;
    --gutter: 0.75rem;
  }
  .header {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }
  .header-left img {
    height: 25px;
  }
  .analysis-container {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
  .result-panel,
  .image-section {
    order: unset !important;
  }
  .result-panel {
    order: -1;
    max-width: none;
    flex: 1 1 auto;
    min-width: 0;
  }
  .canvas-wrapper {
    max-width: 100%;
    margin: 0 auto;
  }
  .card-box {
    padding: 1rem;
  }
  h2.h3 {
    font-size: 1.4rem;
    margin: 2rem 0 1.5rem;
  }
}

/* Tablet & Desktop: ≥ 641px → Bild links, Ergebnis rechts */
@media (min-width: 641px) {
  .analysis-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 1.5rem;
    justify-content: flex-start;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
  }
  .image-section {
    order: 1;
    flex: 1 1 500px;
    min-width: 400px;
  }
  .result-panel {
    order: 2;
    flex: 0 1 300px;
    max-width: 300px;
  }
}

/* Sehr kleine Bildschirme: ≤ 480px */
@media (max-width: 480px) {
  .header {
    flex-direction: column;
    height: auto;
    padding: 0.75rem;
    text-align: center;
  }
  .header-right {
    margin-top: 0.5rem;
  }
  .tab {
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    width: auto;
    padding: 0 1rem;
  }
  .card-box {
    padding: 1rem 0.75rem;
  }
  .circle-btn {
    width: 48px;
    height: 48px;
  }
  .circle-btn::after {
    inset: 9px;
  }
}

/* --------------------------
   Spezielles Styling: iPad Pro 11"
   -------------------------- */
@media only screen
  and (device-width: 834px)
  and (device-height: 1194px)
  and (-webkit-device-pixel-ratio: 2)
  and (orientation: portrait) {
  .analysis-container {
    flex-wrap: nowrap;
  }
  .canvas-wrapper {
    max-width: 520px;
    width: calc(100% - 2rem);
    aspect-ratio: 800 / 480;
    margin: 0 auto;
  }
}

@media only screen
  and (device-width: 1194px)
  and (device-height: 834px)
  and (-webkit-device-pixel-ratio: 2)
  and (orientation: landscape) {
  .canvas-wrapper {
    max-width: 720px;
    width: calc(100% - 2rem);
    aspect-ratio: 16 / 9;
    margin: 0 auto;
  }
}

@media only screen and (min-width: 820px) and (max-width: 900px) and (orientation: portrait) {
  .canvas-wrapper { 
    max-width: 520px; 
    width: calc(100% - 2rem); 
  }
}

@media only screen and (min-width: 900px) and (max-width: 1100px) and (orientation: landscape) {
  .canvas-wrapper { 
    max-width: 720px; 
    width: calc(100% - 2rem); 
  }
}

.canvas-wrapper canvas, #dummyOverlay {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}