:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --fg: #222;
  --header-bg: #004f7c;
  --header-fg: #fff;
  --border: #ccc;
  --weekend-bg: #22222240;
  --accent: #0077b6;
  --nav-bg: #1e1e1e;
  --nav-border: #333;
  --nav-link: #ccc;
  --nav-link-hover: #fff;
}

/* Force Dark Theme via Class */
:root.dark-theme {
    --bg: #121212;
    --fg: #eaeaea;
    --header-bg: #0a3b5e;
    --header-fg: #fff;
    --border: #333;
    --weekend-bg: #2a2a2a;
    --accent: #0096c7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #eaeaea;
    --header-bg: #0a3b5e;
    --header-fg: #fff;
    --border: #333;
    --weekend-bg: #2a2a2a;
    --accent: #0096c7;
  }
}

body {
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  margin: 0;
  padding: 0;
  /* Shift content when sidebar expands */
  padding-left: 60px; 
  /* transition: padding-left 0.3s ease; <-- REMOVED default */
  margin-bottom: 50px;
  /* verhindert Überdeckung des Inhalts */
  position: relative;
  /* min-height: 100vh;
  overflow-x: auto;
  /* explizit horizontal scrollen */
  overflow-y: auto;
  /* vertikal ebenfalls */
}

/* When sidebar is expanded, push body content */
body.nav-expanded {
  padding-left: 250px;
}

body::before {
  content: "";
  position: fixed;
  /* bleibt beim Scrollen */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 682px;
  /* Größe des Logos */
  height: 288px;
  background: url('/images/pef_logo.png') no-repeat center center;
  background-size: contain;
  /* Logo vollständig anzeigen */
  opacity: 0.1;
  /* Transparenz nur fürs Logo */
  pointer-events: none;
  /* keine Klicks blockieren */
  z-index: 0;
  /* unter allen Inhalten */
  font-size: clamp(0.9rem, 0.6vw + 0.8rem, 1.1rem);
}

main,
header,
footer {
  position: relative;
  z-index: 1;
  /* Inhalt bleibt oberhalb */
}

main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: block;
  /* KEIN flex hier – sonst wird Overflow blockiert */
  text-align: center;
  overflow-x: auto;
  /* horizontales Scrollen bei Bedarf */
  overflow-y: auto;
  /* vertikales Scrollen bei Bedarf */
  scroll-behavior: smooth;
  padding-bottom: 60px;
  /* Abstand zum Footer */
  box-sizing: border-box;
  width: 100%;
  min-height: calc(100vh - 50px);
  /* Footer bleibt sichtbar, Inhalt kann wachsen */
  height: auto;
  margin: 0 auto;
  /* zentriert den Container */
  /* padding: 1rem 0 60px 0; <-- Removed footer padding */
  padding: 1rem 0 0 0;
}

/* optional: dezente sichtbare Scrollleisten */
main::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

main::-webkit-scrollbar-thumb {
  background-color: rgba(100, 100, 100, 0.4);
  border-radius: 5px;
}

main::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 100, 100, 0.6);
}

main::-webkit-scrollbar-track {
  background: transparent;
}


main.home-content {
  text-align: center;
  color: var(--fg);
  margin-top: 0vh;
  /* Abstand unter dem zentralen Logo */
  padding: 2rem 1rem;
  z-index: 3;
  font-size: clamp(1.5rem, 2vw + 1rem, 2.5rem);
  margin-bottom: 1rem;
  line-height: 1.2;
}

main.home-content h1 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

main.home-content h2 {
  font-size: 1.4rem;
  margin-top: 2rem;
  font-size: clamp(1.2rem, 1.5vw + 0.8rem, 1.8rem);
  margin-top: 2rem;
  line-height: 1.3;
}

main.home-content ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

main.home-content p,
main.home-content li {
  content: "• ";
  color: #00d4aa;
  /* Akzentfarbe */
  font-size: clamp(1rem, 0.8vw + 0.7rem, 1.2rem);
  line-height: 1.6;
}

footer {
  display: none !important;
}

/* === Top Navigation Refactoring === */

/* Remove Sidebar Padding overrides */
body {
  padding-left: 0 !important;
  padding-top: 100px; /* Space for Top Nav (60px) + Breadcrumbs (40px) */
  margin-bottom: 30px;
}

body.nav-expanded {
    padding-left: 0 !important;
}

/* Nav Container (Fixed Top) */
.top-nav-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* 1. Main Navbar */
.top-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    background-color: var(--nav-bg); /* Uses existing variable #1e1e1e */
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
    font-weight: bold;
    font-size: 1.2rem;
    gap: 10px;
}

.nav-logo-img {
    height: 32px;
    width: 32px;
}

/* Menu Items */
.nav-menu {
    display: flex;
    gap: 5px;
    height: 100%;
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-link {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0 15px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s, background-color 0.2s;
}

.nav-link:hover, .nav-item:hover .nav-link {
    color: #fff;
    background-color: rgba(255,255,255,0.05);
}

.nav-link .arrow {
    font-size: 0.7em;
    opacity: 0.7;
    transition: transform 0.2s;
}

.nav-item:hover .arrow {
    transform: rotate(180deg);
}

/* Dropdowns */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background-color: var(--nav-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-top: 2px solid var(--accent);
    padding: 10px 0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.2, 0, 0.2, 1);
    z-index: 1001;
    border-radius: 0 0 6px 6px;
}

.dropdown-menu.right-aligned {
    left: auto;
    right: 0;
}

.nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: #bbb;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.dropdown-menu a:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.05);
    border-left-color: var(--accent);
    padding-left: 25px; /* Slight shift effect */
}

.dropdown-menu hr {
    border: 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 6px 0;
}

/* 2. Breadcrumbs Bar */
.breadcrumbs-bar {
    height: 40px;
    background-color: #25282c; /* Slightly better contrast than nav-bg */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #888;
    font-size: 0.9rem;
}

#breadcrumb-container a, #breadcrumb-container span {
    color: #888;
    text-decoration: none;
}

#breadcrumb-container a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 8px;
    color: #555;
}

.breadcrumb-leaf {
    color: #eee !important; /* Active page is brighter */
    font-weight: 500;
}

.breadcrumb-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-date {
    font-size: 0.85rem;
    opacity: 0.6;
}

/* === Toast Notification System === */
.toast-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.toast-icon {
    font-size: 1.2rem; /* Bell size */
    cursor: pointer;
    position: relative;
    padding: 5px;
    transition: transform 0.2s;
    user-select: none;
}

.toast-icon:hover {
    transform: scale(1.1);
}

.toast-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #e74c3c;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    animation: bounceIn 0.3s;
}

@keyframes bounceIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.toast-dropdown {
    position: absolute;
    top: 100%; /* Below bell */
    right: 0;
    width: 300px;
    background-color: var(--nav-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--accent);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    z-index: 2000;
    display: none; /* Hidden by default */
    flex-direction: column;
    margin-top: 10px; /* Slight gap */
}

.toast-dropdown.show {
    display: flex;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.toast-header {
    padding: 10px 15px;
    background-color: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: #eee;
}

.toast-header button {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.8rem;
}

.toast-list {
    max-height: 300px;
    overflow-y: auto;
}

.toast-item {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
    color: #ccc;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-item:last-child {
    border-bottom: none;
}

.toast-item:hover {
    background-color: rgba(255,255,255,0.05);
}

.toast-item.unread {
    border-left: 3px solid var(--accent);
    background-color: rgba(0, 119, 182, 0.1); /* Subtle highlighting */
}

.toast-meta {
    font-size: 0.75rem;
    color: #666;
    display: flex;
    justify-content: space-between;
}

.toast-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Mobile Responsiveness (Basic Collapse) */
@media (max-width: 900px) {
    .nav-link span, .nav-brand-text {
        /* display: none; -> Keep Text, hide maybe specific items */
    }
    
    .nav-menu {
        /* If really small, maybe turn into a scrolling bar or hamburger (simplified here for request) */
        overflow-x: auto;
    }

    .top-navbar {
        padding: 0 10px;
    }
    
    .breadcrumbs-bar {
        display: none; /* Hide breadcrumbs on mobile to save space if needed */
    }
    
    body {
        padding-top: 60px; /* Adjust padding if breadcrumbs are hidden */
    }
}

/* Existing utility and main overrides for cleaner layout */
main {
    padding-top: 20px !important;
}

/* User Auth Section */
.nav-user {
    font-size: 0.9rem;
}

