/* Responsive Fixes and Enhancements */

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

/* Improved Grid Responsiveness */
.responsive-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

/* Breakpoint-specific grid layouts */
@media (min-width: 320px) {
  .responsive-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

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

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

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

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

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

/* Orientation-specific fixes */
@media (orientation: landscape) and (max-height: 500px) {
  /* Landscape mobile adjustments */
  .hero-section {
    min-height: 100vh;
    padding: 2rem 0;
  }
  
  .hero-content {
    padding: 1rem 0;
  }
  
  .hero-title {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 1rem;
  }
  
  .hero-subtitle {
    font-size: 1.125rem;
    margin-bottom: 2rem;
  }
  
  .hero-buttons {
    gap: 1rem;
  }
}

@media (orientation: portrait) and (max-width: 480px) {
  /* Portrait mobile optimizations */
  .hero-title {
    font-size: 2rem;
    line-height: 1.3;
  }
  
  .hero-subtitle {
    font-size: 1rem;
    line-height: 1.5;
  }
  
  .plant-card {
    margin-bottom: 1rem;
  }
}

/* Container width optimizations */
.container-responsive {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .container-responsive {
    max-width: 640px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 768px) {
  .container-responsive {
    max-width: 768px;
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (min-width: 1024px) {
  .container-responsive {
    max-width: 1024px;
  }
}

@media (min-width: 1280px) {
  .container-responsive {
    max-width: 1280px;
  }
}

@media (min-width: 1536px) {
  .container-responsive {
    max-width: 1536px;
  }
}

/* Typography scaling */
.text-responsive-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.text-responsive-base {
  font-size: 1rem;
  line-height: 1.5rem;
}

.text-responsive-lg {
  font-size: 1.125rem;
  line-height: 1.75rem;
}

@media (min-width: 640px) {
  .text-responsive-sm {
    font-size: 1rem;
    line-height: 1.5rem;
  }
  
  .text-responsive-base {
    font-size: 1.125rem;
    line-height: 1.75rem;
  }
  
  .text-responsive-lg {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
}

@media (min-width: 768px) {
  .text-responsive-lg {
    font-size: 1.5rem;
    line-height: 2rem;
  }
}

/* Button responsive improvements */
.btn-responsive {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 640px) {
  .btn-responsive {
    padding: 1rem 2rem;
    font-size: 1rem;
  }
}

@media (min-width: 768px) {
  .btn-responsive {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
  }
}

/* Navigation improvements */
.nav-responsive {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
}

@media (min-width: 768px) {
  .nav-responsive {
    padding: 1.5rem 2rem;
  }
}

/* Card responsive improvements */
.card-responsive {
  width: 100%;
  max-width: none;
}

@media (min-width: 640px) {
  .card-responsive {
    max-width: 20rem;
  }
}

@media (min-width: 1024px) {
  .card-responsive {
    max-width: 24rem;
  }
}

/* Spacing improvements */
.section-spacing {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

@media (min-width: 640px) {
  .section-spacing {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
}

@media (min-width: 768px) {
  .section-spacing {
    padding-top: 6rem;
    padding-bottom: 6rem;
  }
}

@media (min-width: 1024px) {
  .section-spacing {
    padding-top: 8rem;
    padding-bottom: 8rem;
  }
}

/* Prevent horizontal overflow */
* {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  width: 100%;
}

.overflow-hidden-x {
  overflow-x: hidden;
}

/* Image responsive improvements */
.img-responsive {
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: cover;
}

/* Grid item improvements */
.grid-item-responsive {
  width: 100%;
  min-width: 0; /* Prevents flex/grid items from overflowing */
}

/* Focus improvements for accessibility */
.focus-visible-enhanced:focus-visible {
  outline: 3px solid #1F3A0F;
  outline-offset: 3px;
  border-radius: 0.5rem;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn-responsive {
    border: 2px solid currentColor;
  }
  
  .card-responsive {
    border: 2px solid currentColor;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-block {
    display: block !important;
  }
}

/* Very small screens (< 320px) */
@media (max-width: 319px) {
  .container-responsive {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  .text-responsive-base {
    font-size: 0.875rem;
  }
  
  .btn-responsive {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
  }
}

/* Large screens optimization */
@media (min-width: 1920px) {
  .container-responsive {
    max-width: 1600px;
  }
}

/* Tablet landscape specific */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .hero-section {
    min-height: 80vh;
  }
  
  .section-spacing {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
}

/* Mobile landscape specific */
@media (max-width: 767px) and (orientation: landscape) {
  .hero-section {
    min-height: 100vh;
    padding: 1rem 0;
  }
  
  .hero-title {
    font-size: 2rem;
    margin-bottom: 1rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
}