/*--------------------------------------------------------------
# モバイルメニュー
--------------------------------------------------------------*/

.main-navigation {
    display: none; /* Hidden by default on desktop */
}

@media (max-width: 768px) {
    /* Hamburger Menu Button */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: #0059b2;
        border: none;
        width: 44px;
        height: 44px;
        cursor: pointer;
        border-radius: 0;
        z-index: 1000;
    }

    body.menu-open .menu-toggle {
        display: none;
    }

    .hamburger-box {
        display: inline-block;
        position: relative;
        width: 24px;
        height: 18px;
    }

    .hamburger-inner,
    .hamburger-inner::before,
    .hamburger-inner::after {
        content: '';
        position: absolute;
        width: 24px;
        height: 2px;
        background-color: #fff;
        left: 50%;
        transform: translateX(-50%);
        transition: transform 0.3s ease;
    }

    .hamburger-inner {
        top: 50%;
        transform: translate(-50%, -50%);
    }

    .hamburger-inner::before {
        top: -8px;
    }

    .hamburger-inner::after {
        bottom: -8px;
    }

    /* Navigation Panel */
    .main-navigation {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh; /* ビューポートの高さいっぱいに表示 */
        background-color: #0059b2;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1001;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* iOSでのスクロールをスムーズに */
        padding-top: 60px; /* ヘッダーの高さ分の余白を追加 */
    }

    .main-navigation.is-open {
        transform: translateX(0);
    }

    .main-navigation-inner {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    /* Mobile Menu Header */
    .mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        background-color: #fff;
        flex-shrink: 0;
    }

    .mobile-menu-header .custom-logo-link {
        display: flex;
        align-items: center;
        text-decoration: none;
        color: #333;
    }

    .mobile-menu-header .custom-logo {
        height: 30px;
        width: auto;
        margin-right: 10px;
    }

    .mobile-menu-header .site-title-text {
        font-size: 16px;
        font-weight: bold;
    }

    /* Close Button */
    .close-menu-toggle {
        background: #0059b2;
        border: none;
        color: #fff;
        font-size: 24px;
        padding: 10px 15px;
        cursor: pointer;
        line-height: 1;
    }

    /* Menu Items */
    .mobile-menu {
        list-style: none;
        padding: 0;
        margin: 0;
        flex-grow: 1;
    }

    .mobile-menu li a {
        display: block;
        padding: 18px 20px;
        color: #fff;
        text-decoration: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        position: relative;
        font-size: 16px;
        font-weight: 500;
        transition: background-color 0.3s ease;
    }
    
    .mobile-menu li a:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    .mobile-menu > li > a::after {
        content: '\f054';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 14px;
    }
    
    .mobile-menu .sub-menu li a::after {
        display: none;
    }

    .mobile-menu .sub-menu {
        list-style: none;
        padding: 0;
        margin: 0;
        background-color: rgba(0, 0, 0, 0.15);
        display: none;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0;
    }
    
    .mobile-menu .menu-item-has-children.active .sub-menu {
        display: block;
    }

    .mobile-menu .sub-menu li {
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-menu .sub-menu li:nth-child(2n) {
        border-right: none;
    }

    .mobile-menu .sub-menu li a {
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 16px 10px;
        font-size: 14px;
        height: 100%;
        min-height: 60px;
        box-sizing: border-box;
        border: none;
    }

    .mobile-menu .sub-menu li:first-child,
    .mobile-menu .sub-menu li:nth-child(2) {
        border-top: none;
    }

    /* Mobile Menu Bottom */
    .mobile-menu-bottom {
        padding: 20px;
        text-align: center;
        flex-shrink: 0;
    }

    .mobile-sub-menu {
        list-style: none;
        padding: 0;
        margin: 20px 0;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
    }

    .mobile-sub-menu li {
        margin-bottom: 10px;
    }

    .mobile-sub-menu a {
        color: rgba(255, 255, 255, 0.8);
        text-decoration: none;
        font-size: 13px;
        transition: color 0.3s ease;
    }
    
    .mobile-sub-menu a:hover {
        color: #fff;
        text-decoration: underline;
    }

    .mobile-menu-logo {
        margin: 20px 0;
        text-align: center;
    }

    .mobile-menu-logo img {
        max-width: 150px;
        height: auto;
    }

    .mobile-menu-copyright {
        font-size: 12px;
        color: #fff;
    }

    /* Hide desktop nav on mobile */
    .header-desktop-nav {
        display: none;
    }
}
