/* ===== CSS VARIABLES (Light + Dark) ===== */
:root {
  --bg: #ffffff;
  --bg-secondary: #f1f3f4;
  --bg-nav: #ffffff;
  --text: #202124;
  --text-muted: #5f6368;
  --text-light: #9aa0a6;
  --border: #e0e0e0;
  --accent: #1a73e8;
  --accent-hover: #1557b0;
  --link: #1a73e8;
  --note-bg: #f1f3f4;
  --input-bg: #f1f3f4;
  --btn-bg: #ffffff;
  --btn-border: #dadce0;
  --shadow: rgba(0,0,0,0.08);
  --rec-card-bg: #ffffff;
  --need-help-bg: #ffffff;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --bg: #121212;
  --bg-secondary: #1e1e1e;
  --bg-nav: #1a1a1a;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --text-light: #5f6368;
  --border: #2d2d2d;
  --accent: #8ab4f8;
  --accent-hover: #aecbfa;
  --link: #8ab4f8;
  --note-bg: #1e1e1e;
  --input-bg: #2d2d2d;
  --btn-bg: #2d2d2d;
  --btn-border: #444;
  --shadow: rgba(0,0,0,0.3);
  --rec-card-bg: #1e1e1e;
  --need-help-bg: #1e1e1e;
}

/* ===== RESET ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Google Sans', Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== TOP NAV ===== */
.top-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-nav);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background var(--transition), border-color var(--transition);
}
.nav-logo {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Desktop: Searchbar inline in Top-Nav */
.search-bar {
  flex: 1;
  max-width: 600px;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border-radius: 24px;
  padding: 8px 16px;
  gap: 8px;
  transition: background var(--transition);
}
.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  width: 100%;
  color: var(--text);
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-icon { color: var(--text-muted); font-size: 18px; display: flex; align-items: center; flex-shrink: 0; }

.nav-right {
  margin-left: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

/* Mobile: Searchbar als eigene Zeile – versteckt auf Desktop */
.mobile-search-bar {
  display: none;
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}
.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 4px;
  font-family: inherit;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.lang-btn.active { color: var(--accent); }
.lang-btn:hover { background: var(--bg-secondary); color: var(--accent); }
.lang-sep { color: var(--border); font-size: 14px; }

/* Dark Mode Toggle */
.dark-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 6px 8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.dark-toggle:hover { background: var(--bg-secondary); color: var(--text); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.nav-yt-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}
.nav-yt-link:hover { background: var(--bg-secondary); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #34a853;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== SUB NAV ===== */
.sub-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-nav);
  overflow-x: auto;
  padding: 0 16px;
  scrollbar-width: none;
  transition: background var(--transition), border-color var(--transition);
}
.sub-nav::-webkit-scrollbar { display: none; }
.sub-nav a {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  display: block;
  transition: color 0.15s, background 0.15s;
}
.sub-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}
.sub-nav a:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--bg-secondary);
}

/* Content fade animation */
#mainContent {
  transition: opacity 0.2s ease;
}
#mainContent.loading {
  opacity: 0.4;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  padding: 12px 24px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-light); }

/* ===== MAIN LAYOUT ===== */
.main-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 40px;
  gap: 40px;
}
.content { flex: 1; min-width: 0; }
.sidebar { width: 260px; flex-shrink: 0; }

/* ===== ARTICLE ===== */
.article-title {
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  margin: 24px 0 16px;
  line-height: 1.3;
}
.article-intro {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 24px;
}

/* ===== PLACEHOLDER IMAGE ===== */
.placeholder-img {
  width: 100%;
  max-width: 500px;
  height: 260px;
  background: var(--bg-secondary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  position: relative;
  overflow: hidden;
  transition: background var(--transition);
}
.placeholder-img::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--border) 25%, var(--bg-secondary) 50%, var(--border) 75%);
}
.placeholder-img-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.placeholder-img-inner svg { opacity: 0.3; }
.placeholder-img-inner span { font-size: 12px; color: var(--text-light); }
.img-caption { text-align: center; font-size: 12px; color: var(--text-muted); margin-bottom: 24px; }

/* ===== TABLE ===== */
.content-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}
.content-table th {
  background: var(--bg-secondary);
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  color: var(--text);
  border: 1px solid var(--border);
  transition: background var(--transition);
}
.content-table td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
  line-height: 1.6;
  transition: border-color var(--transition);
}
.content-table td:first-child { white-space: nowrap; font-size: 14px; }
.cell-icon { width: 40px; height: 40px; margin-top: 8px; display: flex; align-items: center; justify-content: center; }
.cell-icon svg { width: 32px; height: 32px; }

/* ===== NOTE BOX ===== */
.note-box {
  background: var(--note-bg);
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.6;
  margin-top: 8px;
  color: var(--text);
  transition: background var(--transition);
}
.note-box strong { font-weight: 500; }

/* ===== FEEDBACK ===== */
.feedback-row {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding-top: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}
.feedback-icon {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}
.helpful-row {
  border-top: 1px solid var(--border);
  margin-top: 20px;
  padding-top: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.helpful-row span { font-size: 15px; font-weight: 400; color: var(--text); }
.helpful-btn {
  padding: 8px 24px;
  border: 1px solid var(--btn-border);
  border-radius: 4px;
  background: var(--btn-bg);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  font-family: inherit;
}
.helpful-btn:hover { background: var(--bg-secondary); }
.helpful-btn.selected { background: #1a73e8; color: #fff; }

.feedback-thankyou {
  margin-top: 10px;
  font-size: 14px;
  color: #1a73e8;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.25s ease;
}
.feedback-thankyou.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== RECOMMENDATIONS ===== */
.recs-title { font-size: 15px; font-weight: 500; color: var(--text); margin: 28px 0 12px; }
.recs-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.rec-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text);
  max-width: 320px;
  background: var(--rec-card-bg);
  transition: background var(--transition), border-color var(--transition);
}
.need-help {
  background: var(--need-help-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 24px;
  text-align: center;
  margin-top: 28px;
  transition: background var(--transition), border-color var(--transition);
}
.need-help h3 { font-size: 20px; font-weight: 400; margin-bottom: 6px; color: var(--text); }
.need-help p { font-size: 14px; color: var(--text-muted); }

/* ===== SIDEBAR ===== */
.sidebar-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s;
}
.sidebar-link:hover { color: var(--accent); }
.sidebar-link.active { font-weight: 500; color: var(--text); }

.sidebar-recs .rec-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-top: 10px;
  background: #1a1a1a;
  border-radius: 10px;
  text-decoration: none;
  color: white;
}
.sidebar-recs .rec-card svg { flex-shrink: 0; }
.sidebar-recs .rec-card a {
  color: #e8eaed;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
}
.sidebar-recs .rec-card:hover { background: #222; }
.sidebar-recs .recs-title {
  font-size: 16px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 10px;
}
.rec-card a { color: white !important; opacity: 1 !important; }

/* ===== ARTICLE LINK ===== */
.article-link { color: #71b8ff; text-decoration: none; }
.article-link:hover { text-decoration: underline; }

.section-item { color: #aaa; cursor: pointer; transition: 0.2s; }
.section-item.active { color: #4da3ff; font-weight: 600; }

/* ===== SEARCH DROPDOWN ===== */
.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-nav);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  z-index: 999;
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}
[data-theme="dark"] .search-dropdown {
  background: #1e1e1e;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.search-dropdown.open { display: block; }

.sd-empty {
  padding: 20px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}
.sd-section-head {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 10px 16px 4px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-nav);
}
[data-theme="dark"] .sd-section-head { background: #1e1e1e; }

.sd-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
  color: var(--text);
}
.sd-item:hover,
.sd-item.focused { background: var(--bg-secondary); }
.sd-item:last-child { border-bottom: none; }

.sd-icon { flex-shrink: 0; margin-top: 1px; color: var(--text-muted); }
.sd-text { flex: 1; min-width: 0; }
.sd-title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-title mark {
  background: none;
  color: var(--accent);
  font-weight: 600;
}
.sd-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {

  /* Top Nav: nur Logo + rechte Buttons, Searchbar raus */
  .top-nav {
    padding: 8px 12px;
    gap: 8px;
  }
  .nav-logo {
    font-size: 15px;
  }

  /* Desktop-Searchbar in Top-Nav verstecken */
  .top-nav .search-bar {
    display: none;
  }

  /* Mobile Searchbar: eigene Zeile unter Top-Nav, über Sub-Nav */
  .mobile-search-bar {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border-radius: 24px;
    padding: 8px 16px;
    gap: 8px;
    margin: 8px 12px;
    position: relative;
    transition: background var(--transition);
  }
  .mobile-search-bar input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    width: 100%;
    color: var(--text);
  }
  .mobile-search-bar input::placeholder { color: var(--text-muted); }
  .mobile-search-bar .search-icon { color: var(--text-muted); display: flex; align-items: center; flex-shrink: 0; }

  /* Dropdown für Mobile Searchbar */
  .mobile-search-bar .search-dropdown {
    left: 0;
    right: 0;
  }

  .nav-right { gap: 6px; }
  .nav-yt-link { display: none; }
  .lang-sep { display: none; }
  .lang-btn { padding: 4px 4px; font-size: 12px; }
  .dark-toggle { padding: 5px 6px; }

  /* Sub Nav */
  .sub-nav { padding: 0 8px; }
  .sub-nav a { padding: 10px 10px; font-size: 13px; }

  /* Breadcrumb */
  .breadcrumb { padding: 8px 12px; font-size: 12px; }

  /* Layout */
  .main-layout {
    flex-direction: column;
    padding: 0 12px 40px;
    gap: 0;
  }
  .sidebar { display: none; }
  .content { width: 100%; }

  /* Artikel */
  .article-title { font-size: 20px; margin: 16px 0 12px; }

  /* Bild */
  .placeholder-img { height: 180px; max-width: 100%; }

  /* Tabelle scrollbar auf Mobile */
  .content-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .content-table { font-size: 13px; min-width: 400px; }
  .content-table th,
  .content-table td { padding: 8px 10px; }

  /* Recommendations */
  .recs-grid { flex-direction: column; }
  .rec-card { max-width: 100%; }
  .need-help { padding: 20px 16px; }
  .need-help h3 { font-size: 17px; }
}