/* ==========================================
   アダプティブナビゲーション
   モバイル: ボトムナビゲーション
   PC: サイドナビゲーション（ナビゲーションレール）
   ========================================== */

.adaptive-nav {
    position: fixed;
    background: #FFFFFF;
    /* 完全に不透明 */
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-container {
    display: flex;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 12px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(200, 80, 60, 0.08);
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

/* アクティブ状態 */
.nav-item.active {
    color: var(--primary);
    background: rgba(200, 80, 60, 0.12);
}

.nav-item.active .nav-icon {
    transform: scale(1.15);
}

/* バッジ（お気に入り数など） */
.nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* タップ時のフィードバック */
.nav-item:active {
    transform: scale(0.95);
}

/* ==========================================
   モバイル: ボトムナビゲーション
   ========================================== */
@media (max-width: 767px) {
    .adaptive-nav {
        bottom: 0;
        left: 0;
        right: 0;
        border-top: 1px solid var(--border-color);
        border-left: none;
        border-right: none;
        border-bottom: none;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        background: #FFFFFF;
        /* 完全に不透明 */
    }

    .nav-container {
        flex-direction: row;
        justify-content: space-around;
        padding: 8px 0;
        max-width: 600px;
        margin: 0 auto;
    }

    .nav-item {
        min-width: 60px;
    }

    /* ボトムナビがある分、メインコンテンツに余白を追加 */
    body {
        padding-bottom: 70px;
    }

    /* 横向き時の調整 */
    @media (orientation: landscape) {
        .nav-container {
            padding: 4px 0;
        }

        .nav-item {
            padding: 4px 8px;
        }

        .nav-icon {
            font-size: 20px;
            margin-bottom: 2px;
        }

        .nav-label {
            font-size: 10px;
        }
    }
}

/* ==========================================
   PC: サイドナビゲーション（ナビゲーションレール）
   ========================================== */
@media (min-width: 768px) {
    .adaptive-nav {
        left: 0;
        top: 0;
        height: 100vh;
        width: 88px;
        border-right: 1px solid var(--border-color);
        border-top: none;
        border-left: none;
        border-bottom: none;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
        background: linear-gradient(180deg, #FFFFFF 0%, #FAFAFA 100%);
        /* Subtle gradient background */
    }

    .nav-container {
        flex-direction: column;
        justify-content: flex-start;
        padding: 32px 12px;
        height: 100%;
        gap: 16px;
        /* Increased gap between items */
    }

    .nav-item {
        width: 100%;
        padding: 16px 8px;
        /* Increased padding */
        margin: 0;
        border-radius: 16px;
        gap: 6px;
        /* Gap between icon and label */
    }

    .nav-item:hover {
        background: rgba(200, 80, 60, 0.1);
        transform: translateX(4px);
    }

    .nav-item.active {
        background: linear-gradient(135deg, rgba(200, 80, 60, 0.15), rgba(200, 80, 60, 0.08));
        box-shadow: inset 3px 0 0 var(--primary);
    }

    .nav-icon {
        width: 28px;
        /* SVG icon width */
        height: 28px;
        /* SVG icon height */
        fill: currentColor;
        /* Inherit color from parent */
        margin-bottom: 0;
        /* Remove margin, use gap instead */
    }

    .nav-label {
        font-size: 11px;
        /* Increased from 10px */
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* サイドナビがある分、メインコンテンツに余白を追加 */
    body {
        padding-left: 88px;
    }

    /* ヘッダーの調整 */
    header {
        margin-left: 0;
    }

    /* ホバー時のツールチップ */
    .nav-item::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 16px);
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 8px 14px;
        border-radius: 8px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.3px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .nav-item:hover::after {
        opacity: 1;
    }

    /* 矢印を追加 */
    .nav-item::before {
        content: '';
        position: absolute;
        left: 100%;
        margin-left: 8px;
        border: 6px solid transparent;
        border-right-color: rgba(0, 0, 0, 0.9);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-item:hover::before {
        opacity: 1;
    }
}

/* ==========================================
   ダークモード対応
   ========================================== */
@media (prefers-color-scheme: dark) {
    .adaptive-nav {
        background: #1a1a1a;
        /* 完全に不透明 */
        border-color: var(--border-color-dark, #333);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }

    .nav-item {
        color: var(--text-secondary-dark, #aaa);
    }

    .nav-item:hover {
        background: rgba(212, 122, 110, 0.15);
    }

    .nav-item.active {
        color: var(--primary-dark, #D47A6E);
        background: rgba(212, 122, 110, 0.2);
    }
}

/* ==========================================
   アニメーション
   ========================================== */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

.nav-item.active .nav-icon {
    animation: bounce 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* アクセシビリティ: フォーカス状態 */
.nav-item:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.nav-item:focus:not(:focus-visible) {
    outline: none;
}

/* ==========================================
   印刷時は非表示
   ========================================== */
@media print {
    .adaptive-nav {
        display: none;
    }

    body {
        padding-left: 0 !important;
        padding-bottom: 0 !important;
    }
}