/* ============================================
   서울비디치과 Mobile UX Enhanced v1.0
   Bottom Sheet 메뉴 + 스와이프 제스처 + Pull-to-Refresh
   + 동적 퀵바 + 태블릿 레이아웃
   ============================================ */

/* ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
   1. Bottom Sheet 모바일 메뉴
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ */

/* 기존 모바일 네비 숨김 (Bottom Sheet로 대체) */
@media (max-width: 768px) {
  .mobile-nav {
    display: none !important;
  }
}

/* Bottom Sheet 컨테이너 */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
  max-height: 85vh;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, rgba(25, 22, 20, 0.98) 0%, rgba(15, 12, 10, 0.99) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.bottom-sheet.active {
  transform: translateY(0);
}

/* 드래그 핸들 */
.bottom-sheet-handle {
  display: flex;
  justify-content: center;
  padding: 12px 0 8px;
  cursor: grab;
  touch-action: none;
}

.bottom-sheet-handle::before {
  content: '';
  width: 40px;
  height: 4px;
  background: rgba(201, 169, 98, 0.4);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.bottom-sheet-handle:active::before {
  background: rgba(201, 169, 98, 0.7);
}

/* Bottom Sheet 헤더 */
.bottom-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px 16px;
  border-bottom: 1px solid rgba(201, 169, 98, 0.15);
}

.bottom-sheet-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 600;
}

.bottom-sheet-title .logo-icon {
  font-size: 1.5rem;
}

.bottom-sheet-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bottom-sheet-close:active {
  background: rgba(201, 169, 98, 0.2);
  transform: scale(0.95);
}

/* Bottom Sheet 콘텐츠 */
.bottom-sheet-content {
  padding: 16px 20px;
  overflow-y: auto;
  max-height: calc(85vh - 100px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* 메뉴 그리드 레이아웃 */
.bottom-sheet-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.bottom-sheet-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(201, 169, 98, 0.1);
  border-radius: 16px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  transition: all 0.2s ease;
}

.bottom-sheet-menu-item:active {
  background: rgba(201, 169, 98, 0.15);
  border-color: rgba(201, 169, 98, 0.3);
  transform: scale(0.97);
}

.bottom-sheet-menu-item i {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(139, 90, 43, 0.3) 0%, rgba(201, 169, 98, 0.2) 100%);
  border-radius: 12px;
  font-size: 1.25rem;
  color: #C9A962;
}

.bottom-sheet-menu-item span {
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
}

/* 서브메뉴 섹션 */
.bottom-sheet-section {
  margin-bottom: 20px;
}

.bottom-sheet-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(201, 169, 98, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  padding-left: 4px;
}

.bottom-sheet-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bottom-sheet-list li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.bottom-sheet-list li a:active {
  background: rgba(201, 169, 98, 0.12);
}

.bottom-sheet-list li a i {
  width: 20px;
  color: rgba(201, 169, 98, 0.7);
}

/* 퀵 액션 버튼 영역 */
.bottom-sheet-actions {
  display: flex;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid rgba(201, 169, 98, 0.1);
  margin-top: 8px;
}

.bottom-sheet-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.bottom-sheet-action-btn.primary {
  background: linear-gradient(135deg, #8B5A2B 0%, #C9A962 100%);
  color: #ffffff;
}

.bottom-sheet-action-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #C9A962;
  border: 1px solid rgba(201, 169, 98, 0.3);
}

.bottom-sheet-action-btn:active {
  transform: scale(0.97);
}

/* Bottom Sheet 오버레이 */
.bottom-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.bottom-sheet-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Safe Area 지원 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-sheet-content {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  
  .bottom-sheet-actions {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}


/* ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
   2. 터치 스와이프 제스처 (갤러리/카드)
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ */

/* 스와이프 가능한 컨테이너 */
.swipe-container {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.swipe-track {
  display: flex;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.swipe-track.dragging {
  transition: none;
  cursor: grabbing;
}

.swipe-slide {
  flex-shrink: 0;
  width: 100%;
}

/* 스와이프 인디케이터 (dots) */
.swipe-indicators {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
}

.swipe-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(201, 169, 98, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
}

.swipe-dot.active {
  width: 24px;
  border-radius: 4px;
  background: #C9A962;
}

/* 스와이프 네비게이션 화살표 (데스크탑용) */
.swipe-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(201, 169, 98, 0.3);
  border-radius: 50%;
  color: #C9A962;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10;
}

.swipe-container:hover .swipe-nav {
  opacity: 1;
}

.swipe-nav:hover {
  background: rgba(139, 90, 43, 0.4);
  border-color: #C9A962;
}

.swipe-nav.prev {
  left: 16px;
}

.swipe-nav.next {
  right: 16px;
}

.swipe-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* 모바일에서 화살표 숨김 */
@media (max-width: 768px) {
  .swipe-nav {
    display: none;
  }
}

/* 스와이프 힌트 애니메이션 */
.swipe-hint {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
  animation: swipeHintFade 3s ease-out forwards;
  pointer-events: none;
}

.swipe-hint i {
  animation: swipeHintMove 1.5s ease-in-out infinite;
}

@keyframes swipeHintMove {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(10px); }
}

@keyframes swipeHintFade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* 카드 스와이프 효과 */
.swipeable-card {
  transition: transform 0.3s ease, opacity 0.3s ease;
  touch-action: pan-y;
}

.swipeable-card.swiping {
  transition: none;
}

.swipeable-card.swiped-left {
  transform: translateX(-100%) rotate(-5deg);
  opacity: 0;
}

.swipeable-card.swiped-right {
  transform: translateX(100%) rotate(5deg);
  opacity: 0;
}


/* ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
   3. Pull-to-Refresh 효과
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ */

/* Pull-to-Refresh 컨테이너 */
.ptr-container {
  position: relative;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* Pull-to-Refresh 인디케이터 */
.ptr-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: height 0.2s ease;
  background: linear-gradient(180deg, rgba(139, 90, 43, 0.1) 0%, transparent 100%);
}

.ptr-indicator.active {
  height: 60px;
}

.ptr-indicator.refreshing {
  height: 60px;
}

.ptr-spinner {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ptr-spinner-ring {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(201, 169, 98, 0.2);
  border-top-color: #C9A962;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.ptr-indicator.refreshing .ptr-spinner-ring {
  animation: ptrSpin 0.8s linear infinite;
}

@keyframes ptrSpin {
  to { transform: rotate(360deg); }
}

.ptr-text {
  margin-left: 12px;
  font-size: 0.85rem;
  color: rgba(201, 169, 98, 0.8);
}

/* Pull-to-Refresh 상태별 화살표 */
.ptr-arrow {
  width: 24px;
  height: 24px;
  color: #C9A962;
  transition: transform 0.2s ease;
}

.ptr-indicator.ready .ptr-arrow {
  transform: rotate(180deg);
}

.ptr-indicator.refreshing .ptr-arrow {
  display: none;
}


/* ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
   4. 동적 모바일 퀵바
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ */

/* 동적 퀵바 컨테이너 */
.dynamic-quickbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: linear-gradient(180deg, rgba(15, 12, 10, 0.95) 0%, rgba(10, 8, 6, 0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(201, 169, 98, 0.15);
  padding: 8px 12px;
  transition: transform 0.3s ease;
}

.dynamic-quickbar.hidden {
  transform: translateY(100%);
}

/* 퀵바 그리드 */
.quickbar-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 500px;
  margin: 0 auto;
}

.quickbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  min-width: 56px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.quickbar-item:active {
  background: rgba(201, 169, 98, 0.15);
  transform: scale(0.95);
}

.quickbar-item.active {
  color: #C9A962;
}

.quickbar-item i {
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.quickbar-item:active i {
  transform: scale(0.9);
}

.quickbar-item span {
  font-size: 0.65rem;
  font-weight: 500;
  white-space: nowrap;
}

/* CTA 버튼 (예약) - 강조 */
.quickbar-item.cta {
  background: linear-gradient(135deg, #8B5A2B 0%, #C9A962 100%);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 24px;
  box-shadow: 0 4px 15px rgba(139, 90, 43, 0.4);
}

.quickbar-item.cta span {
  font-weight: 600;
}

/* 시간대별 동적 버튼 표시 */
.quickbar-item[data-time-visible] {
  display: none;
}

.quickbar-item[data-time-visible].time-visible {
  display: flex;
}

/* 페이지별 동적 버튼 */
.quickbar-item[data-page-visible] {
  display: none;
}

.quickbar-item[data-page-visible].page-visible {
  display: flex;
}

/* 알림 배지 */
.quickbar-item .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #ef4444;
  border-radius: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Safe Area 지원 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .dynamic-quickbar {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
}

/* 데스크탑에서 숨김 */
@media (min-width: 769px) {
  .dynamic-quickbar {
    display: none;
  }
}


/* ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
   5. 태블릿 전용 레이아웃 (1024px)
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ */

/* 태블릿 브레이크포인트 */
@media (min-width: 769px) and (max-width: 1024px) {
  /* 컨테이너 */
  .container {
    max-width: 100%;
    padding: 0 32px;
  }
  
  /* 그리드 시스템 */
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .bento-cell-3x1,
  .bento-cell-3x2,
  .bento-cell-4x1 {
    grid-column: span 2;
  }
  
  /* 히어로 섹션 */
  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
  }
  
  .hero-visual {
    display: none;
  }
  
  .hero-text h1 {
    font-size: clamp(2.25rem, 5vw, 3rem);
  }
  
  .hero-cta {
    justify-content: center;
  }
  
  /* 섹션 타이틀 */
  .section-title h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
  }
  
  /* 진료 카드 그리드 */
  .treatments-grid,
  .treatment-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .treatment-card {
    padding: 28px;
  }
  
  /* 의료진 그리드 */
  .doctors-grid,
  .doctor-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  /* 통계 그리드 */
  .trust-stats,
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  /* FAQ 그리드 */
  .faq-grid {
    grid-template-columns: 1fr;
  }
  
  /* 후기 캐러셀 */
  .testimonial-carousel,
  .review-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  /* 푸터 */
  .footer-top {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }
  
  .footer-links {
    grid-template-columns: repeat(3, 1fr);
    justify-items: center;
  }
  
  /* CTA 섹션 */
  .cta-wrapper {
    padding: 48px 32px;
  }
  
  .cta-buttons {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  
  .cta-buttons .btn {
    width: 100%;
    max-width: 300px;
  }
  
  /* 양옆 여백 최적화 */
  .section {
    padding: 60px 0;
  }
  
  /* 카드 그리드 태블릿 최적화 */
  .value-cards,
  .guarantee-cards,
  .concerns-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* 시설 섹션 */
  .facility-wrapper {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .facility-visual {
    display: block;
  }
  
  /* BDX 섹션 */
  .bdx-wrapper {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .bdx-visual {
    display: none;
  }
  
  /* 층별 안내 */
  .floor-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* 케이스 갤러리 */
  .cases-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* 헤더 태블릿 최적화 */
  .header-container {
    padding: 12px 24px;
  }
  
  .gnb-item > a {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  /* 서브메뉴 태블릿 최적화 */
  .submenu {
    min-width: 400px;
    padding: 20px;
  }
  
  .gnb-item.has-submenu:hover .submenu {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 태블릿 가로 모드 */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 100px 32px 60px;
  }
  
  .hero-content {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }
  
  .hero-visual {
    display: block;
  }
  
  .hero-cta {
    justify-content: flex-start;
  }
}


/* ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
   6. 추가 모바일 UX 개선
   ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ */

/* 햅틱 피드백 시뮬레이션 */
@media (hover: none) and (pointer: coarse) {
  .haptic-feedback:active {
    animation: hapticPulse 0.1s ease;
  }
}

@keyframes hapticPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.98); }
}

/* 스크롤 스냅 개선 */
.scroll-snap-enhanced {
  scroll-snap-type: y proximity;
  scroll-padding-top: 80px;
}

.scroll-snap-enhanced .section {
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

/* 모바일 터치 피드백 개선 */
@media (hover: none) {
  .touch-feedback {
    position: relative;
    overflow: hidden;
  }
  
  .touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(201, 169, 98, 0.3) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
  }
  
  .touch-feedback:active::after {
    animation: touchRipple 0.4s ease-out;
  }
}

@keyframes touchRipple {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

/* 모바일 폼 개선 */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important; /* iOS 줌 방지 */
  }
  
  .form-input, .form-select, .form-textarea {
    padding: 14px 16px;
    border-radius: 12px;
  }
}

/* 모바일 버튼 개선 */
@media (max-width: 768px) {
  .btn {
    padding: 14px 24px;
    font-size: 0.95rem;
    border-radius: 12px;
  }
  
  .btn-lg {
    padding: 16px 28px;
    font-size: 1rem;
  }
}

/* 바텀 시트 열렸을 때 스크롤 방지 */
body.bottom-sheet-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}
