/* Dark Mode Styles */

:root {
  --color-bg-light: #ffffff;
  --color-bg-dark: #1a1a1a;
  --color-text-light: #333333;
  --color-text-dark: #e8e8e8;
  --color-border-light: #dddddd;
  --color-border-dark: #444444;
  --color-card-light: #f9f9f9;
  --color-card-dark: #2a2a2a;
}

/* Light Mode (Standard) */
body.light-mode {
  --current-bg: var(--color-bg-light);
  --current-text: var(--color-text-light);
  --current-border: var(--color-border-light);
  --current-card: var(--color-card-light);
}

/* Dark Mode */
body.dark-mode {
  --current-bg: var(--color-bg-dark);
  --current-text: var(--color-text-dark);
  --current-border: var(--color-border-dark);
  --current-card: var(--color-card-dark);
}

/* Allgemeine Elemente */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
  background-color: var(--current-bg, #ffffff);
  color: var(--current-text, #333333);
}

/* Header */
.site-header {
  transition: background-color 0.3s ease;
}

body.dark-mode .site-header {
  background-color: #0d0d0d !important;
}

/* Navigation */
body.dark-mode .main-navigation {
  background-color: #1a1a1a !important;
  color: #e8e8e8 !important;
}

body.dark-mode .nav-list > li > a {
  color: #e8e8e8;
}

body.dark-mode .nav-list > li > a:hover {
  background-color: rgba(102, 126, 234, 0.15);
}

body.dark-mode .nav-list .submenu {
  background-color: #2a2a2a;
}

body.dark-mode .nav-list .submenu li a {
  color: #e8e8e8;
}

body.dark-mode .nav-list .submenu li a:hover {
  background-color: rgba(102, 126, 234, 0.2);
}

/* Main Content */
body.dark-mode main {
  background-color: var(--current-bg);
  color: var(--current-text);
}

body.dark-mode article {
  border-bottom-color: var(--color-border-dark);
}

body.dark-mode article h1,
body.dark-mode article h2,
body.dark-mode article h3 {
  color: #e8e8e8;
}

body.dark-mode article p {
  color: #b8b8b8;
}

body.dark-mode article a {
  color: #7fa3ff;
}

body.dark-mode article a:hover {
  color: #a8c5ff;
}

/* Blog Cards */
body.dark-mode .blog-card {
  background-color: var(--color-card-dark);
  border-color: var(--color-border-dark);
}

body.dark-mode .blog-title,
body.dark-mode .blog-title a {
  color: #e8e8e8;
}

body.dark-mode .blog-meta {
  color: #999999;
}

body.dark-mode .blog-excerpt {
  color: #b8b8b8;
}

body.dark-mode .blog-read-more {
  color: #7fa3ff;
}

body.dark-mode .blog-read-more:hover {
  color: #a8c5ff;
}

/* Footer */
body.dark-mode footer {
  background-color: #1a1a1a !important;
  color: #e8e8e8;
}

body.dark-mode .footer-column h3 {
  color: #e8e8e8;
}

body.dark-mode .footer-column ul li a {
  color: #b8b8b8;
}

body.dark-mode .footer-column ul li a:hover {
  color: #7fa3ff;
}

body.dark-mode .footer-bottom {
  border-top-color: var(--color-border-dark);
  color: #999999;
}

/* Forms */
body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
  background-color: var(--color-card-dark);
  color: var(--current-text);
  border-color: var(--color-border-dark);
}

body.dark-mode button {
  background-color: #667eea;
  color: white;
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #667eea;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.dark-mode-toggle:hover {
  background-color: #764ba2;
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

body.dark-mode .dark-mode-toggle {
  background-color: #ffc107;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

body.dark-mode .dark-mode-toggle:hover {
  background-color: #ffb300;
  box-shadow: 0 6px 16px rgba(255, 193, 7, 0.4);
}

/* Mobile */
@media (max-width: 480px) {
  .dark-mode-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }
}

add_filter('wp_nav_menu_items', 'my_dark_mode_nav_button', 10, 2);

function my_dark_mode_nav_button($items, $args) {
    if ($args->theme_location === 'primary-menu') {
        $button = '<li style="margin-left: auto;"><button class="dark-mode-toggle dark-mode-nav" title="Dark Mode">🌙</button></li>';
        $items .= $button;
    }
    return $items;
}

.dark-mode-nav {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    width: auto !important;
    height: auto !important;
    border-radius: 4px !important;
    padding: 10px 15px !important;
    margin-left: 1rem;
    font-size: 1rem !important;
}
/* Widget Styling im Dark Mode */
body.dark-mode .widget {
    color: #e8e8e8 !important;
}

body.dark-mode .widget h3 {
    color: #e8e8e8 !important;
}

body.dark-mode .widget p {
    color: #e8e8e8 !important;
}

body.dark-mode .widget ul li {
    color: #e8e8e8 !important;
}

body.dark-mode .widget ul li a {
    color: #7fa3ff !important;
}

body.dark-mode .widget-title {
    color: #e8e8e8 !important;
}

body.dark-mode .footer-column .widget-title {
    color: #e8e8e8 !important;
}

body.dark-mode .footer-column .widget {
    color: #e8e8e8 !important;
}