/* ============================================================
   MR EGYPT TRIPS — Mobile Responsive CSS v2.0 (Complete Rewrite)
   Covers: 320px → 1024px (phones & tablets — ALL device types)
   ============================================================ */

/* ===== PWA Install Banner ===== */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: linear-gradient(135deg, #001F3F 0%, #0d47a1 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}
.pwa-install-banner.show {
    transform: translateY(0);
}
.pwa-install-banner .pwa-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}
.pwa-install-banner .pwa-text {
    flex: 1;
}
.pwa-install-banner .pwa-text h6 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}
.pwa-install-banner .pwa-text p {
    margin: 2px 0 0;
    font-size: 0.75rem;
    opacity: 0.8;
}
.pwa-install-banner .btn-pwa-install {
    background: #fff;
    color: #001F3F;
    border: none;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
}
.pwa-install-banner .btn-pwa-dismiss {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

/* ===== GLOBAL FLUID TYPOGRAPHY ===== */
@media (max-width: 1024px) {
    html { font-size: 15px; }
    
    /* Icon size limits — prevent oversized icons on mobile */
    .fa-4x, .fa-5x, .fa-6x { font-size: 2.5rem !important; }
    .fa-3x { font-size: 2rem !important; }
    .fa-2x { font-size: 1.5rem !important; }
    i[style*="font-size: 5rem"], i[style*="font-size: 4rem"], 
    i[style*="font-size:5rem"], i[style*="font-size:4rem"] {
        font-size: 2.5rem !important;
    }
    
    /* Image size limits — no oversized inline images */
    img[height="100"], img[height="120"], img[height="150"] {
        height: auto !important;
        max-height: 80px !important;
    }
}

/* ===== TABLETS (769px - 1024px) ===== */
@media (max-width: 1024px) and (min-width: 769px) {
    .container { max-width: 720px; }
    
    .display-3 { font-size: 2.5rem !important; }
    .display-4 { font-size: 2rem !important; }
    .display-6 { font-size: 1.5rem !important; }
    
    /* Trip cards: 2 per row on tablet */
    #tripsContainer .col-lg-4 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    
    /* Netflix carousel */
    .netflix-card { min-width: 200px; }
    
    /* Gallery */
    .gallery-carousel-section .gallery-item {
        width: 200px !important;
    }
}

/* ===== LARGE PHONES & SMALL TABLETS (429px - 768px) ===== */
@media (max-width: 768px) {
    .container { padding-left: 16px; padding-right: 16px; }
    
    /* Typography scaling */
    .display-3 { font-size: 2rem !important; }
    .display-4 { font-size: 1.75rem !important; }
    .display-6 { font-size: 1.3rem !important; }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    .lead { font-size: 1rem !important; }
    
    /* ===== HERO SECTION ===== */
    .hero-section, .carousel-inner { min-height: 60vh !important; }
    #heroCarousel { max-height: 70vh !important; }
    .hero-content { text-align: center !important; }
    .hero-content .d-flex { justify-content: center; flex-wrap: wrap; }
    .hero-content .btn { width: 100%; max-width: 300px; }
    .hero-content h1 { font-size: 1.8rem !important; line-height: 1.3; }
    .hero-content p { font-size: 0.95rem !important; }

    /* Carousel controls */
    .carousel-control-prev, .carousel-control-next { width: 10% !important; }
    .carousel-control-prev-icon, .carousel-control-next-icon {
        padding: 8px !important;
        width: 32px; height: 32px;
    }
    
    /* ===== URGENCY COUNTDOWN BAR ===== */
    .urgency-bar { font-size: 0.8rem; padding: 8px 0; }
    .urgency-bar .container { 
        flex-direction: row !important; 
        flex-wrap: wrap !important;
        gap: 4px !important; 
        justify-content: center !important;
    }
    .countdown-digit { font-size: 1rem; min-width: 28px; padding: 3px 6px !important; }
    .countdown-label { font-size: 0.55rem; margin: 0 3px; }
    .urgency-bar .btn { 
        font-size: 0.7rem !important; 
        padding: 4px 12px !important; 
        min-height: 30px !important;
        width: auto !important;
        margin-bottom: 0 !important;
    }
    
    /* ===== TRUST MARQUEE ===== */
    .trust-marquee-wrapper { padding: 6px 0 !important; }
    .trust-marquee img { height: 22px !important; margin: 0 10px !important; }
    .trust-marquee h6 { font-size: 0.7rem !important; }
    
    /* ===== STATS SECTION ===== */
    #statsSection .stat-item i { font-size: 1.3rem !important; margin-bottom: 8px !important; }
    #statsSection h2 { font-size: 1.3rem; }
    #statsSection p { font-size: 0.7rem; }
    
    /* ===== SEARCH BAR ===== */
    .search-glass-wrapper { border-radius: 12px !important; }
    #tripSearch { font-size: 0.9rem !important; padding: 10px !important; }
    #voiceSearchBtn { display: none; }
    
    /* ===== STORY BUBBLES ===== */
    .story-bubbles-wrap { 
        max-width: 100% !important; 
        border-radius: 12px !important; 
        overflow-x: auto; 
        white-space: nowrap;
    }
    .story-bubble { margin: 0 4px; }
    .story-ring img { width: 40px; height: 40px; }
    
    /* ===== CATEGORY FILTERS ===== */
    #categoryFilters { 
        gap: 6px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 8px;
    }
    #categoryFilters::-webkit-scrollbar { display: none; }
    .filter-btn { 
        padding: 6px 14px !important; 
        font-size: 0.8rem !important; 
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        width: auto !important;
        flex-grow: 0 !important;
    }
    
    /* ===== TRIP CARDS: full width stacked ===== */
    #tripsContainer .col-lg-4,
    #tripsContainer .col-sm-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    .trip-card .card-body { padding: 16px !important; }
    .trip-card .card-title { font-size: 1.1rem; }
    .trip-card .h4 { font-size: 1.2rem !important; }
    /* Fix buttons—keep them side by side, no stacking */
    .trip-card .d-flex.gap-2 { 
        flex-direction: row !important;
        gap: 8px !important;
    }
    .trip-card .d-flex.gap-2 .btn { 
        width: auto !important;
        flex: 1 !important;
        min-width: 0 !important;
        font-size: 0.85rem !important;
        padding: 8px 12px !important;
        margin-bottom: 0 !important;
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* ===== NETFLIX CAROUSEL ===== */
    .netflix-carousel-container { gap: 12px; padding-left: 15px; }
    .netflix-card { min-width: 160px; }
    .netflix-rank { font-size: 3rem; left: -8px; }
    
    /* ===== CONCIERGE SECTION ===== */
    .concierge-box { padding: 20px !important; }
    .concierge-btn { padding: 12px !important; }
    .concierge-btn i { font-size: 1.5rem !important; }
    .concierge-btn span { font-size: 0.75rem !important; }
    
    /* ===== PARALLAX SECTION ===== */
    .parallax-story { padding: 40px 0; }
    .parallax-content { padding: 20px; }
    .parallax-content .display-4 { font-size: 1.5rem !important; }
    .parallax-content .row .col-md-4 { margin-bottom: 16px; }
    .parallax-content h4 { font-size: 1rem; }
    .parallax-content i.fa-3x { font-size: 1.8rem !important; }
    
    /* ===== GALLERY ===== */
    .gallery-carousel-section .gallery-item {
        width: 150px !important;
        height: 150px !important;
    }
    
    /* ===== FOOTER ===== */
    footer .row > [class*="col-"] { margin-bottom: 24px; }
    footer .text-end, footer .text-start { text-align: center !important; }
    /* Payment/trust logos in footer — scale down properly */
    footer .bg-white img,
    footer .trust-strip img {
        height: 16px !important;
        max-height: 16px !important;
        width: auto !important;
    }
    footer .container .d-flex.gap-4 {
        gap: 12px !important;
    }
    footer .container .d-flex.gap-md-5 {
        gap: 12px !important;
    }
    /* Footer newsletter input */
    footer .form-control-lg {
        font-size: 0.85rem !important;
        padding: 10px 50px 10px 16px !important;
    }
    
    /* ===== MODALS ===== */
    .modal-dialog { margin: 8px; }
    .modal-body { padding: 16px; }
    
    /* ===== TABLES ===== */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 500px; }
    
    /* ===== FORMS ===== */
    .form-control, .form-select { font-size: 16px !important; } /* Prevent iOS zoom on focus */
    
    /* ===== BOTTOM NAV BAR FIXES ===== */
    .bottom-app-bar {
        padding: 8px 0 max(env(safe-area-inset-bottom, 10px), 10px) 0 !important;
    }
    .bottom-app-bar .bar-item {
        position: relative;
        z-index: 2;
        min-width: 60px;
        padding: 4px 8px;
    }
    .bottom-app-bar .bar-item i {
        font-size: 1.2rem !important;
    }
    .bottom-app-bar .bar-item span {
        font-size: 0.65rem !important;
        line-height: 1.2;
    }
    
    /* ===== WHATSAPP BUTTON — don't overlap bottom nav ===== */
    .wa-pulse-widget {
        bottom: 85px !important;
        right: 15px !important;
        z-index: 1035 !important;
    }
    .wa-pulse-btn {
        width: 50px !important;
        height: 50px !important;
        font-size: 26px !important;
    }
    .wa-pulse-widget::before,
    .wa-pulse-widget::after {
        width: 50px !important;
        height: 50px !important;
    }
    .wa-tooltip { display: none !important; }
    
    /* ===== CONCIERGE AVATAR — hide on mobile (WhatsApp button already present) ===== */
    .concierge-avatar-widget { display: none !important; }
    
    /* ===== SCROLL TO TOP — position above WhatsApp ===== */
    #scrollToTopBtn {
        bottom: 145px !important;
        right: 15px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 0.9rem !important;
    }
    [dir="rtl"] #scrollToTopBtn {
        right: auto !important;
        left: 15px !important;
    }
    
    /* ===== OMNI-DIAL — reposition above bottom bar ===== */
    .omni-dial {
        bottom: 85px !important;
        left: 15px !important;
    }
    .omni-btn {
        width: 48px !important;
        height: 48px !important;
        font-size: 20px !important;
    }
    .omni-menu {
        width: 250px !important;
    }
    
    /* ===== FOMO TOAST — lift above bottom bar ===== */
    #fomoToast {
        bottom: 85px !important;
        left: 10px !important;
        max-width: 280px !important;
        font-size: 0.85rem;
    }
    .social-proof-toast {
        bottom: 85px !important;
        left: 10px !important;
        max-width: 280px !important;
    }
    
    /* ===== PWA INSTALL MODAL — compact & above bottom bar ===== */
    .pwa-modal {
        bottom: 70px !important;
        padding: 0 10px !important;
    }
    .pwa-modal .d-flex {
        padding: 10px !important;
        border-radius: 12px !important;
    }
    .pwa-modal img {
        width: 38px !important;
        height: 38px !important;
    }
    .pwa-modal h6 { font-size: 0.85rem !important; }
    .pwa-modal small { font-size: 0.7rem !important; }
    
    /* Touch targets — minimum 44px for accessibility */
    .btn-sm { min-height: 38px; min-width: 38px; }
    .nav-link { padding: 12px 16px !important; }
    
    /* Hide desktop-only elements */
    .d-none-mobile { display: none !important; }
    
    /* ===== HOW IT WORKS SECTION ===== */
    section[style*="linear-gradient"][style*="#f0fdfa"] .col-md-4 {
        margin-bottom: 20px;
    }
    section[style*="linear-gradient"][style*="#f0fdfa"] .d-inline-flex {
        width: 60px !important;
        height: 60px !important;
    }
    section[style*="linear-gradient"][style*="#f0fdfa"] .fa-2x {
        font-size: 1.3rem !important;
    }
    /* Desktop-only timeline connector */
    section[style*="linear-gradient"][style*="#f0fdfa"] .position-absolute[style*="height: 3px"] {
        display: none !important;
    }
    
    /* ===== BOOKING MODAL ===== */
    #bookingModal .modal-dialog {
        margin: 5px !important;
        max-width: calc(100% - 10px) !important;
    }
    #bookingModal .modal-body {
        padding: 15px !important;
    }
    #bookingModal .row .col-md-6 {
        padding: 4px 0 !important;
    }
    
    /* ===== LEAFLET MAP ===== */
    .leaflet-map-wrapper #interactiveMap {
        height: 250px !important;
    }
    
    /* ===== INNER PAGES (trip-details, about, cart, etc.) ===== */
    .page-hero {
        padding: 40px 0 !important;
        min-height: auto !important;
    }
    .page-hero h1 {
        font-size: 1.6rem !important;
    }
    .page-hero p {
        font-size: 0.9rem !important;
    }
    
    /* Trip Details Page */
    .trip-details-gallery {
        grid-template-columns: 1fr !important;
    }
    .trip-details-sidebar {
        position: static !important;
    }
    .trip-details-price-card {
        position: static !important;
        margin-top: 20px !important;
    }
    
    /* Contact / About page columns */
    .col-lg-6.contact-form-col,
    .col-lg-6.contact-info-col {
        padding: 0 !important;
    }
    
    /* Cart page */
    .cart-item-row {
        flex-direction: column !important;
    }
    .cart-item-image {
        width: 100% !important;
        height: 150px !important;
    }
}

/* ===== STANDARD PHONES (376px - 428px) ===== */
@media (max-width: 428px) {
    .container { padding-left: 12px; padding-right: 12px; }
    
    .display-3 { font-size: 1.6rem !important; }
    .display-4 { font-size: 1.4rem !important; }
    .display-6 { font-size: 1.2rem !important; }
    
    /* Hero */
    .hero-section, .carousel-inner { min-height: 50vh !important; }
    .hero-content h1 { font-size: 1.5rem !important; }
    .hero-content p { font-size: 0.85rem !important; max-width: 100%; }
    .hero-content { padding: 0 8px; }
    .hero-content .row { margin-top: 60px !important; }
    
    /* Stats compact */
    #statsSection .col-6 { padding: 4px !important; }
    #statsSection i { font-size: 1.2rem !important; }
    #statsSection h2 { font-size: 1.1rem; margin-bottom: 2px; }
    #statsSection p { font-size: 0.65rem; margin-bottom: 0; }
    
    /* Concierge buttons smaller */
    .concierge-btn { padding: 10px !important; }
    .concierge-btn i { font-size: 1.2rem !important; }
    .concierge-btn span { font-size: 0.7rem !important; }
    
    /* Booking form compact */
    .modal-body .row .col-md-6 { padding: 4px 0; }
    
    /* Netflix */
    .netflix-card { min-width: 140px; }
    
    /* PWA banner compact */
    .pwa-install-banner { padding: 12px 14px; gap: 8px; }
    .pwa-install-banner .pwa-icon { width: 40px; height: 40px; }
    .pwa-install-banner .pwa-text h6 { font-size: 0.85rem; }
    .pwa-install-banner .btn-pwa-install { padding: 6px 14px; font-size: 0.8rem; }
    
    /* Footer payment logos even smaller */
    footer .bg-white img {
        height: 14px !important;
        max-height: 14px !important;
    }
    footer .bg-white .fw-bold {
        font-size: 0.7rem !important;
    }
}

/* ===== SMALL PHONES (320px - 375px) ===== */
@media (max-width: 375px) {
    html { font-size: 13px; }
    .container { padding-left: 10px; padding-right: 10px; }
    
    .display-3 { font-size: 1.4rem !important; }
    .hero-content h1 { font-size: 1.3rem !important; }
    
    /* Stats 2x2 grid */
    #statsSection .col-6 { flex: 0 0 50%; }
    
    /* Netflix */
    .netflix-card { min-width: 120px; }
    .netflix-rank { font-size: 2rem; }
    
    /* Reduce paddings */
    section { padding-top: 24px !important; padding-bottom: 24px !important; }
    .py-5 { padding-top: 24px !important; padding-bottom: 24px !important; }
    .mb-5 { margin-bottom: 24px !important; }
    
    /* Even smaller bottom nav */
    .bottom-app-bar .bar-item span { font-size: 0.6rem !important; }
    .bottom-app-bar .bar-item i { font-size: 1rem !important; }
}

/* ===== NAVBAR MOBILE ===== */
@media (max-width: 768px) {
    /* Navbar compact but visible */
    .navbar { 
        padding: 6px 0 !important;
        z-index: 1050 !important;
    }
    
    /* Logo — make it readable (60px, not 36px) */
    .navbar-brand img { 
        height: 60px !important; 
        width: auto !important;
        max-width: 120px !important;
        object-fit: contain !important;
    }
    /* When scrolled, slightly smaller */
    .glass-scrolled .navbar-brand img {
        height: 48px !important;
    }
    
    /* Mobile Quick Action Icons */
    #mobileQuickIcons {
        display: flex !important;
        gap: 4px !important;
    }
    #mobileQuickIcons .btn,
    #mobileQuickIcons .theme-toggle {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        padding: 0 !important;
        margin: 0 !important;
        font-size: 0.85rem !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Hamburger toggler */
    .navbar-toggler {
        border: none !important;
        padding: 6px !important;
        font-size: 1rem !important;
    }
    .navbar-toggler:focus {
        box-shadow: none !important;
    }
    
    /* Language switcher compact */
    .lang-switcher .btn, .nav-item .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    /* Dropdown full width on mobile */
    .navbar .dropdown-menu {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -10px 30px rgba(0,0,0,0.2) !important;
        transform: none !important;
        padding: 20px;
    }
}

/* ===== LANDSCAPE MODE ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section, .carousel-inner { min-height: 100vh !important; }
    .hero-content h1 { font-size: 1.5rem !important; }
    .hero-content p { display: none; }
    #statsSection { display: none; }
    .bottom-app-bar { padding-bottom: 5px !important; }
}

/* ===== SAFE AREA (notch phones — iPhone X+) ===== */
@supports (padding-top: env(safe-area-inset-top)) {
    .navbar { padding-top: env(safe-area-inset-top); }
    .pwa-install-banner { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
    footer { padding-bottom: env(safe-area-inset-bottom); }
    .bottom-app-bar {
        padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    }
}

/* ===== DARK MODE MOBILE TWEAKS ===== */
@media (max-width: 768px) {
    [data-theme="dark"] .trust-marquee-wrapper { background: #1a1a1a !important; }
    [data-theme="dark"] .search-glass-wrapper { background: #1e293b !important; }
    [data-theme="dark"] #searchDropdown { background: #1e293b !important; }
    [data-theme="dark"] .bottom-app-bar { 
        background: rgba(24, 25, 26, 0.97) !important; 
        border-top: 1px solid rgba(255,255,255,0.05) !important;
    }
    [data-theme="dark"] .pwa-modal .d-flex {
        background: #242526 !important;
        border-color: #3a3b3c !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .pwa-install-banner, .whatsapp-float, .scroll-to-top,
    .urgency-bar, #smartConcierge, .trust-marquee-wrapper,
    .navbar-toggler, .bottom-app-bar, .wa-pulse-widget,
    .omni-dial, .concierge-avatar-widget, #fomoToast,
    .social-proof-toast, .pwa-modal { display: none !important; }
}

/* ===== SMOOTH SCROLLING ===== */
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== FIX: Global button width override — prevent 100% width everywhere ===== */
@media (max-width: 768px) {
    /* Only hero CTA and other specific contexts get full-width buttons */
    .hero-content .btn,
    .modal-body .btn-primary.w-100,
    .btn-lg.w-100 {
        width: 100% !important;
    }
    /* Reset the aggressive width: 100% from style.css for all other buttons */
    .trip-card .btn,
    .filter-btn,
    .urgency-bar .btn,
    .navbar .btn,
    .concierge-btn,
    #categoryFilters .btn {
        width: auto !important;
        margin-bottom: 0 !important;
    }
}

/* ===== FIX: Trip card button text truncation prevention ===== */
@media (max-width: 768px) {
    .trip-card .d-flex.gap-2 .btn-outline-primary,
    .trip-card .d-flex.gap-2 .btn-primary {
        font-size: 0.82rem !important;
        padding: 8px 10px !important;
        letter-spacing: -0.02em;
    }
}

/* ===== FIX: GSAP reveal text rotation on mobile ===== */
@media (max-width: 768px) {
    .gsap-reveal {
        transform: none !important;
        opacity: 1 !important;
    }
}

/* ===== FIX: FOMO toast covering bottom nav "Home" button ===== */
@media (max-width: 768px) {
    #fomoToast,
    .social-proof-toast {
        bottom: 100px !important;
        left: 10px !important;
        right: auto !important;
        max-width: 260px !important;
        font-size: 0.8rem !important;
        z-index: 1040 !important;
    }
}

/* ===== FIX: WhatsApp & Scroll-to-top not overlapping footer text ===== */
@media (max-width: 768px) {
    .whatsapp-float,
    .wa-pulse-widget {
        bottom: 90px !important;
        right: 12px !important;
        width: 48px !important;
        height: 48px !important;
        z-index: 1045 !important;
    }
    .scroll-to-top {
        bottom: 145px !important;
        right: 12px !important;
        width: 40px !important;
        height: 40px !important;
        z-index: 1044 !important;
    }
}

/* ===== FIX: Desktop view — ensure action icons don't show mobile bar ===== */
@media (min-width: 992px) {
    #mobileQuickIcons {
        display: none !important;
    }
}
