/* Mobile Responsiveness Fixes for FBS Algeria */

/* Mobile viewport */
@media (max-width: 768px) {
  /* Base mobile styles */
  body {
    font-size: 14px;
  }

  /* Header adjustments */
  header {
    padding: 0.75rem 1rem !important;
  }

  header h1 {
    font-size: 1.25rem !important;
  }

  /* Navigation */
  nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  nav a {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
  }

  /* Cards and containers */
  .card, .bg-white {
    margin: 0.5rem !important;
    padding: 1rem !important;
  }

  /* Grid layouts - force single column on mobile */
  .grid {
    grid-template-columns: 1fr !important;
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  /* Wallet page mobile */
  #wallet-page .grid-cols-3 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  #wallet-page button {
    padding: 1rem !important;
  }

  /* Provider Dashboard mobile */
  .provider-dashboard .grid {
    grid-template-columns: 1fr !important;
  }

  .order-card {
    margin-bottom: 1rem !important;
  }

  /* Modals on mobile */
  .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 1rem !important;
  }

  /* Forms on mobile */
  input, textarea, select {
    font-size: 16px !important; /* Prevents zoom on iOS */
  }

  /* Buttons on mobile */
  button {
    min-height: 44px !important; /* iOS touch target */
    padding: 0.75rem 1rem !important;
  }

  /* Tables - make scrollable */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

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

  /* Map containers */
  #map, .map-container {
    height: 300px !important;
  }

  /* Bottom navigation spacing */
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Text sizes */
  h1 { font-size: 1.5rem !important; }
  h2 { font-size: 1.25rem !important; }
  h3 { font-size: 1.125rem !important; }
  h4 { font-size: 1rem !important; }

  /* Spacing utilities */
  .p-8 { padding: 1rem !important; }
  .p-6 { padding: 0.75rem !important; }
  .m-8 { margin: 1rem !important; }
  .m-6 { margin: 0.75rem !important; }

  /* Flex wrapping */
  .flex {
    flex-wrap: wrap !important;
  }

  /* Images */
  img {
    max-width: 100% !important;
    height: auto !important;
  }
}

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

  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  header {
    padding: 0.5rem 1rem !important;
  }

  .modal-content {
    max-height: 80vh !important;
    overflow-y: auto !important;
  }
}

/* Very small phones */
@media (max-width: 375px) {
  body {
    font-size: 13px;
  }

  button {
    font-size: 0.875rem !important;
  }

  .modal-content {
    width: 98vw !important;
    margin: 0.5rem !important;
  }
}

/* iOS safe areas */
@supports (padding: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .fixed-bottom {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}

/* Touch-friendly click areas */
.touch-target {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Prevent text selection on buttons (better UX) */
button, a {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  user-select: none;
  -webkit-user-select: none;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbars on mobile for cleaner look */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 4px;
    height: 4px;
  }

  ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
  }
}
