/* Layout: Header, Medien-Umschalter, Tabs, Suche, Einstellungen, Hauptbereich */

/* Frosted Glass Header */
header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

:root[data-theme="light"] header {
  background: rgba(245, 244, 239, 0.88);
}

/* Breiterer Container für moderne Widescreen-Displays (mehr Luft zum Atmen) */
.header-inner {
  max-width: 1640px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
}

.logo {
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.logo:hover {
  transform: scale(1.03);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* Media Switcher (Shows / Movies / Games) */
.media-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 2px;
  flex-shrink: 0;
}
.media-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.media-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.media-btn.active {
  background: var(--bg-raised);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ---------- Suchleiste: Herzstück & Priorität ---------- */
.search-wrap {
  position: relative;
  flex: 1 1 300px;
  min-width: 240px;
  max-width: 460px;
  margin: 0 4px;
}

.search-icon {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-dim); font-size: 15px;
  cursor: pointer; padding: 4px; width: 28px; height: 28px; display: flex;
  align-items: center; justify-content: center; border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}
.search-icon:hover { color: var(--accent); }

input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-wrap input[type="text"] {
  padding-right: 42px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  height: 38px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Dropdown: Garantiert IMMER lesbare Mindestbreite, nie mehr schmaler Schlitz! */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 380px;
  width: max(100%, 380px);
  background: rgba(23, 26, 34, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  max-height: 440px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 0, 0, 0.4);
}

.search-item {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item-active { background: rgba(255, 255, 255, 0.07); }
.search-item img {
  width: 40px;
  height: 56px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--line);
  border-radius: 4px;
}
.search-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.search-item-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}
.search-all-btn {
  padding: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--line);
}
.search-all-btn:hover { background: rgba(255, 255, 255, 0.06); text-decoration: underline; }

/* Tabs & Segmented Control */
.tabs {
  display: flex;
  gap: 3px;
  margin-left: auto;
  background: rgba(0, 0, 0, 0.2);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.tab {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.8px;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.tab.active {
  color: var(--text);
  background: var(--bg-raised);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Settings & Action Buttons */
.settings-wrap { position: relative; }
.settings-btn {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.settings-btn:hover { border-color: var(--text-dim); transform: translateY(-1px); }
.profile-btn-header { padding: 0; }

#headerAvatarIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 16px;
  transform: translateY(-1px);
}
.badge-new-count {
  position: absolute; top: -4px; right: -4px; background: #e53e3e; color: white;
  font-size: 9.5px; font-weight: 800; padding: 2px 5px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(229, 62, 62, 0.5);
}

.settings-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: rgba(23, 26, 34, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  min-width: 250px;
  width: max-content;
  padding: 8px 0;
  z-index: 70;
  display: none;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
}
.settings-menu.open {
  display: block;
  animation: popIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.settings-item {
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13.5px;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease;
}
.settings-item:hover { background: rgba(255, 255, 255, 0.06); }

.settings-item select.lang-select {
  width: auto;
  min-width: 58px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  margin: 0;
}
.settings-item select.lang-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.settings-item select.lang-select option {
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
}
.settings-divider { height: 1px; background: var(--line); margin: 6px 0; }

/* Main Container: Auch hier auf 1640px erweitert */
main {
  flex: 1;
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif; font-weight: 400; font-size: 32px; letter-spacing: 0.03em;
  color: var(--text); margin: 0 0 18px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 10px;
}
.section-title-sub { font-family: 'Inter', sans-serif; font-size: 13.5px; color: var(--text-dim); font-weight: 600; }
.section-title-spread { justify-content: space-between; }