/* Responsive Design Enhancements for Gogolo */

/* Base responsive adjustments */
html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

/* Mobile-first approach */
body {
  min-width: 320px; /* Minimum supported width */
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Responsive typography */
@media (max-width: 640px) {
  .tw-page-title {
    font-size: 1.5rem; /* Smaller on mobile */
  }
  
  .tw-section-title {
    font-size: 1.25rem; /* Smaller on mobile */
  }
  
  .tw-card-title {
    font-size: 1.125rem; /* Smaller on mobile */
  }
}

/* Responsive form elements */
@media (max-width: 640px) {
  .tw-form-input,
  .tw-form-select,
  .tw-form-textarea {
    font-size: 16px; /* Prevent iOS zoom on focus */
    padding: 0.5rem; /* Slightly larger touch target */
  }
  
  .tw-form-label {
    margin-bottom: 0.25rem; /* Tighter spacing on mobile */
  }
}

/* Responsive buttons */
@media (max-width: 640px) {
  .tw-btn-primary,
  .tw-btn-secondary,
  .tw-btn-outline,
  .tw-btn-ghost {
    width: 100%; /* Full width on mobile */
    margin-bottom: 0.5rem; /* Spacing between stacked buttons */
  }
  
  .tw-btn-sm {
    padding: 0.375rem 0.75rem; /* Slightly larger on mobile for touch */
  }
}

/* Responsive cards */
@media (max-width: 640px) {
  .tw-card {
    margin-bottom: 1rem; /* More spacing between cards */
  }
  
  .tw-card-body {
    padding: 1rem; /* Smaller padding on mobile */
  }
}

/* Responsive tables */
@media (max-width: 768px) {
  .tw-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  .tw-table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .tw-table-responsive thead {
    display: none; /* Hide headers on small screens */
  }
  
  .tw-table-responsive tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
  }
  
  .tw-table-responsive tbody td {
    display: block;
    text-align: right;
    padding: 0.5rem;
    border: none;
    border-bottom: 1px solid #e5e7eb;
  }
  
  .tw-table-responsive tbody td:before {
    content: attr(data-label);
    float: left;
    font-weight: bold;
  }
  
  .tw-table-responsive tbody td:last-child {
    border-bottom: none;
  }
}

/* Responsive grid layouts */
.tw-responsive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Responsive images */
.tw-responsive-image {
  max-width: 100%;
  height: auto;
}

/* Responsive map containers */
@media (max-width: 768px) {
  [id^="map-"] {
    height: 300px !important; /* Smaller maps on mobile */
  }
  
  .sticky.top-20 {
    position: relative !important; /* Non-sticky on mobile */
    top: 0 !important;
  }
}

/* Responsive navigation */
@media (max-width: 768px) {
  .tw-breadcrumbs {
    flex-wrap: wrap;
    font-size: 0.875rem;
  }
}

/* Responsive alerts */
@media (max-width: 640px) {
  .tw-alert {
    padding: 0.75rem;
  }
  
  .tw-alert-title {
    font-size: 1rem;
  }
}

/* Responsive modals */
@media (max-width: 640px) {
  .tw-modal {
    width: 95%;
    max-width: none;
  }
}

/* Responsive tabs */
@media (max-width: 640px) {
  .tw-tabs {
    flex-wrap: wrap;
  }
  
  .tw-tab {
    flex: 1 0 auto;
    text-align: center;
    padding: 0.5rem;
  }
}

/* Responsive pagination */
@media (max-width: 640px) {
  .tw-pagination {
    justify-content: center;
  }
  
  .tw-pagination-item:not(.tw-pagination-prev):not(.tw-pagination-next):not(.tw-pagination-active) {
    display: none;
  }
}

/* Responsive dropdowns */
@media (max-width: 640px) {
  .tw-dropdown-menu {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0.5rem 0.5rem 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 50vh;
    overflow-y: auto;
  }
  
  .tw-dropdown-menu.show {
    transform: translateY(0);
  }
  
  .tw-dropdown-item {
    padding: 0.75rem 1rem;
  }
}

/* Responsive sidebar */
@media (max-width: 768px) {
  #sidebar {
    width: 100% !important;
    position: fixed !important;
    left: 0;
    top: 70px !important;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 50;
  }
  
  #sidebar.expanded {
    transform: translateX(0);
  }
}

/* Responsive footer */
@media (max-width: 640px) {
  footer .flex {
    flex-direction: column;
    text-align: center;
  }
  
  footer .justify-between > div {
    margin-bottom: 1rem;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background-color: white !important;
    color: black !important;
  }
  
  .tw-card {
    box-shadow: none !important;
    border: 1px solid #e5e7eb !important;
  }
  
  a {
    text-decoration: none !important;
    color: black !important;
  }
  
  .tw-btn-primary,
  .tw-btn-secondary,
  .tw-btn-outline,
  .tw-btn-ghost {
    display: none !important;
  }
}

/* High contrast mode adjustments */
@media (forced-colors: active) {
  .tw-btn-primary,
  .tw-btn-secondary,
  .tw-btn-outline,
  .tw-btn-ghost {
    forced-color-adjust: none;
    border: 2px solid currentColor;
  }
  
  .tw-card {
    forced-color-adjust: none;
    border: 1px solid currentColor;
  }
}
