/* Mobile Responsive & Native Sliding Bottom Sheet */
.mobile-sheet-handle {
  display: none;
}

@media (max-width: 768px) {
  /* 전역 레이아웃 고정 */
  html, body {
    overflow: hidden;
    height: 100%;
    width: 100%;
    position: fixed;
  }

  .app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    flex-direction: column;
  }

  /* 🗺️ 지도가 모바일 전체 화면을 시원하게 채움 */
  .map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
  }

  /* 상단 지도 엔진 스위처 */
  .map-floating-bar {
    top: 10px;
    left: 10px;
    right: 10px;
    justify-content: center;
    z-index: 10;
  }

  .engine-switch {
    background: rgba(18, 20, 24, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 3px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  }

  .btn-engine {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  /* 📱 사이드바가 모바일 네이티브 바텀시트로 변신! */
  .sidebar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: 82vh !important;
    max-height: 85vh !important;
    z-index: 100 !important;
    background: rgba(18, 20, 24, 0.96) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    border-right: none;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.7);

    /* 📌 기본 접힘 상태 (Peek): 손잡이 + 날짜 선택기 + 3단 통계 카드가 훤히 보이는 높이 (~162px) */
    transform: translateY(calc(100% - 162px));
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* 🚀 확장 상태 (위로 올렸을 때) */
  .sidebar.expanded {
    transform: translateY(0) !important;
  }

  /* 모바일 상단 드래그/탭 핸들 */
  .mobile-sheet-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 10px 0 6px 0;
    cursor: pointer;
    touch-action: pan-y;
  }

  .mobile-sheet-handle .handle-bar {
    width: 48px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    transition: background 0.2s;
  }

  .mobile-sheet-handle:active .handle-bar {
    background: var(--accent-ride, #ff5722);
  }

  /* 모바일에서는 사이드바 로고 헤더를 슬림하게 정리 */
  .sidebar-header {
    padding: 4px 16px 8px 16px;
    border-bottom: none;
  }

  .brand-title {
    font-size: 1rem;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }

  /* 날짜 컨트롤 패널 및 통계 */
  .timeline-control-panel {
    padding: 0 16px 10px 16px;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .date-selector-wrapper {
    margin-bottom: 8px;
  }

  .date-picker-trigger {
    padding: 8px 12px;
  }

  .trigger-label {
    font-size: 0.88rem;
  }

  .stats-grid {
    gap: 6px;
  }

  .stat-card {
    padding: 6px 4px;
    text-align: center;
  }

  .stat-label {
    font-size: 0.68rem;
    margin-bottom: 2px;
  }

  .stat-value {
    font-size: 0.92rem;
  }

  /* 타임라인 피드 스크롤 영역 */
  .timeline-feed {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px 36px 16px;
  }

  /* 📅 달력 팝오버: 모바일 화면 중앙 플로팅 팝업으로 최적화 */
  .calendar-popover {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 350px !important;
    z-index: 2000 !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 16px !important;
  }

  /* 📍 장소 수정 모달 모바일 최적화 */
  .place-picker-box {
    width: 95vw !important;
    max-width: 480px !important;
    max-height: 85vh !important;
  }

  /* 토스트 알림 모바일 위치 조정 (바텀시트 상단 위) */
  .toast-popup {
    bottom: 175px !important;
    z-index: 3000 !important;
    max-width: 90vw !important;
  }
}
