/* ========================================
   MOBILE OPTIMIZATION - ArcadiaB
   Enhanced mobile experience fixes
   Created: 2026-02-16
   ======================================== */

/* BASE MOBILE IMPROVEMENTS */
@media (max-width: 768px) {
  
  /* Better text readability */
  body {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  
  /* Larger touch targets (minimum 44x44px) */
  .btn,
  .btn-primary,
  .btn-secondary,
  .nav-link,
  button,
  a.btn {
    min-height: 44px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }
  
  /* Hero section - better mobile layout */
  .hero {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
    min-height: auto;
  }
  
  .hero-content {
    text-align: center;
    max-width: 100%;
  }
  
  .hero h1 {
    font-size: 2.25rem;
    line-height: 1.2;
    margin-bottom: var(--space-md);
  }
  
  .hero p {
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: var(--space-lg);
  }
  
  /* CTA buttons - stack vertically with more spacing */
  .hero-cta {
    flex-direction: column;
    gap: var(--space-md);
    width: 100%;
  }
  
  .hero-cta .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Cards - better spacing */
  .card {
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
  }
  
  .card-title {
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
  }
  
  .card-text {
    font-size: 1rem;
    line-height: 1.6;
  }
  
  /* Grid layouts - proper stacking */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  /* Stats - larger, more readable */
  .stat-number {
    font-size: 2.5rem;
    line-height: 1.1;
  }
  
  .stat-label {
    font-size: 0.875rem;
    margin-top: var(--space-xs);
  }
  
  /* Forms - larger inputs */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px; /* Prevents iOS zoom */
    min-height: 44px;
    padding: 0.75rem 1rem;
  }
  
  textarea {
    min-height: 120px;
  }
  
  /* Spacing improvements */
  .section {
    padding: var(--space-xl) 0;
  }
  
  .container {
    padding: 0 var(--space-md);
  }
  
  /* Navigation fixes */
  /* Ensure nav header stays fixed at top on mobile */
  .nav {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
  }
  
  .nav-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-lg);
    gap: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    border-top: 1px solid var(--border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  
  .nav-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  
  .nav-link {
    font-size: 1.125rem;
    padding: 0.75rem 0;
    width: 100%;
    border-bottom: 1px solid var(--border-subtle);
  }
  
  .nav-link:last-child {
    border-bottom: none;
  }
  
  /* Mega menu mobile */
  .mega-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-top: var(--space-sm);
  }
  
  .mega-menu-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .mega-menu-grid a {
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
  }
  
  .mega-menu-icon {
    font-size: 2rem;
    margin-bottom: var(--space-xs);
  }
  
  .mega-menu-title {
    font-size: 1.125rem;
    margin-bottom: var(--space-xs);
  }
  
  .mega-menu-desc {
    font-size: 0.875rem;
    line-height: 1.5;
  }
  
  /* Footer improvements */
  .footer {
    padding: var(--space-xl) 0;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    text-align: center;
  }
  
  .footer-section {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-subtle);
  }
  
  .footer-section:last-child {
    border-bottom: none;
  }
  
  .footer-links {
    flex-direction: column;
    gap: var(--space-sm);
  }
  
  .footer-link {
    font-size: 0.938rem;
    padding: 0.5rem 0;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
    padding-top: var(--space-lg);
  }
  
  /* Product cards */
  .product-card {
    padding: var(--space-lg);
  }
  
  .product-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
  }
  
  .product-title {
    font-size: 1.375rem;
    margin-bottom: var(--space-sm);
  }
  
  /* Feature lists */
  .feature-list {
    gap: var(--space-md);
  }
  
  .feature-item {
    padding: var(--space-md);
  }
  
  .feature-icon {
    min-width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
  
  .feature-title {
    font-size: 1rem;
    margin-bottom: var(--space-xs);
  }
  
  .feature-text {
    font-size: 0.875rem;
    line-height: 1.5;
  }
  
  /* Trust badges */
  .trust-badge {
    padding: var(--space-md);
    min-height: 80px;
  }
  
  .trust-badge-icon {
    font-size: 2rem;
    margin-bottom: var(--space-xs);
  }
  
  .trust-badge-text {
    font-size: 0.875rem;
  }
  
  /* Images - responsive */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* Video embeds */
  .video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
  }
  
  .video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
  
  /* Better table handling */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Hide desktop-only elements */
  .desktop-only {
    display: none !important;
  }
  
  /* Show mobile-only elements */
  .mobile-only {
    display: block !important;
  }
}

/* SMALL MOBILE (< 375px) */
@media (max-width: 374px) {
  html {
    font-size: 13px;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.375rem;
  }
  
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.938rem;
  }
}

/* HORIZONTAL MOBILE (landscape) */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    padding-top: var(--space-md);
    padding-bottom: var(--space-md);
    min-height: auto;
  }
  
  .nav-menu {
    max-height: calc(100vh - 60px);
  }
}

/* TOUCH IMPROVEMENTS */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover states on touch devices */
  .btn:hover,
  .nav-link:hover,
  .card:hover {
    transform: none;
  }
  
  /* Larger touch targets */
  a, button, input, select, textarea {
    min-height: 44px;
  }
  
  /* Prevent double-tap zoom */
  a, button {
    touch-action: manipulation;
  }
}

/* ACCESSIBILITY - Respect user preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* HIGH CONTRAST MODE */
@media (prefers-contrast: high) {
  .btn-primary {
    border: 2px solid currentColor;
  }
  
  .card {
    border: 2px solid var(--border);
  }
}

/* ========================================
   PHASE 1 MOBILE FIXES - 2026-02-16
   Critical issues for conversion optimization
   ======================================== */

/* STACKER INMOBILIARIO - Direct graphic (no phone frame since OTC service) */
@media (max-width: 768px) {
  /* Stacker uses direct graphic, not phone mockup */
  .products-grid .card-product:nth-child(6) .product-graphic {
    max-width: 280px;
    margin: 1.5rem auto 0;
  }
  
  .products-grid .card-product:nth-child(6) .product-graphic img {
    width: 100%;
    height: auto;
    border-radius: 0.75rem;
  }
  
  /* Ensure Stacker description is full-width and readable */
  .products-grid .card-product:nth-child(6) {
    text-align: center;
  }
  
  .products-grid .card-product:nth-child(6) .card-copy {
    max-width: 100%;
    margin: 0 auto;
  }
}

/* HERO SECTION - Explicit vertical stacking */
@media (max-width: 768px) {
  .hero-grid,
  .hero .grid-2 {
    display: flex !important;
    flex-direction: column;
    gap: 2rem;
  }
  
  .hero-content {
    order: 1;
  }
  
  .hero .phone-mockup {
    order: 2;
    max-width: 280px;
    margin: 0 auto;
  }
  
  .hero .phone-frame {
    max-width: 100%;
  }
  
  /* Trust pills after CTAs */
  .trust-pills,
  .hero-trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }
  
  .trust-pill {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }
}

/* NAVIGATION - Enhanced mobile treatment */
@media (max-width: 768px) {
  /* Hide BTC price on mobile nav bar */
  .nav-actions .btc-price {
    display: none;
  }
  
  /* Reduce spacing between nav actions */
  .nav-actions {
    gap: 0.5rem;
  }
  
  /* Ensure hamburger is large enough */
  .nav-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
  }
  
  /* Language toggle smaller on mobile */
  .lang-toggle {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
}

/* PRODUCTS GRID - Phone mockup sizing */
@media (max-width: 768px) {
  .card-product .phone-mockup {
    max-width: 200px;
    margin: 1.5rem auto 0;
  }
  
  .card-product .phone-frame {
    max-width: 100%;
  }
  
  .card-product .phone-screen img {
    width: 100%;
    height: auto;
  }
  
  /* Product cards - better mobile layout */
  .card-product {
    display: flex;
    flex-direction: column;
    text-align: center;
  }
  
  .card-product > div:first-child {
    order: 1;
  }
  
  .card-product .phone-mockup {
    order: 2;
  }
}

/* CTA BUTTONS - Full width treatment */
@media (max-width: 768px) {
  .hero-cta .btn,
  .hero-cta .btn-primary,
  .hero-cta .btn-secondary {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  
  .btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
  }
  
  /* Ensure arrow icons don't break layout */
  .btn .arrow {
    margin-left: 0.5rem;
  }
}

/* TRUST BAR - Desktop bullets, mobile stacking */
.trust-bar span:not(:last-child)::after {
  content: " • ";
  margin: 0 var(--space-sm);
}

@media (max-width: 768px) {
  .trust-bar .container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .trust-bar span:not(:last-child)::after {
    content: none; /* Remove bullets on mobile */
  }
  
  .trust-bar span {
    margin: 0;
  }
  
  /* STATS GRID - Better wrapping */
  .stats-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }
  
  .trust-badge {
    flex: 0 1 auto;
    min-width: 140px;
  }
  
  /* Hide less important badges on smallest screens */
  @media (max-width: 374px) {
    .trust-badge:nth-child(n+4) {
      display: none;
    }
  }
}

/* SECTION HEADERS - Better mobile typography */
@media (max-width: 768px) {
  .section-title {
    font-size: 1.75rem;
    line-height: 1.3;
    margin-bottom: 1rem;
  }
  
  .section-subtitle {
    font-size: 1rem;
    line-height: 1.6;
  }
  
  .section-label {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
  }
}

/* PHONE MOCKUPS - Prevent overflow */
@media (max-width: 768px) {
  .phone-mockup,
  .phone-frame {
    max-width: 100%;
    overflow: hidden;
  }
  
  .phone-screen {
    width: 100%;
  }
  
  .phone-screen img {
    max-width: 100%;
    height: auto;
    display: block;
  }
}


/* ========================================
   PHASE 2 MOBILE FIXES - Additional Improvements
   ======================================== */

/* AUDIENCE CARDS - Vertical stacking */
@media (max-width: 768px) {
  .audience-grid,
  .grid-2.audience {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .audience-card {
    width: 100%;
  }
}

/* CONTENT BRIDGES - Compact mobile treatment */
@media (max-width: 768px) {
  .content-bridge-image,
  .bridge-preview-image {
    display: none;
  }
  
  .content-bridge-title {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
  }
  
  .content-bridge-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.875rem;
    line-height: 1.5;
  }
}

/* MAXI CHAT WIDGET - Safe positioning */
@media (max-width: 768px) {
  #maxi-chat-button,
  .maxi-chat-button,
  .chat-widget-button {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 5rem) !important;
    right: 1rem !important;
    z-index: 999;
  }
}

/* FORMS - Better mobile UX */
@media (max-width: 768px) {
  .form-group {
    margin-bottom: 1.5rem;
  }
  
  label {
    font-size: 0.938rem;
    margin-bottom: 0.5rem;
    display: block;
  }
  
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    width: 100%;
    font-size: 16px; /* Prevents iOS zoom */
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
  }
  
  textarea {
    min-height: 120px;
    resize: vertical;
  }
  
  .form-submit {
    width: 100%;
  }
}

/* TESTIMONIALS - Mobile carousel */
@media (max-width: 768px) {
  .testimonials-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .testimonial-card {
    width: 100%;
  }
}

/* STATS / NUMBERS - Larger on mobile for impact */
@media (max-width: 768px) {
  .stat-number,
  .big-number {
    font-size: 2.5rem;
    line-height: 1.1;
    font-weight: 700;
  }
  
  .stat-label {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    opacity: 0.8;
  }
}

/* CALL-TO-ACTION SECTIONS - Full prominence */
@media (max-width: 768px) {
  .cta-section {
    padding: 2.5rem 1.5rem;
    text-align: center;
  }
  
  .cta-title {
    font-size: 1.75rem;
    line-height: 1.3;
    margin-bottom: 1rem;
  }
  
  .cta-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
  }
  
  .cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }
  
  .cta-buttons .btn {
    width: 100%;
  }
}

/* PREVENT HORIZONTAL SCROLL */
@media (max-width: 768px) {
  body,
  html {
    overflow-x: hidden;
    max-width: 100vw;
  }
  
  .container {
    max-width: 100%;
    overflow-x: hidden;
  }
  
  * {
    max-width: 100%;
  }
  
  /* Exception for elements that need full width */
  .nav,
  .nav-menu,
  .hero,
  .section {
    max-width: none;
  }
}

/* SPACING ADJUSTMENTS - More breathing room */
@media (max-width: 768px) {
  .mb-xs { margin-bottom: 0.5rem; }
  .mb-sm { margin-bottom: 0.75rem; }
  .mb-md { margin-bottom: 1rem; }
  .mb-lg { margin-bottom: 1.5rem; }
  .mb-xl { margin-bottom: 2rem; }
  
  .mt-xs { margin-top: 0.5rem; }
  .mt-sm { margin-top: 0.75rem; }
  .mt-md { margin-top: 1rem; }
  .mt-lg { margin-top: 1.5rem; }
  .mt-xl { margin-top: 2rem; }
  
  .py-xl { padding-top: 3rem; padding-bottom: 3rem; }
  .py-lg { padding-top: 2rem; padding-bottom: 2rem; }
}

