/* Mobile Sidebar Styles */

.mobile-menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--primary-text-color);
  font-size: 1.5rem;
  transition: color 0.3s ease;
}

:root.appearance-light .mobile-menu-toggle {
  color: #000000;
}

@media (prefers-color-scheme: dark) {
  :root.appearance-auto .mobile-menu-toggle {
    color: #ffffff;
  }
}

@media (prefers-color-scheme: light) {
  :root.appearance-auto .mobile-menu-toggle {
    color: #000000;
  }
}

.mobile-menu-toggle:hover {
  color: var(--link-color);
}

.mobile-blog-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  flex-grow: 1;
  text-align: center;
}

.mobile-blog-title a {
  color: var(--primary-text-color);
  text-decoration: none;
}

:root.appearance-light .mobile-blog-title a {
  color: #000000;
}

@media (prefers-color-scheme: dark) {
  :root.appearance-auto .mobile-blog-title a {
    color: #ffffff;
  }
}

@media (prefers-color-scheme: light) {
  :root.appearance-auto .mobile-blog-title a {
    color: #000000;
  }
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  visibility: hidden;
  transition: visibility 0s 0.3s;
}

.mobile-sidebar.active {
  visibility: visible;
  transition: visibility 0s 0s;
}

.mobile-sidebar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0);
  transition: background-color 0.3s ease;
  cursor: pointer;
}

.mobile-sidebar.active .mobile-sidebar-overlay {
  background-color: rgba(0, 0, 0, 0.5);
}

.mobile-sidebar-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 80%;
  height: 100%;
  background-color: #ffffff;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* 深色模式 */
:root.appearance-dark .mobile-sidebar-content {
  background-color: #1a1a1a;
}

/* 自動模式下根據系統偏好 */
:root.appearance-auto .mobile-sidebar-content {
  background-color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root.appearance-auto .mobile-sidebar-content {
    background-color: #1a1a1a;
  }
}

.mobile-sidebar.active .mobile-sidebar-content {
  transform: translateX(0);
}

.mobile-sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-sidebar-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-text-color);
}

/* 淺色模式下使用全黑文字 */
:root.appearance-light .mobile-sidebar-header h3 {
  color: #000000;
}

/* 深色模式下使用純白色文字 */
:root.appearance-dark .mobile-sidebar-header h3 {
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root.appearance-auto .mobile-sidebar-header h3 {
    color: #ffffff;
  }
}

@media (prefers-color-scheme: light) {
  :root.appearance-auto .mobile-sidebar-header h3 {
    color: #000000;
  }
}

.mobile-sidebar-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--primary-text-color);
  font-size: 1.5rem;
  transition: color 0.3s ease;
}

:root.appearance-light .mobile-sidebar-close {
  color: #000000;
}

:root.appearance-dark .mobile-sidebar-close {
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root.appearance-auto .mobile-sidebar-close {
    color: #ffffff;
  }
}

@media (prefers-color-scheme: light) {
  :root.appearance-auto .mobile-sidebar-close {
    color: #000000;
  }
}

.mobile-sidebar-close:hover {
  color: var(--link-color);
}

.mobile-sidebar-nav {
  padding: 1rem 0;
  flex: 1;
}

.mobile-nav-item {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--primary-text-color);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
  border-left: 3px solid transparent;
}

:root.appearance-light .mobile-nav-item {
  color: #000000;
}

:root.appearance-dark .mobile-nav-item {
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root.appearance-auto .mobile-nav-item {
    color: #ffffff;
  }
}

@media (prefers-color-scheme: light) {
  :root.appearance-auto .mobile-nav-item {
    color: #000000;
  }
}

.mobile-nav-item:hover {
  background-color: var(--hover-background-color);
  color: var(--link-color);
  border-left-color: var(--link-color);
}

.mobile-nav-item:active {
  background-color: var(--active-background-color);
}

/* Hide on desktop */
@media screen and (min-width: 769px) {
  .mobile-sidebar {
    display: none !important;
  }
}

/* Prevent body scroll when sidebar is open */
body.sidebar-open {
  overflow: hidden;
}
