/* Base responsive typography */
html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Cross-browser compatibility */
* {
  box-sizing: border-box;
}

/* Enhanced focus states for accessibility and cross-browser compatibility */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* Responsive image handling */
img {
  max-width: 100%;
  height: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Enhanced responsive breakpoints */
@media (max-width: 640px) {
  /* Mobile-specific styles */
  .hero-title {
    font-size: 1.875rem !important; /* 30px */
    line-height: 2.25rem !important;
  }
  
  .hero-subtitle {
    font-size: 1.125rem !important; /* 18px */
    line-height: 1.75rem !important;
  }
  
  .section-padding {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }
  
  .mobile-text-center {
    text-align: center !important;
  }
  
  .mobile-full-width {
    width: 100% !important;
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  /* Tablet-specific styles */
  .tablet-grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  /* Large tablet/small desktop styles */
  .lg-tablet-padding {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
  }
}

/* Cross-browser video container */
.video-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  overflow: hidden;
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Enhanced form styling for cross-browser compatibility */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 0.375rem;
  transition: all 0.2s ease-in-out;
}

/* Focus states for better accessibility */
input:focus,
textarea:focus,
button:focus {
  outline: 2px solid #eab308;
  outline-offset: 2px;
}

/* Button hover states for touch devices */
@media (hover: hover) {
  .hover-scale:hover {
    transform: scale(1.05);
  }
}

/* Prevent horizontal scroll on mobile */
body {
  overflow-x: hidden;
}

/* Enhanced background image handling */
.bg-fixed {
  background-attachment: fixed;
}

/* Disable fixed backgrounds on mobile for better performance */
@media (max-width: 768px) {
  .bg-fixed {
    background-attachment: scroll !important;
  }
}

/* Improved text readability on background images */
.text-shadow-strong {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(0, 0, 0, 0.6);
}

.text-shadow-medium {
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7), 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Loading states and performance optimizations */
.lazy-load {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.lazy-load.loaded {
  opacity: 1;
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .bg-gray-900,
  .bg-gray-800 {
    background: white !important;
    color: black !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .text-gray-300 {
    color: #ffffff !important;
  }
  
  .text-gray-400 {
    color: #e5e5e5 !important;
  }
}

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

/* Enhanced mobile navigation */
@media (max-width: 768px) {
  .mobile-nav-spacing {
    gap: 1rem !important;
  }
  
  .mobile-nav-text {
    font-size: 0.875rem !important;
  }
  
  .mobile-button-padding {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.875rem !important;
  }
}

/* Grid system improvements for better responsive behavior */
.responsive-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

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

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

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

/* Enhanced container max-widths for better readability */
.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;
  }
}

/* Improved form validation styling */
.form-error {
  color: #ef4444;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.form-success {
  color: #10b981;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Enhanced button states */
.btn-primary {
  background-color: #eab308;
  color: #1f2937;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease-in-out;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: #d97706;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(234, 179, 8, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading spinner for form submissions */
.loading-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}