  /* Modal 遮罩 & 容器 */
  #favoriteModalOverlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
    display: flex; justify-content: center; align-items: center;
  }
  #favoriteModal {
    background: #fff;
    border-radius: 8px;
    width: 95%;
    max-width: 750px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
  }
  #favoriteModal header {
    font-weight: 700;
    font-size: 1.3rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #ddd;
  }
  #favoriteModal .modal-body {
    padding: 1rem 1.5rem;
    flex-grow: 1;
    overflow-y: auto;
  }
  #favoriteModal footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #ddd;
    background: #f9f9f9;
    text-align: right;
  }
  /* 按鈕 */
  #clearAllBtn, #saveFavoritesBtn, #closeCatBtn {
    border-radius: 5px;
    border: none;
    font-size: 1rem;
    padding: 0.5rem 1.2rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
  }
  #closeCatBtn{
    background: #f09124;
    color: white;
    margin-right: 1rem;
  }
  #clearAllBtn {
    background: #6c757d;
    color: white;
    margin-right: 1rem;
  }
  #clearAllBtn:hover:not(:disabled) {
    background: #5a6268;
  }
  #saveFavoritesBtn {
    background: #007bff;
    color: white;
  }
  #saveFavoritesBtn:disabled {
    background: #a0c0ff;
    cursor: not-allowed;
  }
  #saveFavoritesBtn:hover:not(:disabled) {
    background: #0056b3;
  }

  /* 搜尋框 */
  .category-search-box {
    margin-bottom: 0.75rem;
  }
  .category-search-box input[type="search"] {
    width: 100%;
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
    border: 1px solid #bbb;
    border-radius: 5px;
  }
  .category-search-box input[type="search"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px #007bff88;
  }
  
  /* 調整商品搜尋容器，方便放按鈕 */
  #productCategorySearchWrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
  }
  #collapseAllBtn {
    flex-shrink: 0;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.35rem 0.8rem;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease-in-out;
  }
  #collapseAllBtn:hover:not(:disabled){
    background: #5a6268;
  }
  #collapseAllBtn:focus {
    outline: 2px solid #343a40;
    outline-offset: 2px;
  }

  /* 商品分類清單（雙層） */
  #productCategoryList {
    list-style: none;
    padding: 0;
    margin: 0 0 1.8rem 0;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
  }
  .parent-category {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #eee;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    font-weight: 600;
  }
  .parent-category:hover,
  .parent-category:focus {
    background-color: #e2e6ea;
    outline:none;
  }
  .parent-category[aria-expanded="true"] {
    background-color: #d1ecf1;
  }
  .child-list {
    list-style: none;
    margin: 0;
    padding-left: 1.8rem;
    max-height: 160px;
    overflow-y: auto;
    background:#fafafa;
  }
  .child-list li {
    user-select: none;
    margin: 0.2rem 0;
  }
  .child-list li label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    font-size: 0.95rem;
    color: #333;
  }
  .child-list li label input[type="checkbox"] {
    cursor: pointer;
    width: 1rem;
    height: 1rem;
  }

  /* 標示父分類子分類數量 */
  .child-count {
    font-size: 0.9rem;
    color: #666;
    margin-left: 0.5rem;
  }

  /* 被選擇的父分類與子分類標示 */
  .parent-category .selected-mark,
  .child-list li.selected > label {
    font-weight: 700;
    color: #007bff;
  }
  .parent-category .selected-mark {
    margin-left: 0.5rem;
    color: #007bff;
    font-size: 0.9rem;
    user-select:none;
  }

  /* 賣家分類 */
  #sellerSection {
    margin-bottom: 1.8rem;
  }
  #sellerSection .section-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
  #sellerSearchBox {
    margin-bottom: 0.75rem;
  }
  #sellerSearchBox input[type=search] {
    width: 100%;
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid #bbb;
  }
  #sellerSearchBox input[type=search]:focus {
    outline:none;
    border-color: #dc3545;
    box-shadow: 0 0 5px #dc354588;
  }
  #sellerList {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    min-height: 40px;
    max-height: 140px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    background: #fafafa;
  }
  .seller-item {
    user-select: none;
    cursor: pointer;
    background: #eee;
    border-radius: 20px;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    color: #333;
    border: 2px solid transparent;
    transition: background-color 0.3s, border-color 0.3s;
    white-space: nowrap;
  }
  .seller-item.selected {
    background: #dc3545;
    color: white;
    border-color: #a31b2a;
  }
  .seller-item:hover:not(.selected) {
    background-color: #f5c3c8;
  }
  .seller-item:focus {
    outline: 2px solid #a31b2a;
    outline-offset: 2px;
  }

  /* 已選標籤區 */
  #selectedPreviewSection {
    margin-bottom: 1.5rem;
  }
  #selectedPreviewSection h4 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
  }
  .tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .tag {
    background: #007bff;
    color: white;
    border-radius: 20px;
    padding: 0.3rem 0.65rem;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    user-select: none;
  }
  .tag.product-child {
    background: #28a745;
  }
  .tag.seller {
    background: #dc3545;
  }
  .tag button {
    border: none;
    background: none;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.4rem;
    cursor: pointer;
    user-select: none;
  }
  .tag button:focus {
    outline: 1px solid white;
    outline-offset: 2px;
  }

  /* 驗證訊息 */
  .validation-msg {
    font-size: 0.9rem;
    color: #d93025;
    min-height: 1.2em;
    margin-top: 0.2rem;
    margin-bottom: 0.8rem;
  }

  /* 響應 */
  @media (max-width: 600px) {
    #favoriteModal {
      max-width: 100vw;
      width: 100vw;
      height: 90vh;
      border-radius: 0;
      max-height: 90vh;
    }
  }