/* Mobile-specific adjustments (320px - 767px) */

/* Base mobile adjustments */
@media (max-width: 767px) {
  html {
    font-size: 15px;
  }
  
  .lf-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Improve touch targets */
  .btn,
  .lf-input,
  .lf-select,
  .lf-chip {
    min-height: 2.75rem;
  }
  
  .lf-bottom-nav__item {
    min-height: 3.5rem;
    padding: 0.5rem 0;
  }
  
  /* Adjust card padding for small screens */
  .lf-card {
    padding: 1.25rem;
  }
  
  .lf-card-header {
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
  }
  
  /* Stack elements vertically on very small screens */
  .flex-between,
  .flex-center {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  /* Adjust typography for small screens */
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.25rem;
  }
  
  h3 {
    font-size: 1.125rem;
  }
}

/* Extra small devices (320px - 374px) */
@media (max-width: 374px) {
  html {
    font-size: 14px;
  }
  
  .lf-content {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }
  
  .lf-card {
    padding: 1rem;
    border-radius: var(--lf-radius-md);
  }
  
  /* Adjust spacing for very small screens */
  .gap-4 {
    gap: 0.75rem;
  }
  
  .gap-8 {
    gap: 1rem;
  }
  
  .mt-6 {
    margin-top: 1rem;
  }
  
  .mt-8 {
    margin-top: 1.5rem;
  }
  
  /* Make OTP inputs smaller but still touch-friendly */
  .lf-otp-input {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.125rem;
  }
  
  /* Adjust bottom nav for very small screens */
  .lf-bottom-nav {
    padding: 0.5rem 0;
  }
  
  .lf-bottom-nav__item span {
    font-size: 0.6875rem;
  }
  
  .lf-bottom-nav__icon {
    font-size: 1.125rem;
  }
}

/* Small devices (375px - 413px) */
@media (min-width: 375px) and (max-width: 413px) {
  .lf-card {
    padding: 1.125rem;
  }
  
  .btn {
    padding: 0.75rem 1.25rem;
  }
}

/* Mobile landscape and tablet adjustments */
@media (min-width: 568px) and (max-width: 767px) {
  .lf-quick-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .lf-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .lf-toast-container {
    max-width: 26rem;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Prevent horizontal scrolling */
@media (max-width: 767px) {
  body {
    overflow-x: hidden;
    width: 100%;
  }
  
  .lf-table-wrapper {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}

/* Improve touch scrolling on iOS */
@media (max-width: 767px) {
  .lf-content {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Prevent pull-to-refresh on overscroll */
  body {
    overscroll-behavior-y: contain;
  }
}

/* Fix for mobile keyboards */
@media (max-width: 767px) {
  .lf-auth-page {
    min-height: -webkit-fill-available;
  }
  
  /* Prevent zoom on input focus for iOS */
  @supports (-webkit-touch-callout: none) {
    input,
    select,
    textarea {
      font-size: 16px; /* Prevents iOS zoom */
    }
  }
}

/* Safe area insets for modern phones */
@supports (padding: max(0px)) {
  .lf-bottom-nav {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }
  
  .lf-content {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom));
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn-primary {
    border: 2px solid currentColor;
  }
  
  .lf-input,
  .lf-select,
  .lf-textarea {
    border-width: 2px;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .skeleton {
    animation: none;
  }
}

/* Dark mode considerations (optional future support) */
@media (prefers-color-scheme: dark) {
  .lf-card,
  .lf-table-wrapper,
  .lf-table thead,
  .lf-stat-card,
  .lf-quick-btn,
  .lf-worker-card,
  .lf-activity-list,
  .lf-availability,
  .lf-timeline-content,
  .lf-activity-item {
    background-color: #1a2c1f;
    border-color: #2d4033;
  }
  
  .lf-bg {
    background-color: #121a14;
  }
  
  .lf-surface {
    background-color: #1a2c1f;
  }
  
  .lf-border,
  .lf-border-light {
    border-color: #2d4033;
  }
  
  .lf-text-main {
    color: #e8f5ee;
  }
  
  .lf-text-secondary {
    color: #c6d6cc;
  }
  
  .lf-text-muted {
    color: #8a9990;
  }
}