/* Mobile Responsive Styles */

/* Touch-Friendly Sizes */
@media (max-width: 768px) {
  /* Increase touch targets */
  button,
  a,
  input[type="checkbox"],
  input[type="radio"] {
    min-height: 48px;
    min-width: 48px;
  }

  /* Larger text inputs on mobile */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px;
  }

  /* Mobile Typography */
  h1 {
    font-size: 1.875rem; /* 30px */
  }

  h2 {
    font-size: 1.5rem; /* 24px */
  }

  h3 {
    font-size: 1.25rem; /* 20px */
  }

  /* Mobile Padding */
  .mobile-p-4 {
    padding: 1rem;
  }

  .mobile-px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .mobile-py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  /* Mobile Spacing */
  .mobile-space-y-4 > * + * {
    margin-top: 1rem;
  }

  /* Stack Cards on Mobile */
  .mobile-stack > * {
    width: 100%;
    margin-bottom: 1rem;
  }

  /* Full Width Modals on Mobile */
  [role="dialog"] {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
  }

  /* Sticky Mobile Header */
  header {
    position: sticky;
    top: 0;
    z-index: 40;
  }

  /* Mobile Table Responsiveness */
  .mobile-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-table-scroll table {
    min-width: 600px;
  }

  /* Mobile Card Tables (Stack Instead of Table) */
  .mobile-card-table {
    display: none;
  }

  .mobile-cards {
    display: block;
  }

  /* Hide Desktop Elements */
  .desktop-only {
    display: none !important;
  }

  /* Show Mobile Elements */
  .mobile-only {
    display: block !important;
  }

  /* Mobile Navigation */
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 0.5rem;
    z-index: 40;
  }

  .dark .mobile-nav {
    background: #1f2937;
    border-top-color: #374151;
  }

  /* Mobile Bottom Bar Spacing */
  body.has-mobile-nav main {
    padding-bottom: 4rem;
  }

  /* Swipeable Cards */
  .swipeable {
    touch-action: pan-y;
  }

  /* Pull to Refresh Indicator */
  .pull-to-refresh {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem;
    background: rgba(15, 75, 128, 0.9);
    color: white;
    border-radius: 0 0 0.5rem 0.5rem;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
  }

  .pull-to-refresh.active {
    opacity: 1;
  }

  /* Mobile Search Full Screen */
  .mobile-search-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 50;
    padding: 1rem;
  }

  .dark .mobile-search-fullscreen {
    background: #111827;
  }

  /* Mobile Dropdown Full Width */
  [data-dropdown-target="menu"] {
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
  }

  /* Mobile Stats Grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* Compact Mobile Cards */
  .card-compact {
    padding: 0.75rem;
  }

  /* Mobile Safe Areas (for notch devices) */
  .mobile-safe-top {
    padding-top: max(1rem, env(safe-area-inset-top));
  }

  .mobile-safe-bottom {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .mobile-safe-left {
    padding-left: max(1rem, env(safe-area-inset-left));
  }

  .mobile-safe-right {
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

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

  .tablet-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Show Desktop Elements */
  .desktop-only {
    display: block !important;
  }

  /* Hide Mobile Elements */
  .mobile-only {
    display: none !important;
  }
}

/* Desktop Styles */
@media (min-width: 1025px) {
  .mobile-only {
    display: none !important;
  }

  .desktop-only {
    display: block !important;
  }

  /* Hover states (only on desktop) */
  .hover-effects:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .landscape-hide {
    display: none;
  }

  .landscape-compact {
    padding: 0.5rem;
  }
}

/* iOS Specific */
@supports (-webkit-touch-callout: none) {
  /* iOS safe areas */
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  /* Fix iOS input zoom */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* iOS momentum scrolling */
  .scroll-smooth {
    -webkit-overflow-scrolling: touch;
  }
}

/* Android Specific */
@media (max-width: 768px) {
  /* Prevent text size adjustment */
  html {
    -webkit-text-size-adjust: 100%;
  }

  /* Better tap highlighting */
  * {
    -webkit-tap-highlight-color: rgba(15, 75, 128, 0.1);
  }
}

/* PWA Specific */
@media (display-mode: standalone) {
  /* When app is installed as PWA */
  .pwa-only {
    display: block !important;
  }

  .browser-only {
    display: none !important;
  }
}
