/* 모바일 최적화 CSS */

/* 터치 최적화 */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* 터치 영역 최적화 */
button, a, input, select, textarea, .btn {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 모바일 네비게이션 최적화 */
@media (max-width: 768px) {
  .navbar-nav .nav-link {
    padding: 12px 16px;
    min-height: 48px;
    display: flex;
    align-items: center;
    touch-action: manipulation;
  }
  
  .navbar-toggler {
    min-height: 48px;
    min-width: 48px;
    padding: 12px;
    touch-action: manipulation;
  }
  
  /* 드롭다운 메뉴 터치 최적화 */
  .dropdown-menu {
    min-width: 200px;
  }
  
  .dropdown-item {
    padding: 12px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
    touch-action: manipulation;
  }
}

/* 스와이퍼 터치 최적화 */
.promotion-swiper-container {
  touch-action: pan-y pinch-zoom;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.promoteSwiper {
  touch-action: pan-y pinch-zoom;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.swiper {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.swiper-slide {
  touch-action: manipulation;
}

/* 모바일에서 스크롤 영역 분리 */
@media (max-width: 768px) {
  .promotion-swiper-container {
    touch-action: pan-x pan-y;
    position: relative;
    z-index: 1;
  }
  
  .promoteSwiper {
    touch-action: pan-x pan-y;
  }
  
  .swiper-slide {
    touch-action: pan-x pan-y;
  }
}

/* 모달 터치 최적화 */
.modal-dialog {
  touch-action: manipulation;
}

.modal-content {
  touch-action: manipulation;
}

.modal-header, .modal-body, .modal-footer {
  touch-action: manipulation;
}

/* 폼 요소 터치 최적화 */
.form-control, .form-select {
  min-height: 44px;
  touch-action: manipulation;
}

.form-check-input {
  min-width: 20px;
  min-height: 20px;
  touch-action: manipulation;
}

.form-check-label {
  min-height: 44px;
  display: flex;
  align-items: center;
  touch-action: manipulation;
}

/* 카드 터치 최적화 */
.card {
  touch-action: manipulation;
}

.card-body {
  touch-action: manipulation;
}

/* 리스트 아이템 터치 최적화 */
.list-group-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  touch-action: manipulation;
}

/* 테이블 터치 최적화 */
.table-responsive {
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

/* 터치 디바이스 호버 효과 제거 */
@media (hover: none) and (pointer: coarse) {
  .btn:hover {
    transform: none;
    box-shadow: none;
  }
  
  .btn:active {
    transform: scale(0.98);
  }
  
  .nav-link:hover {
    transform: none;
    box-shadow: none;
  }
  
  .nav-link:active {
    transform: scale(0.98);
    background-color: rgba(0, 0, 0, 0.1);
  }
  
  .card:hover {
    transform: none;
    box-shadow: none;
  }
  
  .card:active {
    transform: scale(0.99);
  }
  
  .list-group-item:hover {
    background-color: transparent;
  }
  
  .list-group-item:active {
    background-color: rgba(0, 0, 0, 0.05);
  }
}

/* 스크롤 최적화 */
body {
  -webkit-overflow-scrolling: touch;
  overflow-scrolling: touch;
}

/* 스크롤바 스타일링 (웹킷 브라우저) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* iOS Safari 최적화 */
@supports (-webkit-touch-callout: none) {
  body {
    -webkit-overflow-scrolling: touch;
  }
  
  .container {
    -webkit-overflow-scrolling: touch;
  }
  
  .swiper {
    -webkit-overflow-scrolling: touch;
  }
}

/* 안드로이드 Chrome 최적화 */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  body {
    -webkit-overflow-scrolling: touch;
  }
}

/* 작은 화면 최적화 */
@media (max-width: 576px) {
  .btn {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 16px;
  }
  
  .form-control, .form-select {
    min-height: 48px;
    font-size: 16px;
  }
  
  .nav-link {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 16px;
  }
  
  .dropdown-item {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 16px;
  }
}

/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
  .btn {
    border-width: 2px;
  }
  
  .form-control, .form-select {
    border-width: 2px;
  }
}

/* 다크 모드 최적화 */
@media (prefers-color-scheme: dark) {
  ::-webkit-scrollbar-track {
    background: #2d2d2d;
  }
  
  ::-webkit-scrollbar-thumb {
    background: #555;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: #777;
  }
}
