/* Global Mobile Performance and UX Improvements */

/* Viewport and sizing fixes */
html {
  /* Better text rendering on mobile */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  
  /* Smooth scrolling */
  scroll-behavior: smooth;
}

body {
  /* Prevent horizontal scroll */
  overflow-x: hidden;
  max-width: 100vw;
  
  /* Better font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent zoom on input focus (iOS) */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Better image loading performance */
img {
  max-width: 100%;
  height: auto;
}

/* Mobile-optimized containers */
@media (max-width: 768px) {
  .container,
  .container-fluid {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  /* Better section spacing */
  section {
    padding: 60px 0;
  }
  
  /* Mobile typography scale */
  h1 {
    font-size: clamp(1.75rem, 5vw, 3rem);
    line-height: 1.2;
    margin-bottom: 1rem;
  }
  
  h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    line-height: 1.3;
    margin-bottom: 0.875rem;
  }
  
  h3 {
    font-size: clamp(1.25rem, 3.5vw, 2rem);
    line-height: 1.4;
    margin-bottom: 0.75rem;
  }
  
  p, .text-body {
    font-size: clamp(0.875rem, 2.5vw, 1.125rem);
    line-height: 1.6;
  }
  
  /* Better button spacing */
  .btn {
    min-height: 48px;
    padding: 12px 20px;
    margin: 8px 4px;
  }
  
  /* Mobile grid improvements */
  .row {
    margin-left: -8px;
    margin-right: -8px;
  }
  
  .col, [class*="col-"] {
    padding-left: 8px;
    padding-right: 8px;
  }
}

/* Ultra-small screen optimizations */
@media (max-width: 360px) {
  .container,
  .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }
  
  section {
    padding: 40px 0;
  }
  
  .btn {
    font-size: 14px;
    padding: 10px 16px;
    min-height: 44px;
  }
  
  .row {
    margin-left: -6px;
    margin-right: -6px;
  }
  
  .col, [class*="col-"] {
    padding-left: 6px;
    padding-right: 6px;
  }
}

/* Touch interaction improvements */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .btn:hover,
  .card:hover,
  .feature-card:hover {
    transform: none;
  }
  
  /* Larger touch targets */
  .btn, button, .nav-link {
    min-height: 48px;
    min-width: 48px;
  }
  
  /* Better touch feedback */
  .btn:active,
  button:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* Landscape mobile optimizations */
@media screen and (max-height: 480px) and (orientation: landscape) {
  /* Reduce vertical spacing in landscape */
  section {
    padding: 30px 0;
  }
  
  .hero-section {
    min-height: auto;
    padding: 20px 0;
  }
  
  h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }
  
  h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  
  .btn {
    margin: 4px 2px;
  }
}

/* Performance optimizations */
* {
  /* Better box sizing */
  box-sizing: border-box;
}

/* Reduce motion for users who prefer it */
@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;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a1a;
    color: #e0e0e0;
  }
  
  .card, .feature-card {
    background-color: #2a2a2a;
    border-color: #444;
  }
  
  .btn-primary {
    background-color: #0066cc;
    border-color: #0066cc;
  }
}

/* Print styles for mobile */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }
  
  .no-print,
  .btn,
  .navbar,
  .sidebar {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
}