:root {
    --green: #1ABC9C;
    --text: #333;
}

/* reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
    background: #fff;
    color: var(--text);
}

.header-wrap {
    position: sticky;
    top: 0;
    z-index: 3000;
    background: #fff;
}


/* 上方帶狀區 */
.top-bar {
    background: var(--top-bar-bg, var(--green));
    color: var(--top-bar-color, #fff);
    text-align: center;
    padding: 10px 0;
    letter-spacing: 2px;
    font-size: 16px;
    overflow: hidden;
}

.top-bar p {
    margin: 0;
    line-height: 1;
}

.top-bar-static {
    display: block;
    margin: 0;
    padding: 0;
    color: inherit;
    text-decoration: none;
    line-height: 1;
}

a.top-bar-static:hover {
    color: inherit;
    text-decoration: none;
}

/* ===== 上方帶狀區：倒數計時 ===== */
.top-bar-countdown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    color: inherit;
    line-height: 1;
}

.top-bar-countdown-item {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.top-bar-countdown-item strong {
    font-size: 16px;
    font-weight: 700;
    color: inherit;
    font-variant-numeric: tabular-nums;
}

.top-bar-countdown-item span {
    font-size: 12px;
    font-weight: 400;
    opacity: .88;
}

/* 上方帶狀區：多公告輪播，一次只顯示一則 */
.top-bar-rotator {
    position: relative;
    padding: 0;
    min-height: 38px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-bar-countdown-label {
    font-size: 14px;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
}

.top-bar-rotator .top-bar-item {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 10px 16px;

    color: inherit;
    text-decoration: none;
    line-height: 1;

    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);

    transition:
        opacity .35s ease,
        transform .35s ease,
        visibility .35s ease;

    white-space: nowrap;

    pointer-events: none;
}

.top-bar-rotator .top-bar-item.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);

    pointer-events: auto;
}

.top-bar-rotator .top-bar-item:hover {
    color: inherit;
    text-decoration: none;
}

@media (max-width: 768px) {
    .top-bar-rotator {
        min-height: 46px;
        height: 46px;
        overflow: hidden;
    }

    .top-bar-rotator .top-bar-item {
        padding: 5px 12px;

        white-space: normal;

        font-size: 14px;
        line-height: 1.3;

        text-align: center;

        overflow-wrap: anywhere;
        word-break: break-word;

        transform: translateX(20px);
    }

    .top-bar-rotator .top-bar-item.is-active {
        transform: translateX(0);
    }

    .top-bar-countdown {
        gap: 7px;
        white-space: nowrap;
    }

    .top-bar-countdown-label {
        font-size: 12px;
    }

    .top-bar-countdown-item {
        gap: 2px;
    }

    .top-bar-countdown-item strong {
        font-size: 14px;
    }

    .top-bar-countdown-item span {
        font-size: 10px;
    }
}

.logo a {
    color: inherit;
    text-decoration: none;
}

/* header */
.site-header {
    background: #fff;
    padding: 15px 0;
    position: sticky;
    /* 讓 header 黏在視窗上方 */
    top: 0;
    z-index: 3000;
    /* 要比 dropdown / overlay 高 */
}

/* Header 結構 */
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px 18px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* 左邊 */
.left-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    /* <-- 讓左邊區塊可伸展 */
}

.logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 30px;
    letter-spacing: 5px;
    font-weight: 400;
    white-space: nowrap;
}

.logo .site-logo {
    height: 30px;
    /* 依你的 header 高度調整 */
    width: auto;
    display: block;
}

/* icon 共用 */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text);
}

.icon-btn:hover {
    color: var(--green);
}

/* 預設：桌機版隱藏手機專用搜尋 icon */
.search-btn-mobile {
    display: none;
}

/* 手機版：上面一排只有搜尋 icon，下面維持原本 Logo + icons */
@media (max-width: 769px) {

    /* 顯示手機專用搜尋 icon，讓它自己一排靠左 */
    .search-btn-mobile {
        display: inline-flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        padding: 8px 16px;
        /* 可依喜好調整間距 */
    }

    /* 手機版隱藏原本在 logo 旁邊那顆搜尋 icon */
    .site-header .left-wrap .search-btn:not(.search-btn-mobile) {
        display: none;
    }

    /* 下面那排（Logo + 右邊 icons）維持橫向排列 */
    .site-header .header-inner {
        padding: 8px 16px 12px;
    }
}


/* 右邊 icon */
.right-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex: 1;
    /* <-- 讓右邊區塊可伸展 */
}

.cart-box {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--green);
    color: #fff;
    font-size: 10px;
    border-radius: 999px;
    padding: 2px 5px;
}

/* user dropdown */
.user-box {
    position: relative;
}

/* ===== 會員小鈴鐺通知 ===== */
.member-notification-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

    .member-notification-btn {
    position: relative;
}

.member-notification-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--green);
    color: #fff;
    font-size: 10px;
    line-height: 17px;
    text-align: center;
    font-weight: 600;
}

.member-notification-dropdown {
    position: absolute;
    top: 125%;
    right: 0;
    width: 320px;
    max-width: calc(100vw - 28px);
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .14);
    z-index: 5000;
    overflow: hidden;
    text-align: left;
}

.member-notification-title {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
    color: #222;
    border-bottom: 1px solid #f1f1f1;
}

.member-notification-list {
    max-height: 360px;
    overflow-y: auto;
}

.member-notification-item {
    display: block;
    padding: 12px 14px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f5f5f5;
    background: #fff;
}

.member-notification-item:hover {
    background: #f8fffc;
    color: #333;
    text-decoration: none;
}

.member-notification-item.is-unread {
    background: #f2fffb;
}

.member-notification-item-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #222;
}

.member-notification-item-content {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    word-break: break-word;
}

.member-notification-item-time {
    margin-top: 5px;
    font-size: 12px;
    color: #999;
}

.member-notification-empty {
    padding: 18px 14px;
    font-size: 13px;
    color: #999;
    text-align: center;
}

.small-arrow {
    font-size: 10px;
    margin-left: 2px;
}

/* 使用者下拉選單 */
.user-dropdown {
    position: absolute;
    top: 125%;
    right: 0;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    display: none;
    min-width: 180px;
    z-index: 50;
    padding: 6px 0;
    font-size: 14px;
}

/* 選單項目 */
.user-dropdown a {
    display: block;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.user-dropdown a:hover {
    background: rgba(100, 141, 122, 0.08);
    color: #000;
}

/* 登出項目與分隔線 */
.user-dropdown hr {
    margin: 6px 0;
    border: none;
    border-top: 1px solid #e3e3e3;
}

.user-dropdown a.logout {
    font-weight: 500;
    color: #333;
}

.user-dropdown a.logout:hover {
    color: #648d7a;
}

/* 讓 dropdown 裡的 button 長得像 <a> */
.dropdown-item-like {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 10px 12px;
    /* 依你 dropdown a 的 padding 調整 */
    color: inherit;
    cursor: pointer;
}

.dropdown-item-like:hover {
    background: rgba(0, 0, 0, .05);
}


/* 導覽列 (桌機預設顯示) */
.main-nav {
    background: #fff;
    padding: 15px 0 15px;
}

.main-nav ul {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    gap: 38px;
    justify-content: center;
    align-items: center;
    list-style: none;
    flex-wrap: nowrap;
    /* 防止自動換行 */
    white-space: nowrap;
    /* 確保文字不自動折行 */
}

.main-nav a {
    text-decoration: none;
    font-size: 16px;
    letter-spacing: 2px;
    color: #000;
    display: inline-block;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--green);
}

/* === 共同設定 === */
.main-nav ul>li {
    position: relative;
}

.main-nav .dropdown-menu,
.main-nav .submenu {
    position: absolute;
    background: #fff;
    list-style: none;
    margin: 0;
    padding: 10px 0;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 999;
}

/* === 第一層下拉（往下展開） === */
.main-nav .dropdown-menu {
    top: 100%;
    left: 0;
}

/* === 第二層下拉（往右側展開） === */
.main-nav .submenu {
    top: 0;
    left: 100%;
}

/* 第二層：所有品牌右側箭頭 */
.main-nav li.has-submenu>a {
    position: relative;
    padding-right: 24px;
    /* 預留位置給箭頭 */
}

.main-nav li.has-submenu > a::after {
    content: "\203A";
    position: absolute;
    right: 10px;
    top: 40%;
    transform: translateY(-50%);
    font-size: 28px;
    color: #666;
    transition: 0.2s;
}

/* 滑過時箭頭變綠 */
.main-nav li.has-submenu:hover>a::after {
    color: #00c3a1;
}


/* === 連結樣式 === */
.main-nav .dropdown-menu li a,
.main-nav .submenu li a {
    display: block;
    padding: 8px 18px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}

.main-nav .dropdown-menu li a:hover,
.main-nav .submenu li a:hover {
    background: #f5f5f5;
    color: #00c3a1;
    /* 你的綠色 */
}

/* === hover 展開功能 === */

/* 第一層 hover */
.main-nav li.has-dropdown:hover>.dropdown-menu {
    display: block;
}

/* 第二層 hover */
.main-nav li.has-submenu:hover>.submenu {
    display: block;
}


/* 手機側欄 */
.mobile-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right .25s ease;
    z-index: 3500;
    display: flex;
    flex-direction: column;
}

.mobile-panel.open {
    right: 0;
}

.panel-inner {
    margin-top: 50px;
    padding: 84px 28px 36px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.panel-left-icons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.panel-menu {
    list-style: none;
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-menu a {
    text-decoration: none;
    font-size: 18px;
    letter-spacing: 1px;
    color: #000;
}

.panel-social {
    padding: 30px;
    margin-top: 24px;
    display: flex;
    gap: 16px;
    font-size: 18px;
}

.panel-social a {
    color: #333;
    /* 改成你要的顏色，例如黑灰 */
    transition: color 0.2s ease;
}

.panel-social a:hover {
    color: var(--green);
    /* 滑過去變綠色，可改成 #5383ff 等 */
}

/* 手機側欄主選項（可展開） */
.panel-menu .has-children>.panel-link {
    width: 100%;
    padding: 0;
    border: none;
    outline: none;
    background: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 18px;
    letter-spacing: 1px;
    color: #000;
    cursor: pointer;
}

/* 第二層的 button 字小一點 & 縮排 */
.panel-menu .panel-link.sub {
    font-size: 16px;
}

/* 下拉箭頭 icon */
.panel-menu .panel-link i {
    font-size: 16px;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

/* 子選單 ul */
.panel-submenu {
    list-style: none;
    margin: 8px 0 0;
    padding-left: 14px;
    display: none;
    /* 預設隱藏 */
    gap: 12px;
    flex-direction: column;
}

/* 子選單內的連結 */
.panel-submenu a {
    display: block;
    font-size: 15px;
    color: #333;
    text-decoration: none;
    padding: 4px 0;
}

.panel-submenu a:hover {
    color: var(--green);
}

/* 展開狀態：父層加 .open */
.panel-menu .has-children.open>.panel-submenu {
    display: flex;
}

/* 展開時箭頭旋轉 */
.panel-menu .has-children.open>.panel-link i {
    transform: rotate(180deg);
}

/* 第三層（品牌清單）再縮一點 */
.panel-submenu .panel-submenu {
    padding-left: 16px;
    margin-top: 4px;
}



/* 手機側欄的 dropdown 修正，避免被吃掉 */
@media (max-width: 768px) {
    .mobile-panel .user-dropdown {
        left: 0;
        right: auto;
        width: calc(100% + 10px);
        max-width: none;
    }

    .mobile-panel .member-notification-dropdown {
        left: 0;
        right: auto;
        top: 130%;
        width: 280px;
        max-width: calc(100vw - 40px);
    }
}


/* 背景遮罩 */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    display: none;
    z-index: 140;
    }

.overlay.show {
    display: block;
}

/* ===== RWD ===== */

/* 1) 先做小螢幕 (手機) 的樣子 */
@media (max-width: 768px) {

    /* 水平導覽列手機隱藏 */
    .main-nav {
        display: none;
    }

    /* 手機：LOGO 左、搜尋在 logo 下改成直排？這裡用同一行但字縮小 */
    .logo {
        position: static;
        transform: none;
        text-align: center;
        width: 100%;
        margin-bottom: 10px;
    }

    /* 手機：右邊只顯示 bag + 漢堡 */
    .right-wrap .member-notification-wrap,
    .right-wrap .user-box {
    display: none;
    }

    .menu-btn {
        position: relative;
        width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.3s ease;
    }

    .menu-btn i {
        font-size: 26px;
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    /* 開啟狀態下 icon 淡出旋轉 */
    .menu-btn.active i {
        transform: rotate(180deg) scale(0.8);
        opacity: 0;
    }

    /* ✕ icon 生成在偽元素上，避免 DOM 變動 */
    .menu-btn::after {
        content: "\f62a";
        /* bi-x-lg */
        font-family: "bootstrap-icons";
        font-size: 26px;
        position: absolute;
        opacity: 0;
        transform: rotate(-180deg) scale(0.8);
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    /* 顯示 ✕ */
    .menu-btn.active::after {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }

    /* 只針對側欄裡的 */
    .mobile-panel .user-box {
        position: relative;
    }

    .mobile-panel .user-dropdown {
        right: auto;
        /* 不要往右對齊，改往左 */
        left: 0;
        /* 從 panel 左邊開始 */
        top: 130%;
        /* 稍微往下 */
        width: calc(100% + 20px);
        /* 撐大一點好點選，可調 */
        max-width: none;
        border-radius: 6px;
    }
}

/* 2) 螢幕夠大 → 回到桌機 */
@media (min-width: 769px) {

    /* 桌機：側欄不用 */
    .mobile-panel,
    .overlay {
        display: none;
    }

    /* 桌機：漢堡隱藏 */
    .menu-btn {
        display: none;
    }

  /* 桌機：通知、user 顯示 */
    .right-wrap .notif-btn,
    .right-wrap .user-box {
        display: inline-flex;
    }
}

/* 大一點的桌機調整 */
@media (min-width: 992px) {
    .main-nav ul {
        gap: 44px;
    }
}

/* =====  Search Panel ===== */
/* Search Panel */
.search-panel {
    position: fixed;
    inset: 0 0 auto 0;
    background: #fff;
    padding: 26px 0 22px;
    z-index: 3000;
    border-bottom: 1px solid #ececec;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    text-align: center;
}

/* 讓內容置中並限制寬度 */
.search-panel .container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 18px;
}

/* 搜尋框本體寬 70% */
#searchForm {
    width: min(100%, 1000px);
    position: relative;
}

/* 框線樣式 */
.search-box {
    width: 100%;
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    background: #fff;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.08);
}

/* 圖示與輸入框 */
.search-box .input-group-text {
    padding-left: 4px;
    padding-right: 10px;
    border: 0;
    background: transparent;
    color: #555;
}

.search-box .input-group-text i {
    font-size: 18px;
}

.search-box .form-control {
    border: 0;
    box-shadow: none;
    outline: none;
    height: 46px;
    padding-left: 4px;
    font-size: 15px;
    color: #222;
}

.search-box .form-control::placeholder {
    color: #999;
}

/* Close 鈕靠右邊對齊輸入框 */
#searchClose {
    flex: 0 0 auto;
    margin-top: 7px !important;
    padding: 6px 10px;
    border: 0;
    color: #666 !important;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

#searchClose:hover {
    color: var(--green) !important;
    text-decoration: none;
}

/* ===== 搜尋推薦關鍵字 ===== */
#searchSuggest {
    width: 100%;
    margin-top: 12px !important;
    text-align: left;
    background: transparent;
}

.search-header-suggestions {
    width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 10px;
}

.search-header-suggestions-title {
    margin: 0 4px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: #777;
    white-space: nowrap;
}

.search-header-suggestions-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 8px;
}

.search-header-suggestion-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 14px;
    border: 1px solid #e1e1e1;
    border-radius: 999px;
    background: #fafafa;
    color: #444;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        background-color 0.2s ease;
}

.search-header-suggestion-btn:hover {
    transform: translateY(-1px);
    border-color: var(--green);
    background: #f3fcf9;
    color: var(--green);
    text-decoration: none;
}

@media (max-width: 768px) {
    .search-panel {
        padding: 18px 0 16px;
    }

    .search-panel .container {
        padding: 0 14px;
        gap: 8px;
    }

    #searchForm {
        width: 100%;
    }

    .search-box {
        min-height: 44px;
        border-radius: 6px;
    }

    .search-box .form-control {
        height: 42px;
        font-size: 14px;
    }

    #searchClose {
        margin-top: 5px !important;
        padding-left: 6px;
        padding-right: 6px;
        font-size: 13px;
    }

    .search-header-suggestions {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .search-header-suggestions-list {
        gap: 6px;
    }

    .search-header-suggestion-btn {
        min-height: 30px;
        padding: 6px 12px;
        font-size: 12px;
    }
}
