/* 
 * mobile.css - Premium Mobile & Tablet UX for Campers in Flow
 * Covers: Portrait phones, landscape phones, tablets
 */

/* ============================================
   MOBILE PORTRAIT (up to 768px)
   ============================================ */
@media (max-width: 768px) {
    /* --- Global Adjustments --- */
    :root {
        --header-height: 70px;
        --nav-bottom-height: 65px;
    }

    body {
        padding-bottom: var(--nav-bottom-height);
        font-size: 14px;
    }

    /* --- Header & Navigation --- */
    header {
        height: var(--header-height);
        padding: 0 1rem;
        justify-content: space-between;
    }

    .logo span {
        display: none;
    }

    .logo {
        font-size: 1.1rem;
        gap: 0.5rem;
    }

    .nav-links {
        display: none; /* Hide desktop links */
    }

    .hamburger-btn {
        display: flex;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        padding: 8px;
        color: var(--light);
    }

    #platform-mode-switcher {
        margin-left: 0.5rem !important;
        padding: 0.4rem 0.6rem !important;
    }

    #platform-mode-switcher span:not(.material-icons) {
        display: none; /* Hide label on very small screens, show icon only */
    }

    @media (min-width: 480px) {
        #platform-mode-switcher span:not(.material-icons) {
            display: inline;
        }
        .logo span {
            display: inline;
        }
    }

    /* --- Landing Page Premium Look --- */
    .hero {
        padding: 8rem 5% 4rem;
        text-align: center;
    }

    h1 {
        font-size: 2.5rem !important;
        line-height: 1.1;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin: 1.5rem 0 2.5rem;
    }

    .feature-card {
        padding: 1.5rem !important;
        border-radius: 24px !important;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1.5rem !important;
    }

    /* =========================================
       MAP VIEW - MOBILE OVERHAUL
       ========================================= */
    #map-section {
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
    }

    /* --- Close Map Button: Compact icon, top-left --- */
    #close-map {
        position: fixed !important;
        top: 12px !important;
        left: 12px !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        z-index: 1200 !important;
        padding: 0 !important;
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        border-radius: 14px !important;
        background: rgba(15, 23, 42, 0.85) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        color: transparent !important;
        font-size: 0 !important;
        line-height: 0 !important;
        text-indent: -9999px !important;
        overflow: hidden !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
    }

    #close-map::after {
        content: '✕';
        position: absolute;
        font-size: 18px;
        font-weight: 700;
        color: white;
        text-indent: 0;
        line-height: 1;
    }

    /* --- Filter Button: Compact floating action button --- */
    #toggle-filter-btn {
        position: fixed !important;
        bottom: calc(var(--nav-bottom-height) + 16px) !important;
        left: 16px !important;
        right: auto !important;
        top: auto !important;
        z-index: 1200 !important;
        background: var(--primary) !important;
        color: var(--dark) !important;
        border-radius: 50px !important;
        padding: 10px 18px !important;
        max-height: 44px !important;
        box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45) !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        border: none !important;
        white-space: nowrap !important;
        writing-mode: horizontal-tb !important;
    }

    /* --- Map Controls Top Right: Compact on mobile --- */
    .map-controls-top-right {
        top: 12px !important;
        right: 12px !important;
        gap: 8px !important;
    }

    .map-control-toggle {
        width: 42px !important;
        height: 42px !important;
        border-radius: 12px !important;
    }

    .map-control-toggle .material-icons {
        font-size: 20px !important;
    }

    /* --- Leaflet Zoom Controls: Compact --- */
    .leaflet-bottom.leaflet-right {
        bottom: calc(var(--nav-bottom-height) + 16px) !important;
        right: 12px !important;
    }

    .leaflet-bar a {
        width: 38px !important;
        height: 38px !important;
        line-height: 38px !important;
        font-size: 18px !important;
    }

    /* =========================================
       FILTER SIDEBAR - MOBILE BOTTOM SHEET
       ========================================= */
    #filter-sidebar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: 85vh !important;
        background: rgba(15, 23, 42, 0.98) !important;
        backdrop-filter: blur(25px) !important;
        -webkit-backdrop-filter: blur(25px) !important;
        border-radius: 28px 28px 0 0 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
        transform: translateY(100%) !important;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
        z-index: 10100 !important;
        padding: 2.5rem 1.5rem 2rem !important;
        overflow-y: auto !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5) !important;
    }

    #filter-sidebar.active {
        transform: translateY(0) !important;
    }

    /* Bottom sheet drag handle */
    #filter-sidebar::before {
        content: '';
        display: block;
        height: 4px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 2px;
        margin: 0 auto 1rem auto;
    }

    #filter-sidebar h3 {
        font-size: 1.2rem !important;
        margin-top: 0 !important;
    }

    .close-sidebar {
        top: 1rem !important;
        right: 1rem !important;
        width: 36px !important;
        height: 36px !important;
    }

    .filter-group {
        margin-bottom: 1.4rem !important;
    }

    .filter-group label {
        font-size: 0.85rem !important;
        margin-bottom: 0.5rem !important;
    }

    .filter-checkbox-group label {
        padding: 6px 0 !important;
        font-size: 0.9rem !important;
        min-height: 36px !important;
        display: flex !important;
        align-items: center !important;
    }

    .filter-input {
        padding: 0.7rem !important;
        font-size: 16px !important; /* Prevents iOS zoom */
        border-radius: 10px !important;
    }

    /* Filter action buttons at bottom */
    #filter-sidebar > div:last-child {
        position: sticky;
        bottom: 0;
        padding: 1rem 0;
        background: var(--dark-lighter);
        z-index: 1;
    }

    /* =========================================
       POI PREVIEW CARD - MOBILE BOTTOM SHEET
       ========================================= */
    .preview-card {
        position: fixed !important;
        bottom: -100% !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 0 !important;
        z-index: 1500 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6) !important;
        transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        flex-direction: row !important;
        background: #111827 !important;
        border: none !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    .preview-card.active {
        bottom: var(--nav-bottom-height) !important;
    }

    /* Drag handle on preview card */
    .preview-card::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
        z-index: 10;
    }

    .preview-card .preview-img {
        width: 100px !important;
        height: auto !important;
        min-height: 100px !important;
        max-height: 140px !important;
        border-radius: 16px !important;
        margin: 16px 0 16px 16px !important;
        object-fit: cover !important;
        flex-shrink: 0 !important;
    }

    .preview-card .preview-info {
        padding: 20px 16px 16px 12px !important;
        min-width: 0 !important; /* Allow text truncation */
    }

    .preview-card .preview-name {
        font-size: 1rem !important;
        line-height: 1.2 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .preview-card .preview-meta {
        font-size: 0.75rem !important;
        margin-top: 2px !important;
    }

    .preview-card .preview-features {
        margin-top: 8px !important;
        gap: 8px !important;
    }

    .preview-card .preview-features .material-icons {
        font-size: 16px !important;
    }

    .preview-card .preview-features span {
        font-size: 0.65rem !important;
    }

    .preview-card .preview-actions {
        margin-top: 10px !important;
        gap: 8px !important;
    }

    .preview-card .btn-preview-main {
        padding: 8px !important;
        font-size: 0.8rem !important;
        border-radius: 10px !important;
    }

    .preview-card .btn-preview-close {
        position: absolute !important;
        top: 6px !important;
        right: 8px !important;
        width: 32px !important;
        height: 32px !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.08) !important;
    }

    .preview-card .btn-preview-close .material-icons {
        font-size: 18px !important;
    }

    /* =========================================
       POI DETAILS MODAL - FULL SCREEN MOBILE
       ========================================= */
    #poi-details-overlay {
        background: rgba(0, 0, 0, 0.6) !important;
        align-items: flex-end !important;
        padding: 0 !important;
    }

    .poi-details-modal {
        width: 100% !important;
        max-width: 100% !important;
        height: 95vh !important;
        height: 95dvh !important;
        max-height: 95vh !important;
        border-radius: 24px 24px 0 0 !important;
        margin: 0 !important;
        animation: slideUpMobile 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* Drag handle on details modal */
    .poi-details-modal::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 2px;
        margin: 12px auto 0 auto;
        position: relative;
        z-index: 20;
    }

    .poi-details-header {
        position: fixed !important;
        top: auto !important;
        right: 16px !important;
        bottom: calc(var(--nav-bottom-height) + 16px) !important;
        z-index: 10120 !important;
    }

    .poi-details-header .btn {
        width: 44px !important;
        height: 44px !important;
        background: rgba(15, 23, 42, 0.9) !important;
        backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
    }

    .poi-content-wrapper {
        padding: 1.5rem !important;
    }

    .poi-main-content {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        padding: 0 !important;
    }

    .poi-right {
        position: relative !important;
    }

    .poi-hero-bg {
        height: 400px !important;
    }

    .poi-description-box {
        padding: 1.5rem !important;
        margin-bottom: 2rem !important;
        border-radius: 16px !important;
    }

    .poi-description {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    .poi-offers-box {
        padding: 1.5rem !important;
        margin-bottom: 2rem !important;
        border-radius: 20px !important;
    }

    .offers-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .offer-card {
        padding: 1.2rem !important;
        border-radius: 14px !important;
    }

    .offer-title {
        font-size: 1.1rem !important;
    }

    .offer-description {
        font-size: 0.9rem !important;
    }

    .offer-price {
        font-size: 1.4rem !important;
    }

    /* Feature grid - compact for mobile */
    .poi-features-full-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 0.6rem !important;
    }

    .feature-status-item {
        padding: 10px 12px !important;
        border-radius: 10px !important;
    }

    .feature-label {
        font-size: 0.78rem !important;
    }

    /* Info card */
    .info-card {
        padding: 1.5rem !important;
        border-radius: 16px !important;
    }

    .contact-item .material-icons {
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px !important;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
        gap: 0.6rem !important;
    }

    .gallery-img {
        height: 100px !important;
        border-radius: 10px !important;
    }

    .gallery-section {
        margin-top: 2rem !important;
    }

    /* Reviews */
    .reviews-section {
        margin-top: 2rem !important;
        padding-top: 2rem !important;
    }

    .review-item {
        padding: 1.2rem !important;
        border-radius: 14px !important;
    }

    /* --- Search Overlay --- */
    .search-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: var(--dark);
        z-index: 10005;
        display: none;
        flex-direction: column;
        padding: 1.5rem;
    }

    .search-overlay.active {
        display: flex;
    }

    .search-overlay-header {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .search-overlay-input {
        flex: 1;
        background: rgba(255,255,255,0.05);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 1rem;
        color: white;
        font-size: 1.1rem;
    }

    /* --- Portal & Settings --- */
    .portal-container {
        padding: 1rem !important;
    }

    .settings-grid, .profile-grid {
        grid-template-columns: 1fr !important;
    }

    .card {
        padding: 1.5rem !important;
        border-radius: 20px !important;
    }

    input, select, textarea {
        font-size: 16px !important; /* Prevent iOS zoom */
    }

    /* --- Forum --- */
    .forum-thread-card {
        padding: 1rem !important;
    }

    .thread-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* --- Pro Upgrade Page --- */
    .pro-pricing-grid {
        grid-template-columns: 1fr !important;
        padding: 0 !important;
    }

    .pro-card {
        transform: none !important;
        margin-bottom: 2rem;
    }

    /* --- Custom Elements --- */
    .mobile-only {
        display: block !important;
    }

    .desktop-only {
        display: none !important;
    }

    /* --- Suggest Spot Banner: Compact on mobile --- */
    #suggest-spot-banner {
        top: 60px !important;
        padding: 0.6rem 1rem !important;
        font-size: 0.8rem !important;
        border-radius: 30px !important;
        width: calc(100% - 32px) !important;
    }

    /* --- Compare Overlay --- */
    .compare-overlay .compare-header {
        padding: 1rem !important;
    }

    .compare-overlay .compare-header h1 {
        font-size: 1.3rem !important;
    }

    .compare-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   GLASSMORPHISM POLISH FOR MOBILE
   ============================================ */
@media (max-width: 768px) {
    .btn-glass {
        backdrop-filter: blur(5px);
        background: rgba(255, 255, 255, 0.03);
    }
    
    .dropdown-menu {
        position: fixed !important;
        top: auto !important;
        bottom: var(--nav-bottom-height, 65px) !important;
        left: 0 !important;
        width: 100% !important;
        border-radius: 24px 24px 0 0 !important;
        animation: slideUpMobile 0.3s ease-out !important;
        max-height: 80vh !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
        z-index: 10010 !important;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.5) !important;
    }
}


/* ============================================
   TABLET PORTRAIT (769px - 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    /* --- Map Controls: Slightly smaller --- */
    #close-map {
        bottom: 1.5rem !important;
        padding: 0.8rem 1.5rem !important;
        font-size: 0.9rem !important;
    }

    #toggle-filter-btn {
        top: 80px !important;
    }

    .map-controls-top-right {
        top: 50px !important;
    }

    /* --- Filter Sidebar: Wider for tablet --- */
    #filter-sidebar {
        width: 380px !important;
    }

    /* --- POI Details: Better proportions --- */
    .poi-details-modal {
        width: 95% !important;
        max-width: 900px !important;
        max-height: 90vh !important;
    }

    .poi-main-content {
        grid-template-columns: 1.5fr 1fr !important;
        gap: 2rem !important;
    }

    .poi-content-wrapper {
        padding: 2.5rem !important;
    }

    /* --- Preview Card --- */
    .preview-card {
        max-width: 450px !important;
    }

    /* --- Offers --- */
    .offers-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
    }
}


/* ============================================
   LANDSCAPE PHONES (max-height: 500px + landscape)
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    :root {
        --nav-bottom-height: 50px;
    }

    /* --- Map: Full viewport --- */
    #map-section {
        height: 100vh !important;
        height: 100dvh !important;
    }

    /* --- Close Map: Compact top-left --- */
    #close-map {
        position: fixed !important;
        top: 8px !important;
        left: 8px !important;
        bottom: auto !important;
        right: auto !important;
        transform: none !important;
        padding: 0 !important;
        width: 38px !important;
        height: 38px !important;
        border-radius: 10px !important;
        background: rgba(15, 23, 42, 0.85) !important;
        backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        font-size: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 1200 !important;
    }

    #close-map::before {
        content: '✕';
        font-size: 16px;
        font-weight: 700;
        color: white;
    }

    /* --- Filter Button: Compact --- */
    #toggle-filter-btn {
        position: fixed !important;
        bottom: calc(var(--nav-bottom-height) + 8px) !important;
        left: 12px !important;
        top: auto !important;
        padding: 8px 14px !important;
        font-size: 0.8rem !important;
        border-radius: 30px !important;
        z-index: 1200 !important;
    }

    /* --- Map Controls: Smaller --- */
    .map-controls-top-right {
        top: 8px !important;
        right: 8px !important;
        gap: 6px !important;
    }

    .map-control-toggle {
        width: 36px !important;
        height: 36px !important;
    }

    .map-control-toggle .material-icons {
        font-size: 18px !important;
    }

    /* --- Filter Sidebar: Side panel in landscape --- */
    #filter-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -350px !important;
        bottom: auto !important;
        width: 320px !important;
        height: 100vh !important;
        border-radius: 0 !important;
        transform: none !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    #filter-sidebar.active {
        left: 0 !important;
        transform: none !important;
    }

    #filter-sidebar::before {
        display: none !important;
    }

    /* --- Preview Card: Compact landscape --- */
    .preview-card {
        max-width: 400px !important;
        bottom: -300px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        border-radius: 16px !important;
    }

    .preview-card.active {
        bottom: calc(var(--nav-bottom-height) + 8px) !important;
    }

    .preview-card .preview-img {
        width: 80px !important;
        min-height: 80px !important;
        max-height: 100px !important;
    }

    /* --- POI Details: Landscape optimized --- */
    .poi-details-modal {
        height: 100vh !important;
        border-radius: 0 !important;
    }

    .poi-details-modal::before {
        display: none !important;
    }

    .poi-content-wrapper {
        padding: 1rem 1.5rem !important;
    }

    .poi-hero-bg {
        height: 300px !important;
    }

    .poi-features-full-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    }

    /* --- Leaflet Controls --- */
    .leaflet-bottom.leaflet-right {
        bottom: calc(var(--nav-bottom-height) + 8px) !important;
        right: 8px !important;
    }

    .leaflet-bar a {
        width: 34px !important;
        height: 34px !important;
        line-height: 34px !important;
    }
}

/* ============================================
   TABLET LANDSCAPE (1025px - 1366px)
   ============================================ */
@media (min-width: 1025px) and (max-width: 1366px) {
    .poi-details-modal {
        max-width: 1100px !important;
    }

    .poi-main-content {
        gap: 3rem !important;
    }

    .poi-content-wrapper {
        padding: 3rem !important;
    }

    .preview-card {
        max-width: 480px !important;
    }
}


/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideUpMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes slideDownMobile {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}
