/* ========================================
   COMPREHENSIVE MOBILE RESPONSIVE STYLES
   ======================================== */

/* Mobile First Approach - General Styles */
@media (max-width: 1024px) {
  /* Tablet adjustments */
  .container {
    max-width: 100%;
    padding: 0 30px;
  }
  
  /* Grid adjustments for tablets */
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  /* ===== LAYOUT FOUNDATIONS ===== */
  body {
    overflow-x: hidden !important;
  }
  
  .container {
    padding: 0 15px !important;
    max-width: 100% !important;
  }
  
  /* ===== NAVIGATION MOBILE ===== */
  .stage-header {
    position: fixed !important;
    top: 0 !important;
    width: 100% !important;
    z-index: 9999 !important;
    background: rgba(0, 51, 102, 0.98) !important;
    backdrop-filter: blur(10px) !important;
    padding: 10px 15px !important;
    height: 60px !important;
  }
  
  .stage-navigation {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    height: 100% !important;
  }
  
  .stage-nav-logo {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
  }
  
  .stage-nav-logo img {
    height: 35px !important;
    width: auto !important;
  }
  
  .nav-title {
    display: none !important;
  }
  
  /* Mobile Menu Toggle */
  .mobile-toggle {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    padding: 10px !important;
    margin-top: 5px !important;
    z-index: 10000 !important;
  }
  
  .mobile-toggle span {
    display: block !important;
    width: 25px !important;
    height: 3px !important;
    background: white !important;
    border-radius: 2px !important;
    transition: all 0.3s ease !important;
  }
  
  .mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px) !important;
  }
  
  .mobile-toggle.active span:nth-child(2) {
    opacity: 0 !important;
  }
  
  .mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px) !important;
  }
  
  /* Mobile Menu */
  .stage-nav-menu {
    position: fixed !important;
    top: 60px !important;
    left: -100% !important;
    width: 100% !important;
    height: calc(100vh - 60px) !important;
    background: rgba(0, 51, 102, 0.98) !important;
    backdrop-filter: blur(10px) !important;
    flex-direction: column !important;
    padding: 60px 20px 30px !important;
    transition: left 0.3s ease !important;
    overflow-y: auto !important;
    z-index: 9998 !important;
  }
  
  .stage-nav-menu.active {
    left: 0 !important;
  }
  
  .stage-nav-item {
    width: 100% !important;
    margin: 10px 0 !important;
  }
  
  .stage-nav-link {
    display: block !important;
    padding: 15px !important;
    font-size: 1.1rem !important;
    color: white !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  }
  
  /* Dropdown mobile */
  .dropdown-menu {
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    background: rgba(0, 0, 0, 0.2) !important;
    margin-top: 10px !important;
    border-radius: 8px !important;
    padding: 10px !important;
  }
  
  .dropdown-link {
    color: white !important;
    font-size: 0.95rem !important;
    padding: 10px 15px !important;
    display: block !important;
  }
  
  /* ===== HERO SECTIONS ===== */
  .stage-hero {
    min-height: 500px !important;
    padding-top: 24px !important; /* bring logo closer to the very top */
    background-color: #ffffff !important; /* solid white background */
  }
  
  .stage-logo {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 120px !important;
    margin: 0 auto 0 !important; /* align to top like start page */
    display: block !important;
  }


  /* remove dark overlay on hero for mobile to avoid gray cast */
  .stage-hero::after {
    background: transparent !important;
  }
  
  .stage-content {
    padding: 30px 20px 60px !important;
    margin-top: 20px !important;
  }
  
  .stage-content h2 {
    font-size: 1.8rem !important;
    line-height: 1.3 !important;
    margin-bottom: 15px !important;
  }
  
  .stage-content p {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    margin: 8px 0 !important;
  }
  
  /* ===== TYPOGRAPHY ===== */
  h1, [style*="font-size: 4rem"],
  [style*="font-size: 3.5rem"] {
    font-size: 2rem !important;
    line-height: 1.3 !important;
  }
  
  h2, [style*="font-size: 3rem"],
  [style*="font-size: 2.5rem"] {
    font-size: 1.75rem !important;
    line-height: 1.3 !important;
  }
  
  h3, [style*="font-size: 2rem"],
  [style*="font-size: 1.8rem"] {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
  }
  
  h4, [style*="font-size: 1.5rem"],
  [style*="font-size: 1.3rem"] {
    font-size: 1.25rem !important;
  }
  
  p, [style*="font-size: 1.1rem"],
  [style*="font-size: 1.2rem"] {
    font-size: 1rem !important;
    line-height: 1.6 !important;
  }
  
  /* ===== GRID LAYOUTS ===== */
  /* Convert all grids to single column on mobile */
  [style*="display: grid"],
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  
  /* Flexbox layouts */
  [style*="display: flex"]:not(.mobile-toggle):not(.stage-navigation) {
    flex-direction: column !important;
    gap: 20px !important;
  }
  
  /* Keep horizontal flex for specific elements */
  .cta-buttons,
  .social-links,
  .footer-links {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
  }
  
  /* ===== CARDS AND COMPONENTS ===== */
  .category-card,
  .project-card,
  .story,
  .download-item,
  .schwerpunkt-card,
  .news-card,
  .event-card {
    width: 100% !important;
    margin-bottom: 20px !important;
  }
  
  /* Card images */
  [style*="height: 250px"],
  [style*="height: 220px"],
  [style*="height: 200px"] {
    height: 200px !important;
  }
  
  /* ===== SECTIONS ===== */
  section[style*="padding: 100px"],
  section[style*="padding: 80px"],
  .content-section {
    padding: 60px 0 !important;
  }
  
  /* Section headers */
  .section-header {
    margin-bottom: 40px !important;
    padding: 0 15px !important;
  }
  
  /* ===== BUTTONS ===== */
  .btn,
  .cta-button,
  [style*="padding: 15px 40px"],
  [style*="padding: 18px 45px"] {
    padding: 12px 25px !important;
    font-size: 1rem !important;
    width: auto !important;
    min-width: 140px !important;
  }
  
  /* ===== FORMS ===== */
  form {
    width: 100% !important;
  }
  
  input[type="text"],
  input[type="email"],
  textarea,
  select {
    width: 100% !important;
    padding: 12px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
  }
  
  /* Newsletter form */
  [style*="display: flex"][style*="gap: 15px"] {
    flex-direction: column !important;
  }
  
  /* ===== FOOTER ===== */
  .footer {
    padding: 40px 0 20px !important;
  }
  
  .footer-main {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
    text-align: center !important;
  }
  
  .footer-links-grid {
    grid-template-columns: 1fr !important;
    text-align: center !important;
  }
  
  .footer-logo {
    margin: 0 auto 20px !important;
    max-width: 200px !important;
  }
  
  .footer-logo img,
  .footer-logo-img {
    max-width: 100% !important;
    height: auto !important;
    width: 100% !important;
  }
  
  .footer-logo-section .footer-logo {
    max-width: 180px !important;
  }
  
  /* ===== IMAGES ===== */
  img {
    max-width: 100% !important;
    height: auto !important;
  }
  
  /* Large decorative images */
  [style*="width: 400px"],
  [style*="width: 500px"],
  [style*="width: 600px"] {
    width: 100% !important;
    max-width: 300px !important;
    margin: 0 auto !important;
  }
  
  /* ===== SPACING ===== */
  /* Margins */
  [style*="margin-bottom: 80px"],
  [style*="margin-bottom: 60px"] {
    margin-bottom: 40px !important;
  }
  
  [style*="margin-bottom: 40px"] {
    margin-bottom: 30px !important;
  }
  
  [style*="margin-top: 80px"],
  [style*="margin-top: 60px"] {
    margin-top: 40px !important;
  }
  
  /* Padding */
  [style*="padding: 40px"],
  [style*="padding: 35px"],
  [style*="padding: 30px"] {
    padding: 20px !important;
  }
  
  /* ===== SPECIAL ELEMENTS ===== */
  /* Wave effects */
  .footer-waves,
  .top-waves {
    height: 60px !important;
  }
  
  /* ===== SLIDER ARROWS ===== */
  /* Fix large slider arrows on mobile */
  .slider-nav,
  .slider-arrow,
  [class*="slider-prev"],
  [class*="slider-next"],
  .carousel-control-prev,
  .carousel-control-next,
  button[onclick*="changeSlide"],
  /* Target circular navigation buttons */
  div[style*="border-radius: 50%"],
  button[style*="border-radius: 50%"],
  a[style*="border-radius: 50%"],
  [style*="width: 60px"][style*="height: 60px"],
  [style*="width: 70px"][style*="height: 70px"],
  [style*="width: 80px"][style*="height: 80px"],
  [style*="width: 100px"][style*="height: 100px"] {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    font-size: 18px !important;
    line-height: 40px !important;
  }
  
  /* Blue circular navigation buttons specifically */
  [style*="background"][style*="blue"][style*="border-radius: 50%"],
  [style*="background: #"][style*="border-radius: 50%"],
  [style*="background: rgb"][style*="border-radius: 50%"] {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* If arrows use SVG or icons */
  .slider-nav svg,
  .slider-arrow svg,
  [class*="slider-prev"] svg,
  [class*="slider-next"] svg {
    width: 20px !important;
    height: 20px !important;
  }
  
  /* Arrow positioning adjustments */
  .slider-nav.prev,
  [class*="slider-prev"],
  .carousel-control-prev,
  [style*="position: absolute"][style*="left"] {
    left: 10px !important;
  }
  
  .slider-nav.next,
  [class*="slider-next"],
  .carousel-control-next,
  [style*="position: absolute"][style*="right"] {
    right: 10px !important;
  }
  
  /* Fix article navigation layout */
  div[style*="display: flex"][style*="justify-content: space-between"],
  .article-nav,
  .post-navigation {
    padding: 10px !important;
    gap: 10px !important;
  }
  
  /* Navigation text next to buttons */
  a:has(+ [style*="border-radius: 50%"]),
  [style*="border-radius: 50%"] + a,
  .nav-text {
    font-size: 14px !important;
    margin: 0 5px !important;
  }
  
  /* If arrows use :before or :after pseudo elements */
  .slider-nav:before,
  .slider-nav:after,
  [class*="slider-prev"]:before,
  [class*="slider-next"]:after {
    font-size: 20px !important;
  }
  
  /* Specific fix for Aktuelles section and news navigation */
  .news-navigation a,
  .article-navigation a,
  .post-navigation a,
  section a[style*="font-size"],
  .aktuelles-navigation a {
    font-size: 14px !important;
    padding: 8px 16px !important;
  }
  
  /* Override inline styles for large text on mobile */
  [style*="font-size: 4rem"],
  [style*="font-size: 3.5rem"],
  [style*="font-size: 3rem"] {
    font-size: 1.5rem !important;
  }
  
  /* Navigation arrows and symbols */
  .arrow-left,
  .arrow-right,
  .nav-arrow,
  a > span[style*="font-size"] {
    font-size: 18px !important;
  }
  
  /* Any element with large inline font-size containing arrows */
  *[style*="font-size: 3"] {
    font-size: 1.2rem !important;
  }
  
  /* Specific overrides for navigation elements */
  div[style*="display: flex"] a[style*="font-size"],
  nav a[style*="font-size"] {
    font-size: 14px !important;
  }
  
  /* Override any large circular elements that might be navigation */
  *[style*="border-radius: 50%"][style*="width"],
  *[style*="border-radius: 50%"][style*="height"] {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
  }
  
  /* Ensure proper sizing for ALL circular buttons */
  div[style*="border-radius"][style*="50%"],
  span[style*="border-radius"][style*="50%"],
  button[style*="border-radius"][style*="50%"],
  a[style*="border-radius"][style*="50%"] {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    font-size: 20px !important;
    line-height: 40px !important;
    text-align: center !important;
  }
  
  /* Process steps */
  .process-steps,
  .step {
    width: 100% !important;
  }
  
  /* Stats and numbers */
  [style*="font-size: 3.5rem"],
  [style*="font-size: 2.5rem"] {
    font-size: 2rem !important;
  }
  
  /* Hide decorative elements */
  [style*="position: absolute"][style*="opacity: 0.1"],
  [style*="position: absolute"][style*="opacity: 0.05"] {
    display: none !important;
  }
  
  /* ===== TABLES ===== */
  table {
    display: block !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
  }
  
  /* ===== MODALS & OVERLAYS ===== */
  .modal,
  [style*="position: fixed"] {
    padding: 20px !important;
  }
  
  /* ===== UTILITY CLASSES ===== */
  .hide-mobile {
    display: none !important;
  }
  
  .show-mobile {
    display: block !important;
  }
  
  /* Text alignment */
  .text-center-mobile {
    text-align: center !important;
  }
  
  /* ===== Z-INDEX FIXES ===== */
  .stage-header {
    z-index: 10000 !important;
  }
  
  .mobile-toggle {
    z-index: 10001 !important;
  }
  
  .stage-nav-menu {
    z-index: 9999 !important;
  }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
  /* Even smaller typography */
  h1 {
    font-size: 1.75rem !important;
  }
  
  h2 {
    font-size: 1.5rem !important;
  }
  
  h3 {
    font-size: 1.25rem !important;
  }
  
  /* Smaller buttons */
  .btn,
  .cta-button {
    padding: 10px 20px !important;
    font-size: 0.9rem !important;
  }
  
  /* Reduce section padding */
  section {
    padding: 40px 0 !important;
  }
  
  /* Smaller cards */
  .category-card,
  .project-card {
    padding: 15px !important;
  }
  
  /* Even smaller footer logo on small screens */
  .footer-logo {
    max-width: 150px !important;
  }
  
  .footer-logo-section .footer-logo {
    max-width: 140px !important;
  }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .stage-hero {
    min-height: 400px !important;
  }
  
  .stage-nav-menu {
    height: calc(100vh - 60px) !important;
    overflow-y: auto !important;
  }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari fixes */
  .stage-nav-menu {
    -webkit-overflow-scrolling: touch;
  }
  
  input, textarea, select {
    font-size: 16px !important; /* Prevent zoom */
  }
}

/* Print styles */
@media print {
  .stage-header,
  .footer,
  .mobile-toggle,
  .cta-section {
    display: none !important;
  }
  
  body {
    font-size: 12pt !important;
  }
}