/* Mobile Responsive Styles */

/* Mobile Menu Button - Hidden on desktop */
#mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#mobile-menu-btn:hover {
    background-color: var(--bg-hover);
}

/* Desktop Logo - Hidden on mobile */
#desktop-logo {
    display: flex;
}

/* Mobile Bottom Navigation - Hidden on desktop */
#mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.mobile-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 60px;
    max-width: 100%;
}

.mobile-nav-item {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 4px 2px;
    gap: 2px;
}

.mobile-nav-item i {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.mobile-nav-item.active {
    color: var(--brand-color);
    font-weight: 600;
}

.mobile-nav-item:hover {
    color: var(--brand-color);
    background-color: var(--bg-hover);
}

/* Mobile Search Bar - Hidden by default */
#mobile-search-bar {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: 16px;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#mobile-search-bar.open {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#mobile-search-input {
    width: 100%;
    padding: 12px 20px 12px 48px;
    border: 1px solid var(--bg-accent);
    border-radius: 50px;
    background: var(--bg-base);
    color: var(--text-main);
    font-size: 16px;
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

#mobile-search-input:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(var(--brand-color), 0.1);
}

#mobile-search-input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

/* Mobile Search Button - Hidden on desktop */
#mobile-search-btn {
    display: none !important;
}

/* Mobile Fire Button - Hidden on desktop */
#mobile-fire-btn {
    display: none !important;
}

/* Mobile Drawer Overlay */
#mobile-drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1998;
    backdrop-filter: blur(4px);
}

#mobile-drawer-overlay.open {
    display: block;
}

/* Mobile Drawer */
#mobile-drawer {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    z-index: 1999;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
}

#mobile-drawer.open {
    left: 0;
}

.mobile-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-section);
}

.mobile-drawer-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-drawer-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mobile-drawer-content {
    padding: 1rem 0;
}

.mobile-drawer-item {
    display: flex !important;
    align-items: center;
    gap: 16px;
    padding: 12px 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.mobile-drawer-item:hover {
    background: var(--bg-hover);
    color: var(--brand-color);
    transform: translateX(4px);
}

.mobile-drawer-item.active {
    background: var(--bg-accent);
    color: var(--brand-color);
    border-left-color: var(--brand-color);
    font-weight: 600;
}

.mobile-drawer-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Mobile Right Sidebar / On Fire Bottom Sheet */
#mobile-on-fire-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    backdrop-filter: blur(4px);
    display: none;
}

#mobile-on-fire-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile On Fire content styling */
.mobile-on-fire-handle {
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 12px auto 8px auto;
    opacity: 0.5;
}

.mobile-on-fire-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem 0.5rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.mobile-on-fire-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-on-fire-close {
    background: var(--bg-hover);
    border: none;
    font-size: 1.4rem;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.mobile-on-fire-close:hover {
    background: var(--bg-accent);
    color: var(--text-primary);
}

.mobile-on-fire-content {
    padding: 1rem 1.5rem 2rem 1.5rem;
}

/* Mobile moment cards in bottom sheet */
.mobile-moment-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 10px;
    background: var(--bg-section);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.mobile-moment-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
    transform: translateY(-1px);
}

.mobile-moment-image {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

.mobile-moment-icon {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-sm);
}

.mobile-moment-details {
    flex: 1;
    min-width: 0;
}

.mobile-moment-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 1.1rem;
    line-height: 1.3;
}

.mobile-moment-stats {
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 4px;
}

.mobile-moment-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mobile-moment-author {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mobile-moment-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-left: 8px;
}

/* Empty state for mobile on fire */
.mobile-on-fire-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.mobile-on-fire-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
}

.mobile-on-fire-empty h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.mobile-on-fire-empty p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
}

/* CRITICAL: Responsive breakpoints with high specificity */
@media (max-width: 768px) {
    /* Force mobile layout - Override all Tailwind classes */
    body {
        overflow-x: hidden;
    }
    
    /* Show mobile elements */
    #mobile-menu-btn {
        display: block !important;
    }
    
    #mobile-bottom-nav {
        display: block !important;
    }
    
    #mobile-search-btn {
        display: flex !important;
    }
    
    #mobile-fire-btn {
        display: flex !important;
    }
    
    /* Hide desktop logo on mobile */
    #desktop-logo {
        display: none !important;
    }
    
    /* Adjust navbar for mobile */
    nav {
        padding: 0 12px !important;
    }
    
    .nav-center {
        display: none !important;
    }
    
    .nav-left {
        flex: 1 !important;
        justify-content: flex-start !important;
    }
    
    .nav-right {
        flex: 1 !important;
        justify-content: flex-end !important;
        gap: 24px !important; /* Increased from 4px to 24px for better touch spacing */
    }
    
    /* CRITICAL: Force mobile layout by targeting the parent container with higher specificity */
    div.flex.flex-row {
        flex-direction: column !important;
        padding: 0 !important;
        margin-top: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Hide ALL sidebars on mobile with maximum specificity */
    aside,
    .w-1\/5,
    aside.w-1\/5 {
        display: none !important;
        width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Force main content to full width with maximum specificity */
    main,
    .w-3\/5,
    main.w-3\/5 {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem !important;
        border: none !important;
        margin-bottom: 80px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Override all Tailwind padding classes on mobile */
    .px-4,
    .px-6,
    .pr-4,
    .pl-4 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .mt-6 {
        margin-top: 0 !important;
    }
    
    /* Adjust navbar buttons for mobile */
    .nav-right a {
        padding: 12px 16px !important; /* Increased from 8px to 12px/16px for larger touch targets */
        min-width: 48px !important; /* Ensure minimum touch target size */
        min-height: 48px !important; /* Ensure minimum touch target size */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important; /* Add rounded corners */
        transition: background-color 0.2s ease !important;
    }
    
    .nav-right a:active {
        background-color: var(--bg-hover) !important; /* Visual feedback on tap */
        transform: scale(0.95) !important; /* Slight scale feedback */
    }
    
    .nav-icon {
        font-size: 1.4rem !important; /* Slightly larger icons for better visibility */
    }
    
    .profile-pic {
        width: 32px !important;
        height: 32px !important;
    }
    
    /* Mobile-specific location button adjustments */
    #navbar-location-btn {
        font-size: 0.85rem !important;
        padding: 4px 8px !important;
        margin-left: 8px !important;
    }
    
    #navbar-location-status {
        display: none !important;
    }
    
    /* Global fire cooldown adjustments */
    #global-fire-cooldown {
        font-size: 0.8rem !important;
        padding: 4px 8px !important;
        margin-left: 8px !important;
    }
    
    /* Notification container mobile adjustments */
    #notification-container {
        right: 8px !important;
        width: calc(100vw - 16px) !important;
        max-width: 360px !important;
    }
    
    /* Global messages mobile adjustments */
    #global-messages div {
        min-width: calc(100vw - 32px) !important;
        max-width: calc(100vw - 32px) !important;
        margin: 8px 16px !important;
        font-size: 1rem !important;
    }
    
    /* Chat modal mobile adjustments */
    #chat-modal {
        bottom: 80px !important;
        right: 8px !important;
        width: calc(100vw - 16px) !important;
        max-width: 360px !important;
        height: 60vh !important;
        min-height: 400px !important;
    }
    
    /* Ensure proper box-sizing */
    *,
    *::before,
    *::after {
        box-sizing: border-box !important;
    }
}

@media (max-width: 480px) {
    /* Extra small mobile adjustments */
    .mobile-nav-item {
        font-size: 0.7rem !important;
        padding: 2px 1px !important;
    }
    
    .mobile-nav-item i {
        font-size: 1rem !important;
    }
    
    nav {
        padding: 0 8px !important;
    }
    
    .nav-right a {
        padding: 0 6px !important;
    }
    
    #mobile-drawer {
        width: 260px !important;
    }
    
    main {
        padding: 0.75rem !important;
    }
}

/* Hide mobile elements on desktop with high specificity */
@media (min-width: 769px) {
    #mobile-menu-btn,
    #mobile-bottom-nav,
    #mobile-search-btn,
    #mobile-fire-btn,
    #mobile-drawer,
    #mobile-drawer-overlay,
    #mobile-search-bar {
        display: none !important;
    }
    
    #desktop-logo {
        display: flex !important;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #mobile-bottom-nav {
        height: 50px !important;
    }
    
    .mobile-nav-grid {
        height: 50px !important;
    }
    
    .mobile-nav-item {
        font-size: 0.7rem !important;
    }
    
    .mobile-nav-item i {
        font-size: 1rem !important;
    }
    
    main {
        margin-bottom: 60px !important;
    }
    
    #chat-modal {
        height: 70vh !important;
        bottom: 60px !important;
    }
}

/* Touch-friendly interactions */
@media (pointer: coarse) {
    .mobile-nav-item,
    .mobile-drawer-item,
    #mobile-menu-btn,
    .mobile-drawer-close {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    nav a {
        min-height: 44px !important;
        min-width: 44px !important;
    }
}
