.top-nav {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    height: 150px;
    display: flex;
    align-items: center;
}

.nav-container { 
    display: flex; 
    align-items: center; 
    justify-content: flex-start; 
    gap: 12px; 
    flex-wrap: nowrap; 
    max-width: 1280px; 
    margin: 0 auto;
    width: 100%;
    padding: 0 1rem;
}
.nav-logo { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
    flex: 0 0 auto;
    flex-shrink: 0;
}

.logo-img { 
    height: 120px; 
    width: auto; 
    max-width: none !important;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.2)); 
    flex: 0 0 auto;
    flex-shrink: 0;
}
[data-theme="dark"] .logo-img { filter: brightness(0) saturate(100%) invert(1) drop-shadow(0 2px 8px rgba(255,255,255,.05)); }

.nav-menu { 
    flex: 1 1 auto; 
    display: flex; 
    align-items: center; 
    min-width: 0; 
}

.nav-right-side {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    padding-left: 1rem;
}

.auth-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    background: transparent;
    border: none;
}

.nav-rows { 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
    margin-left: 16px; 
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center; 
}

.nav-row { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.nav-link { 
    color: var(--text-secondary); 
    text-decoration: none; 
    padding: 6px 10px; 
    border-radius: 10px; 
    transition: color .2s ease, background .2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-link-large {
    font-size: 1.1rem;
    font-weight: 500;
    padding: 10px 16px;
}

.nav-link:hover { 
    color: var(--primary-color); 
    background: var(--bg-tertiary); 
}

.nav-link.active { 
    color: var(--primary-color); 
    background: var(--primary-light); 
}

/* Navigation Main Container */
.nav-main {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    margin-left: 1rem;
}

.nav-left-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-right-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
    margin-left: auto;
}

.nav-top-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Dropdown Menu */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    padding: 0.5rem 0;
}

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

.nav-dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* Profilbild-Dropdown */
.nav-profile-dropdown {
    position: relative;
}

.nav-profile-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.nav-profile-button:hover {
    background: var(--bg-secondary);
}

.nav-profile-image {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

.nav-profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-profile-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    padding: 0.35rem 0;
    overflow: hidden;
    max-height: calc(100vh - 160px);
}

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

.nav-profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
}

.nav-profile-dropdown-item-theme {
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
    padding-top: 0.75rem;
}

.nav-profile-dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.nav-profile-dropdown-item-logout {
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    color: var(--danger-color, #ef4444);
}

.nav-profile-dropdown-item-logout button {
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    color: inherit;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-profile-dropdown-item-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color, #ef4444);
}

.nav-profile-dropdown-item i {
    width: 18px;
    text-align: center;
}

.row-1 {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.row-2 { 
    align-items: center; 
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.row-2 .nav-right-side {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    flex-shrink: 0;
    padding-left: 1rem;
}

.search-container { position: relative; }

/* Search */
.search-box { 
    width: 240px; 
    max-width: 240px; 
    min-width: 240px;
    position: relative; 
    display: flex; 
    align-items: center; 
    flex-shrink: 0;
}

.search-input { 
    padding: 0.5rem 1rem 0.5rem 2.5rem; 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-md); 
    background: var(--bg-primary); 
    color: var(--text-primary); 
    font-size: 0.9rem; 
    width: 240px; 
    min-width: 240px; 
    max-width: 240px; 
    text-align: left; 
    transition: border-color .2s ease, box-shadow .2s ease;
    flex-shrink: 0;
}
input.search-input[type="text"] { padding-left: 2.5rem !important; }
.search-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 2px var(--primary-light); }
.search-input::placeholder { color: var(--text-muted); }
.search-icon { position: absolute; left: 10px; width: 1rem; color: var(--text-muted); }
.search-results { position: absolute; top: 100%; left: 0; right: auto; width: 100%; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: 0 4px 12px rgba(0,0,0,.15); max-height: 400px; overflow-y: auto; z-index: 1000; margin-top: .25rem; min-width: 280px; max-width: 280px; }
.search-result-item { min-width: 280px; max-width: 280px; }

/* Theme toggle */
.theme-toggle { 
    background: var(--bg-secondary); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-lg); 
    padding: 8px 10px; 
    cursor: pointer; 
    font-size: 1.1rem; 
    transition: background .2s ease, color .2s ease, border-color .2s ease; 
    position: relative; 
    overflow: hidden; 
    color: var(--text-primary);
    flex-shrink: 0;
    width: auto;
    min-width: 40px;
}

/* Mobile Menu Toggle (Hamburger) */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: var(--bg-secondary, rgba(255, 255, 255, 0.05));
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: var(--text-primary, #ffffff);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block !important;
    opacity: 1 !important;
}

.mobile-menu-content {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: var(--bg-primary, #1f2937);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow-y: auto;
    transition: right 0.3s ease;
    padding: 1.5rem;
    display: block;
}

.mobile-menu-content.active {
    right: 0 !important;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
}

.mobile-menu-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
}

.mobile-menu-close {
    background: transparent;
    border: none;
    color: var(--text-primary, #ffffff);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md, 8px);
    transition: background 0.2s ease;
}

.mobile-menu-close:hover {
    background: var(--bg-secondary, rgba(255, 255, 255, 0.05));
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary, #ffffff);
    text-decoration: none;
    border-radius: var(--radius-md, 8px);
    transition: all 0.2s ease;
    font-size: 1rem;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background: var(--bg-secondary, rgba(255, 255, 255, 0.1));
    color: var(--primary-color, #8b5cf6);
}

.mobile-menu-section {
    margin-bottom: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
}

.mobile-menu-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.mobile-search-container {
    margin-bottom: 1.5rem;
}

.mobile-search-box {
    width: 100%;
    position: relative;
}

.mobile-search-box .search-input {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

.mobile-search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
    border-radius: var(--radius-md, 8px);
    background: var(--bg-secondary, rgba(255, 255, 255, 0.05));
    color: var(--text-primary, #ffffff);
    font-size: 0.9rem;
}

.mobile-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

.mobile-auth-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
}

.mobile-auth-section .btn-auth {
    width: 100%;
    justify-content: center;
}

.mobile-auth-section .user-menu {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
}

.mobile-auth-section .user-info {
    border-right: none;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
    padding-right: 0;
    padding-bottom: 0.75rem;
    justify-content: center;
}

.mobile-auth-section .logout-form {
    width: 100%;
}

.mobile-auth-section .btn-logout {
    width: 100%;
    justify-content: center;
}

@media (max-width: 1200px) {
  .nav-menu { 
    width: 100%; 
  }
  
  .nav-rows { 
    width: 100%; 
    margin-left: 0; 
  }
  
  .row-1 {
    flex-wrap: wrap;
  }
  
  .row-2 { 
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
  }
  
  .row-2 .nav-right-side {
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
    padding-left: 0;
    margin-top: 0.5rem;
    order: 10;
  }
  
  .row-2 .search-container { 
    order: 1; 
    width: 100%; 
    max-width: 100%; 
    margin-left: 0; 
  }
  
  .search-box {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
  }
  
  .search-input {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
  }
}

@media (max-width: 1200px) {
  .mobile-menu-toggle {
    display: flex;
    margin-left: auto;
    margin-right: 1rem;
  }
  
  .nav-menu {
    display: none;
  }
  
  .nav-menu.mobile-active {
    display: block;
  }
  
  .top-nav {
    height: auto;
    min-height: 80px;
    padding: 0.5rem 0;
  }
  
  .logo-img {
    height: 60px;
  }
  
  .nav-container {
    padding: 0 0.75rem;
  }
}

/* Auth Links */
.auth-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    background: transparent;
    border: none;
}

.btn-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md, 8px);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
    cursor: pointer;
}

.btn-auth.btn-login {
    color: var(--text-primary);
    background: var(--bg-secondary, rgba(255, 255, 255, 0.05));
    border-color: var(--border-color, rgba(255, 255, 255, 0.2));
}

.btn-auth.btn-login:hover {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.1));
    border-color: var(--primary-color, #8b5cf6);
    color: var(--primary-color, #8b5cf6);
    transform: translateY(-1px);
}

.btn-auth.btn-register {
    color: white;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border-color: transparent;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

.btn-auth.btn-register:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-auth i {
    font-size: 0.85rem;
}

.btn-auth span {
    display: inline-block;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-right: 0.75rem;
    border-right: none;
}

.user-info i {
    font-size: 1.1rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

.user-name {
    color: var(--text-primary, #ffffff);
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-block;
}

.user-name:hover {
    color: var(--primary-color, #8b5cf6);
}

.user-badge {
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm, 4px);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-badge.admin {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.user-badge.teacher {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.user-badge.student {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.logout-form {
    margin: 0;
    padding: 0;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    background: transparent;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
    transform: translateY(-1px);
}

.btn-logout i {
    font-size: 0.85rem;
}

/* Light Mode Anpassungen */
[data-theme="light"] .btn-auth.btn-login {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #1f2937;
}

[data-theme="light"] .btn-auth.btn-login:hover {
    background: #e5e7eb;
    border-color: #8b5cf6;
    color: #8b5cf6;
}

[data-theme="light"] .user-menu {
    background: transparent;
    border: none;
}

[data-theme="light"] .user-info {
    border: none;
}

[data-theme="light"] .user-name {
    color: #1f2937;
}

[data-theme="light"] .user-info i {
    color: #6b7280;
}

[data-theme="light"] .btn-logout {
    border-color: #e5e7eb;
    color: #6b7280;
}

[data-theme="light"] .btn-logout:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}

/* Responsive */
@media (max-width: 780px) {
  .logo-img { height: 80px; }
  .nav-link { padding: 5px 9px; }
  
  .nav-right-side {
    gap: 0.5rem;
  }
  
  .btn-auth span {
      display: none;
  }
  
  .btn-auth {
      padding: 0.5rem;
      min-width: 40px;
      justify-content: center;
  }
  
  .user-name {
      display: none;
  }
  
  .user-info {
      border-right: none;
      padding-right: 0;
  }
  
  .user-badge {
    display: none;
  }
}


