/* Mobile Responsive Fixes for Souq Al-Sham */

/* Base mobile improvements */
@media (max-width: 768px) {
  /* Prevent text overflow */
  * {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Container padding */
  .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Typography fixes */
  h1 {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
  }

  h2 {
    font-size: 1.25rem !important;
    line-height: 1.3 !important;
  }

  h3 {
    font-size: 1.1rem !important;
    line-height: 1.3 !important;
  }

  p, div, span {
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
  }

  /* Button improvements */
  button, .btn {
    min-height: 44px !important;
    font-size: 1rem !important;
    padding: 12px 16px !important;
  }

  /* Input improvements */
  input, textarea, select {
    min-height: 44px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    padding: 12px !important;
  }

  /* Card spacing */
  .card, [class*="card"] {
    margin-bottom: 12px !important;
  }

  /* Grid improvements */
  .grid {
    gap: 12px !important;
  }

  /* Messages page fixes */
  .messages-container {
    height: calc(100vh - 120px) !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .messages-list {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 12px !important;
    max-height: calc(100vh - 250px) !important;
  }

  .message-input-container {
    position: sticky !important;
    bottom: 0 !important;
    background: white !important;
    padding: 12px !important;
    border-top: 1px solid #e5e7eb !important;
    z-index: 10 !important;
  }

  .message-input-container input {
    width: 100% !important;
    margin-bottom: 8px !important;
  }

  .message-input-container button {
    width: 100% !important;
  }

  /* Safety tips banner */
  .safety-tips {
    font-size: 0.85rem !important;
    padding: 8px 12px !important;
    margin-bottom: 12px !important;
  }

  /* Ad details page */
  .ad-details-sidebar {
    position: sticky !important;
    bottom: 0 !important;
    background: white !important;
    padding: 16px !important;
    border-top: 2px solid #e5e7eb !important;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1) !important;
    z-index: 20 !important;
  }

  .ad-details-sidebar button {
    width: 100% !important;
    margin-bottom: 8px !important;
  }

  /* Header improvements */
  header {
    padding: 12px !important;
  }

  header button, header a {
    font-size: 0.9rem !important;
    padding: 8px 12px !important;
  }

  /* Footer improvements */
  footer {
    padding: 24px 12px !important;
  }

  footer .grid {
    grid-template-columns: 1fr !important;
  }

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

  /* Prevent horizontal scroll */
  body, html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* Fix overlapping content */
  .relative {
    position: relative !important;
  }

  .absolute {
    position: absolute !important;
  }

  /* Spacing utilities */
  .space-y-2 > * + * {
    margin-top: 8px !important;
  }

  .space-y-4 > * + * {
    margin-top: 16px !important;
  }

  .space-y-6 > * + * {
    margin-top: 24px !important;
  }

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

  .flex-col {
    flex-direction: column !important;
  }

  /* Search filters mobile */
  .search-filters {
    position: relative !important;
    padding: 12px !important;
    margin-bottom: 16px !important;
  }

  .search-filters select,
  .search-filters input {
    width: 100% !important;
    margin-bottom: 8px !important;
  }
}

/* Extra small devices (phones, less than 375px) */
@media (max-width: 375px) {
  h1 {
    font-size: 1.25rem !important;
  }

  h2 {
    font-size: 1.1rem !important;
  }

  p, div, span {
    font-size: 0.9rem !important;
  }

  button, .btn {
    font-size: 0.9rem !important;
    padding: 10px 12px !important;
  }
}

/* Tablet improvements (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .container {
    max-width: 720px !important;
    margin: 0 auto !important;
  }

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

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

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

