/* ナビゲーションバー全体 */
.navbar {
    background-color: #222235;
    border-bottom: 1px solid #222235;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    width: 100%;
    height: 60px;
    position: fixed; /* relative から fixed に変更 */
    top: 0;          /* 上に張り付ける */
    left: 0;         /* 左に張り付ける */
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1000; /* 他の要素より手前に表示 */
}

/* ロゴ部分 */
.nav-logo {
    font-weight: bold;
    font-size: 1.25rem;
    color: #cfcfcf;
    text-decoration: none;
    margin-right: 40px;
    white-space: nowrap;
}

/* メニューリスト */
.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}

/* 各メニュー項目 */
.nav-item {
    position: relative; /* ドロップダウンの基準位置 */
    height: 100%;
    display: flex;
    align-items: center;
}

/* メニューのリンク */
.nav-link {
    display: block;
    padding: 0 15px;
    color: #cfcfcf;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    height: 100%;
    line-height: 60px; /* バーの高さに合わせる */
    transition: color 0.2s, background-color 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    color: #cfcfcf;
    background-color: #373757;
}

/* --- ドロップダウンメニュー --- */
.dropdown {
    display: none; /* デフォルトは非表示 */
    position: absolute;
    top: 100%; /* 親の下に配置 */
    left: 0;
    background-color: #222235;
    min-width: 200px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 5px 0;
    z-index: 1001;
}

/* ホバー時にドロップダウンを表示 */
.nav-item:hover .dropdown {
    display: block;
}

/* ドロップダウン内のリンク */
.dropdown a {
    display: block;
    padding: 10px 20px;
    color: #cfcfcf;
    text-decoration: none;
    font-size: 0.9rem;
}

.dropdown a:hover {
    background-color: #373757;
    color: #cfcfcf;
}

/* 現在のページのスタイル (オプション) */
.nav-link.active {
    border-bottom: 2px solid #cfcfcf;
    color: #cfcfcf;
}

.hamburger {
    display: none;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 30px;
    height: 24px;
    position: relative;
    z-index: 1002; /* メニューより手前に */
}

.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #cfcfcf; /* 線の色 */
    position: absolute;
    transition: all 0.3s;
    border-radius: 2px;
}

.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 10px; }
.hamburger span:nth-child(3) { top: 20px; }

/* ボタンが押された時 (×印にする) */
.hamburger.active span:nth-child(1) {
    top: 10px;
    transform: rotate(45deg);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    top: 10px;
    transform: rotate(-45deg);
}

/* --- スマホ表示 (768px以下) --- */
@media (max-width: 768px) {
    
    .navbar {
        justify-content: flex-start;
        padding: 0 15px;
    }

    /* ハンバーガーボタンを表示 */
    .hamburger {
        display: block;
        margin-right: 15px;
    }

    /* メニューリスト (初期状態は隠す) */
    .nav-menu {
        display: block;
        position: fixed;
        top: 60px; /* バーの高さ分下げる */
        left: 0;
        width: 100%;
        height: calc(100vh - 60px); /* 画面いっぱいに */
        background-color: #222235; /* 背景色 */
        padding: 20px 0;
        overflow-y: auto;
        transition: transform 0.3s ease-in-out;
        transform: translateX(-100%); /* 画面右へ隠す */
        flex-direction: column; /* 縦並び */
    }

    /* メニューが開いた時 */
    .nav-menu.open {
        transform: translateX(0); /* スライドイン */
    }

    /* 各アイテム */
    .nav-item {
        display: block; /* 縦並び */
        height: auto;
        border-bottom: 1px solid #373757;
    }

    .nav-link {
        font-size: 1.1rem;
        padding: 15px 20px;
        color: #fff;
    }

    /* スマホでのドロップダウン (常に表示してインデントする) */
    .dropdown {
        display: block; /* 常に表示 */
        position: static; /* 浮かせない */
        background-color: #1a1a2e; /* 少し暗くする */
        box-shadow: none;
        border: none;
        padding: 0;
        width: 100%;
    }

    .dropdown a {
        padding: 12px 20px 12px 40px; /* 左にインデント */
        color: #a0a0a0;
        border-bottom: 1px solid #2a2a40;
    }
    
    .dropdown a:hover {
        background-color: #373757;
        color: #fff;
    }
}