/* ============================================================================
 * common/sidebar.css — 跨主題共用行動裝置側邊選單（Mobile Sidebar）
 * ============================================================================
 *
 * 用途：
 *   行動裝置（小於 991px）開啟的側邊抽屜式選單，含 overlay 遮罩、
 *   3 層選單（Level 1 / Level 2 / Level 3）、System Menu 系統列、
 *   Footer 區與 Member Center Menu 會員中心區。
 *
 * 內容索引：
 *   1. .mobile-sidebar-overlay        全螢幕半透明遮罩（z-index 1040）
 *   2. .mobile-sidebar                側邊抽屜本體（位移開合動畫）
 *   3. .sidebar-header / -top / -title / -close-btn / -divider   標頭區
 *   4. .sidebar-content               主內容捲動區（含 scrollbar hide）
 *   5. .sidebar-menu-l1               第 1 層選單（含展開按鈕、跳轉連結）
 *   6. .sidebar-menu-l2               第 2 層選單（同 L1 結構）
 *   7. .sidebar-menu-l3               第 3 層選單
 *   8. .sidebar-system-menu           系統列選單
 *   9. .sidebar-footer                Footer 區
 *  10. .member-menu-header / -list   會員中心選單區（登入後顯示）
 *  11. .logout-btn-container / .logout-btn   登出按鈕（會員中心底部）
 *  12. .strong                       通用字重 utility（原 default.css 內附於本區段尾端）
 *
 * 使用頁面：行動裝置（< 991px）所有頁面的側邊抽屜選單
 *           （由 header bar 右上角的 hamburger 按鈕觸發開合）
 * 相依 vendor：無（自製 sidebar；非 Bootstrap offcanvas）
 *
 * 載入順序（最先到最後，後者覆寫前者）：
 *   widgets.css -> default.css（舊單檔，凍結中）-> common/base.css ->
 *   common/header.css -> themes/default/base.css -> themes/default/header.css ->
 *   common/sidebar.css（本檔）-> themes/default/sidebar.css ->
 *   其他 common/themes 檔 -> custom.css
 *
 * 抽取來源：public/web/css/default.css line 7378~7889（Mobile Sidebar 完整區段）
 *
 * 詳細規格：openspec/specs/web-theme-css/spec.md（Requirement R.FUNC.1 / R.FUNC.8）
 * 變更記錄：openspec/changes/issue518-web-theme-css-modularization/（task 5.3）
 * ============================================================================
 */



/* =========================================
   Mobile Sidebar Styles (Custom Implementation)
   ========================================= */

/* Overlay */
.mobile-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  /* Bootstrap offcanvas is 1045, modal is 1055 */
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s ease;
}

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

/* Sidebar Aside */
.mobile-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 80%;
  /* Fallback for mobile mostly */
  max-width: 380px;
  /* Reasonable max width */
  background-color: #fff;
  z-index: 1050;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  border-left: 1px solid #f3f4f6;
}

@media (min-width: 768px) {
  .mobile-sidebar {
    width: 35%;
    min-width: 320px;
  }
}

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

/* Header */
.sidebar-header {
  padding: 3rem 1.5rem 1rem 1.5rem;
  /* pt-12 pb-4 px-6 */
}

.sidebar-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 900;
  color: #9ca3af;
  /* gray-400 */
  text-transform: uppercase;
  letter-spacing: 3px;
}

.sidebar-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: #9ca3af;
  transition: color 0.3s;
}

.sidebar-close-btn:hover {
  color: #000;
}

.sidebar-divider {
  height: 2px;
  width: 2rem;
  background-color: #000;
}

/* Content Area */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem;
}

/* Scrollbar hide */
.custom-scrollbar::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

/* Menu Level 1 */
.sidebar-menu-l1 {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-item-l1 {
  margin-bottom: 0.5rem;
}

/* 第 1 層選單容器 - 使用 flexbox 分離跳轉和展開按鈕 */
.menu-item-l1-wrapper {
  display: flex;
  align-items: stretch;
  transition: all 0.3s;
}

.menu-item-l1-wrapper:hover {
  background-color: #f9fafb;
}

/* 左側：跳轉連結區域 */
.menu-btn-l1-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: transparent;
  border: none;
  text-align: left;
  transition: all 0.3s;
  color: #6b7280;
  text-decoration: none;
}

.menu-btn-l1-link:hover {
  color: #111827;
}

/* 右側：展開按鈕區域 */
.menu-btn-l1-toggle {
  flex-shrink: 0;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s;
  color: #6b7280;
  cursor: pointer;
}

.menu-btn-l1-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.menu-btn-l1-toggle.active {
  background-color: #000;
  color: #fff;
}

/* 當展開時，整個容器變黑 */
.menu-btn-l1-toggle.active~.menu-btn-l1-link,
.menu-item-l1-wrapper:has(.menu-btn-l1-toggle.active) {
  background-color: #000;
  color: #fff;
}

.menu-item-l1-wrapper:has(.menu-btn-l1-toggle.active) .menu-btn-l1-link {
  color: #fff;
}

.menu-icon-l1 {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.menu-label-l1 {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.arrow-icon {
  font-size: 14px;
  transition: transform 0.3s;
}

.menu-btn-l1-toggle:not(.active) .arrow-icon {
  opacity: 0.3;
}

/* Menu Level 2 */
.menu-container-l2 {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease-in-out;
}

.sidebar-menu-l2 {
  list-style: none;
  padding-left: 1rem;
  margin: 0;
}

.menu-item-l2 {
  margin-bottom: 0.25rem;
}

/* 第 2 層選單容器 - 使用 flexbox 分離跳轉和展開按鈕 */
.menu-item-l2-wrapper {
  display: flex;
  align-items: stretch;
  transition: all 0.3s;
}

.menu-item-l2-wrapper:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

/* 左側：跳轉連結區域 */
.menu-btn-l2-link {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0.625rem;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  color: #9ca3af;
  text-decoration: none;
  transition: all 0.3s;
}

.menu-btn-l2-link:hover {
  color: #111827;
}

/* 右側：展開按鈕區域 */
.menu-btn-l2-toggle {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(0, 0, 0, 0.05);
  transition: all 0.3s;
  color: #9ca3af;
  cursor: pointer;
}

.menu-btn-l2-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.menu-btn-l2-toggle.active {
  background-color: rgba(0, 0, 0, 0.1);
  color: #111827;
}

.arrow-icon-l2 {
  font-size: 12px;
  transition: transform 0.3s;
}

.menu-btn-l2-toggle:not(.active) .arrow-icon-l2 {
  opacity: 0.3;
}

/* Menu Level 3 */
.menu-container-l3 {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease-in-out;
  border-left: 2px solid #f3f4f6;
  /* border-gray-100 */
  margin-left: 0.5rem;
}

.sidebar-menu-l3 {
  list-style: none;
  padding-left: 1rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  margin: 0;
}

.menu-link-l3 {
  display: block;
  padding: 0.25rem 0;
  font-size: 13px;
  font-weight: 700;
  color: #9ca3af;
  /* gray-400 */
  text-transform: uppercase;
  letter-spacing: -0.025em;
  /* tracking-tight */
  text-decoration: none;
  transition: color 0.3s;
}

.menu-link-l3:hover {
  color: #000;
}

/* System Menu */
.sidebar-system-menu {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.menu-btn-system {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: transparent;
  border: none;
  color: #9ca3af;
  transition: color 0.3s;
}

.menu-btn-system:hover {
  color: #000;
}

.menu-label-system {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Footer */
.sidebar-footer {
  padding: 0;
  border-top: 1px solid #f3f4f6;
  background-color: #fff;
}

.user-info-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.75rem;
  cursor: pointer;
  background-color: #fff;
  transition: background-color 0.3s;
}

.user-info-section:hover {
  background-color: #f9fafb;
}

.user-info-section.active {
  background-color: #f9fafb;
}

.user-avatar-v2 {
  width: 3rem;
  height: 3rem;
  background-color: #000;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  color: #111827;
  letter-spacing: 0.025em;
}

.user-role {
  font-size: 10px;
  color: #9ca3af;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0.1em;
  margin-top: 0.125rem;
}

.user-toggle-icon {
  color: #9ca3af;
  transition: transform 0.3s;
}

.user-info-section.active .user-toggle-icon {
  transform: rotate(180deg);
}

/* Member Center Menu */
.member-center-menu {
  display: none;
  padding: 1.5rem;
  background-color: #fff;
  border-bottom: 1px solid #f3f4f6;
}

.member-center-menu.open {
  display: block;
}

.member-menu-header {
  font-size: 14px;
  color: #9ca3af;
  font-weight: 700;
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
}

.member-group {
  margin-bottom: 2rem;
}

.member-group-title {
  font-size: 14px;
  font-weight: 900;
  color: #111827;
  margin-bottom: 1rem;
}

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

.member-menu-list li {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  border-left: 1px solid #f3f4f6;
}

.member-menu-list a {
  text-decoration: none;
  color: #9ca3af;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.3s;
}

.member-menu-list a:hover {
  color: #000;
}

.logout-btn-container {
  padding: 0 1.5rem 1.5rem 1.5rem;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  /* border-gray-200 */
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  text-decoration: none;
  transition: all 0.3s;
}

.logout-btn:hover {
  background-color: #000;
  color: #fff;
  border-color: #000;
}


/* ============================================================================
 * 共用側邊欄分類選單（.product-cat / .product-side-menu）
 *   原位於 common/pages/product.css 區段 3，但因 posts.show 等其他頁面亦使用
 *   .product-side-menu / .product-cat 樣式，僅在 product.css 中無法跨頁面套用。
 *   遷移至 sidebar.css（所有頁面皆載入）以還原 cm12 之 cross-page 一致樣式。
 *   抽自 default.css line 3072~3260
 * ============================================================================
 */

.product-cat ul li {
  list-style: none;
  padding: 0;
}

.product-cat .product-cat-item a {
  background: #c5c5c5;
  color: #121212;
  font-weight: 600;
  margin-bottom: 12px;
  border-radius: 0px;
  padding: 8px 10px;
  display: block;
}

.product-cat .product-cat-item ul {
  padding-left: 16px;
}

.product-cat .product-cat-item li a {
  background: #d9d9d9;
  border: 1px solid #d9d9d9;
}

.product-cat .product-cat-item .product-cat-item ul li a {
  background: #f2f2f2;
  border: 1px solid #f2f2f2;
}

.product-cat .product-cat-item li span {
  color: #000000;
}

.product-cat .product-cat-item li .text-danger {
  color: #000000 !important;
}

.product-cat .product-cat-item span {
  color: #121212;
  font-weight: 400;
}

.product-cat .product-cat-item.active {
  background: #121212;
  color: #ffffff;
}

.product-side-menu {
  background: #ffffff;
  border-left: 4px solid #2C2C2C;
  /* padding: 24px 20px;
     原 default.css 因 .widget (padding: 20px 8px) source order 在後而 reverse-override；
     模組化後 sidebar.css 載入順序在 widget.css 之後，若保留會反向覆蓋造成 sideMenu 變高，
     故移除此 dead rule 以還原原始 cascade 結果（cm12 等效 padding 20px 8px）。 */
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
}

.product-side-menu .widget-title {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 800;
  text-transform: none;
  padding-left: 0;
}

.product-side-menu .widget-title::before {
  display: none;
}

.product-side-menu .product-cat {
  margin-top: 0;
}

.product-side-menu .product-cat ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.product-side-menu .product-cat-item {
  margin-bottom: 0;
}

.product-side-menu .product-cat-item:last-child {
  margin-bottom: 0;
}

.product-side-menu .product-cat-item > a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  border-radius: 0;
  border: 1px solid transparent;
  text-decoration: none;
  color: #111111;
  font-weight: 600;
  background: transparent;
  border-bottom: 1px solid #f1f1f1;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.product-side-menu .product-cat-item > a::after {
  content: none;
}

.product-side-menu .product-cat-item > a:hover {
  background: #f7f7f7;
  border-color: transparent;
}

.product-side-menu .product-cat > ul > .product-cat-item > a {
  background: transparent;
}

.product-side-menu .product-cat > ul > .product-cat-item > a:hover {
  background: #f2f2f2;
}

.product-side-menu .product-cat > ul > .product-cat-item.is-active > a {
  background: #000000;
  color: #ffffff;
}

.product-side-menu .product-cat-item span {
  color: inherit;
  font-weight: inherit;
}

.product-side-menu .product-cat-item .text-danger {
  color: inherit !important;
}

.product-side-menu .product-cat-item ul {
  margin-top: 0;
  padding-left: 16px;
  border-left: 1px solid #e5e7eb;
}

.product-side-menu .product-cat-item ul ul {
  margin-top: 0;
  padding-left: 16px;
  border-left: none;
}

.product-side-menu .product-cat-item ul .product-cat-item {
  margin-bottom: 0;
}

.product-side-menu .product-cat-item ul .product-cat-item:last-child {
  margin-bottom: 0;
}

.product-side-menu .product-cat-item ul .product-cat-item > a {
  font-size: 13px;
  padding: 10px 8px 10px 12px;
  background: transparent;
  border: none;
  border-radius: 0;
  font-weight: 500;
  line-height: 1.4;
  border-bottom: 1px solid #f5f5f5;
}

.product-side-menu .product-cat-item ul .product-cat-item > a::after {
  content: none;
}

.product-side-menu .product-cat-item ul .product-cat-item.is-active > a {
  background: transparent;
  color: #111111;
  font-weight: 700;
}

.product-side-menu .product-cat-item ul .product-cat-item.is-active > a::after {
  content: none;
}

.product-side-menu .product-cat-item.has-children > a::after {
  content: "\f078";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 12px;
  color: #9ca3af;
  margin-left: auto;
}

.product-side-menu .product-cat-item.is-active.has-children > a::after,
.product-side-menu .product-cat-item ul .product-cat-item.is-active.has-children > a::after {
  color: #ffffff;
}
