/* 側面滑出選單樣式 */
.mobile-sidebar {
  position: fixed;
  top: 0;
  right: -300px; /* 初始隱藏在右側 */
  width: 300px;
  height: 100vh;
  background-color: #2c3e50; /* 深色底色 */
  z-index: 9999;
  transition: right 0.3s ease-in-out;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
}

.mobile-sidebar.open {
  right: 0; /* 滑出時顯示 */
}

.mobile-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.mobile-sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

.mobile-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #34495e;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-sidebar-title {
  color: #ecf0f1;
  font-size: 18px;
  font-weight: bold;
  margin: 0;
}

.mobile-sidebar-close {
  background: none;
  border: none;
  color: #ecf0f1;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

.mobile-sidebar-close:hover {
  color: #e74c3c;
}

.mobile-sidebar-menu {
  padding: 0;
  margin: 0;
  list-style: none;
}

.mobile-sidebar-menu li {
  border-bottom: 1px solid #34495e;
}

.mobile-sidebar-menu li:last-child {
  border-bottom: none;
}

.mobile-sidebar-menu a {
  display: block;
  padding: 20px;
  color: #ecf0f1;
  text-decoration: none;
  font-size: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
  border-left: 4px solid transparent;
}

.mobile-sidebar-menu a:hover {
  background-color: #34495e;
  color: #3498db;
  border-left-color: #3498db;
}

.mobile-sidebar-menu a:active {
  background-color: #2c3e50;
}

/* 手機選單按鈕樣式調整 */
.navbar-toggle {
  border: none;
  background: transparent;
  padding: 8px 12px;
}

.navbar-toggle:focus {
  outline: none;
}

.navbar-toggle .icon-bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background-color: #333;
  transition: all 0.3s ease;
}

.navbar-toggle .icon-bar + .icon-bar {
  margin-top: 4px;
}

/* 按鈕動畫效果 */
.navbar-toggle.active .icon-bar:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.navbar-toggle.active .icon-bar:nth-child(2) {
  opacity: 0;
}

.navbar-toggle.active .icon-bar:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* 響應式設計 */
@media (max-width: 768px) {
  .mobile-sidebar {
    width: 280px;
    right: -280px;
  }
}

@media (max-width: 480px) {
  .mobile-sidebar {
    width: 100%;
    right: -100%;
  }
}

/* 確保桌面版選單正常顯示 */
@media (min-width: 992px) {
  .mobile-sidebar {
    display: none;
  }
  
  .navbar-toggle {
    display: none;
  }
}
