/* App-like Mobile Styles */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection for content areas */
.card-text, .review-content, input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* App-like Navigation */
/* Update the existing navbar styles around line 27 */
/* App-like Navigation - Remove conflicting styles */
.navbar {
    /* Keep only mobile-specific enhancements */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* On mobile, hide desktop navigation */
@media (max-width: 767px) {
    .navbar {
        padding: 0.5rem 1rem;
        min-height: 60px;
        font-size: 0.9rem;
    }
    
    .navbar .container {
        justify-content: center;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
        font-weight: 600;
    }
    
    .navbar-collapse {
        display: none !important;
    }
    
    .navbar-toggler {
        display: none;
    }
}
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Card improvements */
.card {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* Button improvements */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    min-height: 44px; /* iOS touch target size */
}

.btn:active {
    transform: scale(0.98);
}

/* Mobile-first carousel */
.carousel-item .row {
    margin: 0;
}

/* Fix for carousel overflow and dragging */
@media (max-width: 768px) {
    .carousel-item .row {
        margin: 0;
        flex-wrap: nowrap;
        overflow-x: hidden; /* Prevent horizontal scrolling */
        width: 100%;
    }
    
    .carousel-item .col {
        flex: 0 0 80%;
        max-width: 80%;
        margin-right: 10px;
        padding: 5px;
    }
    
    /* Ensure carousel doesn't cause page to be wider than viewport */
    .stall-carousel {
        max-width: 100vw;
        overflow: hidden;
    }
    
    /* Make cards more touch-friendly */
    .card {
        margin-bottom: 15px;
        min-height: 200px;
    }
    
    .card-body {
        padding: 10px;
    }
    
    /* Ensure bottom navigation is always visible */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e9ecef;
        padding: 10px 0;
        z-index: 1000;
        display: flex;
        justify-content: space-around;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        height: 65px;
        /* Add safe area inset for newer devices */
        padding-bottom: env(safe-area-inset-bottom, 10px);
    }
    
    /* Ensure content doesn't get hidden behind bottom nav */
    body {
        padding-bottom: 80px;
        overscroll-behavior-y: none;
        overflow-x: hidden;
        width: 100%;
        position: relative;
        touch-action: pan-y;
    }
    
    /* Make stall cards more clickable */
    .card a.btn {
        display: block;
        width: 100%;
        margin-top: 10px;
        padding: 8px;
        font-size: 14px;
    }
    
    /* Improve touch targets */
    .btn, a.btn, .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Exclude stall-card elements from global touch target styles */
     .stall-card .card-title,
     .stall-card .card-text,
     .stall-name,
     .stall-number,
     .stall-description {
         min-height: auto;
         display: block;
         text-align: left;
     }
     
     /* Ensure stall-info maintains proper layout on mobile */
     .stall-info {
         display: flex !important;
         flex-direction: column !important;
         align-items: stretch !important;
         justify-content: flex-start !important;
         text-align: left !important;
     }
     
     .stall-info > * {
         align-self: flex-start !important;
         text-align: left !important;
     }
}

.carousel-inner {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.carousel-item {
    scroll-snap-align: start;
}
}

/* Bottom navigation for mobile */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e9ecef;
        padding: 8px 0;
        z-index: 1000;
        display: flex;
        justify-content: space-around;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #6c757d;
        font-size: 12px;
        padding: 8px;
        min-width: 60px;
    }
    
    .mobile-nav-item.active {
        color: #0d6efd;
    }
    
    .mobile-nav-item i {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    /* Add bottom padding to prevent content being hidden */
    body {
        padding-bottom: 80px;
    }
    
    /* On mobile, optimize navigation instead of hiding completely */
    @media (max-width: 767px) {
        /* Remove the display: none rule */
        .navbar {
            padding: 0.5rem 0;
            min-height: 50px;
        }
        
        .navbar-brand {
            font-size: 1.2rem;
            font-weight: bold;
        }
        
        /* Hide only the navigation menu but keep the brand */
        .navbar-collapse {
            display: none !important;
        }
        
        .navbar-toggler {
            display: none;
        }
        
        /* Center the brand for better mobile appearance */
        .navbar .container {
            justify-content: center;
            padding-left: 1rem;
            padding-right: 1rem;
        }
    }
}

/* 删除全局的 .navbar { display: none; } 规则 */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Pull to refresh indicator */
.pull-refresh {
    position: fixed;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: top 0.3s ease;
    z-index: 1040;
}

.pull-refresh.show {
    top: 20px;
}

/* Form improvements */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    min-height: 44px;
    font-size: 16px; /* Prevents zoom on iOS */
}

.form-control:focus, .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Rating stars touch-friendly */
.rating-label {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Image gallery improvements */
.gallery-img {
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.gallery-img:active {
    transform: scale(0.95);
}

/* Search and filter improvements */
.search-container {
    position: sticky;
    top: 76px;
    background: white;
    padding: 15px 0;
    z-index: 100;
    border-bottom: 1px solid #e9ecef;
}

/* Floating action button */
.fab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0d6efd;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.fab:hover {
    transform: scale(1.1);
    background: #0b5ed7;
}

/* Ranking Badge Styles for Vote Options */
.ranking-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    border: 3px solid white;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.ranking-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* Top 3 special styling with better colors */
.ranking-badge.rank-1 {
    background: linear-gradient(135deg, #FFD700 0%, #FF8C00 50%, #FF6B35 100%);
    min-width: 48px;
    height: 48px;
    border-radius: 24px;
    font-size: 1rem;
    animation: pulse-gold 2s infinite;
}

.ranking-badge.rank-2 {
    background: linear-gradient(135deg, #E8E8E8 0%, #C0C0C0 50%, #A8A8A8 100%);
    min-width: 44px;
    height: 44px;
    border-radius: 22px;
    font-size: 0.9rem;
    animation: pulse-silver 2s infinite;
}

.ranking-badge.rank-3 {
    background: linear-gradient(135deg, #CD7F32 0%, #B8860B 50%, #DAA520 100%);
    min-width: 42px;
    height: 42px;
    border-radius: 21px;
    font-size: 0.85rem;
    animation: pulse-bronze 2s infinite;
}

/* Ranks 4-10 with improved styling */
.ranking-badge.rank-4,
.ranking-badge.rank-5,
.ranking-badge.rank-6,
.ranking-badge.rank-7,
.ranking-badge.rank-8,
.ranking-badge.rank-9,
.ranking-badge.rank-10 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-width: 36px;
    height: 36px;
    border-radius: 18px;
    font-size: 0.8rem;
}

/* Icon styling for top 3 */
.ranking-badge i {
    margin-right: 3px;
    font-size: 0.8em;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.ranking-badge.rank-1 i {
    color: #FFF;
    font-size: 0.9em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.ranking-badge.rank-2 i {
    color: #FFF;
    font-size: 0.85em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.ranking-badge.rank-3 i {
    color: #FFF;
    font-size: 0.8em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Pulse animations for top 3 */
@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4), 0 0 0 0 rgba(255, 215, 0, 0.7); }
    50% { box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4), 0 0 0 8px rgba(255, 215, 0, 0); }
}

@keyframes pulse-silver {
    0%, 100% { box-shadow: 0 4px 12px rgba(192, 192, 192, 0.4), 0 0 0 0 rgba(192, 192, 192, 0.7); }
    50% { box-shadow: 0 4px 12px rgba(192, 192, 192, 0.4), 0 0 0 6px rgba(192, 192, 192, 0); }
}

@keyframes pulse-bronze {
    0%, 100% { box-shadow: 0 4px 12px rgba(205, 127, 50, 0.4), 0 0 0 0 rgba(205, 127, 50, 0.7); }
    50% { box-shadow: 0 4px 12px rgba(205, 127, 50, 0.4), 0 0 0 4px rgba(205, 127, 50, 0); }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .ranking-badge {
        top: 6px;
        right: 6px;
        min-width: 32px;
        height: 32px;
        border-radius: 16px;
        font-size: 0.75rem;
        border: 2px solid white;
    }
    
    .ranking-badge.rank-1 {
        min-width: 38px;
        height: 38px;
        border-radius: 19px;
        font-size: 0.85rem;
    }
    
    .ranking-badge.rank-2 {
        min-width: 36px;
        height: 36px;
        border-radius: 18px;
        font-size: 0.8rem;
    }
    
    .ranking-badge.rank-3 {
        min-width: 34px;
        height: 34px;
        border-radius: 17px;
        font-size: 0.75rem;
    }
    
    .ranking-badge.rank-4,
    .ranking-badge.rank-5,
    .ranking-badge.rank-6,
    .ranking-badge.rank-7,
    .ranking-badge.rank-8,
    .ranking-badge.rank-9,
    .ranking-badge.rank-10 {
        min-width: 30px;
        height: 30px;
        border-radius: 15px;
        font-size: 0.7rem;
    }
    
    .ranking-badge i {
        margin-right: 2px;
        font-size: 0.7em;
    }
}

/* Ensure the option card has relative positioning for absolute badge */
.modern-option-card {
    position: relative;
}