/* Mobile Responsiveness Fixes 
   This file addresses specific mobile responsiveness issues:
   1. Removes extra right padding on smaller screens
   2. Improves header and menu responsiveness
   3. Enhances About Us section for mobile viewing
   4. Fixes WhatsApp and scroll-to-top buttons for better visual appeal
*/

/* CSS Variables for responsive adjustments */
:root {
  --bg-opacity: 0.95;
  --bg-transform: scale(1.05);
  --bg-animation: subtle-zoom 25s infinite alternate ease-in-out;

  /* Button styling variables */
  --whatsapp-size: 56px;
  --scrolltop-size: 50px;
  --button-spacing: 16px;
  --button-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  --button-hover-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* Fix for right padding/margin on all screen sizes */
html,
body {
  overflow-x: hidden !important;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  padding: 0;
  overflow-x: clip;
}

/* Enhanced WhatsApp button styling */
.whatsapp-chat-btn {
  position: fixed;
  right: var(--button-spacing);
  bottom: calc(var(--button-spacing) * 2 + var(--scrolltop-size));
  width: var(--whatsapp-size);
  height: var(--whatsapp-size);
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--button-shadow);
  z-index: 1200; /* Higher z-index to appear above scroll-to-top */
  transition: all 0.3s ease;
  text-decoration: none;
}

.whatsapp-chat-btn i {
  font-size: 2rem;
}

.whatsapp-chat-btn:hover,
.whatsapp-chat-btn:focus {
  background: #1ebe57;
  transform: scale(1.05) translateY(-3px);
  box-shadow: var(--button-hover-shadow);
}

/* Enhanced scroll-to-top button styling */
.scroll-to-top {
  position: fixed;
  right: var(--button-spacing);
  bottom: var(--button-spacing);
  width: var(--scrolltop-size);
  height: var(--scrolltop-size);
  border-radius: 50%;
  background: var(--primary-color, #3498db);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--button-shadow);
  z-index: 1100; /* Lower z-index than WhatsApp button */
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  opacity: 1;
  visibility: visible;
}

.scroll-to-top i {
  font-size: 1.25rem;
}

.scroll-to-top:hover,
.scroll-to-top:focus {
  transform: translateY(-3px);
  box-shadow: var(--button-hover-shadow);
  background: var(--primary-hover-color, #2980b9);
}

/* Custom pulse animation for the scroll-to-top button */
@keyframes gentle-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
  }
}

.scroll-to-top.visible {
  animation: gentle-pulse 2s infinite;
}

/* WhatsApp button pulse animation */
@keyframes whatsapp-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(37, 211, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

.whatsapp-chat-btn {
  animation: whatsapp-pulse 2s infinite;
}

/* Responsive background image adjustments */
body.show-fixed-bg::before {
  opacity: var(--bg-opacity) !important;
  transform: var(--bg-transform) !important;
  animation: var(--bg-animation) !important;
}

/* Additional general fixes for all screen sizes to remove right padding */
.container,
section,
header,
footer,
.row,
.col,
.hero-section,
.about-section,
.services-section,
.testimonials-section,
.contact-section {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Specific fixes for header and menu to prevent scrollbar */
header {
  overflow-x: hidden;
}

header .container {
  overflow-x: hidden;
}

.header-left {
  overflow-x: hidden;
  max-width: 100%;
}

.site-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

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

.nav-links.active {
  overflow-x: hidden;
}

/* Header and logo fixes */
@media (max-width: 991px) {
  header {
    padding: 10px 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Fix header scrollbar issue */
  header .container {
    width: 100%;
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    overflow-x: hidden;
  }

  .logo img {
    max-height: 45px;
    transition: max-height 0.3s ease;
  }

  /* Fix mobile menu scrollbar */
  .nav-links {
    overflow-x: hidden;
  }

  .nav-links.active {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  header.scrolled .logo img {
    max-height: 40px;
  }

  /* Better menu toggle button position */
  .menu-toggle {
    margin-right: 5px;
  }

  /* Container width adjustments to prevent overflow */
  .container {
    width: 95%;
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* Medium devices (tablets) */
@media (max-width: 768px) {
  /* Fix header alignment */
  header .container {
    padding: 0 15px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  /* Fix site title if it's causing overflow */
  .site-title {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Improve mobile menu */
  .mobile-menu,
  .nav-links,
  .nav-links.active {
    width: 100%;
    left: 0;
    right: 0;
    box-sizing: border-box;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Prevent horizontal scroll on hamburger menu */
  .hamburger {
    margin-right: 5px;
    z-index: 1001;
  }

  /* Adjust hero and section content */
  .hero-content h1 {
    font-size: 2.2rem;
  }

  .hero-content p {
    font-size: 1rem;
  } /* About section improvements */
  .about-cards {
    flex-direction: column;
    gap: 25px;
  }

  .about-card {
    width: 100%;
    margin: 0;
  }

  /* Improved Who We Are, Vision, Mission cards */
  .about-hero-cards {
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding: 0 10px;
    margin: 40px auto;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }

  .about-hero-card {
    width: 90%;
    max-width: 450px;
    min-width: 250px;
    margin-bottom: 15px;
    margin-left: auto;
    margin-right: auto;
  }

  .about-hero-img-wrap {
    height: 200px;
  }

  /* Improve About section layout */
  .about-section-modern {
    padding: 80px 0;
  }

  .about-container {
    width: 100%;
    padding: 0 15px;
    box-sizing: border-box;
  }

  .about-intro-block {
    flex-direction: column;
  }

  .about-intro-text {
    width: 100%;
    margin-bottom: 20px;
  }

  .about-intro-img-wrap {
    width: 100%;
    height: auto;
    margin-bottom: 20px;
  }

  .about-intro-img {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: cover;
  }

  /* Better static background for mobile */
  body.show-fixed-bg::before {
    background-attachment: scroll;
    background-position: center;
    opacity: 0.3;
  }

  /* Timeline adjustments */
  .timeline-container {
    padding: 0 15px;
  }

  .timeline-content {
    padding: 15px;
  }

  /* Fix button positions for responsive design */
  .scroll-to-top {
    right: 15px;
    bottom: 15px;
  }

  /* Adjust WhatsApp button position to be above the scroll-to-top button */
  .whatsapp-chat-btn {
    right: 15px;
    bottom: 80px;
  }
}

/* Small devices (small tablets and large phones) */
@media (max-width: 576px) {
  /* Fix padding on main container and sections */
  section {
    padding: 40px 0;
  }

  .container {
    width: 100%;
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    margin-left: 0;
    margin-right: 0;
  }

  /* Fix any potential horizontal scroll issues */
  .row,
  .col,
  [class^='col-'] {
    padding-right: 0;
    margin-right: 0;
    max-width: 100%;
  }

  /* Enhanced About hero cards for small screens */
  .about-hero-cards {
    gap: 25px;
    margin: 30px auto;
  }

  .about-hero-card {
    width: 95%;
    padding-bottom: 20px;
  }

  .about-hero-img-wrap {
    height: 180px;
    border-radius: 1.5rem 1.5rem 0.8rem 0.8rem;
  }

  .about-hero-title-overlay {
    font-size: 1.5rem;
    padding: 12px 0 8px 0;
  }

  .about-hero-desc {
    padding: 25px 20px 0;
    font-size: 1rem;
    line-height: 1.5;
  }

  /* Improved background image for small screens */
  body.show-fixed-bg::before {
    opacity: 0.25;
    transform: scale(1.02);
  }

  /* Reduce header height when scrolled */
  header.scrolled {
    padding: 5px 0;
  }

  header.scrolled .logo img {
    max-height: 35px;
  }

  /* Timeline adjustments */
  .timeline {
    margin: 30px auto;
    padding: 0;
  }

  .timeline::after {
    left: 31px;
  }

  .timeline-container {
    width: 100%;
    padding-right: 25px;
    padding-left: 70px;
  }

  .timeline-container::before {
    left: 60px;
    border-width: 10px 10px 10px 0;
    border-color: transparent var(--card-bg) transparent transparent;
  }

  .left-container,
  .right-container {
    left: 0;
  }

  .right-container {
    left: 0;
  }
}

/* Extra small devices (phones) */
@media (max-width: 360px) {
  /* Further reduce padding */
  .container {
    padding-left: 10px;
    padding-right: 10px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

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

  /* Smaller heading text */
  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  /* About hero cards optimized for very small screens */
  .about-hero-cards {
    gap: 20px;
    margin: 25px auto;
  }

  .about-hero-card {
    width: 98%;
    padding-bottom: 15px;
    border-radius: 1.5rem;
  }

  .about-hero-img-wrap {
    height: 140px;
    border-radius: 1.5rem 1.5rem 0.5rem 0.5rem;
  }

  .about-hero-title-overlay {
    font-size: 1.2rem;
    padding: 8px 0 6px 0;
  }

  .about-hero-desc {
    padding: 15px 15px 0;
    font-size: 0.95rem;
  }

  /* Optimize background for very small screens */
  body.show-fixed-bg::before {
    opacity: 0.2;
    background-position: center top;
  }

  /* Adjust button sizes */
  .btn {
    padding: 8px 15px;
    font-size: 0.9rem;
  }

  /* Fix any images or media that might overflow */
  img,
  video,
  iframe {
    max-width: 100%;
    height: auto;
  }

  /* Adjust any fixed width elements */
  .hero-section,
  .about-section,
  .services-section,
  .testimonials-section,
  .contact-section,
  .footer {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Button positioning for very small screens */
  .scroll-to-top {
    width: 42px;
    height: 42px;
    right: 10px;
    bottom: 10px;
  }

  .scroll-to-top i {
    font-size: 1rem;
  }

  .whatsapp-chat-btn {
    width: 48px;
    height: 48px;
    right: 10px;
    bottom: 65px;
  }

  .whatsapp-chat-btn i {
    font-size: 1.6rem;
  }
}

/* Mobile menu enhancements */
@media (max-width: 991px) {
  /* Hamburger button styling */
  .hamburger {
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1001;
    position: relative;
    background: none;
    border: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
  }

  .hamburger .line1,
  .hamburger .line2,
  .hamburger .line3 {
    width: 100%;
    height: 3px;
    background-color: #111;
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.4, 2, 0.6, 1);
  }

  /* Hamburger animation */
  .hamburger.active .line1 {
    transform: translateY(9px) rotate(45deg);
  }
  .hamburger.active .line2 {
    opacity: 0;
  }
  .hamburger.active .line3 {
    transform: translateY(-9px) rotate(-45deg);
  }

  /* Mobile nav styling */
  .nav-links {
    position: fixed;
    top: 80px;
    right: -100%;
    width: 280px;
    height: calc(100vh - 80px);
    background: #fff;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    padding: 30px 20px 20px 20px;
    transition: right 0.4s cubic-bezier(0.4, 2, 0.6, 1);
    overflow-y: auto;
    z-index: 1000;
    border-radius: 0 0 0 16px;
  }
  .nav-links.active {
    right: 0;
  }
  .nav-links li {
    margin: 12px 0;
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.3s cubic-bezier(0.4, 2, 0.6, 1);
    width: 100%;
  }
  .nav-links.active li {
    opacity: 1;
    transform: translateX(0);
  }
  .nav-links a {
    font-size: 16px;
    padding: 10px 5px;
    display: block;
    color: #111;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    width: 100%;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
  }
  .nav-links a:hover,
  .nav-links a:focus {
    background: #f7f7f7;
    color: #eab308;
  }
  /* Staggered animation for menu items */
  .nav-links.active li:nth-child(1) {
    transition-delay: 0.08s;
  }
  .nav-links.active li:nth-child(2) {
    transition-delay: 0.16s;
  }
  .nav-links.active li:nth-child(3) {
    transition-delay: 0.24s;
  }
  .nav-links.active li:nth-child(4) {
    transition-delay: 0.32s;
  }
  .nav-links.active li:nth-child(5) {
    transition-delay: 0.4s;
  }
  .nav-links.active li:nth-child(6) {
    transition-delay: 0.48s;
  }
}

@media (max-width: 480px) {
  .nav-links {
    width: 95vw;
    min-width: 0;
    max-width: 99vw;
    padding: 18px 8px 12px 8px;
    border-radius: 0 0 0 12px;
  }
  .header-left {
    max-width: calc(100% - 50px);
  }
  .logo img {
    max-height: 38px;
  }
}
