/**
 * Touch Feedback Styles
 * Visual feedback for touch interactions
 */

/* Base touch active state */
.touch-active {
    opacity: 0.7 !important;
    transform: scale(0.98);
    transition: all 0.1s ease-out;
}

/* Specific feedback for buttons */
button.touch-active,
.btn.touch-active,
[role="button"].touch-active {
    transform: scale(0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Feedback for links */
a.touch-active {
    opacity: 0.6 !important;
    text-decoration: underline;
}

/* Feedback for cards and clickable containers */
.card.touch-active,
.clickable.touch-active,
.attraction-card.touch-active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Feedback for list items */
li.touch-active,
.list-item.touch-active {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    li.touch-active,
    .list-item.touch-active {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

/* Disable text selection during touch */
.touch-active {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Map control specific feedback */
.map-control.touch-active,
.leaflet-control.touch-active {
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
}

/* Navigation items */
.nav-link.touch-active,
.dropdown-item.touch-active {
    background-color: rgba(0, 0, 0, 0.05);
    transform: none; /* Don't scale navigation items */
}

/* Form elements */
input[type="button"].touch-active,
input[type="submit"].touch-active,
.form-button.touch-active {
    transform: scale(0.97);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Icon buttons */
.icon-button.touch-active,
.favorite-btn.touch-active,
.share-btn.touch-active {
    transform: scale(0.9);
    opacity: 0.8 !important;
}

/* Prevent double-tap zoom on touch devices */
.touch-target {
    touch-action: manipulation;
}

/* Increase touch target size for better usability */
.touch-target-enhanced {
    position: relative;
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Extended touch area using pseudo-element */
.touch-target-enhanced::before {
    content: '';
    position: absolute;
    top: -8px;
    right: -8px;
    bottom: -8px;
    left: -8px;
}

/* Swipe indicators */
.swipeable {
    position: relative;
    overflow: hidden;
}

.swipeable::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.swipeable.swiping-left::after {
    opacity: 1;
    background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.1) 100%);
}

.swipeable.swiping-right::after {
    opacity: 1;
    background: linear-gradient(270deg, transparent 0%, rgba(0,0,0,0.1) 100%);
}

/* Loading state for async actions */
.touch-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.touch-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    animation: touch-spin 0.8s linear infinite;
}

@keyframes touch-spin {
    to { transform: rotate(360deg); }
}

/* Ripple effect for material design style feedback */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Dark mode ripple */
@media (prefers-color-scheme: dark) {
    .ripple-effect {
        background-color: rgba(255, 255, 255, 0.2);
    }
}

/* Accessibility: Focus visible for keyboard navigation */
.touch-target:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Remove default tap highlight on WebKit browsers */
.touch-target {
    -webkit-tap-highlight-color: transparent;
}

/* Mobile Portrait Mode Map Visibility Fixes */
@media only screen and (max-width: 768px) and (orientation: portrait) {
    /* Fix container height constraint that hides map */
    .container {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
    }
    
    /* Ensure map container is visible */
    .map-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Make sure map itself is visible */
    #map {
        display: block !important;
        visibility: visible !important;
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* Adjust filters panel to not push map out of view */
    .filters-panel {
        flex-shrink: 0;
        max-height: 40vh;
        overflow-y: auto;
    }
}

/* General mobile map fixes */
@media only screen and (max-width: 768px) {
    /* Override problematic height constraints */
    .container {
        height: auto !important;
        min-height: 100vh !important;
    }
    
    /* Ensure map is always visible on mobile */
    .map-container {
        display: block !important;
        visibility: visible !important;
    }
    
    #map {
        display: block !important;
        visibility: visible !important;
        position: relative !important;
        z-index: 1 !important;
    }
}