/* =========================================================
   2026 商周改版 - Header 圓角膠囊搜尋框與 Q 博士造型
   ========================================================= */

@media (min-width: 992px) {
    /* Header 層級拉高至 99，確保常駐搜尋框與下拉提示永遠置頂不被選單/分類列遮擋 (僅桌機版) */
    .header-row {
        z-index: 99 !important;
    }
    /* 展開 header container 高度與允許頭像向上探出 */
    .header-row {
        overflow: visible !important;
    }
    
    .header-row .container {
        overflow: visible !important;
        position: relative;
    }

    /* 調整右上方 nav，靠齊中線 */
    .topNav-row {
        margin-right: 0 !important;
        overflow: visible !important;
    }

    /* 隱藏原本右側絕對定位的純放大鏡按鈕 */
    .header-search .search-parent {
        display: none !important;
    }
}

.topNav-search-group {
    display: flex;
    align-items: center;
    position: relative;
    margin-left: 1.5rem;
    height: 60px;
}

/* 膠囊搜尋表單容器 (上下各減少 5px：高 40px -> 30px) */
.header-capsule-form {
    display: flex;
    align-items: center;
    background: #f2f3f5;
    border: 1px solid #e1e4e8;
    border-radius: 16px;
    padding: 0 4px 0 14px;
    width: 190px;
    height: 30px;
    transition: all 0.25s ease-in-out;
    position: relative;
    z-index: 2;
}

.header-capsule-form:focus-within {
    width: 240px;
    background: #ffffff;
    border-color: #84ae63;
    box-shadow: 0 2px 10px rgba(132, 174, 99, 0.25);
}

/* 輸入框 */
.header-capsule-input {
    border: none;
    background: transparent;
    font-size: 14px;
    color: #333333;
    width: 100%;
    outline: none;
    padding: 0;
}

.header-capsule-input::placeholder {
    color: #8c8c8c;
    font-size: 13px;
}

/* 搜尋按鈕 (放大鏡) */
.header-capsule-btn {
    border: none;
    background: transparent;
    color: #2b2b2b;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.header-capsule-btn:hover {
    color: #84ae63;
    background: rgba(132, 174, 99, 0.12);
}

.header-capsule-btn i {
    font-size: 14px;
}

/* Q 博士角色包覆外層 (底部切齊 Header 底線，overflow: hidden 防止下半身探出 Header) */
.header-qbo-box {
    position: relative;
    display: flex;
    align-items: flex-end;
    height: 60px !important;
    max-height: 60px !important;
    overflow: hidden !important;
    margin-left: 10px;
    align-self: flex-end;
    pointer-events: none;
    z-index: 1;
    top: 0 !important;
    transition: all .5s ease-in-out;
}

.header-row.sticky .header-qbo-box {
    position: relative;
    height: 40px !important;
    max-height: 40px !important;
    top: -10px !important;
}

/* Q 博士角色插圖 */
.header-qbo-mascot {
    height: 60px !important;
    max-height: 60px !important;
    width: auto !important;
    max-width: none !important;
    display: block;
    user-select: none;
    pointer-events: none;
    transition: transform 0.2s ease-in-out;
}

.header-capsule-form:focus-within ~ .header-qbo-box .header-qbo-mascot {
    transform: translateY(-2px) scale(1.06);
}

/* 熱門關鍵字下拉提示 (focus 時展示，設定極高層級確保在選單上方) */
.header-capsule-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 260px;
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
    padding: 12px 14px;
    display: none;
    z-index: 999;
}

.header-capsule-dropdown.is-open {
    display: block;
}

.header-capsule-dropdown-tit {
    font-size: 12px;
    font-weight: 700;
    color: #888888;
    margin-bottom: 8px;
}

.header-capsule-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.header-capsule-tags li a {
    display: inline-block;
    font-size: 12px;
    color: #354870;
    background: #f0f4f8;
    padding: 3px 10px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.header-capsule-tags li a:hover {
    background: #84ae63;
    color: #ffffff;
}

/* 手機版與平板版 (< 992px) 隱藏桌機膠囊與老頭，保留原生放大鏡與漢堡按鈕 */
@media (max-width: 991.98px) {
    .topNav-search-group {
        display: none !important;
    }
}
