/**
 * Ganesha WebTech — performance, responsive, and UX enhancements
 */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Prevent layout shift from images */
img {
  max-width: 100%;
  height: auto;
}

picture {
  display: block;
  line-height: 0;
}

/* Better tap targets on mobile */
@media (max-width: 991.98px) {
  .btn,
  .wsmenu-list a,
  .form-control,
  select.form-control {
    min-height: 44px;
  }

  .wsmenu-list .btn {
    width: 100%;
    margin-top: 8px;
    justify-content: center;
  }

  .tel_text {
    display: inline;
    margin-left: 6px;
  }
}

/* Hero readability */
#hero-9 .hero-9-txt {
  padding-top: 20px;
}

#hero-9 .h2-sm {
  line-height: 1.25;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

#hero-9 .p-xl {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* Review widgets — stack on mobile */
.review-widget {
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
}

@media (max-width: 767.98px) {
  .review-widget {
    flex-direction: column;
    align-items: center;
  }

  .clutch-widget,
  .goodfirm-widget {
    float: none;
    max-width: 100%;
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

/* Consultation modal (replaces side offcanvas) */
.gws-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gws-modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.gws-consultation-modal {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gws-consultation-modal.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gws-modal-dialog {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.gws-consultation-modal.show .gws-modal-dialog {
  transform: translateY(0) scale(1);
}

.gws-modal-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
}

.gws-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 12px;
  background: linear-gradient(135deg, #61a0d6 0%, #4a8ec4 100%);
  color: #fff;
}

.gws-modal-header h5 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

.gws-modal-subtitle {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.92;
  line-height: 1.45;
  color: #fff;
}

.gws-modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.gws-modal-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.gws-modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.gws-form-group {
  margin-bottom: 16px;
}

.gws-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.gws-modal-body .form-control {
  border-radius: 10px;
  border: 1px solid #d8dee6;
  padding: 12px 14px;
  font-size: 0.95rem;
}

.gws-modal-body .form-control:focus {
  border-color: #61a0d6;
  box-shadow: 0 0 0 3px rgba(97, 160, 214, 0.2);
}

.gws-modal-submit {
  margin-top: 8px;
  padding: 14px 20px;
  font-weight: 600;
  border-radius: 10px;
}

.gws-modal-trust {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
}

body.gws-modal-open {
  overflow: hidden;
}

@media (max-width: 575.98px) {
  .gws-consultation-modal {
    padding: 12px;
    align-items: flex-end;
  }

  .gws-modal-dialog {
    max-width: 100%;
    max-height: 92dvh;
  }

  .gws-modal-content {
    border-radius: 16px 16px 0 0;
    max-height: 92dvh;
  }

  .gws-modal-header {
    padding: 20px 18px 10px;
  }

  .gws-modal-body {
    padding: 16px 18px 20px;
  }
}

/* Hero quote forms — prevent overlap on tablet/mobile */
@media (max-width: 991.98px) {
  #hero-21 .hero-promo {
    z-index: 1;
    position: relative;
    margin-top: 24px;
    margin-bottom: 0;
  }

  #hero-21 .hero-21-txt {
    position: relative;
    z-index: 2;
    margin-bottom: 28px;
  }

  #hero-21 .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  #hero-21 .hero-form {
    margin: 0 0 24px;
  }

  #hero-21 .hero-form form {
    padding: 28px 20px 24px;
  }
}

/* Forms UX */
.contact-form .form-control,
.register-form .form-control,
.consultation-form .form-control {
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form .form-control:focus,
.register-form .form-control:focus,
.consultation-form .form-control:focus {
  border-color: #61a0d6;
  box-shadow: 0 0 0 3px rgba(97, 160, 214, 0.18);
}

.contact-form .is-invalid,
.register-form .is-invalid {
  border-color: #dc3545;
}

.field-error,
.contact-form-error,
.quote-form-msg.text-danger {
  color: #c0392b;
  font-size: 0.875rem;
  margin-top: 6px;
}

.quote-form-msg.text-success {
  color: #1e7e34;
  font-weight: 500;
}

/* Success popup — mobile friendly */
@media (max-width: 575.98px) {
  .popup {
    width: calc(100% - 32px) !important;
    max-width: 100%;
    margin: 16px;
    padding: 28px 20px !important;
  }
}

/* Gallery — responsive grid */
.project-gallery .gallery-image,
.gallery-section .gallery-image {
  overflow: hidden;
  border-radius: 10px;
  margin-bottom: 24px;
}

.project-gallery img,
.gallery-section img {
  transition: transform 0.35s ease;
}

.project-gallery .gallery-image:hover img,
.gallery-section .gallery-image:hover img {
  transform: scale(1.03);
}

/* Sticky mobile CTA bar */
.gws-mobile-cta {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999990;
  background: #fff;
  border-top: 1px solid #e8ecf1;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  gap: 10px;
}

.gws-mobile-cta a {
  flex: 1;
  text-align: center;
  font-size: 0.875rem;
  padding: 12px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.gws-mobile-cta .cta-call {
  background: #f4f7fb;
  color: #1a2b3c;
  border: 1px solid #d8dee6;
  max-width: 42%;
}

.gws-mobile-cta .cta-quote {
  background: #61a0d6;
  color: #fff;
  flex: 1.2;
}

@media (max-width: 767.98px) {
  .gws-mobile-cta {
    display: flex;
    padding-right: 68px;
  }

  body {
    padding-bottom: 80px;
  }

  /* Lift Tawk.to bubble above the mobile CTA bar */
  #tawkchat-minified-container,
  #tawkchat-minified-wrapper,
  .tawk-min-container,
  .widget-visible iframe[title*="chat"] {
    bottom: 78px !important;
    right: 12px !important;
  }
}

/* Header scroll state */
.wsmainfull.scroll {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

/* Section spacing on mobile */
@media (max-width: 767.98px) {
  .wide-60,
  .wide-80 {
    padding-top: 50px;
    padding-bottom: 50px;
  }

  .hero-section {
    padding-top: 30px;
  }

  .hero-21-txt,
  .hero-11-txt,
  .hero-4-title {
    margin-bottom: 24px;
  }

  .hero-promo {
    margin-top: 24px;
  }
}

/* Brand carousel — smaller logos on mobile */
.brand-logo img {
  max-height: 42px;
  width: auto;
  object-fit: contain;
}

/* Footer responsive */
@media (max-width: 767.98px) {
  .footer-info,
  .footer-contacts,
  .footer-links {
    text-align: center;
  }

  .footer-logo img {
    margin: 0 auto;
  }
}

/* Loading state for form buttons */
button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Focus visible for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #61a0d6;
  outline-offset: 2px;
}

/* Hide third-party widget placeholders until loaded */
.gws-deferred-widget {
  min-height: 45px;
}

.gws-deferred-widget.is-loaded {
  min-height: 0;
}
