/* ==========================================================================
   MOBILE PWA DESIGN - SaaS Style
   ========================================================================== */

/* ============================================
   CSS Variables for Mobile PWA
   ============================================ */
:root {
    /* Safe Area Insets for notched devices */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);

    /* Bottom Navigation */
    --bottom-nav-height: 65px;
    --bottom-nav-bg: rgba(255, 255, 255, 0.95);
    --bottom-nav-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);

    /* Touch Targets */
    --touch-target-min: 44px;

    /* Mobile Spacing */
    --mobile-padding: 16px;
    --mobile-gap: 12px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bottom-nav-bg: rgba(30, 30, 30, 0.95);
    --bottom-nav-shadow: 0 -2px 20px rgba(0, 0, 0, 0.5);
}

/* ============================================
   Bottom Navigation Bar
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    background: var(--bottom-nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--bottom-nav-shadow);
    z-index: 1000;
    padding-bottom: var(--safe-area-bottom);
    border-top: 1px solid rgba(0, 84, 41, 0.1);
    display: none !important;
    /* Hidden - bottom navigation removed */
}

.bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--bottom-nav-height);
    max-width: 600px;
    margin: 0 auto;
    padding: 0 8px;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    text-decoration: none;
    color: #6c757d;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    border-radius: 12px;
}

.bottom-nav-item i {
    font-size: 1.4rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav-item span {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
    transition: all 0.3s ease;
}

/* Active State */
.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item.active i {
    transform: translateY(-3px) scale(1.1);
}

.bottom-nav-item.active span {
    font-weight: 700;
}

/* Ripple Effect on Tap */
.bottom-nav-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 84, 41, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.bottom-nav-item:active::before {
    width: 100%;
    height: 100%;
}

/* Badge for Cart */
.bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: #ff4757;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--bottom-nav-bg);
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ============================================
   Mobile Optimizations
   ============================================ */

/* Add padding to body for bottom nav - REMOVED */
body.mobile-view {
    padding-bottom: 20px;
    /* Bottom nav removed, reduced padding */
}

/* Mobile Container */
.mobile-container {
    max-width: 100%;
    padding: var(--mobile-padding);
}

/* Touch-Optimized Cards */
.event-card-mobile {
    border-radius: 16px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: var(--mobile-gap);
}

.event-card-mobile:active {
    transform: scale(0.98);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

/* Horizontal Scroll Section */
.horizontal-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 8px 0;
}

.horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.horizontal-scroll-item {
    flex: 0 0 280px;
    scroll-snap-align: start;
}

/* Pull to Refresh */
.pull-to-refresh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--primary-color) 0%, transparent 100%);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    pointer-events: none;
}

.pull-to-refresh.active {
    transform: translateY(0);
}

.pull-to-refresh-icon {
    color: white;
    font-size: 1.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Mobile Header Simplification
   ============================================ */
@media (max-width: 991px) {

    /* Hide bottom nav on mobile - removed */
    .bottom-nav {
        display: none !important;
    }

    /* Simplify top navbar */
    .navbar {
        padding: 8px 0;
    }

    .navbar .container {
        padding: 0 var(--mobile-padding);
    }

    /* Hide desktop menu items */
    .navbar-menu {
        display: none !important;
    }

    /* Simplified mobile header */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .mobile-header-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .mobile-header-right {
        display: flex;
        align-items: center;
        gap: 8px;
    }
}

/* ============================================
   Swipe Gestures
   ============================================ */
.swipeable {
    touch-action: pan-y;
    user-select: none;
}

.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.swipe-indicator.left {
    left: 20px;
}

.swipe-indicator.right {
    right: 20px;
}

.swipe-indicator.active {
    opacity: 1;
}

/* ============================================
   Mobile Modals & Sheets
   ============================================ */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1100;
    max-height: 90vh;
    overflow-y: auto;
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
}

.bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #dee2e6;
    border-radius: 2px;
    margin: 12px auto;
}

.bottom-sheet-content {
    padding: 0 var(--mobile-padding) var(--mobile-padding);
}

/* ============================================
   Install Prompt Banner
   ============================================ */
.install-banner {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 10px);
    left: var(--mobile-padding);
    right: var(--mobile-padding);
    background: linear-gradient(135deg, var(--primary-color) 0%, #00875f 100%);
    color: white;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 84, 41, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 999;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.install-banner.hidden {
    transform: translateY(200%);
}

@keyframes slideUp {
    from {
        transform: translateY(200%);
    }

    to {
        transform: translateY(0);
    }
}

.install-banner-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.install-banner-content {
    flex: 1;
}

.install-banner-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.install-banner-text {
    font-size: 0.8rem;
    opacity: 0.9;
}

.install-banner-actions {
    display: flex;
    gap: 8px;
}

.install-btn {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.install-btn:active {
    transform: scale(0.95);
}

.dismiss-btn {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dismiss-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

/* ============================================
   Loading States
   ============================================ */
.skeleton-mobile {
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   Touch Feedback
   ============================================ */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 84, 41, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.touch-feedback:active::after {
    width: 200%;
    height: 200%;
}

/* ============================================
   Responsive Utilities
   ============================================ */
@media (max-width: 576px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 577px) {
    .show-mobile-only {
        display: none !important;
    }
}

/* ============================================
   Dark Mode Support
   ============================================ */
[data-theme="dark"] .event-card-mobile,
[data-theme="dark"] .bottom-sheet {
    background: #1e1e1e;
    color: #e0e0e0;
}

[data-theme="dark"] .bottom-sheet-handle {
    background: #444;
}

/* ============================================
   Accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
.bottom-nav-item:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}