/**
 * ヘッダースタイル（修正版）
 * 既存のheader.cssを以下で完全に置き換えてください
 *
 * @package Ezodeer_Shop
 */

/* ==========================================================================
   ヘッダー基本構造
   ========================================================================== */
   .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    transition: all 0.3s ease;
    overflow: visible; /* ロゴがはみ出せるように */
}

/* デフォルト状態（透明） */
.site-header {
    background: transparent;
    box-shadow: none;
}

/* スクロール時の背景 */
.site-header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* フロントページでpadding-topを0に */
body.home,
body.page-template-front-page {
    padding-top: 0;
}

/* その他のページ */
body:not(.home):not(.page-template-front-page) {
    padding-top: 120px;
}

/* category-typeページではpadding-topを調整 */
body.page-template-page-category-type,
body.page-template-category-type {
    padding-top: 120px;
}

/* ==========================================================================
   ヘッダートップ
   ========================================================================== */
.header-top {
    background: rgba(14, 14, 14, 0.8);
    color: #fff;
    padding: 8px 0;
    font-size: 14px;
    transition: all 0.3s ease;
}

/* スクロール時はヘッダートップを隠す */
.site-header.scrolled .header-top {
    max-height: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
}

/* category-typeページではヘッダートップを表示（高さを統一） */
body.page-template-page-category-type .header-top,
body.page-template-category-type .header-top {
    display: block !important;
    background: rgba(14, 14, 14, 0.8) !important;
    color: #fff !important;
    padding: 8px 0 !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
    min-height: 40px !important;
    line-height: 1.4 !important;
}

/* 商品アーカイブページではヘッダートップを非表示 */
body.post-type-archive-product .header-top,
body.tax-product_cat .header-top {
    display: none;
}

/* category-typeページでのヘッダーメニュー位置調整 */
body.page-template-page-category-type .main-navigation,
body.page-template-category-type .main-navigation {
    justify-content: center;
}

body.page-template-page-category-type #primary-menu,
body.page-template-category-type #primary-menu,
body.page-template-page-category-type .menu,
body.page-template-category-type .menu {
    justify-content: center;
    margin: 0 auto;
}

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

.header-info {
    font-size: 13px;
}

.header-contact {
    font-size: 13px;
}

/* ==========================================================================
   ヘッダーメイン
   ========================================================================== */
.header-main {
    padding: 20px 0;
    transition: all 0.3s ease;
    overflow: visible; /* ロゴがはみ出せるように */
}

/* スクロール時のパディング調整 */
.site-header.scrolled .header-main {
    padding: 15px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.site-branding {
    flex-shrink: 0;
    position: relative;
    z-index: 10; /* 他の要素より前面に */
}

.custom-logo-link {
    display: block;
}

.custom-logo {
    max-height: 48px;
    width: auto;
    filter: brightness(0) invert(1); /* デフォルトは白色 */
    transition: filter 0.3s ease;
}

/* スクロール時のロゴ色（黒色に） */
.site-header.scrolled .custom-logo {
    filter: none;
}

/* その他のページでも黒色に */
body:not(.home):not(.page-template-front-page) .custom-logo {
    filter: none;
}

/* ==========================================================================
   コンテナ
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   デスクトップナビゲーション
   ========================================================================== */
.main-navigation {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#primary-menu,
.menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    gap: 30px;
}

.menu-item {
    position: relative;
    margin: 0;
}

.menu-item > a {
    display: block;
    padding: 10px 0;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* スクロール時のメニュー色 */
.site-header.scrolled .menu-item > a {
    color: #333;
    text-shadow: none;
}

.menu-item > a:hover {
    color: #000;
}

/* ドロップダウンメニュー矢印 */
.menu-item-has-children > a::after {
    content: '▼';
    font-size: 0.7em;
    margin-left: 5px;
    opacity: 0.8;
}

/* ==========================================================================
   アカウント・カートメニュー
   ========================================================================== */
.header-actions {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    margin-left: auto;
}

.header-action-item {
    margin: 0;
}

.header-action-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    text-decoration: none;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    padding: 8px 12px;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* スクロール時のアクションリンク */
.site-header.scrolled .header-action-link {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.header-action-link:hover {
    background: rgba(139, 69, 19, 0.2);
    transform: translateY(-2px);
}

.header-action-link ion-icon {
    font-size: 2rem;
}

.action-label {
    font-size: 1.4rem;
    font-weight: 500;
}

/* カート数バッジ */
.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background: #ff4444;
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ==========================================================================
   メガメニュー（PCのみ）
   ========================================================================== */
@media (min-width: 769px) {
    .has-mega-menu {
        position: relative;
    }

    .mega-menu {
        position: absolute;
        top: 100%;
        left: 0;
        transform: translateX(0); /* 左端をヘッダーロゴの左端に合わせる */
        width: 90vw;
        max-width: 1000px;
        margin-left: 0; /* 左マージンを0に設定 */
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 1000;
        border-radius: 12px;
        overflow: hidden;
        margin-top: 10px;
    }
    
    /* 最初のメガメニュー（肉の種類から探す）の左端調整 */
    .menu-item:first-child .mega-menu {
        left: 0;
        transform: translateX(0); /* 左端をヘッダーロゴの左端に合わせる */
        margin-left: 0;
    }
    
    /* 2番目のメガメニュー（用途から探す）も右にずらす */
    .menu-item:nth-child(2) .mega-menu {
        left: 0;
        transform: translateX(-5%); /* -5%右にずらす */
    }
    
    /* 3番目以降のメガメニューは中央寄せ */
    .menu-item:nth-child(n+3) .mega-menu {
        left: 50%;
        transform: translateX(-50%);
    }

    /* ホバー時のみ表示 */
    .has-mega-menu:hover .mega-menu {
        opacity: 1;
        visibility: visible;
    }

    .mega-menu-inner {
        padding: 30px;
    }

    .mega-menu-grid {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
        max-width: 900px;
        margin: 0 auto;
    }

    .mega-menu-item {
        text-align: center;
    }

    .mega-menu-item a {
        display: block;
        text-decoration: none;
        color: #333;
        transition: all 0.3s ease;
        padding: 10px;
        border-radius: 8px;
    }

    .mega-menu-item a:hover {
        background: rgba(139, 69, 19, 0.08);
        transform: translateY(-3px);
    }

    .mega-menu-image {
        width: 90px;
        height: 90px;
        margin: 0 auto 6px;
        overflow: hidden;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
    }

    .mega-menu-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

    .mega-menu-item:hover .mega-menu-image {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    .mega-menu-item:hover .mega-menu-image img {
        transform: scale(1.1);
    }

    /* プレースホルダー画像 */
    .placeholder-image {
        width: 100%;
        height: 100%;
        background: #f8f8f8;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 3rem;
    }

    .mega-menu-label {
        display: block;
        font-size: 1.0rem;
        font-weight: 600;
        color: #333;
        margin-top: 4px;
        line-height: 1.2;
    }
}

/* ==========================================================================
   通常のドロップダウンメニュー
   ========================================================================== */
.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    list-style: none;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
}

.menu-item:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sub-menu .menu-item {
    margin: 0;
}

.sub-menu .menu-item > a {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 0.95em;
    color: #333;
    text-shadow: none;
}

.sub-menu .menu-item > a:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #000;
    padding-left: 25px;
}

/* ==========================================================================
   モバイルメニューボタン
   ========================================================================== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: relative;
    z-index: 1002;
}


.hamburger {
    display: block;
    width: 30px;
    height: 24px;
    position: relative;
}

.bar {
    display: block;
    width: 100%;
    height: 3px;
    background: #fff;
    margin: 6px 0;
    transition: all 0.3s ease;
    transform-origin: center;
}

.site-header.scrolled .bar {
    background: #333;
}

/* アクティブ状態 */
.mobile-menu-toggle.active .bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.mobile-menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ==========================================================================
   モバイルメニュー
   ========================================================================== */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    max-width: 80%;
    height: 100vh;
    background: #fff;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-inner {
    padding: 60px 20px 20px;
}

.mobile-menu-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.mobile-menu-close:hover {
    color: #333;
}

/* モバイルメニューリスト */
.mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu-list .menu-item {
    margin: 0;
    border-bottom: 1px solid #eee;
}

.mobile-menu-list .menu-item > a {
    display: block;
    padding: 15px 10px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    transition: all 0.3s ease;
}

.mobile-menu-list .menu-item > a:hover,
.mobile-menu-list .menu-item > a:active {
    background: #f8f8f8;
    padding-left: 20px;
}

/* モバイルサブメニュー */
.mobile-menu-list .menu-item-has-children > a::after {
    content: '+';
    float: right;
    font-size: 20px;
    line-height: 1;
    transition: transform 0.3s ease;
}

.mobile-menu-list .menu-item-has-children.active > a::after {
    transform: rotate(45deg);
}

.mobile-menu-list .sub-menu {
    display: none;
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    background: #f8f8f8;
    border-radius: 0;
}

.mobile-menu-list .menu-item-has-children.active > .sub-menu {
    display: block;
}

.mobile-menu-list .sub-menu .menu-item {
    border-bottom: 1px solid #e0e0e0;
}

.mobile-menu-list .sub-menu .menu-item > a {
    padding-left: 30px;
    font-size: 15px;
}

/* モバイルメニューのサブメニュー内の画像付きリンク */
.mobile-menu-list .sub-menu .mobile-menu-link-with-image {
    display: flex;
    align-items: center;
    padding: 15px 10px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border-bottom: 1px solid #e0e0e0;
    padding-left: 30px;
}

.mobile-menu-list .sub-menu .mobile-menu-link-with-image:hover {
    background: #f8f8f8;
    padding-left: 40px;
}

.mobile-menu-list .sub-menu .mobile-menu-image {
    width: 30px;
    height: 30px;
    margin-right: 15px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-menu-list .sub-menu .mobile-menu-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-menu-list .sub-menu .mobile-menu-image .placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #999;
    font-size: 14px;
}

.mobile-menu-list .sub-menu .mobile-menu-label {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    flex: 1;
}

/* モバイルメニューの画像付きリンク */
.mobile-menu-link-with-image {
    display: flex;
    align-items: center;
    padding: 15px 10px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border-bottom: 1px solid #e0e0e0;
}

.mobile-menu-link-with-image:hover {
    background: #f8f8f8;
    padding-left: 20px;
}

.mobile-menu-image {
    width: 30px;
    height: 30px;
    margin-right: 15px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mobile-menu-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-menu-image .placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #999;
    font-size: 14px;
}

.mobile-menu-label {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    flex: 1;
}

/* モバイルアクション */
.mobile-actions {
    display: none;
    justify-content: space-around;
    padding: 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.mobile-action-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: #333;
    text-decoration: none;
    font-size: 1.4rem;
    transition: color 0.3s ease;
    position: relative;
}

.mobile-action-link ion-icon {
    font-size: 2.4rem;
}

.mobile-action-link:hover {
    color: #000;
}

.mobile-action-link .cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* オーバーレイ */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* メニュー開いた時のbody */
body.menu-open {
    overflow: hidden;
}

/* ==========================================================================
   その他のページでのヘッダー
   ========================================================================== */
body:not(.home):not(.page-template-front-page) .site-header {
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

body:not(.home):not(.page-template-front-page) .header-top {
    background:rgb(0, 0, 0);
}

body:not(.home):not(.page-template-front-page) .menu-item > a,
body:not(.home):not(.page-template-front-page) .header-action-link {
    color: #333;
    text-shadow: none;
}

body:not(.home):not(.page-template-front-page) .header-action-link {
    background: rgba(0, 0, 0, 0.05);
}

body:not(.home):not(.page-template-front-page) .bar {
    background: #333;
}

/* 商品詳細ページでのヘッダー */
body.page-product-detail .site-header,
body.single-product .site-header {
    background: #fff !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
}

body.page-product-detail .menu-item > a,
body.page-product-detail .header-action-link,
body.single-product .menu-item > a,
body.single-product .header-action-link {
    color: #333 !important;
    text-shadow: none !important;
}

body.page-product-detail .header-action-link,
body.single-product .header-action-link {
    background: rgba(0, 0, 0, 0.05) !important;
}

body.page-product-detail .bar,
body.single-product .bar {
    background: #333 !important;
}

/* 商品詳細ページでのロゴ色 */
body.page-product-detail .custom-logo,
body.single-product .custom-logo {
    filter: none !important;
}

/* ==========================================================================
   スクリーンリーダー
   ========================================================================== */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* ==========================================================================
   レスポンシブ
   ========================================================================== */
@media (max-width: 1024px) {
    .menu-item {
        margin: 0;
    }
    
    #primary-menu,
    .menu {
        gap: 20px;
    }
    
    .action-label {
        display: none;
    }
    
    .header-action-link {
        padding: 8px;
        background: none;
    }
}

@media (max-width: 768px) {
    /* ヘッダー調整 */
    body {
        padding-top: 80px;
    }
    
    body.home,
    body.page-template-front-page {
        padding-top: 0;
    }
    
    /* category-typeページのモバイル対応 */
    body.page-template-page-category-type,
    body.page-template-category-type {
        padding-top: 80px;
    }
    
    .header-top {
        padding: 5px 0;
    }
    
    .header-contact {
        display: none;
    }
    
    .header-info {
        font-size: 12px;
        text-align: center;
        width: 100%;
    }
    
    .header-main {
        padding: 15px 0;
    }
    
    .custom-logo {
        max-height: 38px; /* モバイルでは少し小さく */
    }
    
    /* ヘッダーコンテンツのレイアウト調整 */
    .header-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* ロゴは左端 */
    .site-branding {
        order: 1;
    }
    
    /* デスクトップメニュー非表示 */
    .main-navigation {
        display: none;
    }
    
    /* モバイルメニューボタンを右端に */
    .mobile-menu-toggle {
        display: block;
        order: 2;
    }
    
    
    /* モバイルアクション表示 */
    .mobile-actions {
        display: flex;
    }
    
    /* メガメニュー無効化 */
    .mega-menu {
        display: none !important;
    }
}