/**
 * PMTiles Generation Service - Responsive Styles
 * 
 * Additional responsive styles to complement Tailwind CSS
 */

/* Custom responsive breakpoints */
:root {
  --breakpoint-xs: 480px;
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
}

/* Mobile-first approach */

/* Base styles for small screens */
.map-container {
  height: 300px;
}

.card-grid {
  grid-template-columns: 1fr;
}

.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Hide elements on small screens */
.hide-on-mobile {
  display: none;
}

/* Adjust font sizes for better readability on small screens */
h1 {
  font-size: 1.5rem !important;
}

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

h3 {
  font-size: 1.125rem !important;
}

/* Adjust spacing for small screens */
.mobile-p-2 {
  padding: 0.5rem !important;
}

.mobile-px-2 {
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

.mobile-py-2 {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

/* Adjust form elements for small screens */
input, select, textarea {
  font-size: 16px !important; /* Prevents iOS zoom on focus */
}

/* Media queries for larger screens */

/* Small screens (sm) */
@media (min-width: 640px) {
  .hide-on-mobile {
    display: initial;
  }
  
  .show-on-mobile {
    display: none;
  }
  
  h1 {
    font-size: 1.875rem !important;
  }
  
  h2 {
    font-size: 1.5rem !important;
  }
  
  h3 {
    font-size: 1.25rem !important;
  }
  
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Medium screens (md) */
@media (min-width: 768px) {
  .map-container {
    height: 400px;
  }
  
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large screens (lg) */
@media (min-width: 1024px) {
  .map-container {
    height: 500px;
  }
  
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Extra large screens (xl) */
@media (min-width: 1280px) {
  .map-container {
    height: 600px;
  }
  
  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Touch device optimizations */
@media (hover: none) {
  /* Increase tap target sizes */
  button, 
  .btn,
  a.btn,
  .nav-link,
  input[type="checkbox"],
  input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Add more space between interactive elements */
  .touch-friendly-spacing > * {
    margin-bottom: 0.75rem;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .page-break {
    page-break-before: always;
  }
  
  body {
    font-size: 12pt;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .dark-mode-auto {
    background-color: #1a202c;
    color: #e2e8f0;
  }
  
  .dark-mode-auto .card,
  .dark-mode-auto .bg-white {
    background-color: #2d3748;
    color: #e2e8f0;
  }
  
  .dark-mode-auto .border,
  .dark-mode-auto .border-gray-200 {
    border-color: #4a5568;
  }
  
  .dark-mode-auto .text-gray-900 {
    color: #e2e8f0;
  }
  
  .dark-mode-auto .text-gray-700 {
    color: #cbd5e0;
  }
  
  .dark-mode-auto .text-gray-500 {
    color: #a0aec0;
  }
}

/* Responsive utilities */
.flex-responsive {
  display: flex;
  flex-direction: column;
}

@media (min-width: 640px) {
  .flex-responsive {
    flex-direction: row;
  }
}

/* Responsive grid system (complementing Tailwind's grid) */
.grid-responsive {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .grid-responsive {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-responsive {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Responsive table */
.table-responsive-stack tr {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 1rem;
}

.table-responsive-stack td,
.table-responsive-stack th {
  display: block;
  text-align: left;
  padding: 0.5rem;
}

.table-responsive-stack td:before {
  content: attr(data-label);
  font-weight: bold;
  display: inline-block;
  width: 40%;
}

@media (min-width: 768px) {
  .table-responsive-stack tr {
    display: table-row;
    border-bottom: none;
    margin-bottom: 0;
  }
  
  .table-responsive-stack td,
  .table-responsive-stack th {
    display: table-cell;
  }
  
  .table-responsive-stack td:before {
    content: none;
  }
}

/* Responsive navigation improvements */
.nav-responsive {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
}

.nav-responsive.active {
  transform: translateX(0);
}

.nav-responsive a {
  color: white;
  font-size: 1.5rem;
  margin: 1rem 0;
}

@media (min-width: 768px) {
  .nav-responsive {
    position: static;
    background-color: transparent;
    transform: none;
    flex-direction: row;
    justify-content: flex-start;
    height: auto;
  }
  
  .nav-responsive a {
    color: inherit;
    font-size: inherit;
    margin: 0 1rem 0 0;
  }
}