/* ============================================
   APPLE-GRADE MOBILE OPTIMIZATIONS
   TBM Commercial Cleaning Website

   Targets: 375px - 768px viewports
   iOS minimum touch target: 44x44pt (48x48px for safety)
   Android minimum: 48x48dp

   Focus: Smooth 60fps animations, proper touch targets,
   stable layouts, accessible typography
   ============================================ */

/* ============================================
   CCB LICENSE VISIBILITY FIX
   ============================================ */
@media (max-width: 768px) {
    /* Make CCB license highly visible on mobile */
    .footer-bottom p {
        font-size: 0.9rem !important;
        line-height: 1.6 !important;
        color: rgba(255, 255, 255, 0.9) !important;
        font-weight: 500 !important;
        padding: 0.75rem 1rem;
        text-align: center;
    }

    /* Improve footer readability */
    .footer-section p,
    .footer-section li {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    /* Footer links - ensure touch targets */
    .footer-section a {
        display: inline-block;
        padding: 10px 6px;
        margin: -10px -6px;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}

/* ============================================
   TOUCH TARGETS - iOS/Android Compliance
   iOS minimum: 44x44pt (48px for safety)
   Android minimum: 48x48dp
   Spacing between targets: minimum 8px (12px preferred)
   ============================================ */
@media (max-width: 768px) {
    /* All buttons - 44pt minimum with proper spacing */
    .btn,
    button,
    input[type="submit"],
    input[type="button"],
    a[class*="btn"],
    .btn-primary,
    .btn-secondary,
    .btn-large {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 24px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        margin-bottom: 12px; /* Spacing between stacked buttons */
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 166, 81, 0.15);
    }

    /* Adjacent button spacing - prevent accidental taps */
    .btn + .btn,
    button + button,
    a[class*="btn"] + a[class*="btn"] {
        margin-left: 12px;
    }

    /* Stacked buttons in flex containers */
    .hero-cta .btn,
    .cta-buttons .btn,
    .btn-group .btn {
        margin-bottom: 12px;
    }

    .hero-cta .btn:last-child,
    .cta-buttons .btn:last-child,
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }

    /* Large action buttons - 52px for primary CTAs */
    .btn-large,
    .btn-large-primary,
    .btn-large-secondary {
        min-height: 52px;
        padding: 16px 32px;
        font-size: 17px;
        font-weight: 600;
    }

    /* Phone numbers - prominent touch target with proper styling */
    a[href^="tel:"] {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 17px;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        border-radius: 8px;
        background-color: rgba(0, 166, 81, 0.1);
        color: #00a651;
        text-decoration: none;
        margin: 4px 0;
        -webkit-tap-highlight-color: rgba(0, 166, 81, 0.15);
        transition: all 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    a[href^="tel:"]:active {
        background-color: rgba(0, 166, 81, 0.2);
        transform: scale(0.98);
    }

    /* Standalone phone CTA buttons - larger and more prominent */
    .phone-cta a[href^="tel:"],
    .hero a[href^="tel:"],
    a[href^="tel:"].btn {
        min-height: 52px;
        padding: 14px 24px;
        font-size: 18px;
        font-weight: 700;
        background: linear-gradient(135deg, #00a651 0%, #008a43 100%);
        color: white;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 166, 81, 0.25);
    }

    /* Navigation menu items - proper spacing */
    .navbar-menu a,
    .navbar-menu li a {
        min-height: 44px;
        padding: 14px 16px;
        display: flex;
        align-items: center;
        margin: 0;
    }

    /* Ensure spacing between nav items */
    .navbar-menu li {
        margin-bottom: 4px;
    }

    .navbar-menu li:last-child {
        margin-bottom: 0;
    }

    /* Form inputs - 16px font prevents iOS zoom */
    input,
    textarea,
    select,
    .form-input,
    .form-textarea,
    .form-select {
        min-height: 44px;
        font-size: 16px !important; /* CRITICAL: Prevents iOS zoom */
        padding: 12px 16px;
        border-radius: 8px;
        -webkit-appearance: none;
        appearance: none;
    }

    /* Preset cards and interactive cards */
    .preset-card,
    .response-option {
        min-height: 80px;
        padding: 16px 12px;
        margin-bottom: 12px;
    }
}

/* ============================================
   60FPS ANIMATIONS - Hardware Acceleration
   ============================================ */

/* Force GPU acceleration */
.btn,
.card,
.feature-card-modern,
.pricing-card,
.floating-quote-btn,
.preset-card,
.response-option,
video {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

/* Optimized easing curves - Apple's standard */
.btn,
button,
a,
.preset-card,
.response-option {
    transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.card,
.feature-card-modern,
.step-card {
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active states - instant feedback */
.btn:active,
button:active,
.preset-card:active,
.response-option:active {
    transform: scale(0.97);
    transition: all 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Floating button active state */
.floating-quote-btn:active {
    transform: translateY(0) scale(0.95);
    transition: all 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   SMOOTH VIDEO PLAYBACK
   ============================================ */
video {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    max-width: 100%;
    height: auto;
    display: block;
}

/* Video containers - stable aspect ratio */
[style*="padding-bottom: 56.25%"] {
    will-change: transform;
    transform: translateZ(0);
}

/* ============================================
   TYPOGRAPHY - Legible & Scalable
   ============================================ */
@media (max-width: 768px) {
    /* Base font size */
    html {
        font-size: 16px;
    }

    /* Headings - readable hierarchy */
    h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    h2 {
        font-size: 1.75rem;
        line-height: 1.25;
        margin-bottom: 0.875rem;
    }

    h3 {
        font-size: 1.4rem;
        line-height: 1.3;
    }

    h4 {
        font-size: 1.2rem;
    }

    /* Body text - comfortable reading */
    p {
        font-size: 1rem;
        line-height: 1.65;
        margin-bottom: 1rem;
    }

    /* Section titles */
    .section-title {
        font-size: 1.875rem;
        line-height: 1.25;
    }

    .section-subtitle {
        font-size: 1.05rem;
        line-height: 1.6;
    }

    /* Hero titles */
    .hero h1,
    .hero-title {
        font-size: 2.25rem;
        line-height: 1.2;
    }

    .hero p,
    .hero-subtitle {
        font-size: 1.1rem;
        line-height: 1.6;
    }
}

/* ============================================
   LAYOUT STABILITY - Prevent Wobbling
   ============================================ */

/* Prevent horizontal overflow */
html,
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

@media (max-width: 768px) {
    /* Container stability */
    .container,
    .container-narrow,
    .container-wide {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
        max-width: 100%;
        width: 100%;
    }

    /* Grid stability */
    .grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        width: 100%;
        max-width: 100%;
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    /* Prevent text overflow */
    h1, h2, h3, h4, h5, h6, p, li, a {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
    }

    /* Section padding optimization */
    section,
    .section {
        padding: 2.5rem 0;
    }

    /* Hero section */
    .hero,
    .hero-modern,
    .modern-hero {
        padding: 3rem 0 2.5rem;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */
@media (max-width: 768px) {
    /* Disable expensive hover effects */
    .card:hover,
    .feature-card-modern:hover,
    .pricing-card:hover,
    .testimonial-modern:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    /* Simplify shadows */
    .card,
    .feature-card-modern,
    .pricing-card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    /* Optimize images */
    img {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        transform: translateZ(0);
        max-width: 100%;
        height: auto;
    }

    /* Remove complex animations */
    .fade-in,
    [class*="animate"] {
        animation: none !important;
    }
}

/* ============================================
   TRUST STATS - Mobile Stack
   ============================================ */
@media (max-width: 768px) {
    .trust-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
        padding: 1.25rem 1rem;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.85rem;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .trust-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* ============================================
   FORMS - Mobile Optimized
   16px font minimum prevents iOS auto-zoom
   44px touch targets for all inputs
   ============================================ */
@media (max-width: 768px) {
    /* Form groups - proper vertical spacing */
    .form-group {
        margin-bottom: 20px;
    }

    /* Labels - clear hierarchy and spacing */
    .form-label,
    label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #1f2937;
        display: block;
        line-height: 1.4;
    }

    /* Input fields - iOS zoom prevention */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    input[type="search"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important; /* CRITICAL: Prevents iOS zoom */
        min-height: 44px;
        padding: 12px 16px;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        background-color: #ffffff;
        color: #1f2937;
        width: 100%;
        box-sizing: border-box;
        -webkit-appearance: none;
        appearance: none;
        transition: border-color 200ms ease, box-shadow 200ms ease;
    }

    /* Focus state - clear visual feedback */
    input:focus,
    textarea:focus,
    select:focus {
        outline: none;
        border-color: #00a651;
        box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.15);
    }

    /* Placeholder styling */
    input::placeholder,
    textarea::placeholder {
        color: #9ca3af;
        font-size: 16px;
    }

    /* Textarea - larger for messages */
    textarea {
        min-height: 120px;
        line-height: 1.5;
        resize: vertical;
    }

    /* Select dropdown - custom arrow */
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 16px center;
        padding-right: 40px;
    }

    /* Form buttons full width with proper height */
    .form-group .btn,
    form .btn,
    form button[type="submit"],
    form input[type="submit"] {
        width: 100%;
        min-height: 48px;
        font-size: 17px;
        font-weight: 600;
        margin-top: 8px;
    }

    /* Error states */
    input.error,
    input:invalid:not(:placeholder-shown),
    textarea.error,
    select.error {
        border-color: #ef4444;
    }

    /* Success states */
    input.success,
    input:valid:not(:placeholder-shown),
    textarea.success,
    select.success {
        border-color: #00a651;
    }
}

/* ============================================
   ACCESSIBILITY - Motion & Contrast
   ============================================ */

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Smooth scrolling for those who prefer it */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Focus states - keyboard navigation */
:focus-visible {
    outline: 2px solid #00a651;
    outline-offset: 3px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid #000;
    }

    a {
        text-decoration: underline;
    }
}

/* ============================================
   TAP HIGHLIGHT - Platform Feel
   ============================================ */
button,
a,
input[type="submit"],
input[type="button"],
.btn,
.card,
.preset-card,
.response-option {
    -webkit-tap-highlight-color: rgba(0, 166, 81, 0.15);
    -webkit-touch-callout: none;
}

/* ============================================
   FLOATING ACTION BUTTON - Enhanced
   ============================================ */
@media (max-width: 768px) {
    .floating-quote-btn {
        bottom: 24px;
        right: 20px;
        padding: 16px 24px;
        min-height: 52px;
        min-width: 52px;
        font-size: 1rem;
        font-weight: 700;
        box-shadow: 0 4px 20px rgba(0, 166, 81, 0.4);
        z-index: 9999;
    }

    .floating-quote-btn:active {
        transform: translateY(0) scale(0.95);
    }
}

/* ============================================
   CTA SECTIONS - Mobile Optimized
   ============================================ */
@media (max-width: 768px) {
    /* CTA buttons stack on mobile */
    .hero-cta,
    .hero-cta-group,
    .cta-buttons {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .hero-cta .btn,
    .hero-cta-group .btn,
    .cta-buttons .btn {
        width: 100%;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Phone number displays */
    a[href^="tel:"][style*="font-size: 2.5rem"],
    [style*="font-size: 2.5rem"] a[href^="tel:"] {
        font-size: 2rem !important;
    }
}

/* ============================================
   CRITICAL MOBILE FIXES - iPhone SE / Small Screens
   ============================================ */

/* Fix #1: Hero CTA Buttons - Prevent overflow on 320px devices */
@media (max-width: 480px) {
  .hero-buttons .btn,
  .hero-buttons a[class*="btn"],
  .hero section a.btn,
  section[style*="linear-gradient"] a.btn {
    width: 100% !important;
    max-width: 100% !important;
    min-width: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    display: block !important;
    text-align: center !important;
  }

  .hero-buttons,
  [style*="display: flex"][style*="gap"] {
    padding-left: 1rem;
    padding-right: 1rem;
    flex-direction: column !important;
  }
}

/* Fix #2: Newsletter Form - Stack on mobile */
@media (max-width: 480px) {
  #footer-newsletter-form,
  form[id*="newsletter"] {
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 0 1rem;
  }

  #footer-newsletter-form input[type="email"],
  #newsletter-email,
  form[id*="newsletter"] input[type="email"] {
    min-width: 100% !important;
    width: 100% !important;
    flex: none !important;
  }

  #footer-newsletter-form button,
  form[id*="newsletter"] button[type="submit"] {
    width: 100% !important;
    padding: 14px 20px !important;
  }
}

/* Fix #3: Lumina Chatbot - Full screen on small mobile */
@media (max-width: 480px) {
  #lumina-chat {
    width: 100% !important;
    height: calc(100vh - env(safe-area-inset-bottom, 0px)) !important;
    max-height: none !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 16px 16px 0 0 !important;
  }

  .lumina-chat-header {
    padding: 1rem !important;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .lumina-chat-input {
    padding: 1rem !important;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px)) !important;
  }

  .lumina-chat-input input {
    font-size: 16px !important;
    min-height: 48px !important;
  }

  #lumina-avatar {
    bottom: max(90px, calc(env(safe-area-inset-bottom, 0px) + 70px)) !important;
    right: 16px !important;
    z-index: 9997 !important;
  }
}

/* Fix #4: Extra small devices (iPhone SE 320px) */
@media (max-width: 375px) {
  .lumina-chat-messages {
    font-size: 0.95rem !important;
  }

  .lumina-quick-replies button {
    font-size: 0.9rem !important;
    padding: 10px 14px !important;
  }

  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  section {
    padding: 2rem 0 !important;
  }
}

/* Fix #5: Hide floating buttons on small mobile (z-index conflict) */
@media (max-width: 480px) {
  .floating-quote-btn,
  .tbm-floating-btn,
  [class*="floating"][class*="btn"] {
    display: none !important;
  }
}

/* ============================================
   COMPARISON TABLE - Mobile Optimization
   Location: index.html lines 649-727
   Fixes: TBM vs National pricing comparison
   ============================================ */

/* Tablets and large phones: Enhanced scrollable table */
@media (min-width: 481px) and (max-width: 768px) {
  /* Optimize table for horizontal scroll */
  section[style*="background: #f8f9fa"] div[style*="overflow-x"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
  }

  section[style*="background: #f8f9fa"] table {
    min-width: 600px;
    font-size: 0.9rem;
  }

  /* Reduce padding for better fit */
  section[style*="background: #f8f9fa"] table th {
    padding: 1rem 0.75rem !important;
    font-size: 0.95rem !important;
  }

  section[style*="background: #f8f9fa"] table td {
    padding: 0.875rem 0.625rem !important;
    font-size: 0.85rem !important;
  }

  /* Make first column sticky during scroll */
  section[style*="background: #f8f9fa"] table td:first-child,
  section[style*="background: #f8f9fa"] table th:first-child {
    position: sticky;
    left: 0;
    background: white;
    z-index: 2;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
  }
}

/* Small phones: Transform table into cards */
@media (max-width: 480px) {
  /* Break table structure into blocks */
  section[style*="background: #f8f9fa"] table,
  section[style*="background: #f8f9fa"] thead,
  section[style*="background: #f8f9fa"] tbody,
  section[style*="background: #f8f9fa"] tr,
  section[style*="background: #f8f9fa"] th,
  section[style*="background: #f8f9fa"] td {
    display: block !important;
    width: 100% !important;
  }

  /* Hide original table header */
  section[style*="background: #f8f9fa"] thead {
    display: none !important;
  }

  /* Each row becomes a card */
  section[style*="background: #f8f9fa"] tbody tr {
    margin-bottom: 1.5rem;
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  }

  /* Feature name (first column) */
  section[style*="background: #f8f9fa"] tbody tr td:first-child {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: #00a651 !important;
    padding: 0 0 1rem 0 !important;
    border-bottom: 2px solid #e8f5e8 !important;
    margin-bottom: 1rem !important;
    background: transparent !important;
    text-align: left !important;
  }

  /* Comparison rows - add labels */
  section[style*="background: #f8f9fa"] tbody tr td:not(:first-child) {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.875rem !important;
    margin-bottom: 0.5rem !important;
    background: #f9f9f9 !important;
    border-radius: 8px !important;
  }

  /* Add company labels using CSS */
  section[style*="background: #f8f9fa"] tbody tr td:nth-child(2)::before {
    content: "TBM Local";
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
  }

  section[style*="background: #f8f9fa"] tbody tr td:nth-child(3)::before {
    content: "National Chains";
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
  }

  section[style*="background: #f8f9fa"] tbody tr td:nth-child(4)::before {
    content: "Other Local";
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
  }

  /* Highlight TBM row */
  section[style*="background: #f8f9fa"] tbody tr td:nth-child(2) {
    background: #e8f5e8 !important;
    border: 2px solid #00a651 !important;
    font-weight: 700 !important;
  }

  /* Adjust icon sizes */
  section[style*="background: #f8f9fa"] tbody tr td span {
    font-size: 1.75rem !important;
  }

  /* Remove overflow wrapper on mobile */
  section[style*="background: #f8f9fa"] div[style*="overflow-x"] {
    overflow-x: visible !important;
  }

  /* Adjust section padding */
  section[style*="background: #f8f9fa"] {
    padding: 2.5rem 0 !important;
  }

  /* Reduce heading sizes */
  section[style*="background: #f8f9fa"] h2 {
    font-size: 1.75rem !important;
    line-height: 1.25 !important;
    margin-bottom: 0.75rem !important;
  }
}

/* iPhone SE and very small screens */
@media (max-width: 375px) {
  section[style*="background: #f8f9fa"] h2 {
    font-size: 1.5rem !important;
  }

  section[style*="background: #f8f9fa"] tbody tr {
    padding: 1rem !important;
  }

  section[style*="background: #f8f9fa"] tbody tr td:first-child {
    font-size: 1.05rem !important;
  }

  section[style*="background: #f8f9fa"] tbody tr td::before {
    font-size: 0.9rem !important;
  }
}

/* ============================================
   PRICING CARDS - Mobile Stack
   ============================================ */
@media (max-width: 768px) {
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .pricing-card {
        padding: 2rem 1.5rem;
    }
}

/* ============================================
   TESTIMONIALS - Mobile Friendly
   ============================================ */
@media (max-width: 768px) {
    .testimonial-card,
    .testimonial-modern {
        padding: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .testimonial-text,
    .testimonial-text-modern {
        font-size: 1rem;
        line-height: 1.65;
    }
}

/* ============================================
   MOBILE NAVIGATION DROPDOWN - iOS-Style
   Slide-in drawer with backdrop blur
   ============================================ */
@media (max-width: 768px) {
    /* Hamburger toggle - large touch target */
    .navbar-toggle,
    .mobile-menu-toggle,
    .hamburger {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: background-color 200ms ease;
    }

    .navbar-toggle:active,
    .mobile-menu-toggle:active,
    .hamburger:active {
        background-color: rgba(0, 0, 0, 0.05);
    }

    /* Hamburger icon bars */
    .navbar-toggle span,
    .hamburger span {
        display: block;
        width: 22px;
        height: 2px;
        background-color: #1f2937;
        border-radius: 1px;
        transition: all 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    /* Mobile menu backdrop */
    .mobile-menu-backdrop,
    .navbar-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        visibility: hidden;
        z-index: 998;
        transition: opacity 250ms ease, visibility 250ms ease;
    }

    .mobile-menu-backdrop.active,
    .navbar-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Mobile menu drawer - iOS-style slide from right */
    /* FIXED: Use right positioning to match navigation-refactored.css */
    .navbar-menu {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        bottom: 0 !important;
        width: min(300px, 80vw) !important;
        background: #ffffff !important;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15) !important;
        transform: none !important;
        transition: right 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
        z-index: 9999999 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-top: 72px !important;
        padding-bottom: env(safe-area-inset-bottom, 20px) !important;
        display: flex !important;
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .navbar-menu.active,
    .navbar-menu.open {
        right: 0 !important;
        transform: none !important;
    }

    /* Menu header with close button */
    .navbar-menu-header {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding: 0 16px;
        border-bottom: 1px solid #e5e7eb;
    }

    /* Close button */
    .navbar-menu-close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        border-radius: 50%;
        font-size: 24px;
        color: #6b7280;
        cursor: pointer;
        transition: all 200ms ease;
    }

    .navbar-menu-close:active {
        background: rgba(0, 0, 0, 0.05);
        transform: scale(0.95);
    }

    /* Navigation list styling */
    .navbar-menu ul,
    .navbar-menu nav {
        list-style: none;
        margin: 0;
        padding: 8px 0;
    }

    /* Navigation items */
    .navbar-menu li {
        margin: 0;
        border-bottom: 1px solid #f3f4f6;
    }

    .navbar-menu li:last-child {
        border-bottom: none;
    }

    /* Navigation links - proper touch targets */
    .navbar-menu a {
        display: flex;
        align-items: center;
        min-height: 48px;
        padding: 14px 20px;
        font-size: 17px;
        font-weight: 500;
        color: #1f2937;
        text-decoration: none;
        transition: background-color 150ms ease;
    }

    .navbar-menu a:active {
        background-color: #f3f4f6;
    }

    /* Active/Current page indicator */
    .navbar-menu a.active,
    .navbar-menu li.current a {
        color: #00a651;
        font-weight: 600;
        background-color: rgba(0, 166, 81, 0.05);
    }

    /* CTA button in menu */
    .navbar-menu .btn,
    .navbar-menu .navbar-cta {
        margin: 16px 20px;
        width: calc(100% - 40px);
        justify-content: center;
    }
}

/* ============================================
   SAFE AREA INSETS - iPhone X+ Support
   ============================================ */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .floating-quote-btn {
        bottom: max(20px, env(safe-area-inset-bottom));
        right: max(20px, env(safe-area-inset-right));
    }

    .navbar {
        padding-top: max(0px, env(safe-area-inset-top));
    }

    .navbar-menu {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* ============================================
   PREVENT LAYOUT SHIFT
   ============================================ */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* Reserve space for images to prevent shift */
img[width][height] {
    height: auto;
}

/* ============================================
   FIXED BOTTOM CTA - MOBILE ONLY
   ============================================ */
.tbm-mobile-cta-fixed {
  position: fixed;
  bottom: 20px;
  left: 16px;
  right: 16px;
  z-index: 9998;
  animation: slideUpMobile 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: none; /* Hidden by default */
}

@media (max-width: 768px) {
  .tbm-mobile-cta-fixed {
    display: block;
  }

  /* Adjust for notched devices */
  @supports (padding: env(safe-area-inset-bottom)) {
    .tbm-mobile-cta-fixed {
      bottom: calc(20px + env(safe-area-inset-bottom));
    }
  }
}

@media (min-width: 769px) {
  .tbm-mobile-cta-fixed {
    display: none !important;
  }
}

.tbm-mobile-cta-button {
  width: 100%;
  min-height: 56px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #00a651 0%, #008a43 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 166, 81, 0.4);
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.tbm-mobile-cta-button:active {
  transform: scale(0.98);
  box-shadow: 0 2px 12px rgba(0, 166, 81, 0.5);
}

@keyframes slideUpMobile {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ============================================
   CHAT ACTION BUTTONS - APPLE-GRADE 52PX
   ============================================ */
.lumina-action-buttons button,
.lumina-action-btn,
[class*="lumina"] button {
  min-height: 52px !important;
  padding: 14px 20px !important;
  font-size: 17px !important;
  font-weight: 600;
  border-radius: 10px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.lumina-action-buttons button:active,
.lumina-action-btn:active {
  transform: scale(0.97);
}

/* Large icon for action buttons */
.lumina-action-buttons button svg,
.lumina-action-btn svg {
  width: 24px;
  height: 24px;
}

/* ============================================
   PRICING CHECKOUT MODAL - MOBILE OPTIMIZATION
   ============================================ */
@media (max-width: 768px) {
  #checkoutModal {
    padding: 10px !important;
  }

  #checkoutModal > div {
    margin: 20px auto !important;
    padding: 1.5rem !important;
    max-width: calc(100% - 20px) !important;
  }

  #checkoutModal input,
  #checkoutModal select {
    min-height: 52px !important;
    font-size: 16px !important;
    padding: 14px 16px !important;
    border-radius: 8px;
    -webkit-appearance: none;
  }

  /* Close button - increase to 48x48px for accessibility */
  #checkoutModal button[onclick="closeCheckout()"] {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    font-size: 2rem !important;
  }

  /* Number input - hide default spinners */
  input[type="number"] {
    -moz-appearance: textfield;
  }

  input[type="number"]::-webkit-inner-spin-button,
  input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
}

@media (max-width: 480px) {
  /* Stack all grid layouts on very small screens */
  #checkoutModal [style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  #checkoutModal [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  #checkoutModal [style*="grid-template-columns: repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* Cleaner selection buttons - larger touch targets */
  #checkoutModal .cleaner-btn,
  #checkoutModal button[style*="padding: 0.75rem"] {
    min-height: 52px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    padding: 1rem !important;
  }

  /* Pricing summary - reduce padding */
  #checkoutModal [style*="linear-gradient"] {
    padding: 1rem !important;
  }

  #checkoutModal #totalPrice {
    font-size: 1.75rem !important;
  }

  /* Reduce font sizes for mobile readability */
  #checkoutModal h2 {
    font-size: 1.5rem !important;
  }

  #checkoutModal h3 {
    font-size: 1.2rem !important;
  }
}

/* ============================================
   PRICING CARDS - REMOVE SCALE ON MOBILE
   ============================================ */
@media (max-width: 480px) {
  .pricing-grid [style*="transform: scale"],
  [style*="transform: scale(1.05)"] {
    transform: scale(1) !important;
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.15) !important;
  }
}

/* ============================================
   SECURITY SECTION - MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  /* Stack video and content vertically on mobile */
  section[style*="1a1a2e"] > div > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* Reduce section padding on mobile */
  section[style*="1a1a2e"] {
    padding: 3rem 0 !important;
  }

  /* Adjust heading size */
  section[style*="1a1a2e"] h2 {
    font-size: 1.75rem !important;
    line-height: 1.3 !important;
  }

  /* Video container - full width */
  section[style*="1a1a2e"] video {
    border-radius: 12px !important;
  }

  /* Security items - smaller icons on mobile */
  section[style*="1a1a2e"] div[style*="width: 48px"] {
    width: 40px !important;
    height: 40px !important;
  }
}

@media (max-width: 480px) {
  section[style*="1a1a2e"] h2 {
    font-size: 1.5rem !important;
  }

  section[style*="1a1a2e"] p {
    font-size: 0.95rem !important;
  }
}

/* ============================================
   DARK MODE SUPPORT (Optional Enhancement)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Respect user's dark mode preference if desired */
    /* Currently disabled - can be enabled per client request */
}
