/* モバイルレイアウト - マップ下半分、サイドバー上半分 */

@media (max-width: 768px) {
    /* コンテナを縦に分割 */
    .container {
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .header {
        flex-shrink: 0;
    }

    .footer {
        flex-shrink: 0;
    }

    /* メインコンテンツを縦並び */
    .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        height: calc(100vh - 180px); /* ヘッダーとフッターを除く */
    }

    /* サイドバーを上半分 */
    .sidebar {
        width: 100vw !important;
        height: 50% !important;
        max-height: 50vh !important;
        position: relative !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        overflow-y: auto;
        padding: 1rem !important;
        box-shadow: none !important;
        border-bottom: 2px solid #667eea;
        order: 1;
    }

    /* マップを下半分 */
    .map-wrapper {
        width: 100vw !important;
        height: 50% !important;
        min-height: 50vh !important;
        max-height: 50vh !important;
        position: relative !important;
        order: 2;
    }

    #map {
        width: 100% !important;
        height: 100% !important;
    }

    /* フローティングボタンの位置調整 */
    #addPinBtn {
        position: fixed;
        bottom: 2rem;
        right: 1rem;
        z-index: 900;
    }

    /* サイドバーセクションのコンパクト化 */
    .sidebar-section {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .sidebar-section h3 {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    /* 不要な要素を非表示 */
    .sidebar-header-mobile,
    .sidebar-overlay,
    .hamburger-menu {
        display: none !important;
    }
}

/* 横向き対応 */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        flex-direction: row;
        height: calc(100vh - 120px);
    }

    .sidebar {
        width: 40vw !important;
        height: 100% !important;
        max-height: none !important;
        border-bottom: none;
        border-right: 2px solid #667eea;
        order: 1;
    }

    .map-wrapper {
        width: 60vw !important;
        height: 100% !important;
        min-height: auto !important;
        max-height: none !important;
        order: 2;
    }
}
