/* ==========================================================================
   Safar Tour and Travels - Comprehensive Responsive Stylesheet
   Covers Viewports: 320px, 360px, 375px, 390px, 414px, 480px, 768px, 1024px, 1280px, 1440px+
   ========================================================================== */

/* Prevent horizontal overflow globally */
html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Background scroll lock when mobile navigation is open */
body.menu-open {
  overflow: hidden !important;
  touch-action: none;
  height: 100vh;
}

/* Hide floating items and bottom fixed bars when mobile drawer is open */
body.menu-open .fixed-cta-bar,
body.menu-open .chatbot-trigger,
body.menu-open .chatbot-panel,
body.menu-open .floating-whatsapp,
body.menu-open .floating-call-now {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Base Desktop Settings (>= 1024px) */
@media (min-width: 1024px) {
  .container {
    max-width: min(100% - 48px, 1240px);
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }

  .mobile-toggle {
    display: none !important;
  }

  .desktop-only {
    display: inline-flex !important;
  }

  .mobile-nav-actions {
    display: none !important;
  }

  .fixed-cta-bar {
    display: none !important;
  }

  .floating-whatsapp {
    display: flex !important;
  }

  .floating-call-now {
    display: inline-flex !important;
  }

  .hero-cursor-vehicle {
    display: block;
  }
}

/* Laptops & Standard Desktops (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
  .nav-menu {
    gap: 14px;
  }
  .nav-link {
    font-size: 0.88rem;
  }
  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
    gap: 24px;
  }
}

/* Tablets (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .container {
    max-width: min(100% - 32px, 960px);
    padding-left: 0;
    padding-right: 0;
  }

  .top-header-inner {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  .top-info-list {
    gap: 12px;
    font-size: 0.78rem;
  }

  .site-header {
    height: 70px;
    background-color: var(--nav-bg);
  }
  body {
    padding-top: 70px;
  }
  .header-inner {
    height: 70px;
    padding: 0 16px;
  }
  .logo-img {
    height: 42px;
  }

  .mobile-toggle {
    display: flex !important;
  }

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

  /* Fixed Mobile Navigation Drawer positioned strictly below the header */
  .nav-menu {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: calc(100vh - 70px);
    height: calc(100dvh - 70px);
    max-height: calc(100dvh - 70px);
    background-color: var(--nav-bg);
    flex-direction: column;
    align-items: stretch;
    padding: 20px 20px calc(30px + env(safe-area-inset-bottom, 0px));
    gap: 4px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border-top: 1px solid rgba(212, 175, 55, 0.25);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 999;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  }

  .nav-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-link {
    display: flex;
    align-items: center;
    min-height: 46px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-xs);
    text-decoration: none;
  }
  .nav-link::after {
    display: none;
  }
  .nav-link:hover {
    color: var(--brand-gold);
    background: rgba(255, 255, 255, 0.05);
  }
  .nav-link.active {
    color: var(--brand-gold);
    background: rgba(212, 175, 55, 0.1);
    border-left: 3px solid var(--brand-gold);
    font-weight: 700;
  }

  .mobile-nav-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .mobile-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.98rem;
    text-decoration: none;
  }

  .hero-section {
    min-height: 580px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .hero-vehicle-showcase {
    display: none;
  }

  .fleet-grid,
  .services-grid,
  .tours-grid,
  .dest-grid,
  .exp-grid,
  .how-grid,
  .testimonial-grid,
  .guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .intro-grid,
  .why-grid,
  .contact-map-grid,
  .detail-layout-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
  }
}

/* ==========================================================================
   Mobile Devices (< 768px: 320px, 360px, 375px, 390px, 414px, 480px)
   ========================================================================== */
@media (max-width: 767px) {
  body {
    padding-bottom: 64px !important;
  }

  .container {
    width: 100%;
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }

  /* 1. Top Header - Hidden on small mobile to give full focus to sticky navbar */
  .top-header {
    display: none !important;
  }

  /* 2. Header & Navigation */
  .site-header {
    height: 66px;
    background-color: var(--nav-bg);
  }
  body {
    padding-top: 66px;
  }

  .header-inner {
    height: 66px;
    padding: 0 16px;
  }

  .site-logo {
    max-width: 165px;
  }

  .logo-img {
    height: 38px;
  }

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

  .mobile-toggle {
    display: flex !important;
  }

  /* Fixed Mobile Navigation Drawer positioned strictly below the header */
  .nav-menu {
    position: fixed;
    top: 66px;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: calc(100vh - 66px);
    height: calc(100dvh - 66px);
    max-height: calc(100dvh - 66px);
    background-color: var(--nav-bg);
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    gap: 2px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.65);
    border-top: 1px solid rgba(212, 175, 55, 0.25);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 999;
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  }

  .nav-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-link {
    display: flex;
    align-items: center;
    min-height: 46px;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    padding: 11px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-xs);
    text-decoration: none;
  }
  .nav-link::after {
    display: none;
  }
  .nav-link:hover {
    color: var(--brand-gold);
    background: rgba(255, 255, 255, 0.05);
  }
  .nav-link.active {
    color: var(--brand-gold);
    background: rgba(212, 175, 55, 0.1);
    border-left: 3px solid var(--brand-gold);
    font-weight: 700;
  }

  .mobile-nav-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .mobile-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
  }

  .mobile-nav-btn.btn-call {
    background: #0d2238;
    color: #ffffff;
    border: 1px solid rgba(212, 175, 55, 0.4);
  }
  .mobile-nav-btn.btn-call svg {
    color: var(--brand-gold);
  }
  .mobile-nav-btn.btn-wa {
    background: var(--whatsapp);
    color: #ffffff;
  }
  .mobile-nav-btn.btn-quote {
    background: var(--primary);
    color: #ffffff;
  }

  /* 3. Hero Section (Mobile 520px - 600px Height, Crisp & Photography-Focused) */
  .hero-section {
    min-height: 520px;
    padding: 30px 0;
  }

  .hero-overlay {
    background: linear-gradient(
      180deg,
      rgba(11, 30, 54, 0.8) 0%,
      rgba(11, 30, 54, 0.65) 50%,
      rgba(11, 30, 54, 0.85) 100%
    );
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hero-title {
    font-size: clamp(2rem, 8vw, 2.7rem);
    line-height: 1.15;
    margin-bottom: 12px;
  }

  .hero-desc {
    font-size: 0.96rem;
    line-height: 1.5;
    margin-bottom: 20px;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
    margin-bottom: 20px;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
  }

  .hero-trust-bar {
    gap: 12px;
    font-size: 0.82rem;
  }

  .hero-visual-card {
    display: none; /* Keep mobile hero compact & photo-driven */
  }

  /* 4. Section Spacing on Mobile (45px - 60px) */
  .intro-section,
  .fleet-section,
  .services-section,
  .tours-section,
  .dest-section,
  .why-section,
  .experience-section,
  .how-section,
  .testimonials-section,
  .guide-section,
  .faq-section,
  .quote-section,
  .contact-map-section,
  .detail-content-section,
  .final-cta-section {
    padding: 50px 0;
  }

  .section-header {
    margin-bottom: 30px;
  }

  .section-title {
    font-size: clamp(1.65rem, 6vw, 2rem);
  }

  /* 5. Mobile 1-Column Grids */
  .intro-grid,
  .fleet-grid,
  .services-grid,
  .tours-grid,
  .dest-grid,
  .why-grid,
  .why-features-grid,
  .exp-grid,
  .how-grid,
  .testimonial-grid,
  .guide-grid,
  .contact-map-grid,
  .detail-layout-grid,
  .intro-stats-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .quote-form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .quote-card {
    padding: 24px 16px;
    border-radius: var(--radius-md);
  }

  .form-input,
  .form-select,
  .form-textarea {
    min-height: 46px;
    font-size: 0.95rem;
  }

  .map-wrapper {
    height: 280px;
  }

  /* 6. Footer on Mobile */
  .site-footer {
    padding: 45px 0 16px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 26px;
    margin-bottom: 30px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .footer-legal-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  /* 7. Fixed Mobile Unified Action Bar (Call, WhatsApp, Get Quote) */
  .fixed-cta-bar {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 56px;
    background: #0b1e36;
    border-top: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
    z-index: 990;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .fixed-cta-inner {
    display: grid;
    grid-template-columns: 1fr 1.15fr 1.15fr;
    height: 100%;
    width: 100%;
  }

  .fixed-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 100%;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    color: #ffffff;
    border: none;
  }

  .fixed-cta-call {
    background: #071527;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
  }
  .fixed-cta-whatsapp {
    background: var(--whatsapp);
    color: #ffffff;
  }
  .fixed-cta-quote {
    background: var(--primary);
    color: #ffffff;
  }

  .floating-whatsapp {
    display: none !important;
  }

  .floating-call-now {
    display: none !important;
  }

  .chatbot-trigger {
    bottom: 68px;
    right: 14px;
    width: 44px;
    height: 44px;
  }

  .chatbot-panel {
    bottom: 66px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: calc(100vw - 16px);
    height: min(70vh, 520px);
  }
}

/* ==========================================================================
   Smallest Mobiles (320px - 375px)
   ========================================================================== */
@media (max-width: 375px) {
  .site-logo {
    max-width: 140px;
  }
  .logo-img {
    height: 32px;
  }
  .hero-title {
    font-size: 1.85rem;
  }
  .fixed-cta-btn {
    font-size: 0.78rem;
    gap: 4px;
  }
  .fleet-actions {
    grid-template-columns: 1fr;
  }

  /* Responsive Dropdown Menu for Mobile */
  .nav-dropdown {
    position: static;
  }

  .nav-dropdown-menu {
    position: static;
    background: rgba(11, 30, 54, 0.7);
    border: none;
    border-top: 1px solid rgba(212, 175, 55, 0.1);
    border-radius: 0;
    min-width: auto;
    margin: 0;
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    display: flex !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-dropdown.active .nav-dropdown-menu {
    max-height: 300px;
  }

  .nav-dropdown-item {
    padding: 12px 16px;
    margin: 0;
    font-size: 0.95rem;
  }

  .nav-dropdown-item:first-child {
    border-radius: 0;
  }

  .nav-dropdown-item:last-child {
    border-radius: 0;
  }

  /* Hero Section Mobile Slider Controls */
  .hero-slider-controls {
    bottom: 16px;
    gap: 6px;
  }

  .hero-slider-dot {
    width: 8px;
    height: 8px;
  }

  .hero-slider-dot.active {
    width: 10px;
    height: 10px;
  }

  /* Back Link Mobile Optimization */
  .back-link {
    font-size: 0.85rem;
    padding: 6px 12px;
    gap: 6px;
  }

  .back-link svg {
    width: 18px;
    height: 18px;
  }
}
