/* 
* Ecolighting Website Responsive Styles
* Enhanced media queries to ensure the website is fully responsive on all devices
*/

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Enable smoother scrolling on mobile devices */
html {
  scroll-behavior: smooth;
  /* Prevent content from being zoomed when form inputs are focused on iOS */
  -webkit-text-size-adjust: 100%;
}

/* Remove tap highlight color on mobile elements */
* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* Improve mobile touch targets - ensure all interactive elements have adequate size */
button,
.btn,
a,
input[type="submit"],
input[type="button"],
.nav-menu a,
.menu-toggle,
.close-menu,
.slider-controls button,
.accordion-header,
.faq-question {
  min-height: 44px;
  min-width: 44px;
}

/* Large Devices (desktops, less than 1200px) */
@media (max-width: 1199.98px) {
  .container {
    max-width: 960px;
  }

  /* Adjust desktop decoration for smaller screens */
  .energy-flow {
    width: 80px;
  }

  .slogan-text {
    display: none;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
  }

  .team-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
  }

  .values-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Improve positioning of partnership cards */
  [style*="display: flex; justify-content: center; align-items: stretch;"] {
    gap: 20px;
  }
}

/* Medium Devices (tablets, less than 992px) */
/* Medium-Large screens - optimize navigation without desktop decoration */
@media (min-width: 992px) and (max-width: 1299px) {
  .nav-menu li {
    margin-left: 18px;
  }

  .nav-menu a {
    font-size: 0.92rem;
  }

  .language-switcher {
    margin-left: 12px;
  }
}

@media (max-width: 991.98px) {
  .container {
    max-width: 720px;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.8rem;
  }

  h3 {
    font-size: 1.3rem;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Improve navigation spacing on tablets */
  .nav-menu li {
    margin-left: 15px;
  }

  .nav-menu a {
    font-size: 0.9rem;
  }

  /* Adjust language switcher for tablets */
  .language-switcher {
    margin-left: 8px;
  }

  .language-switcher .lang-btn {
    padding: 5px 8px;
    font-size: 0.8rem;
    min-width: 50px;
  }

  .step-connector {
    flex: 0.05;
  }

  .hero .slide {
    flex-direction: column;
  }

  .slide-content,
  .slide-image {
    width: 100%;
    padding: 0;
  }

  .slide-content {
    order: 1;
    text-align: center;
    margin-bottom: 30px;
  }

  .slide-image {
    order: 2;
    margin: 0 auto;
    max-width: 400px;
  }

  .story-content {
    flex-direction: column;
  }

  .story-image {
    margin: 0 auto 30px;
    max-width: 300px;
  }

  .mv-cards {
    flex-direction: column;
    gap: 30px;
  }

  .mv-card {
    width: 100%;
  }

  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Fix partnership section layout */
  [style*="display: flex; justify-content: center; align-items: stretch;"] {
    flex-direction: column;
    align-items: center;
  }

  [style*="flex: 1; min-width: 300px; max-width: 550px;"] {
    width: 100%;
    margin-bottom: 30px;
  }
}

/* Small Devices (landscape phones, less than 768px) */
@media (max-width: 767.98px) {
  .container {
    max-width: 540px;
  }

  /* Hide desktop decoration and show mobile one */
  .desktop-decoration {
    display: none;
  }

  /* Fix for sticky header on mobile */
  header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--white);
    box-shadow: var(--shadow-md);
  }

  /* Show logo decoration on mobile */
  .logo-decoration {
    display: block;
    animation: pulse 2s infinite alternate;
  }

  /* Show tagline on mobile */
  .tagline-mobile {
    display: block;
  }

  /* Enhanced animations for leaf decorations */
  .logo-decoration .leaf-top {
    animation: leafWave 3s ease-in-out infinite;
  }

  .logo-decoration .leaf-bottom {
    animation: leafWave 3s ease-in-out infinite reverse;
  }

  @keyframes pulse {
    0% {
      opacity: 0.7;
    }
    100% {
      opacity: 1;
    }
  }

  @keyframes leafWave {
    0% {
      transform: rotate(45deg);
    }
    50% {
      transform: rotate(30deg);
    }
    100% {
      transform: rotate(45deg);
    }
  }

  .menu-toggle {
    cursor: pointer;
    padding: 10px;
    z-index: 1010; /* Higher than other elements */
    background-color: var(--primary-green);
    border: 1px solid #fff;
    border-radius: 4px;
    display: none; /* Hidden by default, shown on mobile */
    position: absolute;
    right: 15px;
    top: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    color: white;
    align-items: center;
  }

  .menu-toggle i {
    font-size: 24px;
    color: white;
  }

  .menu-label {
    display: inline-block;
    margin-left: 5px;
    font-weight: bold;
    font-size: 16px;
    color: white;
  }

  /* Ensure the menu toggle is visible on all backgrounds */
  header {
    position: relative;
  }

  /* Mobile menu overlay - dark background when menu is open */
  .nav-menu::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 0.3s ease,
      visibility 0.3s ease;
    z-index: -1;
  }

  .nav-menu.active::before {
    opacity: 1;
    visibility: visible;
  }

  /* Add visual indicator for better visibility */
  .menu-toggle:after {
    content: "Menu";
    position: absolute;
    top: 105%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--primary-green);
    font-weight: bold;
    text-shadow: 0 0 2px white;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 350px;
    height: 100%;
    max-height: 100vh;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 70px 0 20px;
    transition: right 0.3s ease-in-out;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    overflow-y: auto;
  }

  .nav-menu.active {
    right: 0;
  }

  .nav-menu li {
    margin: 0;
    width: 100%;
    list-style: none;
  }

  /* Fix for navigation links */
  .nav-menu a {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 25px;
    font-size: 17px;
    position: relative;
    z-index: 1002;
    font-weight: 500;
    color: #333;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
  }

  .nav-menu a:hover {
    background-color: rgba(12, 107, 61, 0.05);
    padding-left: 30px;
  }

  /* Special styling for active links */
  .nav-menu a.active {
    color: var(--primary-green);
    background-color: rgba(12, 107, 61, 0.08);
    border-left: 4px solid var(--primary-green);
    font-weight: 600;
  }

  /* Cart icon in mobile menu */
  .cart-icon {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
  }

  .cart-icon a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 25px;
    font-size: 17px;
    font-weight: 600;
    color: var(--primary-green);
    background-color: rgba(12, 107, 61, 0.05);
  }

  .cart-icon i {
    font-size: 20px;
  }

  .cart-icon .cart-count {
    position: relative;
    top: auto;
    right: auto;
    background-color: #ff6b6b;
    color: white;
    font-size: 13px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
  }

  .close-menu {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-green);
    background-color: rgba(12, 107, 61, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 1003;
  }

  .close-menu:hover {
    background-color: rgba(12, 107, 61, 0.2);
    transform: rotate(90deg);
  }

  .process-steps {
    flex-direction: column;
    gap: var(--spacing-lg);
  }

  .step-connector {
    display: none;
  }

  .cta-buttons {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .cta-buttons .btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--spacing-md);
    text-align: center;
  }

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

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

  .section-header {
    margin-bottom: 30px;
  }

  .page-banner {
    padding: 40px 0;
  }

  .page-banner h1 {
    font-size: 2rem;
  }

  /* Make tables responsive */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling for tables on iOS */
  }

  /* Improve form usability on mobile */
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 12px;
    border-radius: 8px;
  }

  /* Fix for checkboxes and labels */
  input[type="checkbox"],
  input[type="radio"] {
    width: 22px;
    height: 22px;
  }

  label {
    font-size: 16px;
  }

  /* Ensure images don't overflow on small screens */
  img {
    height: auto;
    max-width: 100%;
  }

  /* Fix contact form on mobile */
  .contact-form-container {
    padding: 20px;
  }

  /* Make sure buttons have proper padding */
  button[type="submit"] {
    padding: 12px;
    width: 100%;
    font-size: 16px;
  }

  /* Fix partnership section stacking */
  [style*="padding: 35px; display: flex; align-items: center; gap: 25px;"] {
    flex-direction: column;
    padding: 20px;
    text-align: center;
  }

  /* Center partnership section logos */
  [style*="flex: 0 0 120px; height: 120px;"] {
    margin: 0 auto 20px;
  }

  /* Make menu toggle clearly visible */
  .menu-toggle {
    display: flex !important; /* Force display */
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 44px;
  }

  /* Show the menu label on mobile */
  .menu-label {
    display: inline-block;
  }
}

/* Extra Small Devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
  body {
    font-size: 15px;
  }

  .container {
    width: 100%;
    padding: 0 15px;
  }

  h1 {
    font-size: 1.8rem;
    line-height: 1.3;
  }

  h2 {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  h3 {
    font-size: 1.2rem;
    line-height: 1.3;
  }

  p {
    font-size: 15px;
    line-height: 1.5;
  }

  .features-grid,
  .products-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 30px;
  }

  .footer-column h3::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .social-icons {
    justify-content: center;
  }

  .contact-info li {
    justify-content: center;
  }

  .newsletter-form {
    flex-direction: column;
    gap: 15px;
  }

  .newsletter-form .btn {
    width: 100%;
  }

  .testimonials-slider {
    flex-direction: column;
  }

  .testimonial-card {
    margin-bottom: var(--spacing-md);
    padding: 20px !important; /* Override inline styles for better mobile display */
  }

  /* Hide testimonial controls on mobile completely */
  .testimonial-controls,
  .testimonial-outside-controls,
  .side-nav,
  .testimonial-indicators,
  .prev-testimonial,
  .next-testimonial {
    display: none !important;
  }

  .slide.active {
    flex-direction: column;
  }

  .slide-content {
    padding-right: 0;
    text-align: center;
    margin-bottom: var(--spacing-lg);
  }

  section {
    padding: 40px 0;
  }

  .section-header h2::after {
    width: 60px;
  }

  .member-image img {
    margin: 0 auto;
  }

  .member-info {
    text-align: center;
  }

  .achievements-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .cta-section {
    padding: 40px 0;
  }

  .cta-content {
    text-align: center;
  }

  /* Improve tap targets for better mobile usability */
  .nav-menu a,
  .btn,
  .social-icons a,
  .footer-links a {
    padding: 12px;
    min-height: 44px; /* Minimum recommended size for tap targets */
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .social-icons a {
    width: 44px;
    height: 44px;
  }

  .team-member {
    margin-bottom: 30px;
  }

  /* Fix blog post display on mobile */
  .blog-post {
    padding: 15px;
  }

  /* Fix blockquote styling on mobile */
  blockquote {
    padding: 15px;
    margin: 20px 0;
  }

  /* Make sure footer links are properly spaced */
  .footer-links li {
    margin-bottom: 10px;
  }

  /* Fix partnership section mobile display */
  [style*="width: 34px; height: 34px; border-radius: 50%;"] {
    margin: 0 auto 10px;
  }

  [style*="display: flex; gap: 15px"] {
    flex-direction: column;
  }
}

/* Fix for iOS Safari 100vh issue */
@supports (-webkit-touch-callout: none) {
  .nav-menu {
    height: -webkit-fill-available;
    max-height: -webkit-fill-available;
  }

  body.js-position-fixed {
    position: fixed !important;
    width: 100% !important;
    /* iOS specific position fix */
    height: 100% !important;
    overflow: hidden !important;
  }
}

/* Additional touch device improvements */
@media (pointer: coarse) {
  body,
  html {
    -webkit-overflow-scrolling: touch;
  }

  html.lock-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
}

/* Improve responsiveness on very small screens */
@media (max-width: 380px) {
  .logo img {
    max-height: 40px;
  }

  .section-header h2 {
    font-size: 1.3rem;
  }

  .product-card {
    padding: 10px;
  }

  .testimonial-card {
    padding: 15px;
  }

  .footer-bottom {
    padding: 15px 0;
  }

  /* Improve form inputs on very small screens */
  .form-group {
    margin-bottom: 15px;
  }

  /* Fix mobile menu for very small screens */
  .nav-menu {
    width: 85%;
  }
}

/* Add dark mode support for mobile devices */
@media (prefers-color-scheme: dark) {
  body.dark-mode-compatible {
    background-color: #222;
    color: #f5f5f5;
  }

  body.dark-mode-compatible header {
    background-color: #333;
  }

  body.dark-mode-compatible a {
    color: #4ca975;
  }
}

/* Add specific fixes for partnerships section on mobile */
@media (max-width: 767px) {
  [style*="flex: 1; min-width: 300px; max-width: 550px;"] {
    min-width: auto;
    width: 100%;
  }

  [style*="padding: 35px; display: flex; align-items: center; gap: 25px;"] {
    padding: 20px;
  }
}

/* Mobile menu improvements for scrolling and navigation */
body.menu-open {
  /* We'll handle this in JavaScript instead */
  /* overflow: hidden; */
  /* position: fixed; */
  /* width: 100%; */
  /* height: 100%; */
}

.nav-menu {
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Improve menu toggle button */
.menu-toggle {
  cursor: pointer;
  padding: 10px;
  z-index: 1010; /* Higher than other elements */
  background-color: var(--primary-green);
  border: 1px solid #fff;
  border-radius: 4px;
  display: none; /* Hidden by default, shown on mobile */
  position: absolute;
  right: 15px;
  top: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  color: white;
  align-items: center;
}

.menu-toggle i {
  font-size: 24px;
  color: white;
}

.menu-label {
  display: inline-block;
  margin-left: 5px;
  font-weight: bold;
  font-size: 16px;
  color: white;
}

/* Ensure the menu toggle is visible on all backgrounds */
header {
  position: relative;
}

@media (max-width: 767.98px) {
  /* Make menu toggle clearly visible */
  .menu-toggle {
    display: flex !important; /* Force display */
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 44px;
  }

  /* Show the menu label on mobile */
  .menu-label {
    display: inline-block;
  }

  /* Language switcher mobile positioning - INSIDE menu */
  .language-switcher {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    width: 100% !important;
    margin: 15px 0 0 0 !important;
    padding: 15px 25px !important;
    border-top: 2px solid rgba(0, 0, 0, 0.1) !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 12px !important;
    background-color: rgba(12, 107, 61, 0.03) !important;
    box-shadow: none !important;
    z-index: auto !important;
  }

  .language-switcher .lang-btn {
    padding: 10px 20px !important;
    width: auto !important;
    min-width: 80px !important;
    font-size: 15px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
  }

  .language-switcher .lang-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }

  .language-switcher .lang-separator {
    width: 1px !important;
    height: 25px !important;
    margin: 0 !important;
    background-color: rgba(0, 0, 0, 0.15) !important;
  }

  /* Fix navigation spacing on mobile */
  nav {
    padding: 12px 0;
  }

  .logo {
    max-width: calc(100% - 100px);
  }

  .logo img {
    max-height: 45px;
  }
}
