/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', 'JetBrains Mono Fallback', monospace;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInFromLeft {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInFromRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

body {
    background-color: #ECECEC;
    color: #0D0D0D;
    line-height: 1.5;
    font-size: 0.95rem;
    margin: 0;
    padding-top: 45px; /* 預留 top-bar 的高度 */
}

/* 固定頂部 bar */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 45px;
  background-color: #ECECEC;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: space-between; /* 讓左右內容分開對齊 */																   
  padding: 0 10px;
  z-index: 1000; /* 保證在最上層 */
}

/* 左側logo區域 */
.top-bar-left {
  display: flex;
  align-items: center;
}

/* 右側聯絡區域 */
.top-bar-right {
  display: flex;
  align-items: center;
}

/* Email 圖示樣式 */
.top-bar-right a {
  color: #0D0D0D;
  font-size: 18px;
  transition: color 0.3s ease;
  text-decoration: none;
}

.top-bar-right a:hover {
  color: #C14E27;
  text-decoration: none;
}					  
/* logo 限制高度 */
.top-bar-logo {
  display: flex;
  height: 28px;
  width: auto;
  margin-right: 15px; /* 在logo和文字之間增加間距 */
}

/* logo文字容器 */
.logo-text-container {
  display: flex;
  align-items: center;
  gap: 1px;
}

/* logo區域連結不顯示底線 */
.top-bar a {
  text-decoration: none;
}

.top-bar a:hover {
  text-decoration: none;
}									 
/* POP TOOL 文字樣式 */
.logo-main-text {
  color: #0D0D0D;
  letter-spacing: 1px;
  white-space: normal;
}

/* THINK BIG 副標文字樣式 */
.logo-sub-text {
  font-size: 20px;
  font-weight: 500;
  color: #C14E27;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto; /* 移除上下margin，讓容器貼著top-bar */
    background-color: #fff;
    border-radius: 0; /* 移除圓角讓它更貼合 */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    height: calc(100vh - 45px); /* 設定容器高度為視窗高度減去top-bar */
}

/* 左側分類列表樣式 */
.sidebar {
    width: 200px;
    background-color: #ECECEC;
    padding: 20px;
    border-right: 1px solid #dee2e6;
    height: 100%; /* 使用100%高度填滿容器 */
    overflow-y: auto;
    animation: slideInFromLeft 0.3s ease-out;
    font-size: 0.9rem;
    /* 隱藏滾動條 */
    -webkit-overflow-scrolling: touch;/* 平滑滾動（iOS） */
    -ms-overflow-style: none;         /* IE 10+ */
    scrollbar-width: none;            /* Firefox */
    scrollbar-color: transparent transparent; /* Firefox：thumb / track */
}

/* WebKit 瀏覽器（Chrome, Safari, 新 Edge） */
.sidebar::-webkit-scrollbar {
    width: 0;    /* 隱藏垂直捲軸寬度 */
    height: 0;   /* 隱藏水平捲軸高度（若有） */
}
.sidebar::-webkit-scrollbar-thumb {
    background: transparent;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    animation: slideInFromLeft 0.5s ease-in-out;
}

.category-container {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* category 按鈕（預設樣式 = 未展開） */
.category-item {
    cursor: pointer;
    padding: 6px 12px;
    font-weight: normal;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent; /* 保持原本色調 */
}

.category-item:hover {
    background: #FFFFFF;
	font-weight: normal;
}

/* 保留你原本的 active 顏色，但我們用 aria-expanded 來控制展開狀態 */
.category-item.active {
    color: #C14E27;
    font-weight: normal;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 如果使用 aria-expanded 控制展開，也套用相同的視覺效果 */
.category-item[aria-expanded="true"] {
    color: #C14E27;
    font-weight: bold;
}

.category-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-content i {
    font-size: 1em;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.category-item[aria-expanded="true"] .category-content i {
    transform: rotate(90deg);
}

/* 子分類容器 - 修復顯示問題 */
.subcategories-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-left: 15px;
}

.category-item[aria-expanded="true"] + .subcategories-container {
    max-height: 500px;
}

.subcategory-item {
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    position: relative;
}

/* 去掉 subcategory 連結底線，並讓整個區塊都可點擊（若使用 <a>） */
.subcategory-item a {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
    padding: 6px 0; /* 讓 <a> 內也有點擊區域 */
}

.subcategory-item a:hover {
    text-decoration: none; /* 滑鼠移上也不顯示底線 */
    color: #C14E27; /* 可選：hover時改變顏色 */
}

.subcategory-item:before {
    content: '';
    position: absolute;
    left: 0;
    opacity: 0.7;
}

.subcategory-item:hover {
    background: #FFFFFF;
}

.subcategory-item.active {
    font-weight: bold;
    color: #C14E27;

}

/* 右側內容區域樣式 */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
    font-size: 1rem;
    background: #F3F3F3;
}

.main-content h1 {
    margin-bottom: 1px;
    padding-bottom: 3px;
    border-bottom: 1.3px solid #e1e4e8;
    color: #C14E27;
    font-size: 1.2rem;
    animation: slideInFromRight 0.5s ease-out;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 搜尋和過濾區域 */
.filter-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    padding: 1px 1px;
    border-radius: 3px;
}

.search-box {
    display: flex;
    max-width: 350px;
    width: 100%;
    margin-left: auto;
}

.search-box input {
    flex: 1;
    padding: 5px 15px;
    border: 1px solid #C2C2C2;
    border-radius: 6px 0 0 6px;
    outline: none;
    font-size: 0.85rem;
    transition: border-color 0.3s;
}

.search-box button {
    background-color: #D7D7D7;
    border: none;
    padding: 10px 15px;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-box button:hover {
    background-color: #C14E27;
    color: #FFFFFF;
}

.sort-options select {
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    outline: none;
    background-color: #F3F3F3;
    font-size: 0.95rem;
    min-width: 120px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.sort-options select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 表格樣式 */
.table-container {
    overflow-x: auto;
    background-color: #FFFFFF;
    border-radius: 10px;
    /* OpenAI.fm 風格的多層陰影效果 */
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.12),
        0 1px 2px rgba(0, 0, 0, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    animation: fadeIn 0.3s ease-in-out;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

table th, table td {
    padding: 1px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background-color:#D7D7D7;
    font-weight: 600;
    color: #343a40;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: px solid #C2C2C2;
}

table th:first-child {
    border-top-left-radius: 10px;
}

table th:last-child {
    border-top-right-radius: 10px;
}

table tr:last-child td {
    border-bottom: none;
}

/* 名稱連結樣式 */
.item-name-link {
    text-decoration: none !important;  /* 拿掉底線 */
    color: #0D0D0D;          /* 保持文字顏色與其他文字一致 */
    font-weight: bold;
}

.item-name-link:hover {
    color: #c14e27;  
}

/* 無連結的名稱也要加粗 */
.item-name {
    font-weight: bold;
}

/* 移動裝置選單按鈕 */
.mobile-menu-btn {
    display: none;
    background-color: #6c757d;
    color: #F3F3F3;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    position: static; /* 移除 fixed 定位 */
}

/* 返回頂部按鈕 */
.back-to-top-btn {
    position: fixed;
    bottom: 80px;
    right: 25px;
    background-color: #C14E27;
    color: #F3F3F3;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 100;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    text-align: center; 
    line-height: 1; 
}

.back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top-btn:hover {
    background-color: #C14E27;
    transform: translateY(-3px);
}

.mobile-menu-btn:hover, .mobile-menu-btn:active {
    background-color: #dbdbdb;
    transform: scale(1.05);
}

/* ========================================
   響應式設計 - 使用新的三個斷點
   ======================================== */

/* 預設樣式 - 小於768px的設備（手機） */
/* 這是基本的手機版設計 */
body {
    padding-top: 50px; /* 手機版增加頂部空間 */
}

.top-bar {
    height: 50px;
    padding: 0 15px;
}

.top-bar-logo {
    height: 24px;
    margin-right: 10px;
}

.logo-main-text {
    font-size: 18px;
    font-weight: bold;
}

.logo-sub-text {
    font-size: 12px;
}

.container {
    flex-direction: column;
    max-width: 100%;
    height: calc(100vh - 50px);
}

.sidebar {
    width: 100%;
    position: fixed;
    top: 50px;
    left: -100%;
    height: calc(100vh - 50px);
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    overflow-y: auto;
    transition: left 0.3s ease;
}

.sidebar.active {
    left: 0;
}

.main-content {
    margin-top: 0;
    padding: 10px;
    font-size: 1.2rem;
}

.main-content h1 {
    font-size: 1.2rem;
    margin-bottom: 1px;
    flex-wrap: wrap;
    gap: 10px;
}

.mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.filter-container {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 15px;
    margin-bottom: 10px;
}

.search-box {
    max-width: 100%;
}

.search-box input,
.search-box button {
    padding: 8px 12px;
    font-size: 1.2rem;
}

.sort-options {
    width: 100%;
}

.sort-options select {
    width: 100%;
    padding: 8px 12px;
    font-size: 1.2rem;
}

/* 表格在手機上的優化 */
.table-container {
    border-radius: 6px;
    margin-bottom: 20px;
}

table {
    font-size: 1rem;
    width: 100%;
    table-layout: fixed;
    word-wrap: break-word;
}

table th, table td {
    padding: 8px 6px;
}

/* 在手機上保留簡介欄位，但調整樣式 */
table th:nth-child(3),
table td:nth-child(3) {
    display: table-cell !important;
    padding: 8px 4px;
    font-size: 1.2rem;
    line-height: 1.3;
    white-space: normal;
    word-wrap: break-word;
}

.back-to-top-btn {
    width: 40px;
    height: 40px;
    bottom: 70px;
    right: 20px;
    font-size: 1.2rem;
}

/* 分類項目在手機上的優化 */
.category-item {
    padding: 8px 12px;
    font-size: 1.2rem;
}

.subcategory-item {
    padding: 8px 12px;
    font-size: 1.2rem;
}

.category-item:hover,
.subcategory-item:hover {
    transform: none;
}

/* 中型設備 - min-width: 768px（平板橫向） */
@media (min-width: 768px) {
    body {
        padding-top: 45px;
    }

    .top-bar {
        height: 45px;
        padding: 0 15px;
    }

    .top-bar-logo {
        height: 28px;
        margin-right: 15px;
    }

    .logo-main-text {
        font-size: 24px;
        font-weight: bold;
    }

    .logo-sub-text {
        font-size: 16px;
    }

    .container {
        flex-direction: row;
        max-width: 100%;
        margin: 0 20px;
        border-radius: 8px;
        height: calc(100vh - 45px);
    }

    .sidebar {
        width: 220px;
        position: static;
        left: auto;
        height: 100%;
        z-index: auto;
        box-shadow: none;
        padding: 18px;
        font-size: 0.9rem;
        transition: none;
    }

    .main-content {
        padding: 25px;
        font-size: 0.95rem;
    }

    .main-content h1 {
        font-size: 1.3rem;
        flex-wrap: nowrap;
        gap: 20px;
    }

    .mobile-menu-btn {
        display: none;
    }

    .filter-container {
        flex-direction: row;
        align-items: center;
        padding: 12px 18px;
        gap: 15px;
        margin-bottom: 10px;
    }

    .search-box {
        max-width: 300px;
    }

    .search-box input,
    .search-box button {
        padding: 9px 14px;
        font-size: 0.9rem;
    }

    .sort-options {
        width: auto;
    }

    .sort-options select {
        width: auto;
        padding: 9px 14px;
        font-size: 0.9rem;
    }

    table {
        font-size: 0.9rem;
        table-layout: auto;
    }

    table th, table td {
        padding: 10px 12px;
    }

    table th:nth-child(3),
    table td:nth-child(3) {
        padding: 10px 12px;
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .back-to-top-btn {
        width: 45px;
        height: 45px;
        bottom: 80px;
        right: 25px;
        font-size: 1rem;
    }

    .category-item {
        padding: 7px 12px;
        font-size: 0.9rem;
    }

    .subcategory-item {
        padding: 7px 12px;
        font-size: 0.85rem;
    }
}

/* 大型設備 - min-width: 992px（桌面小螢幕） */
@media (min-width: 992px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }

    .sidebar {
        width: 240px;
        padding: 20px;
        font-size: 0.9rem;
    }

    .main-content {
        padding: 30px;
        font-size: 0.95rem;
    }

    .main-content h1 {
        font-size: 1rem;
    }

    .logo-main-text {
        font-size: 30px;
    }

    .logo-sub-text {
        font-size: 18px;
    }

    .filter-container {
        padding: 15px 20px;
        gap: 20px;
    }

    .search-box {
        max-width: 350px;
    }

    .search-box input {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .search-box button {
        padding: 10px 15px;
    }

    table {
        font-size: 0.9rem;
    }

    table th, table td {
        padding: 10px 15px;
    }

    .category-item {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .subcategory-item {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* 桌面版的hover效果 */
    .category-item:hover,
    .subcategory-item:hover {
        transform: translateX(2px);
        transition: transform 0.3s ease;
    }
}

/* 特大型設備 - min-width: 1200px（桌面大螢幕） */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }

    .sidebar {
        width: 260px;
        padding: 20px;
        font-size: 0.9rem;
    }

    .main-content {
        padding: 35px;
        font-size: 1rem;
    }

    .main-content h1 {
        font-size: 1rem;
    }

    .logo-main-text {
        font-size: 30px;
    }

    .logo-sub-text {
        font-size: 20px;
    }

    .filter-container {
        padding: 15px 25px;
    }

    .search-box {
        max-width: 400px;
    }

    table {
        font-size: 0.95rem;
    }

    table th, table td {
        padding: 12px 18px;
    }

    .category-item {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    .subcategory-item {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    /* 增強的hover效果 */
    .category-item:hover,
    .subcategory-item:hover {
        transform: translateX(3px);
        transition: transform 0.2s ease;
    }
}