/* ===============================
   Reset & Basics
   =============================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  box-shadow: 0 0 30px rgba(0,0,0,0.1);
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "header"
    "nav"
    "main"
    "footer";
}

/* ===============================
   Header
   =============================== */
header {
  grid-area: header;
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: white;
  padding: 1.5rem 0;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: relative;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p { font-size: 1.1rem; opacity: 0.9; }

/* ===============================
   Navigation (Basis)
   =============================== */
nav {
  grid-area: nav;
  background: #34495e;
  padding: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  position: relative;
  z-index: 1000;
}

nav > ul {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

nav > ul > li { margin: 0; position: relative; }

nav a {
  display: block;
  color: white;
  text-decoration: none;
  padding: 1rem 1.5rem;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
}

nav > ul > li > a:hover {
  background: #2c3e50;
  border-bottom-color: #3498db;
}

/* ▼-Pfeil an Eltern – jetzt für <a> UND .submenu-toggle */
nav .has-dropdown > a::after,
nav .has-dropdown > .submenu-toggle::after {
  content: ' ▼';
  font-size: 0.8rem;
  margin-left: 0.5rem;
  transition: transform 0.3s ease;
}

/* Dropdown-Basis (versteckt) */
nav .dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: #2c3e50;
  min-width: 220px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
  border-radius: 0 0 8px 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  list-style: none;
  padding: 0;
  margin: 0;
}

nav .dropdown li { width: 100%; margin: 0; }

nav .dropdown a {
  padding: 0.8rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  border-left: 3px solid transparent;
  white-space: nowrap;
  font-size: 0.9rem;
}

nav .dropdown a:hover {
  background: #1a252f;
  border-left-color: #3498db;
  transform: translateX(5px);
}

nav .dropdown li:last-child a { border-bottom: none; border-radius: 0 0 8px 8px; }

/* Button-Eltern wie Links aussehen lassen (für Mobile-Toggle) */
.submenu-toggle {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  padding: 1rem 1.5rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
  display: block;
}

/* ===============================
   Layout Hauptbereich
   =============================== */
.main-wrapper {
  grid-area: main;
  display: grid;
  grid-template-columns: 250px 1fr 250px;
  grid-template-areas: "left-sidebar content right-sidebar";
  gap: 2rem;
  padding: 2rem;
  min-height: 600px;
}

.sidebar {
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  height: fit-content;
}

.left-sidebar {
  grid-area: left-sidebar;
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
}

.right-sidebar {
  grid-area: right-sidebar;
  background: linear-gradient(135deg, #f3e5f5, #e1bee7);
}

.sidebar h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #3498db;
}

.sidebar ul { list-style: none; }

.sidebar li {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: white;
  border-radius: 5px;
  transition: transform 0.2s ease;
}

.sidebar li:hover {
  transform: translateX(5px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.sidebar a { color: #2c3e50; text-decoration: none; }
.sidebar a:hover { text-decoration: underline; }

article {
  grid-area: content;
  background: white;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

article h2 {
  color: #2c3e50;
  margin-bottom: 1.5rem;
  font-size: 2rem;
  border-left: 4px solid #3498db;
  padding-left: 1rem;
}

article h3 {
  color: #34495e;
  margin: 2rem 0 1rem 0;
  font-size: 1.5rem;
}

article p { margin-bottom: 1.5rem; text-align: justify; }

article a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.3s ease;
}

article a:hover { color: #2980b9; text-decoration: underline; }

/* Bilder: mobil vollbreit */
article img,
article figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 1rem auto;
  border-radius: 8px; /* optional */
}

/* ===============================
   Footer
   =============================== */
footer {
  grid-area: footer;
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: white;
  text-align: center;
  padding: 2rem;
  margin-top: auto;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.footer-section h4 { margin-bottom: 1rem; color: #3498db; }
.footer-section p, .footer-section a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
}
.footer-section a:hover { color: #3498db; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.2);
  padding-top: 1rem;
}

/* Icons */
.fa {
  padding: 10px;
  margin: 2px;
  font-size: 16px;
  color: white;
  text-align: center;
  text-decoration: none;
}
.fa:hover { opacity: 0.7; }
.fa-whatsapp { background: #25D366; }
.fa-youtube { background: #bb0000; }

/* Menü-Button (Burger) */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 1rem;
  position: absolute;
  top: 1rem;
  right: 1rem;
}

/* Code-Blöcke */
code {
  font-family: Consolas, Monaco, "Courier New", Courier, monospace;
  background-color: #f9f9f9;
  color: #d63384;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.9em;
}
pre code {
  display: block;
  padding: 10px;
  background-color: #282c34;
  color: #abb2bf;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.9em;
}

/* Cookie-Popup */
#cookie-popup {
  font-size: 13px;
  background-color: rgba(0,0,0,0.8);
  color: white;
  text-align: center;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 8000;
  line-height: 20px;
}
.cookie-popup-inner {
  padding: 20px;
  background-color: black;
  color: white;
  max-width: 400px;
  margin: auto;
  box-shadow: 0px 0px 5px rgba(255, 255, 255, 0.2);
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}
.cookie-popup-inner button {
  background-color: white;
  color: black;
  border: 2px solid white;
  padding: 10px;
  transition: 0.2s ease-in-out;
}
.cookie-popup-inner button:hover {
  background-color: #c02124;
  color: white;
  border-color: #c02124;
}

.hidden { display: none; }

/* Dark-Mode Toggle */
#dark-mode-toggle {
  margin: 10px 0;
  padding: 10px 20px;
  background-color: #444;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  display: inline-block;
  font-size: 16px;
}
#dark-mode-toggle:hover { background-color: #666; }

/* ===============================
   Desktop-Hover nur da, wo Hover existiert
   =============================== */
@media (hover: hover) and (min-width: 769px) {
  /* Pfeil auch bei Buttons drehen */
  nav .has-dropdown:hover > a::after,
  nav .has-dropdown:hover > .submenu-toggle::after { transform: rotate(180deg); }

  nav .has-dropdown:hover .dropdown {
    opacity: 1; visibility: visible; transform: translateY(0);
  }
}

/* ===============================
   Tablet & kleiner (<= 968px)
   =============================== */
@media (max-width: 968px) {
  .main-wrapper {
    grid-template-columns: 1fr;
    grid-template-areas:
      "content"
      "left-sidebar"
      "right-sidebar";
    gap: 1.25rem;
    padding: 1.25rem;
  }
  header h1 { font-size: clamp(1.6rem, 2.5vw + 1rem, 2.2rem); }
  article { padding: 1.5rem; }
}

/* ===============================
   Mobile (<= 768px)
   =============================== */
@media (max-width: 768px) {
  .container { margin: 0; box-shadow: none; }

  .menu-toggle { display: block; }

  nav { position: relative; z-index: 1000; }

  /* ausklappendes Menü */
  nav > ul {
    flex-direction: column;
    display: none;                 /* via .active sichtbar */
    position: absolute;
    top: 100%; left: 0; width: 100%;
    background: #34495e;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  nav.active > ul { display: flex; }

  nav > ul > li { position: static; width: 100%; }

  nav a,
  .submenu-toggle {
    padding: 0.75rem 1rem;
    border-left: 3px solid transparent;
    border-bottom: none;
  }
  nav > ul > li > a:hover,
  nav > ul > li > .submenu-toggle:hover {
    border-left-color: #3498db;
    border-bottom: none;
  }

  /* Mobile Dropdowns = Akkordeon (per .has-dropdown.active) */
  nav .dropdown {
    position: static;
    background: #1a252f;
    box-shadow: none;
    border-radius: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  nav .has-dropdown.active .dropdown { max-height: 400px; }

  nav .dropdown a {
    padding-left: 2rem;
    background: #1a252f;
    border-left: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  nav .dropdown a:hover { background: #0f1419; transform: none; }

  /* Sidebars mobil ausblenden, Content allein */
  .left-sidebar,
  .right-sidebar { display: none !important; }

  .main-wrapper {
    grid-template-columns: 1fr;
    grid-template-areas: "content";
    gap: 1rem;
    padding: 1rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: left;
  }

  /* optional, falls vorhanden */
  .feature-grid { grid-template-columns: 1fr; }
}

/* ===============================
   Kleinste Phones (<= 480px)
   =============================== */
@media (max-width: 480px) {
  header { padding: 1rem 0; }
  header h1 { font-size: 1.5rem; }
  article h2 { font-size: 1.5rem; }
  .main-wrapper { padding: 0.5rem; }
  article, .sidebar { padding: 1rem; }
}

/* ===============================
   Desktop: Bilder „normal“ begrenzen
   =============================== */
@media (min-width: 969px) {
  article img,
  article figure img {
    width: auto;         /* respektiert natürliche Breite */
    max-width: 680px;    /* Stellschraube für „normal“ */
    margin-left: auto;
    margin-right: auto;
  }
}

/* ===============================
   Bewegungen reduzieren
   =============================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}