/* Mobile Touch Target Optimization */
@media (max-width: 768px) {
  /* Ensure minimum touch target size of 44x44px */
  button, 
  a, 
  input[type="submit"], 
  input[type="button"],
  .touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Increase spacing between interactive elements */
  .space-y-2 > * + * {
    margin-top: 0.75rem;
  }
  
  /* Larger tap areas for form controls */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  textarea,
  select {
    min-height: 48px;
    padding: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  /* Larger checkboxes and radio buttons */
  input[type="checkbox"],
  input[type="radio"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
  }
  
  /* Better spacing for mobile lists */
  .mobile-list-item {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
  }
  
  /* Swipeable card styles */
  .swipeable {
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
  }
  
  /* Progressive disclosure accordion */
  .disclosure-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
  }
  
  .disclosure-content.expanded {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
  }
  
  /* Mobile-optimized modals */
  .mobile-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    animation: slideUp 0.3s ease-out;
  }
  
  @keyframes slideUp {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
  
  /* Optimized image loading */
  .lazy-image {
    background: #f3f4f6;
    filter: blur(5px);
    transition: filter 0.3s;
  }
  
  .lazy-image.loaded {
    filter: blur(0);
  }
  
  /* Mobile-first card layout */
  .mobile-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
  
  /* Sticky mobile actions */
  .mobile-sticky-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 16px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 30;
  }
  
  /* Improved mobile typography */
  body {
    font-size: 16px;
    line-height: 1.6;
  }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  /* Mobile-optimized tables */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  /* Responsive images */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* Mobile navigation improvements */
  .mobile-nav-item {
    padding: 12px 16px;
    border-radius: 8px;
    transition: background-color 0.2s;
  }
  
  .mobile-nav-item:active {
    background-color: #f3f4f6;
  }
}

/* Tablet-specific optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
  .tablet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* High contrast mode for accessibility */
@media (prefers-contrast: high) {
  button, a {
    border: 2px solid currentColor;
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .mobile-card {
    background: #1f2937;
    color: #f3f4f6;
  }
  
  .mobile-modal {
    background: #1f2937;
    color: #f3f4f6;
  }
}