/* Comprehensive responsive styles for JMC Group website */

/* ===============================
   WAVE FIXES FOR ALL DEVICES
   =============================== */
/* These rules ensure the waves render correctly across all device sizes */
.wave-container.top-wave,
.wave-container.bottom-wave {
  position: relative;
  margin: 0;
  padding: 0;
  z-index: 5;
  overflow: hidden;
  height: auto;
  line-height: 0;
  font-size: 0;
  display: block;
  background-color: #000000;
}

.wave-container.top-wave img,
.wave-container.bottom-wave img {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* ===============================
   MOBILE WAVE FIXES (480px and below)
   =============================== */
@media (max-width: 480px) {
  /* Fix wave image positioning issues on small screens */
  .wave-container img,
  .wave-img,
  img.wave-img,
  .wave-container .wave-img,
  img[alt="wave decoration"],
  .wave-decoration {
    width: 100% !important;
    margin-left: 0 !important;
    left: 0 !important;
    position: relative !important;
    transform: none !important;
    max-width: 100% !important;
  }
  
  /* Fix specific issues with bottom wave container */
  div.wave-container.bottom-wave {
    margin-bottom: -2px;
    overflow: hidden;
  }
  
  /* Ensure no gaps between sections */
  #about + #contact {
    margin-top: -5px;
  }
}

/* ===============================
   HEADER FIXES FOR ALL DEVICES
   =============================== */
/* These rules ensure the header is visible across all device sizes */
@media (max-width: 1200px) {
  .header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    border-radius: 0;
    z-index: 1000;
  }
  
  body {
    padding-top: 70px; /* Add padding to account for fixed header */
  }
  
  /* Hide mobile menu toggle on larger screens */
  .menu-toggle {
    display: none;
  }
}

/* ===============================
   EXTRA LARGE SCREENS (1800px+)
   =============================== */
@media (min-width: 1800px) {
  .container {
    max-width: 1600px;
    width: 80%;
    margin: 0 auto;
  }
  
  .hero-title {
    font-size: 4.5rem;
  }
  
  .hero-subtitle {
    font-size: 2rem;
  }
  
  .section-title {
    font-size: 3.5rem;
  }
  
  .company-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
  }
}

/* ===============================
   LARGE DESKTOP (1500px-1799px)
   =============================== */
@media (min-width: 1500px) and (max-width: 1799px) {
  .container {
    max-width: 1400px;
    width: 85%;
    margin: 0 auto;
  }
  
  .hero-title {
    font-size: 4rem;
  }
  
  .hero-subtitle {
    font-size: 1.8rem;
  }
  
  .section-title {
    font-size: 3.2rem;
  }
  
  .company-grid {
    gap: 35px;
  }
}

   =============================== */
@media (max-width: 1200px) {
  .container {
    width: 90%;
  }

  .hero-title {
    font-size: 3rem;
  }
  
  /* Improve section spacing */
  section {
    padding: 60px 0;
  }
  
  /* Better card layouts for this size */
  .company-grid {
    gap: 30px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
  
  /* Improved about section layout */
  .about-content {
    gap: 40px;
  }
  
  /* Adjust contact grid */
  .contact-grid {
    gap: 30px;
  }
  
  /* Better wave decorations scaling */
  .wave-container {
    height: 100px;
  }
}

/* ===============================
   TABLET LANDSCAPE (992px-1199px)
   =============================== */
@media (max-width: 992px) {
  /* Improve header layout */
  .navbar {
    padding: 15px 0;
  }

  /* Hero section adjustments */
  .hero-title {
    font-size: 2.5rem;
    line-height: 1.3;
  }

  .hero-subtitle {
    font-size: 1.2rem;
    line-height: 1.5;
    margin-bottom: 25px;
  }

  .hero-buttons {
    gap: 15px;
  }
  
  /* Better section spacing */
  section {
    padding: 50px 0;
  }
  
  .section-header {
    margin-bottom: 40px;
  }
  
  /* Improve company cards layout */
  .company-grid {
    gap: 25px;
  }

  /* Fix for the hover effect on touch devices */
  .company-card:hover {
    transform: translateY(-10px) !important;
  }
  
  /* Adjust card paddings */
  .company-card {
    padding: 25px 20px;
  }
  
  .card-content {
    padding: 20px 15px;
  }

  /* About section responsive improvements */
  .about-content {
    gap: 30px;
    flex-direction: column-reverse;
  }
  
  .about-image {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
  }
  
  .about-text {
    max-width: 100%;
  }
  
  /* Improve specialty items layout */
  .specialty-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  /* Wave decorations adjustments */
  .wave-container {
    height: 80px;
  }
  
  .wave-img {
    transform: scale(1.2);
  }
}

/* ===============================
   TABLET PORTRAIT (768px-991px)
   =============================== */
@media (max-width: 768px) {
  /* Adjust container width for better spacing */
  .container {
    width: 95%;
  }
  
  /* Improved header for mobile */
  .header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: #000000;
  }
  
  .navbar {
    padding: 10px 15px;
  }
  
  .logo {
    font-size: 1.2rem;
  }

  .logo-img {
    height: 35px;
  }
  
  /* Better section spacing */
  section {
    padding: 40px 0;
  }
  
  .section-header {
    margin-bottom: 30px;
  }
  
  .section-title {
    font-size: 2.2rem;
  }
  
  .section-subtitle {
    font-size: 1.1rem;
  }
  
  /* Hero section */
  .hero-simple {
    min-height: 450px;
    height: auto;
    padding: 70px 0 50px;
  }
  
  .hero-content {
    text-align: center;
  }

  /* Company cards improvements */
  .company-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    max-width: 600px;
    margin: 0 auto;
  }

  .company-card {
    max-width: 450px;
    margin: 0 auto;
    padding: 20px 15px;
  }

  /* Make sure company logos are sized appropriately */
  .company-logo {
    width: 100px !important;
  }
  
  .company-name {
    font-size: 1.6rem;
  }
  
  .company-tagline {
    font-size: 0.95rem;
  }

  /* Partner lists in two columns for better space usage */
  .partner-list {
    column-count: 2;
    column-gap: 20px;
    font-size: 0.9rem;
  }
  
  .partner-list li {
    margin-bottom: 10px;
    break-inside: avoid;
  }

  .specialty-list {
    grid-template-columns: 1fr;
  }
  
  .specialty-list li {
    padding: 15px 10px;
  }
  
  /* About section */
  .about-text p {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  /* Contact section improvements */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .map-container {
    order: 2;
    height: 300px;
    border-radius: 15px;
    overflow: hidden;
  }

  .contact-info {
    order: 1;
    padding: 25px 20px;
  }
  
  .contact-title {
    font-size: 1.6rem;
    margin-bottom: 20px;
  }
  
  /* Footer improvements */
  .footer-content {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  
  /* Wave decorations enhancements */
  .wave-container {
    height: 60px;
    overflow: hidden;
  }
  
  .wave-img {
    width: 200%;
    max-width: none;
    margin-left: -50%;
  }
  
  /* Mobile nav menu */
  .nav-list {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: 0.5s;
    z-index: 1001;
  }
  
  .nav-list.active {
    right: 0;
  }
  
  .nav-item {
    margin: 15px 0;
    margin-left: 0; /* Reset left margin from desktop styles */
  }
  
  .nav-link {
    color: white;
    font-size: 1.2rem;
    padding: 10px;
    display: block;
  }
  
  /* Mobile menu toggle button */
  .menu-toggle {
    display: block;
    cursor: pointer;
    z-index: 1002;
    position: relative;
    background-color: transparent;
    border: none;
    padding: 5px;
  }
  
  .menu-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: #ffffff;
    margin: 5px 0;
    transition: 0.3s;
  }
  
  /* Make sure the mobile menu button works */
  .menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }
}

/* ===============================
   MOBILE LANDSCAPE (576px-767px)
   =============================== */
@media (max-width: 576px) {
  /* Adjust container padding */
  .container {
    padding: 0 15px;
  }
  
  /* Better section spacing */
  section {
    padding: 35px 0;
  }
  
  .section-header {
    margin-bottom: 25px;
  }
  
  /* Further refine company grid for small screens */
  .company-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  /* Ensure buttons are properly sized */
  .btn {
    padding: 12px 24px;
    font-size: 0.95rem;
  }
}

/* ===============================
   MOBILE PORTRAIT (375px-575px)
   =============================== */
@media (max-width: 480px) {
  /* Better section spacing */
  section {
    padding: 30px 0;
  }
  
  .section-title {
    font-size: 1.8rem;
  }
  
  .section-subtitle {
    font-size: 1rem;
  }
  
  /* Hero section */
  .hero-simple {
    padding: 60px 0 40px;
    min-height: auto;
  }
  
  /* Fine-tune hero section */
  .hero-title {
    font-size: 1.8rem;
    line-height: 1.3;
  }
  
  .hero-subtitle {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 20px;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .hero-buttons .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 12px 20px;
    font-size: 0.95rem;
  }
  
  /* Company cards */
  .company-card {
    padding: 15px 12px;
    border-radius: 12px;
    max-width: 100%;
  }
  
  .company-header {
    margin-bottom: 15px;
  }
  
  .company-logo {
    width: 80px !important;
  }
  
  .company-name {
    font-size: 1.4rem;
  }
  
  .company-tagline {
    font-size: 0.9rem;
  }
  
  .partners-title, .specialty-title {
    font-size: 1.2rem;
    margin-bottom: 12px;
  }

  /* Optimize partner lists for very small screens */
  .partner-list {
    column-count: 1;
    font-size: 0.85rem;
  }
  
  .partner-list li {
    padding: 8px 0;
  }

  /* Ensure contact information is readable */
  .contact-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
  }

  .contact-icon {
    margin-right: 0;
    width: 30px;
    height: auto;
  }
  
  .contact-info {
    padding: 20px 15px;
  }
  
  .contact-title {
    font-size: 1.4rem;
  }
  
  .directions-btn {
    width: 100%;
    text-align: center;
    padding: 12px;
    font-size: 0.95rem;
  }

  /* Make sure specialty icons work on small screens */
  .specialty-list li {
    flex-direction: column;
    text-align: center;
    padding: 12px 8px;
  }

  .specialty-icon {
    margin-right: 0;
    margin-bottom: 10px;
    font-size: 1.8rem;
  }
  
  .specialty-name {
    font-size: 1rem;
  }
  
  .specialty-desc {
    font-size: 0.85rem;
  }

  /* Footer improvements */
  .footer-logo {
    font-size: 1.2rem;
  }
  
  .footer-logo .logo-img {
    height: 40px;
  }

  .footer-bottom {
    padding: 15px 0;
    font-size: 0.85rem;
  }
  
  .footer-contact-item {
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
  }
  
  .footer-icon {
    margin-right: 0;
  }
  
  /* Wave adjustments for very small screens */
  .wave-container {
    height: 40px;
  }
  
  .wave-img {
    width: 250%;
    margin-left: -75%;
  }
}

/* ===============================
   SMALL MOBILE DEVICES (below 375px)
   =============================== */
@media (max-width: 375px) {
  .hero-title {
    font-size: 1.6rem;
  }
  
  .section-title {
    font-size: 1.6rem;
  }
  
  .company-name {
    font-size: 1.3rem;
  }
  
  .contact-title {
    font-size: 1.3rem;
  }
  
  .navbar {
    padding: 8px 10px !important;
    background-color: transparent;
  }
  
  .nav-link {
    font-size: 0.8rem !important;
    padding: 5px !important;
  }
  
  /* Fix menu toggle for very small screens */
  .menu-toggle {
    padding: 3px;
  }
  
  .menu-toggle span {
    margin: 4px 0;
    height: 1.5px;
  }
  
  /* Simplify UI for very small screens */
  .company-card {
    padding: 15px 10px;
  }
  
  /* Improved footer for small phones */
  .footer {
    padding-bottom: 15px;
  }
  
  .footer-content {
    padding: 20px 0;
  }
  
  .footer-logo {
    margin-bottom: 15px;
  }
  
  .footer-logo .logo-img {
    height: 45px;
  }
  
  .footer-contact {
    width: 100%;
    padding: 0 10px;
  }
  
  .footer-contact-item {
    margin-bottom: 12px;
    justify-content: center;
  }
  
  .footer-contact-item p {
    font-size: 14px;
    word-break: break-word;
  }
  
  .footer-bottom {
    padding: 10px 0;
  }
  
  .footer-bottom p {
    font-size: 12px;
    line-height: 1.4;
  }
}

/* ===============================
   TINY DEVICES (Galaxy Fold, etc.)
   =============================== */
@media (max-width: 320px) {
  /* Extra small screens need special care */
  .header {
    background-color: #000000;
  }
  
  .navbar {
    background-color: transparent;
    padding: 5px !important;
  }
  
  .menu-toggle span {
    width: 20px;
    height: 1px;
    margin: 3px 0;
  }
  .container {
    padding: 0 10px;
  }
  
  .hero-title {
    font-size: 1.5rem;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  /* Simplify UI for very small screens */
  .partner-list {
    column-count: 1;
  }
  
  /* Smaller company cards for very small screens */
  .company-card {
    padding: 12px 8px;
  }
  
  /* Further compress UI elements */
  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  /* Ultra small footer fixes */
  .footer-logo span {
    display: block;
    margin-top: 5px;
  }
  
  .footer-contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .footer-contact-item img {
    margin-bottom: 5px;
    width: 24px;
    height: 24px;
  }
  
  .footer-contact-item p {
    font-size: 13px;
  }
  
  .footer-bottom p {
    font-size: 11px;
    padding: 0 5px;
  }
}

/* ===============================
   ORIENTATION SPECIFIC ADJUSTMENTS
   =============================== */
@media (max-width: 900px) and (orientation: landscape) {
  /* Adjust hero section height for landscape */
  .hero-simple {
    min-height: auto;
    padding: 40px 0;
  }
  
  /* Better card layout for landscape orientation */
  .company-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
  
  /* Improved navigation menu for landscape */
  .nav-list {
    padding: 20px 0;
  }
  
  .nav-item {
    margin: 10px 0;
  }
  
  /* About section in landscape orientation */
  .about-content {
    grid-template-columns: 1fr;
  }
}

/* ===============================
   UTILITY CLASSES & SPECIAL CASES
   =============================== */
/* Fix hover effects on touch devices */
@media (hover: none) {
  .company-card:hover {
    transform: none !important;
  }
  
  .company-card:active {
    transform: translateY(-5px) !important;
  }
  
  .btn:hover {
    transform: none !important;
  }
  
  .btn:active {
    transform: scale(0.98) !important;
  }
  
  /* Enhance button touch targets */
  .btn {
    padding: 12px 28px;
    min-height: 44px;
  }
  
  /* Improve touch feedback */
  .nav-link:active::after {
    width: 100%;
    opacity: 1;
  }
}

/* High DPI screens (Retina displays) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Ensure images are sharp on high-resolution screens */
  .logo-img,
  .company-logo,
  .contact-icon,
  .footer-icon {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .company-card {
    opacity: 1;
    transform: none;
    transition: none;
  }
  
  .btn, .nav-link, .company-card {
    transition: none !important;
  }
}

/* ===============================
   GLOBAL RESPONSIVE FIXES
   =============================== */
/* Prevent overflow issues */
html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

/* Ensure images don't break layouts */
img {
  max-width: 100%;
  height: auto;
}

/* Better form element responsiveness */
input, textarea, select, button {
  max-width: 100%;
  font-size: 16px; /* Prevents iOS zoom on focus */
}

/* Animation for intersection observer */
.company-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.company-card.card-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger animations for cards */
.company-card:nth-child(2) {
  transition-delay: 0.1s;
}

.company-card:nth-child(3) {
  transition-delay: 0.2s;
}

/* Fix for iOS form elements */
@supports (-webkit-touch-callout: none) {
  input, textarea, select {
    font-size: 16px;
  }
}

/* Ensure proper width calculations with border-box */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ===============================
   FOOTER FIXES FOR MOBILE DEVICES
   =============================== */
@media (max-width: 767px) {
  /* These rules ensure the footer is properly displayed on all mobile devices */
  .footer {
    position: relative;
    overflow: hidden;
  }
  
  .footer-wave {
    height: auto;
    min-height: 50px;
  }
  
  .footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px 0;
  }
  
  .footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
  }
  
  .footer-contact {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
  }
  
  .footer-contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    justify-content: center;
    width: 100%;
  }
  
  .footer-contact-item img {
    margin-right: 10px;
    width: 30px;
    height: auto;
  }
  
  .footer-contact-item p {
    margin: 0;
    font-size: 15px;
  }
  
  .footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    padding: 15px 0;
  }
}
