/* ============================================
   링크네비 (LinkNavi) - 터치 인터페이스 최적화
   작성일: 2025-08-19
   ============================================ */

/* ============================================
   1. 터치 타겟 최적화
   ============================================ */

/* 최소 터치 타겟 크기 44x44px (iOS 권장) */
.btn,
.nav-link,
.dropdown-item,
.banner-link,
.link-item {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 터치 영역 확대 */
.btn::before,
.nav-link::before {
    content: '';
    position: absolute;
    top: -8px;
    right: -8px;
    bottom: -8px;
    left: -8px;
    z-index: -1;
}

/* ============================================
   2. 터치 피드백
   ============================================ */

/* 터치 시 즉각적인 피드백 */
.btn:active,
.nav-link:active,
.banner-link:active {
    transform: scale(0.98);
    opacity: 0.9;
    transition: transform 0.1s ease, opacity 0.1s ease;
}

/* iOS 탭 하이라이트 제거 */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* 텍스트 선택 방지 (버튼, 링크) */
.btn,
.nav-link,
.navbar-brand {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ============================================
   3. 스크롤 최적화
   ============================================ */

/* 부드러운 스크롤 */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* 오버스크롤 바운스 효과 (iOS) */
body {
    overscroll-behavior-y: contain;
}

/* 가로 스크롤 방지 */
body {
    overflow-x: hidden;
}

/* 스크롤바 스타일링 (터치 디바이스) */
@media (hover: none) and (pointer: coarse) {
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    
    ::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
    }
    
    ::-webkit-scrollbar-thumb {
        background: rgba(255, 215, 0, 0.5);
        border-radius: 3px;
    }
}

/* ============================================
   4. 스와이프 제스처 지원
   ============================================ */

/* 배너 스와이프 영역 */
.banner-section {
    touch-action: pan-y pinch-zoom;
}

/* 가로 스크롤 가능한 영역 */
.horizontal-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

.horizontal-scroll > * {
    scroll-snap-align: start;
}

/* ============================================
   5. 폼 요소 터치 최적화
   ============================================ */

/* 입력 필드 */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea,
select {
    min-height: 44px;
    padding: 12px;
    font-size: 16px; /* iOS 자동 줌 방지 */
    border-radius: 8px;
    touch-action: manipulation;
}

/* 체크박스와 라디오 버튼 */
input[type="checkbox"],
input[type="radio"] {
    min-width: 20px;
    min-height: 20px;
    margin: 12px;
}

/* 터치 친화적 라벨 */
label {
    padding: 8px 0;
    cursor: pointer;
}

/* ============================================
   6. 모달과 드롭다운 터치 최적화
   ============================================ */

/* 모달 백드롭 터치 */
.modal-backdrop {
    touch-action: none;
}

/* 드롭다운 메뉴 */
.dropdown-menu {
    padding: 8px 0;
}

.dropdown-item {
    padding: 12px 20px;
    touch-action: manipulation;
}

/* ============================================
   7. 터치 디바이스 전용 스타일
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* 호버 효과 제거 */
    .btn:hover,
    .nav-link:hover,
    .banner-link:hover,
    .link-item:hover {
        transform: none;
        background-color: inherit;
    }
    
    /* 터치 시에만 효과 적용 */
    .btn:active,
    .nav-link:active {
        background-color: rgba(255, 215, 0, 0.1);
    }
    
    /* 배너 그리드 간격 증가 */
    .premium-banner-grid,
    .standard-banner-grid {
        gap: 12px !important;
    }
    
    /* 카드 간격 증가 */
    .category-card {
        margin-bottom: 16px;
    }
    
    /* 링크 패딩 증가 */
    .link-item {
        padding: 12px;
    }
}

/* ============================================
   8. 제스처 힌트
   ============================================ */

/* 스와이프 가능 표시 */
.swipeable::after {
    content: '← 스와이프 →';
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.75rem;
    color: rgba(255, 215, 0, 0.5);
    pointer-events: none;
}

/* 길게 누르기 힌트 */
.long-press::before {
    content: attr(data-long-press);
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #ffd700;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.long-press:active::before {
    opacity: 1;
}

/* ============================================
   9. 접근성 개선
   ============================================ */

/* 포커스 표시 (터치 후 키보드 사용 시) */
:focus-visible {
    outline: 2px solid #ffd700;
    outline-offset: 2px;
}

/* 스크린 리더 전용 터치 가이드 */
.sr-touch-guide {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   10. 성능 최적화
   ============================================ */

/* GPU 가속 */
.banner-item,
.category-card {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 터치 이벤트 최적화 */
.touch-optimized {
    touch-action: manipulation;
    -webkit-user-drag: none;
}