/* =============================================================================
   VizachiAI — Responsive & Mobile Optimization (responsive.css)
   Black Diamond & 24K Gold Luxury Edition
   ============================================================================= */

@import url('./variables.css');

/* =============================================================================
   1. Large Tablets & Small Laptops (max-width: 1024px)
   ============================================================================= */
@media (max-width: 1024px) {
  .container {
    max-width: 960px;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .grid-layout {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
  }

  /* Internal App sidebar collapse on tablets */
  .sidebar {
    position: fixed !important;
    left: -290px !important;
    width: 280px !important;
    height: 100vh !important;
    height: 100dvh !important;
    top: 0 !important;
    bottom: 0 !important;
    z-index: 1000 !important;
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 0 40px rgba(8, 8, 36, 0.25) !important;
    background: #FFFFFF !important;
  }

  .sidebar.open {
    left: 0 !important;
  }

  .main-content-with-sidebar,
  [style*="margin-left: 260px"],
  [style*="margin-left: 200px"],
  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
  }

  #mobile-menu-toggle-btn,
  #mobile-menu-btn,
  .mobile-menu-toggle {
    display: flex !important;
  }

  #sidebar-close-btn {
    display: flex !important;
  }
}

/* =============================================================================
   2. Tablets & Smartphones (max-width: 768px)
   ============================================================================= */
@media (max-width: 768px) {

  /* ---- Global Prevention of Viewport Horizontal Overflow ---- */
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    background-color: var(--bg-main) !important;
  }

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

  /* ---- Navbar Styling on Mobile ---- */
  .navbar {
    padding: 0 16px !important;
    height: 64px !important;
    background: rgba(249, 247, 244, 0.98) !important;
    border-bottom: 1px solid rgba(197, 168, 128, 0.3) !important;
  }

  .navbar-brand span.font-display {
    font-size: 18px !important;
  }

  .navbar-brand span[style*="font-size: 9px"] {
    font-size: 8px !important;
    letter-spacing: 0.12em !important;
  }

  /* Desktop nav hidden on mobile */
  .nav-menu,
  .nav-actions,
  .hidden-mobile {
    display: none !important;
  }

  /* Mobile menu button active */
  .mobile-menu-toggle,
  #mobile-menu-btn,
  #mobile-menu-toggle-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: var(--radius-md) !important;
    background: var(--bg-cream-soft) !important;
    border: 1px solid rgba(197, 168, 128, 0.4) !important;
    color: var(--diamond-black) !important;
    cursor: pointer !important;
  }

  /* ---- Hero Section & Search Bar on Mobile ---- */
  .hero-section {
    padding: 36px 0 50px !important;
  }

  .hero-brand-badge {
    padding: 6px 14px 6px 8px !important;
    gap: 8px !important;
    max-width: 95% !important;
  }

  .hero-badge-text {
    font-size: 11px !important;
  }

  .hero-simulation-card {
    padding: 20px 18px !important;
    border-radius: 20px !important;
  }

  .floating-badge {
    display: none !important; /* hide absolute floating badges on narrow screens */
  }

  .vip-cta-section {
    padding: 60px 0 !important;
  }

  .vip-cta-emblem-wrapper {
    width: 76px !important;
    height: 76px !important;
    margin-bottom: 20px !important;
  }

  .vip-cta-emblem-inner {
    width: 68px !important;
    height: 68px !important;
  }

  .vip-cta-emblem-inner img {
    width: 38px !important;
    height: 38px !important;
  }

  #hero-search-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
  }

  #hero-search-grid > div,
  #hero-search-grid input,
  #hero-search-grid select,
  #hero-search-grid button {
    width: 100% !important;
    height: 48px !important;
    font-size: 14px !important;
  }

  /* Hero quick tags */
  .hero-section .badge {
    font-size: 11px !important;
    padding: 4px 8px !important;
  }

  /* ---- Landmarks Grid on Mobile ---- */
  #destinations .container > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .card-landmark {
    min-height: 380px !important;
  }

  /* ---- Live Stats Grid on Mobile ---- */
  .stats-bar-grid,
  section[style*="stat"] .container > div[style*="grid-template-columns"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
  }

  /* ---- 8-Sector Bento Grid on Mobile ---- */
  #sectors .container > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  /* ---- Instant Calculator on Mobile ---- */
  #instant-calculator .container > div[style*="grid-template-columns"],
  div[style*="grid-template-columns: 1.2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  /* ---- AI Agent Chat Simulator on Mobile ---- */
  #ai-demo .container > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .demo-question-btn {
    font-size: 12px !important;
    padding: 8px 12px !important;
  }

  #demo-chat-messages {
    height: 240px !important;
  }

  /* ---- Comparison Table on Mobile ---- */
  .table-responsive-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    margin: 0 !important;
  }

  .table-responsive-wrapper table {
    min-width: 580px !important;
  }

  /* ---- How It Works (3 Steps) & Pricing Grid on Mobile ---- */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  /* ---- FAQ Item Header touch size ---- */
  .faq-header {
    padding: 16px !important;
  }

  /* ---- Footer Grid on Mobile ---- */
  footer div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
  }

  /* ---- Typography Adjustments for Mobile ---- */
  h1 { font-size: 28px !important; line-height: 1.2 !important; }
  h2, .section-title { font-size: 22px !important; line-height: 1.25 !important; }
  h3 { font-size: 18px !important; }
  .section-subtitle { font-size: 14px !important; margin-bottom: 30px !important; }
  
  /* ---- Inner App Padding for Bottom Nav Clearance ---- */
  .app-main,
  .dashboard-container,
  .main-content-with-sidebar,
  main[style*="padding: 32px"] {
    padding: 16px !important;
    padding-bottom: 90px !important;
  }
}

/* =============================================================================
   3. Small Smartphones (max-width: 480px)
   ============================================================================= */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .stats-bar-grid,
  section[style*="stat"] .container > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .btn-md, .btn-lg {
    padding: 11px 16px !important;
    font-size: 13px !important;
  }

  .card {
    padding: 18px !important;
    border-radius: var(--radius-lg) !important;
  }

  /* Modals on small screens: bottom sheet */
  .paynet-modal-card,
  .modal-content {
    border-radius: 20px 20px 0 0 !important;
    margin-top: auto !important;
    max-height: 90vh !important;
  }
}

/* =============================================================================
   4. Sidebar Overlay Backdrop
   ============================================================================= */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 36, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* =============================================================================
   5. Mobile Bottom Navigation Bar (For Authenticated App Pages)
   ============================================================================= */
.bottom-nav-bar {
  display: none;
}

@media (max-width: 768px) {
  /* Bottom navigation only on authenticated app pages (e.g. body.app-layout or when injected) */
  body.app-layout .bottom-nav-bar,
  .bottom-nav-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 64px !important;
    background: rgba(249, 247, 244, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-top: 1px solid rgba(197, 168, 128, 0.3) !important;
    box-shadow: 0 -4px 20px rgba(8, 8, 36, 0.08) !important;
    z-index: 9999 !important;
    align-items: center !important;
    justify-content: space-around !important;
    padding: 0 4px !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }

  /* Don't show bottom-nav on landing page */
  body:not(.app-layout):not(.dashboard-page) #mobile-bottom-nav.landing-hide {
    display: none !important;
  }

  .bottom-nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 !important;
    height: 100% !important;
    color: var(--text-muted) !important;
    text-decoration: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    padding: 4px 0 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .bottom-nav-item.active {
    color: var(--diamond-black) !important;
  }

  .bottom-nav-item.active::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 20% !important;
    right: 20% !important;
    height: 3px !important;
    background: var(--gradient-gold) !important;
    border-radius: 0 0 4px 4px !important;
    box-shadow: 0 2px 8px rgba(197, 168, 128, 0.6) !important;
  }

  .bottom-nav-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 24px !important;
  }

  .bottom-nav-label {
    font-size: 10px !important;
    font-weight: 600 !important;
    margin-top: 2px !important;
    letter-spacing: -0.01em !important;
  }

  .bottom-nav-item.active .bottom-nav-label {
    font-weight: 700 !important;
    color: var(--diamond-black) !important;
  }

  .bottom-nav-badge {
    position: absolute !important;
    top: -3px !important;
    right: -8px !important;
    background: var(--gradient-gold) !important;
    color: var(--diamond-dark) !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    padding: 1px 5px !important;
    border-radius: 8px !important;
  }
}
