/* タッチデバイス用スタイル */

/* タッチデバイスの検出 */
.touch-device {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* ホバー状態の制御 */
.touch-device *:hover {
    /* タッチデバイスではホバー効果を無効化 */
    transition: none !important;
    transform: none !important;
    box-shadow: none !important;
}

/* タッチ時のフィードバック */
.touch-device .btn:active,
.touch-device .nav-link:active,
.touch-device .card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* タッチ時のハイライト */
.touch-device .btn.hover,
.touch-device .nav-link.hover,
.touch-device .card.hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ドロップダウンメニュー */
.touch-device .dropdown-menu {
    /* タッチデバイスではホバーでの表示を無効化 */
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
}

.touch-device .dropdown-menu.show {
    display: block;
}

/* スクロール制御 */
.touch-device {
    -webkit-overflow-scrolling: touch;
}

/* ヘッダーの表示制御 */
.touch-device .header {
    transition: transform 0.3s ease;
}

.touch-device .header.header-hidden {
    transform: translateY(-100%);
}

/* タッチターゲットのサイズ */
.touch-device .btn,
.touch-device .nav-link,
.touch-device .dropdown-link {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
}

.touch-device .form-control {
    min-height: 44px;
}

/* スクロールスナップ */
.touch-device .scroll-container {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.touch-device .scroll-item {
    scroll-snap-align: start;
}

/* プルトゥリフレッシュ */
.touch-device .pull-to-refresh {
    position: relative;
    overflow: hidden;
}

.touch-device .pull-to-refresh::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--haichat-dark-gray);
    transition: transform 0.3s ease;
}

.touch-device .pull-to-refresh.pulling::before {
    transform: translateY(50px);
}

/* スワイプアクション */
.touch-device .swipe-action {
    position: relative;
    overflow: hidden;
}

.touch-device .swipe-action-content {
    transition: transform 0.3s ease;
}

.touch-device .swipe-action-menu {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.touch-device .swipe-action.swiped .swipe-action-content {
    transform: translateX(-80px);
}

.touch-device .swipe-action.swiped .swipe-action-menu {
    transform: translateX(0);
}

/* タッチフィードバック */
.touch-device .touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-device .touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
    transition: all 0.5s ease;
}

.touch-device .touch-feedback:active::after {
    transform: translate(-50%, -50%) scale(100);
    opacity: 0;
}

/* アクセシビリティ */
.touch-device :focus {
    outline: none !important;
}

.touch-device :focus-visible {
    outline: 3px solid var(--haichat-blue) !important;
    outline-offset: 2px !important;
}

/* 高コントラストモード */
@media (prefers-contrast: high) {
    .touch-device .touch-feedback::after {
        background: #ffffff;
    }
    
    .touch-device .btn.hover,
    .touch-device .nav-link.hover,
    .touch-device .card.hover {
        background-color: #ffffff;
        color: #000000;
    }
}

/* アニメーション制御 */
@media (prefers-reduced-motion: reduce) {
    .touch-device * {
        animation: none !important;
        transition: none !important;
    }
}
