/**
 * Base Styles – Remote-Gutachten
 * CSS Reset, Grundlegendes Styling, Barrierefreiheit
 */

/* ========================================
   CSS RESET
   ======================================== */

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

html {
  /* Verhindert horizontales Scrollen */
  overflow-x: hidden;

  /* Smooth Scrolling (außer bei prefers-reduced-motion) */
  scroll-behavior: smooth;

  /* Bessere Font-Rendering auf macOS/iOS */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Text Size Adjust für Mobile */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  /* Volle Viewport-Höhe */
  min-height: 100vh;
  min-height: 100dvh; /* Dynamische Viewport-Höhe für Mobile (berücksichtigt Browser-UI) */

  /* Layout */
  display: flex;
  flex-direction: column;

  /* Typografie */
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);

  /* Farben */
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);

  /* iOS Overscroll-Bounce beibehalten (NICHT overflow: hidden!) */
  /* Verhindert horizontales Scrollen, erlaubt vertikales */
  overflow-x: hidden;
  overflow-y: auto;

  /* Touch-Optimierungen */
  touch-action: pan-y pinch-zoom;
}


/* ========================================
   TYPOGRAFIE
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--spacing-lg);
}

h2 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--spacing-md);
}

h3 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--spacing-md);
}

p {
  margin-bottom: var(--spacing-md);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

code {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
  background-color: var(--color-bg-secondary);
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
}


/* ========================================
   VIDEO ELEMENTE
   ======================================== */

video {
  /* Video nimmt vollen Container ein */
  display: block;
  width: 100%;
  height: 100%;

  /* Verhindert doppeltes Antippen auf iOS */
  -webkit-touch-callout: none;

  /* WICHTIG: Inline-Playback für iOS (kein Fullscreen-Zwang) */
  /* MUSS zusätzlich als HTML-Attribut gesetzt werden: playsinline */

  /* Hintergrund während Ladezeit */
  background-color: var(--color-video-bg);

  /* Object-Fit: Mobile = cover (ausfüllen), Desktop = contain (einpassen) */
  object-fit: cover;

  /* Verhindert User-Select auf Video */
  user-select: none;
  -webkit-user-select: none;
}

@media (min-width: 768px) {
  video {
    /* Auf Desktop: Video einpassen statt beschneiden */
    object-fit: contain;
  }
}


/* ========================================
   BUTTONS & INTERAKTIVE ELEMENTE
   ======================================== */

button {
  /* Reset Browser-Styles */
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;

  /* Touch-Optimierungen */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;

  /* Minimum Touch-Target für Barrierefreiheit */
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);

  /* Transitions */
  transition: all var(--transition-fast);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  transition: border-color var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
}


/* ========================================
   BILDER & MEDIEN
   ======================================== */

img {
  /* Responsive Images */
  max-width: 100%;
  height: auto;
  display: block;

  /* Verhindert Image-Drag auf Desktop */
  user-select: none;
  -webkit-user-drag: none;
}

svg {
  /* SVG Icons */
  display: inline-block;
  vertical-align: middle;
  fill: currentColor;
}


/* ========================================
   LISTEN
   ======================================== */

ul,
ol {
  list-style: none;
}


/* ========================================
   BARRIEREFREIHEIT
   ======================================== */

/* Screen Reader Only Klasse */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Fokus-Styles für Tastaturnavigation */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* High Contrast Mode Support (Windows) */
@media (prefers-contrast: high) {
  * {
    outline-color: currentColor;
  }
}


/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Verstecken auf Mobile */
.hidden-mobile {
  display: none;
}

@media (min-width: 768px) {
  .hidden-mobile {
    display: block;
  }
}

/* Verstecken auf Desktop */
.hidden-desktop {
  display: block;
}

@media (min-width: 768px) {
  .hidden-desktop {
    display: none;
  }
}

/* Generisch verstecken */
.hidden {
  display: none !important;
}

/* Vollbreite */
.full-width {
  width: 100%;
}

/* Flex Utilities */
.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--spacing-sm);
}

.gap-md {
  gap: var(--spacing-md);
}

.gap-lg {
  gap: var(--spacing-lg);
}


/* ========================================
   ANTI-PATTERN FIXES
   ======================================== */

/* Verhindert Pinch-Zoom auf Inputs (nur wenn gewollt) */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
  font-size: 16px; /* Verhindert Auto-Zoom auf iOS */
}

/* Safe Area Insets für iOS (Notch, Home Indicator) */
@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-top: var(--safe-area-inset-top);
    padding-right: var(--safe-area-inset-right);
    padding-bottom: var(--safe-area-inset-bottom);
    padding-left: var(--safe-area-inset-left);
  }
}


/* ========================================
   LOADING STATE
   ======================================== */

/* Basis-Loading-Spinner (kann später erweitert werden) */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
