/* ==============================================
   RESPONSIVE STYLES - MOBILE OPTIMIERUNG
   ============================================== */

/* Große Bildschirme (Laptops, Desktops) */
@media screen and (max-width: 1200px) {
  .container {
    width: 95%;
  }

  /* Theme Toggle für große Bildschirme */
  @media screen and (min-width: 769px) {
    .theme-toggle {
      left: 90px; /* Desktop Fine-Tuning */
    }
  }
}

/* Mittlere Bildschirme (Tablets) */
@media screen and (max-width: 992px) {
  .container {
    width: 90%;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero h2 {
    font-size: 1.5rem;
  }

  /* Portrait Image Anpassung für Tablets */
  .portrait-img {
    width: 180px;
    height: 180px;
  }
}

/* Tablet Fine-Tuning */
@media screen and (min-width: 769px) and (max-width: 992px) {
  .theme-toggle {
    left: 75px;
  }
}

/* ==============================================
   KRITISCHER FIX: MOBILE NAVIGATION
   ============================================== */
@media screen and (max-width: 768px) {
  /* Body Padding für kürzeren Header */
  body {
    padding-top: 70px;
  }

  [data-theme="dark"] body {
    padding-top: 70px;
  }

  /* Header Höhe reduzieren auf Mobile */
  header {
    padding: calc(var(--spacing-md) * 0.75) 0;
  }

  /* Navigation Toggle anzeigen */
  .nav-toggle {
    display: flex;
  }

  /* WICHTIG: Theme Toggle Position korrigieren */
  .nav-controls {
    gap: var(--spacing-sm);
    position: relative; /* FIX: Für korrekte Positionierung */
  }

  .theme-toggle {
    position: static; /* FIX: Entfernt absolute Positionierung auf Mobile */
    transform: none; /* FIX: Entfernt transform */
    width: 35px;
    height: 35px;
    order: 1; /* Stelle sicher, dass es vor dem nav-toggle kommt */
  }

  .nav-toggle {
    order: 2; /* Nach dem theme-toggle */
  }

  .theme-icon {
    font-size: 16px;
  }

  /* Mobile Menu Styles */
  .nav-menu {
    position: fixed;
    top: 70px; /* Angepasst an reduzierten Header */
    left: 0;
    width: 100%;
    background-color: white;
    flex-direction: column;
    align-items: center;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
    z-index: 100;
    box-shadow: var(--box-shadow);
    border-top: 1px solid var(--border-color); /* Bessere Abgrenzung */
  }

  .nav-menu.active {
    max-height: 300px;
    padding: var(--spacing-md) 0;
  }

  .nav-menu li {
    margin: var(--spacing-xs) 0;
    width: 100%;
    text-align: center;
  }

  .nav-menu li a {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    transition: var(--transition);
  }

  .nav-menu li a:hover {
    background-color: var(--light-color);
  }

  /* Hero Section Mobile */
  .hero {
    padding: var(--spacing-lg) 0;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero h2 {
    font-size: 1.25rem;
  }

  /* Portrait Mobile */
  .portrait-img {
    width: 150px;
    height: 150px;
  }

  /* About Section Mobile */
  .about h2 {
    font-size: 2rem;
    text-align: center;
  }

  .about-intro {
    font-size: 1rem;
    text-align: center;
    padding: 0 var(--spacing-md);
  }

  /* Dark Mode Mobile Navigation */
  [data-theme="dark"] .nav-menu {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
  }

  [data-theme="dark"] .nav-menu li a:hover {
    background-color: var(--bg-card);
  }
}

/* Sehr kleine Bildschirme */
@media screen and (max-width: 480px) {
  body {
    font-size: 14px;
    padding-top: 65px; /* Noch kompakter */
  }

  [data-theme="dark"] body {
    padding-top: 65px;
  }

  .container {
    width: 95%;
    padding: 0 var(--spacing-sm);
  }

  /* Header noch kompakter */
  header {
    padding: var(--spacing-sm) 0;
  }

  /* Theme Toggle sehr klein */
  .theme-toggle {
    width: 32px;
    height: 32px;
  }

  .theme-icon {
    font-size: 14px;
  }

  /* Mobile Menu angepasst */
  .nav-menu {
    top: 65px;
  }

  /* Hero sehr klein */
  .hero h1 {
    font-size: 1.8rem;
  }

  .hero h2 {
    font-size: 1.1rem;
  }

  /* Portrait sehr klein */
  .portrait-img {
    width: 120px;
    height: 120px;
  }

  /* About sehr klein */
  .about h2 {
    font-size: 1.8rem;
  }

  .about-intro {
    font-size: 0.95rem;
  }
}

/* ==============================================
   ZUSÄTZLICHE FIXES
   ============================================== */

/* Logo bleibt immer sichtbar und zugänglich */
.logo {
  flex-shrink: 0;
  z-index: 1001;
}

.logo a {
  display: block;
  padding: var(--spacing-xs);
  transition: var(--transition);
}

.logo a:hover {
  color: var(--accent-color);
  transform: scale(1.05);
}

/* Navigation wird nie überlappt */
nav {
  position: relative;
  z-index: 1000;
}

/* Verhindert horizontal scrolling auf kleinen Bildschirmen */
.container {
  overflow-x: hidden;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Focus styles für Accessibility */
.nav-menu a:focus,
.theme-toggle:focus,
.nav-toggle:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Verbesserte Touch-Targets für Mobile */
@media screen and (max-width: 768px) {
  .nav-menu a,
  .theme-toggle,
  .nav-toggle {
    min-height: 44px; /* Apple's empfohlene Touch-Target-Größe */
    min-width: 44px;
  }
}

/* Verhindert Layout-Shift während des Ladens */
.nav-menu {
  contain: layout style;
}

/* Performance-Optimierung für Animationen */
.nav-menu,
.theme-toggle,
.nav-toggle span {
  will-change: transform;
}

/* Dark Mode Fixes */
[data-theme="dark"] .logo a:hover {
  color: var(--accent-color);
}

[data-theme="dark"] .nav-menu a:focus,
[data-theme="dark"] .theme-toggle:focus,
[data-theme="dark"] .nav-toggle:focus {
  outline-color: var(--primary-color);
}

/* ==============================================
   GALERIE RESPONSIVE ANPASSUNGEN
   ============================================== */

/* Große Bildschirme */
@media screen and (min-width: 1200px) {
  .photo-gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablet Anpassungen */
@media screen and (max-width: 992px) {
  .portrait-img {
    width: 180px;
    height: 180px;
  }

  .photo-gallery {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
  }

  .gallery-img {
    height: 200px;
  }

  .interests-section h3 {
    font-size: 1.8rem;
  }

  .section-title h4 {
    font-size: 1.3rem;
  }
}

/* Mobile Anpassungen */
@media screen and (max-width: 768px) {
  .portrait-img {
    width: 150px;
    height: 150px;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero h2 {
    font-size: 1.5rem;
  }

  .about-intro {
    font-size: 1rem;
    text-align: left;
  }

  .interests-section h3 {
    font-size: 1.6rem;
  }

  .section-title h4 {
    font-size: 1.2rem;
  }

  .photo-gallery {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
  }

  .gallery-img {
    height: 180px;
  }
}

/* Sehr kleine Bildschirme */
@media screen and (max-width: 480px) {
  .portrait-img {
    width: 120px;
    height: 120px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero h2 {
    font-size: 1.25rem;
  }

  .photo-gallery {
    grid-template-columns: 1fr;
  }

  .gallery-img {
    height: 160px;
  }

  .gallery-caption {
    padding: var(--spacing-sm);
  }
}

/* ==============================================
   EDUCATION SEITE RESPONSIVE ANPASSUNGEN
   ============================================== */

/* Tablet */
@media screen and (max-width: 768px) {
  .timeline::before {
    left: 20px;
  }

  .timeline-item {
    padding-left: 60px;
  }

  .timeline-marker {
    left: 8px;
  }

  .timeline-dot {
    width: 16px;
    height: 16px;
  }

  .timeline-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .timeline-date {
    margin-top: var(--spacing-xs);
  }

  .subjects-grid {
    grid-template-columns: 1fr;
  }

  .achievements {
    grid-template-columns: 1fr;
  }
}

/* Mobile */
@media screen and (max-width: 480px) {
  .timeline {
    padding: var(--spacing-md) 0;
  }

  .timeline-content {
    padding: var(--spacing-md);
  }

  .timeline-content::before {
    display: none;
  }

  .timeline-header h3 {
    font-size: 1.3rem;
  }

  .education h2 {
    font-size: 2rem;
  }
}

/* ==============================================
   CONTACT SEITE RESPONSIVE ANPASSUNGEN
   ============================================== */

/* Tablet */
@media screen and (max-width: 992px) {
  .contact-header h2 {
    font-size: 2rem;
  }
}

/* Mobile */
@media screen and (max-width: 768px) {
  .contact {
    padding: var(--spacing-lg) 0;
  }

  .contact-form {
    padding: var(--spacing-lg);
  }

  .contact-header h2 {
    font-size: 1.8rem;
  }

  .contact-header p {
    font-size: 1rem;
    text-align: left;
  }

  .form-group {
    margin-bottom: var(--spacing-md);
  }

  .form-group input,
  .form-group textarea {
    padding: var(--spacing-sm);
  }

  .submit-btn {
    width: 100%;
    padding: var(--spacing-md);
    font-size: 1rem;
  }
}

/* Sehr kleine Bildschirme */
@media screen and (max-width: 480px) {
  .contact-form {
    padding: var(--spacing-md);
  }

  .contact-header {
    margin-bottom: var(--spacing-lg);
  }

  .contact-header h2 {
    font-size: 1.6rem;
  }

  .form-group label {
    font-size: 0.9rem;
  }

  .form-group input,
  .form-group textarea {
    font-size: 0.9rem;
  }
}
