/* ========================================
   Header Styles
   - Header / Navigation
   - Hamburger Menu
   ======================================== */

/* Header */
header {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    min-height: 80px;
}

header img {
    height: 45px;
    width: auto;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
}

header a {
    display: inline-block;
    transition: transform 0.3s ease;
}

header a:hover {
    transform: scale(1.05);
}

.header-links {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.header-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.48rem 0.96rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.15);
    font-size: 1.08rem;
    white-space: nowrap;
    flex-shrink: 1;
    border: none;
    cursor: pointer;
    display: inline-block;
}

.header-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

#hamburger {
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

#hamburger:hover {
    transform: scale(1.1);
}

/* Hamburger menu trigger (mobile) */
#hamburger-menu {
    display: none;
    align-items: center;
    justify-content: flex-end;
}

#hamburger-menu-icon {
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    transition: transform 0.3s ease;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hamburger-menu-icon:hover {
    transform: scale(1.1);
}

/* Hamburger overlay */
#hamburger-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: flex-end;
    align-items: flex-start;
    z-index: 10001;
    padding-top: 100px;
}

#hamburger-menu-content {
    background: white;
    width: 80%;
    max-width: 300px;
    height: 100%;
    padding: 2rem 1.5rem;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#hamburger-menu-content a,
#hamburger-menu-content .logout-item {
    color: #4a5568;
    text-decoration: none;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    display: block;
    border: none;
    background: transparent;
}

#hamburger-menu-content a:visited,
#hamburger-menu-content a:active,
#hamburger-menu-content a:link {
    color: #4a5568;
    background: transparent;
}

/* ハンバーガーメニュー内のリンクにlink-buttonスタイルが適用されないようにする */
#hamburger-menu-content a.link-button,
#hamburger-menu-content .link-button {
    background: transparent;
    color: #4a5568;
    border: none;
    padding: 1rem;
    margin: 0;
    min-width: auto;
    width: auto;
    height: auto;
    min-height: auto;
    max-height: none;
    box-shadow: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    display: block;
}

#hamburger-menu-content a:hover,
#hamburger-menu-content .logout-item:hover {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid #667eea;
    transform: translateX(5px);
    color: #4a5568;
}

#hamburger-menu-content .menu-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0.5rem 0;
}

/* ハンバーガーメニューのログアウトセクション（初期非表示） */
.hamburger-logout-section.hidden {
    display: none;
}

/* ハンバーガーメニューのログアウトボタン */
.hamburger-logout-button {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #4a5568;
    transition: all 0.3s ease;
}

@media (min-width: 641px) {
    #hamburger-menu {
        display: none;
    }

    .header-links {
        display: flex;
    }
}

/* モードバッジ */
.mode-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.8rem;
    min-width: 3.5em;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.mode-badge-test {
    background: rgba(59, 130, 246, 0.9);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.mode-badge-error_test {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.mode-badge-ad {
    background: rgba(34, 197, 94, 0.9); /* 緑色 */
    color: white;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.mode-badge-prod_test {
    background: rgba(245, 158, 11, 0.9); /* オレンジ（本番テスト用） */
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* 本テスバッジの文字が抜ける場合のフォールバック（表示を確実にする） */
.mode-badge-prod_test:empty::before {
    content: '本テス';
}

@media (max-width: 640px) {
    header {
        min-height: 50px;
        padding: 0.5rem 1rem;
    }

    header img {
        height: 40px;
    }

    .header-links {
        display: none;
    }

    #hamburger-menu {
        display: flex;
        align-items: center;
    }
    
    .mode-badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
        min-width: 3em;
        margin-right: 0.3rem;
    }
}

