:root{
  --sky-bg:#ffffff;
  --sky-surface:#ffffff;
  --sky-text:#0f172a;
  --sky-muted:#64748b;
  --sky-border:#e2e8f0;
  --sky-primary:#2563eb;
  --sky-primary-2:#1d4ed8;
  --sky-primary-soft:#eff6ff;
  --sky-primary-soft-2:#dbeafe;
  --sky-primary-ink:#1e40af;
}
 
.price{ color: var(--sky-primary) !important; }
.cart-price{ color: var(--sky-primary) !important; }
.product-price{ color: var(--sky-primary) !important; }

/* 頂部導航樣式（家具站） */
.top-nav { position: sticky; top: 0; z-index: 1000; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 6px; padding: 10px 16px; background-color: var(--sky-surface); border-bottom: 1px solid var(--sky-border); }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; }
.search-input { height: 32px; border: 1px solid var(--sky-border); border-radius: 6px; padding: 0 10px; min-width: 220px; }
.search-go { border: none; background: var(--sky-primary-soft); border-radius: 6px; padding: 6px 10px; cursor: pointer; display: none; color: var(--sky-primary-ink); }
/* 有文字時顯示跳轉按鈕；空文字時隱藏 */
.search-input:not(:placeholder-shown) + .search-go { display: inline-flex; }
.menu { display: flex; align-items: center; gap: 16px; }
.menu a { color: var(--sky-text); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.menu a.active, .menu a:hover { background: var(--sky-primary-soft); color: var(--sky-primary-ink); }

/* Hamburger Menu */
.hamburger { display: none; flex-direction: column; justify-content: space-between; width: 24px; height: 18px; cursor: pointer; }
.hamburger span { display: block; height: 2px; width: 100%; background: var(--sky-text); border-radius: 2px; }

/* 第二行分類膠囊導覽 */
.menu2 { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; column-gap: 40px; padding: 10px 12px; border-top: 1px solid var(--sky-border); }
.menu2 > .menu2-item:nth-child(1){ justify-self: start; }
.menu2 > .menu2-item:nth-child(2){ justify-self: center; }
.menu2 > .menu2-item:nth-child(3){ justify-self: end; }
.menu2 > .menu2-item > a { display:inline-flex; align-items:center; padding:8px 12px; border-radius:8px; }
.menu2 a.active, .menu2 a:hover { color: var(--sky-primary); background: var(--sky-primary-soft); }
/* 避免頂層樣式影響下拉內的連結 */
.menu2 .dropdown a { width:auto; height:auto; margin:0; padding:4px 8px; }

/* 右側（第三個）菜單的下拉向左展開，避免超出視窗 */
.menu2 > .menu2-item:last-child .dropdown { left:auto; right:0; }

/* 下拉選單（滑鼠懸浮顯示） */
.menu2-item { position: relative; }
.menu2-item .dropdown { position: absolute; top: calc(100% + 6px); left: 0; min-width: 180px; background: var(--sky-surface); border: 1px solid var(--sky-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.08); padding: 6px; z-index: 100001; opacity: 0; transform: translateY(-6px); visibility: hidden; pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; max-height: calc(100vh - var(--header-visible-h, 140px) - 24px); overflow-y: auto; }
.menu2-item.open .dropdown { opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto; }
.menu2-item .dropdown a { display: block; color: #334155; padding: 8px 10px; border-radius: 6px; text-decoration: none; }
.menu2-item .dropdown a:hover { background: var(--sky-primary-soft); color: var(--sky-primary-ink); }

/* 巨型下拉（多欄） */
.menu2-item .dropdown.megamenu { position: fixed; top: calc(var(--header-visible-h, 140px) + 6px); min-width: unset; width: 900px; max-width: calc(100vw - 40px); font-size: 13px; padding: 12px 16px; display: grid; grid-template-columns: 200px 1fr; gap: 14px; align-items: start; opacity: 0; left: 50%; right: auto; transform: translate(-50%, -6px); visibility: hidden; pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; overflow-x: hidden; }
.menu2-item .dropdown.megamenu .mega-left { border-right: 1px solid var(--sky-border); padding-right: 12px; }
.menu2-item .dropdown.megamenu .mega-left .mega-group { display:flex; align-items:center; justify-content: space-between; color:var(--sky-muted); padding:6px 8px; border-radius:8px; font-size: 13px; }
.menu2-item .dropdown.megamenu .mega-left .mega-group:hover { background:var(--sky-primary-soft); color:var(--sky-primary-ink); }
.menu2-item .dropdown.megamenu .mega-left .mega-group.active { background:var(--sky-primary-soft-2); color:var(--sky-primary-2); }
.menu2-item .dropdown.megamenu .mega-left .chev { color:#9ca3af; }

.menu2-item .dropdown.megamenu .mega-col { display:flex; flex-direction:column; gap:4px; padding-top:2px; }
.menu2-item .dropdown.megamenu .mega-title { display:flex; align-items:center; font-weight:600; color:var(--sky-primary-ink); font-size: 14px; line-height:1.4; padding:4px 0; margin-bottom:8px; border-bottom:1px solid var(--sky-border); }
.menu2-item .dropdown.megamenu .mega-col a { color:#374151; padding:2px 0; border-radius:6px; font-size: 13px; line-height:1.5; }

/* 面板容器佈局：置於第 2 欄 */
.menu2-item .dropdown.megamenu .mega-panels { grid-column: 2; display: grid; grid-auto-flow: row; }
.menu2-item .dropdown.megamenu .mega-panel { display: none; }
.menu2-item .dropdown.megamenu .mega-panel.active { display: grid; gap: 14px; }
.menu2-item .dropdown.megamenu .mega-panel.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.menu2-item .dropdown.megamenu .mega-panel.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.menu2-item .dropdown.megamenu .mega-panel.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.menu2-item .dropdown.megamenu .mega-panel.cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.menu2-item .dropdown.megamenu .mega-right { grid-column: 2; justify-self: end; }
.menu2-item .dropdown.megamenu .mega-col a:hover { background:var(--sky-primary-soft); color:var(--sky-primary-ink); }

.menu2-item .dropdown.megamenu .mega-right { display:flex; flex-direction:column; align-items:flex-start; gap:6px; }
.menu2-item .dropdown.megamenu .mega-learn { color:#6b7280; font-weight:600; font-size: 13px; }
.menu2-item .dropdown.megamenu .mega-more { display:inline-block; color:var(--sky-primary-2); border:1px solid var(--sky-primary-soft-2); background:var(--sky-primary-soft); padding:5px 8px; border-radius:14px; font-size: 13px; }
.menu2-item .dropdown.megamenu .mega-more:hover { background:var(--sky-primary-soft-2); }
.menu2-item.open .dropdown.megamenu { opacity: 1; transform: translate(-50%, 0); visibility: visible; pointer-events: auto; }

/* 左側第一個分類菜單（避免被置中規則影響） */
.menu2 > .menu2-item:first-child .dropdown.megamenu { left: 0; right: auto; transform: translate(0, -6px); }
.menu2 > .menu2-item:first-child.open .dropdown.megamenu { transform: translate(0, 0); }

/* 中間第二個分類菜單：直接顯示在「廚房電器」下面（錨定在菜單項） */
.menu2 > .menu2-item:nth-child(2) .dropdown.megamenu { position: absolute; top: calc(100% + 6px); left: 50%; right: auto; transform: translate(-50%, -6px); }
.menu2 > .menu2-item:nth-child(2).open .dropdown.megamenu { transform: translate(-50%, 0); }

/* 右側第三個分類菜單（向左展開） */
.menu2 > .menu2-item:nth-child(3) .dropdown.megamenu { left: auto; right: 0; transform: translate(0, -6px); }
.menu2 > .menu2-item:nth-child(3).open .dropdown.megamenu { transform: translate(0, 0); }

/* Mobile Styles */
@media (max-width: 768px) {
  .top-nav { padding: 10px; }
  .brand-row { flex-wrap: wrap; }
  .logo img { height: 32px; }
  .search { order: 3; width: 100%; margin-top: 10px; }
  .search-input { width: 100%; min-width: unset; flex: 1; }
  
  .hamburger { display: flex; }
  
  .menu { display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: 0; padding-top: 10px; border-top: 1px solid var(--sky-border); margin-top: 10px; order: 4; }
  .menu a { width: 100%; padding: 10px; }
  
  .menu2 { display: none; width: 100%; grid-template-columns: 1fr; gap: 0; padding: 0; border-top: none; order: 5; }
  .menu2 > .menu2-item { justify-self: stretch; width: 100%; border-bottom: 1px solid var(--sky-border); }
  .menu2 > .menu2-item > a { display: block; width: 100%; padding: 12px 10px; }
  
  /* Show menus when nav is open */
  .top-nav.nav-open .menu,
  .top-nav.nav-open .menu2 { display: flex; }
  .top-nav.nav-open .menu2 { display: grid; }

  /* Mobile Megamenu */
  .menu2-item .dropdown.megamenu {
    position: static;
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr;
    padding: 0 10px 10px;
    box-shadow: none;
    border: none;
    background: var(--sky-primary-soft);
    display: none;
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .menu2-item.open .dropdown.megamenu { display: grid; }
  
  .menu2-item .dropdown.megamenu .mega-left {
    border-right: none;
    border-bottom: 1px solid var(--sky-border);
    padding-bottom: 10px;
    margin-bottom: 10px;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    padding-right: 0;
  }
  
  .menu2-item .dropdown.megamenu .mega-panels {
    grid-column: 1;
    display: block;
  }
  
  .menu2-item .dropdown.megamenu .mega-panel.active {
    grid-template-columns: 1fr !important; /* Force 1 column */
  }
  
  .menu2-item .dropdown.megamenu .mega-right {
    grid-column: 1;
    margin-top: 10px;
  }
}
.menu2 > .menu2-item > a::after { content: '▴'; display: inline-block; margin-left: 6px; font-size: 12px; color: #9ca3af; }
.menu2-item.open > a::after { content: '▾'; }

.header { position: fixed !important; top: 0 !important; left: 0; right: 0; z-index: 100000; background: #fff; transition: transform 220ms ease, box-shadow 220ms ease; will-change: transform; overflow: visible; }
.header.is-hidden { transform: translateY(calc(-1 * var(--header-h, 140px))); box-shadow: none; pointer-events: none; }
.header.is-elevated { box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14); }

body { padding-top: var(--header-visible-h, 0px); }
