/* ============================================================
   MOBILE RESPONSIVE - ZUSÄTZLICHE GLOBALE OPTIMIERUNGEN
   ============================================================ */

/* Grundlegende responsive Anpassungen */
* {
  box-sizing: border-box;
}

/* Verhindere horizontales Scrollen */
html,
body {
  overflow-x: hidden;
  width: 100%;
}

/* Touch-freundliche Elemente */
@media (hover: none) and (pointer: coarse) {
  /* Alle klickbaren Elemente sollten mindestens 44x44px sein (Apple Guidelines) */
  button,
  a,
  input[type="checkbox"],
  input[type="radio"],
  select {
    min-height: 44px;
    min-width: 44px;
  }

  /* Größerer Abstand zwischen klickbaren Elementen */
  button + button,
  a + a {
    margin-left: 8px;
  }
}

/* Verhindere Zoom beim Focus auf Inputs (iOS Safari) */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Bessere Lesbarkeit auf kleinen Bildschirmen */
@media (max-width: 480px) {
  body {
    font-size: 14px;
    line-height: 1.5;
  }

  p {
    margin-bottom: 12px;
  }
}

/* Tabellen responsive */
@media (max-width: 768px) {
  table {
    font-size: 0.85rem;
  }

  /* Ermögliche horizontales Scrollen bei großen Tabellen */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: 8px 6px;
  }
}

@media (max-width: 480px) {
  table {
    font-size: 0.75rem;
  }

  th,
  td {
    padding: 6px 4px;
  }
}

/* Bilder responsive */
img {
  max-width: 100%;
  height: auto;
}

/* Flexbox & Grid responsive */
@media (max-width: 768px) {
  .flex-row-mobile {
    flex-direction: column !important;
  }

  .grid-mobile-single {
    grid-template-columns: 1fr !important;
  }
}

/* Abstände reduzieren auf mobilen Geräten */
@media (max-width: 480px) {
  .container,
  .wrapper {
    padding-left: 12px;
    padding-right: 12px;
  }

  section {
    margin-bottom: 20px;
  }
}

/* Buttons responsive stapeln */
@media (max-width: 480px) {
  .button-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .button-group button {
    width: 100%;
  }
}

/* Modals/Dialogs responsive */
@media (max-width: 768px) {
  dialog,
  .modal {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  dialog,
  .modal {
    width: 98vw !important;
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* Safe Area für Notch-Geräte (iPhone X, etc.) */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }

  header,
  footer {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}

/* Landscape Orientation Optimierungen */
@media (max-height: 500px) and (orientation: landscape) {
  header {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .gwoe-logo {
    height: 40px !important;
  }

  #root {
    padding-top: 60px !important;
  }
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Optimiere Schriftgröße für unterschiedliche Geräte */
@media (min-width: 320px) and (max-width: 480px) {
  html {
    font-size: 14px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  html {
    font-size: 15px;
  }
}

/* Verbessere Touch-Feedback */
button:active,
a:active {
  opacity: 0.7;
}

/* Verhindere Text-Selection beim Tippen auf Buttons */
button,
.btn {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

/* Performance: Hardware Acceleration für Animationen */
button,
.btn,
.dark-mode-toggle {
  transform: translateZ(0);
  will-change: transform;
}
