/* タブレット専用ヘッダーカスタムCSS */

/* iPad専用メディアクエリ - 最優先適用 */
@media only screen 
  and (min-device-width: 768px) 
  and (max-device-width: 1024px) 
  and (-webkit-min-device-pixel-ratio: 1),
only screen 
  and (min-device-width: 768px) 
  and (max-device-width: 1024px) 
  and (-webkit-min-device-pixel-ratio: 2),
only screen 
  and (min-width: 768px) 
  and (max-width: 1024px),
screen and (max-width: 1024px) and (min-width: 768px) {
    
    /* ヘッダー基本設定 */
    .ec-headerRole {
        position: relative;
        background: #fff;
        border-bottom: 1px solid #e5e5e5;
        padding: 10px 0;
    }
    
    /* ロゴを大きく表示 */
    .ec-headerRole__logo img,
    .ec-headerTitle__logo img,
    .ec-headerTitle__title img {
        max-height: 50px !important;
        height: 50px !important;
        width: auto !important;
    }
    
    /* デスクトップナビゲーションを完全に非表示 */
    .ec-headerRole__nav,
    .ec-headerNavSP__nav,
    .ec-headerNavSP,
    nav,
    .navigation,
    .menu-desktop {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    /* ハンバーガーメニューボタンを強制表示 */
    .ec-headerRole__navSP,
    .ec-headerTitle__hamburger,
    #hamburger-menu {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
        right: 20px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 1001 !important;
    }
    
    /* ハンバーガーアイコンのスタイル */
    .ec-headerNavSP__trigger {
        display: block !important;
        background: none;
        border: none;
        padding: 10px;
        cursor: pointer;
        position: relative;
        width: 40px;
        height: 40px;
    }
    
    .ec-headerNavSP__trigger span {
        display: block;
        width: 25px;
        height: 3px;
        background: #333;
        margin: 5px auto;
        transition: 0.3s;
        border-radius: 2px;
    }
    
    /* ハンバーガーメニューオープン時のアニメーション */
    .ec-headerNavSP__trigger.is-active span:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }
    
    .ec-headerNavSP__trigger.is-active span:nth-child(2) {
        opacity: 0;
    }
    
    .ec-headerNavSP__trigger.is-active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
    
    /* モバイルメニューコンテナ */
    .ec-headerNavSP {
        position: fixed;
        top: 0;
        right: -300px;
        width: 300px;
        height: 100vh;
        background: #fff;
        box-shadow: -2px 0 5px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
        padding-top: 80px;
    }
    
    .ec-headerNavSP.is-active {
        right: 0;
    }
    
    /* メニューオーバーレイ */
    .ec-headerNavSP__overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .ec-headerNavSP__overlay.is-active {
        opacity: 1;
        visibility: visible;
    }
    
    /* カテゴリメニューのスタイル */
    .ec-headerCategory__menu {
        padding: 20px;
        border-bottom: 1px solid #eee;
    }
    
    .category-heading h3 {
        font-size: 16px;
        font-weight: bold;
        color: #333;
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 2px solid #007c5c;
    }
    
    .header-category-link {
        display: block;
        padding: 12px 15px;
        color: #333;
        text-decoration: none;
        border-bottom: 1px solid #f0f0f0;
        transition: background-color 0.2s ease;
        font-size: 14px;
    }
    
    .header-category-link:hover {
        background-color: #f8f9fa;
        color: #007c5c;
    }
    
    .header-category-link:last-child {
        border-bottom: none;
    }
    
    /* SNSリンク */
    .mobile-sns-menu {
        padding: 20px;
        text-align: center;
        border-top: 1px solid #eee;
        margin-top: 20px;
    }
    
    .mobile-sns-link {
        display: inline-block;
        width: 40px;
        height: 40px;
        background: #00B900;
        color: white;
        border-radius: 50%;
        text-align: center;
        line-height: 40px;
        font-size: 20px;
        text-decoration: none;
        transition: transform 0.2s ease;
    }
    
    .mobile-sns-link:hover {
        transform: scale(1.1);
    }
    
    /* メニューの閉じるボタン */
    .ec-headerNavSP__close {
        position: absolute;
        top: 20px;
        right: 20px;
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: #333;
        z-index: 1001;
    }
    
    /* ヘッダーのフレックス設定 */
    .ec-headerRole .ec-containerRole {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }
    
    /* ロゴの中央配置 */
    .ec-headerRole__logo {
        flex-grow: 1;
        text-align: center;
    }
    
    /* カート・ログインエリアの調整 */
    .ec-headerRole__actions {
        display: flex;
        align-items: center;
        gap: 15px;
        position: absolute;
        left: 20px;
        top: 50%;
        transform: translateY(-50%);
    }
}

/* JavaScript用のクラス */
.no-scroll {
    overflow: hidden;
}

/* 全タブレットサイズに強制適用 - 正しいクラス名使用 */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    /* デスクトップナビゲーションを強制非表示 */
    .ec-headerRole__nav,
    .ec-headerNavSP__nav,
    .ec-headerNavSP {
        display: none !important;
    }
    
    /* 右上のボタン群を非表示（ハンバーガーメニュー内で表示） */
    .ec-headerTitle__nav {
        display: none !important;
    }
    
    /* ハンバーガーボタンを強制表示 */
    .ec-headerTitle__hamburger {
        display: block !important;
        position: absolute !important;
        right: 20px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        background: none !important;
        border: none !important;
        padding: 10px !important;
        cursor: pointer !important;
        width: 40px !important;
        height: 40px !important;
        z-index: 1001 !important;
    }
    
    .ec-headerTitle__hamburger span {
        display: block !important;
        width: 25px !important;
        height: 3px !important;
        background: #333 !important;
        margin: 5px auto !important;
        transition: 0.3s !important;
        border-radius: 2px !important;
    }
    
    /* ハンバーガーメニューのコンテナ */
    .ec-headerCategory {
        position: fixed !important;
        top: 0 !important;
        right: -350px !important;
        width: 350px !important;
        height: 100vh !important;
        background: #fff !important;
        box-shadow: -2px 0 5px rgba(0,0,0,0.1) !important;
        transition: right 0.3s ease !important;
        z-index: 1000 !important;
        overflow-y: auto !important;
        padding-top: 60px !important;
    }
    
    /* 既存の閉じるボタンを隠して、新しい×ボタンを追加 */
    .ec-headerNavSP__close {
        display: none !important;
    }
    
    .ec-headerCategory::before {
        content: '×' !important;
        position: absolute !important;
        top: 15px !important;
        right: 20px !important;
        font-size: 30px !important;
        color: #333 !important;
        cursor: pointer !important;
        z-index: 1001 !important;
        width: 40px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1 !important;
    }
    
    .ec-headerCategory.mobile-open {
        right: 0 !important;
    }
    
    /* ロゴを大きく表示 */
    .ec-headerRole__logo img,
    .ec-headerTitle__logo img,
    .ec-headerTitle__title img {
        max-height: 50px !important;
        height: 50px !important;
        width: auto !important;
    }
    
    /* ヘッダーレイアウト調整 */
    .ec-headerTitle {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        position: relative !important;
        padding: 10px 20px !important;
    }
    
    .ec-headerTitle__logo {
        flex-grow: 1 !important;
        text-align: center !important;
    }
    
    /* モバイルナビメニューのスタイル - タブレット用（背景色なし） */
    .mobile-nav-menu {
        padding: 20px !important;
        border-bottom: 1px solid #eee !important;
        background-color: transparent !important;
    }
    
    .mobile-nav-link {
        display: block !important;
        padding: 15px 20px !important;
        color: #333 !important;
        text-decoration: none !important;
        border-bottom: 1px solid #e0e0e0 !important;
        font-size: 16px !important;
        transition: background-color 0.2s ease !important;
        background-color: transparent !important;
    }
    
    .mobile-nav-link:hover {
        background-color: #ffffff !important;
        color: #007c5c !important;
    }
    
    .mobile-nav-link:last-child {
        border-bottom: none !important;
    }
    
    /* カテゴリヘッダー */
    .category-heading {
        padding: 20px !important;
        text-align: center !important;
        background-color: #f5f5f5 !important;
        border-bottom: 1px solid #ddd !important;
    }
    
    .category-heading h3 {
        margin: 0 !important;
        font-size: 18px !important;
        font-weight: bold !important;
        color: #333 !important;
    }
    
    /* カテゴリメニューをモバイルと同じリスト形式に */
    .ec-headerCategory__menu {
        padding: 20px !important;
        border-bottom: 1px solid #eee !important;
        display: block !important;
        align-items: unset !important;
        gap: unset !important;
        justify-content: unset !important;
    }
    
    .header-category-link {
        display: block !important;
        padding: 15px 20px !important;
        color: #333 !important;
        text-decoration: none !important;
        border-bottom: 1px solid #f0f0f0 !important;
        transition: background-color 0.2s ease !important;
        font-size: 16px !important;
        background-color: transparent !important;
        border-radius: 0 !important;
        min-width: auto !important;
        text-align: left !important;
    }
    
    .header-category-link:hover {
        background-color: #f8f9fa !important;
        color: #007c5c !important;
        transform: none !important;
        box-shadow: none !important;
    }
    
    .header-category-link:last-child {
        border-bottom: none !important;
    }
    
    /* SNSアイコンセクション - モバイル版と統一 */
    .mobile-sns-menu {
        padding: 20px !important;
        text-align: center !important;
        border-top: 1px solid #eee !important;
        margin-top: 20px !important;
    }
    
    .mobile-sns-link {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 45px !important;
        height: 45px !important;
        background: #6B5A44 !important;
        color: white !important;
        border-radius: 50% !important;
        font-size: 18px !important;
        text-decoration: none !important;
        transition: all 0.3s ease !important;
        margin: 0 8px !important;
        border: 2px solid #6B5A44 !important;
        position: relative !important;
        overflow: hidden !important;
        line-height: 1 !important;
    }
    
    .mobile-sns-link:hover {
        transform: translateY(-2px) !important;
        color: white !important;
    }
    
    /* 各SNSアイコンの色を白に統一（背景は茶色のまま） */
    .mobile-sns-link i {
        color: white !important;
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .mobile-sns-link:hover i {
        color: white !important;
    }
}

/* 追加の強制適用 - iPad Safari対応 */
@media screen and (max-width: 1024px) and (min-width: 768px) {
    /* すべてのデスクトップナビゲーションを強制非表示 */
    .ec-headerRole__nav,
    .ec-headerNavSP__nav,
    .ec-headerNavSP,
    .ec-headerTitle__nav {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* ハンバーガーボタンを強制表示 */
    .ec-headerTitle__hamburger {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* ロゴサイズ強制適用 */
    .ec-headerRole__logo img,
    .ec-headerTitle__logo img,
    .ec-headerTitle__title img {
        max-height: 50px !important;
        height: 50px !important;
        width: auto !important;
    }
}

/* 最強制適用 - すべてのタブレットデバイス対応 */
@media (max-width: 1024px) {
    /* デスクトップナビゲーションを完全削除 */
    .ec-headerRole__nav,
    .ec-headerNavSP__nav,
    .ec-headerNavSP,
    .ec-headerTitle__nav {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
    }
    
    /* カテゴリメニューをブロック表示に強制変更 */
    .ec-headerCategory__menu {
        display: block !important;
        align-items: unset !important;
        gap: unset !important;
        justify-content: unset !important;
        flex-direction: unset !important;
    }
    
    /* ハンバーガーメニューを強制表示 */
    .ec-headerTitle__hamburger,
    #hamburger-menu {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
        right: 20px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 9999 !important;
        background: none !important;
        border: none !important;
        padding: 10px !important;
        cursor: pointer !important;
        width: 40px !important;
        height: 40px !important;
    }
    
    /* ハンバーガーアイコンのライン */
    .ec-headerTitle__hamburger span,
    #hamburger-menu span {
        display: block !important;
        width: 25px !important;
        height: 3px !important;
        background: #333 !important;
        margin: 5px auto !important;
        transition: 0.3s !important;
        border-radius: 2px !important;
    }
    
    /* active状態の時はハンバーガーアイコンを非表示（×ボタンのみ表示） */
    .ec-headerTitle__hamburger.active span,
    #hamburger-menu.active span {
        display: none !important;
    }
}