/* ==========================================
   Custom Overrides — Accent Pro Painting
   ========================================== */

/* === Fix 1: Sticky Header === */
.elementor-location-header,
header[data-elementor-type="header"] {
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
  width: 100% !important;
  background: #ffffff !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.elementor-sticky--active {
  position: sticky !important;
  left: 0 !important;
  width: 100% !important;
}

.elementor-sticky__spacer {
  display: none !important;
}

/* === Fix 3: Navigation System === */

/* Desktop: ALWAYS hide mobile dropdown and hamburger toggle */
@media (min-width: 1025px) {
  .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    display: none !important;
  }
  .elementor-menu-toggle {
    display: none !important;
  }

  /* Desktop hover dropdowns */
  .elementor-nav-menu--main .menu-item-has-children > .sub-menu {
    display: none !important;
    position: absolute !important;
    top: 100%;
    left: 0;
    background: #fff !important;
    min-width: 220px;
    width: max-content;
    max-width: 320px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14) !important;
    z-index: 10000 !important;
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .elementor-nav-menu--main .menu-item-has-children:hover > .sub-menu {
    display: block !important;
  }

  /* Nested flyout to the right */
  .elementor-nav-menu--main .sub-menu .menu-item-has-children > .sub-menu {
    position: absolute !important;
    top: 0 !important;
    left: 100% !important;
    background: #fff !important;
    z-index: 10001 !important;
  }

  .elementor-nav-menu--main .sub-menu li {
    display: block !important;
    width: 100%;
  }

  .elementor-nav-menu--main .sub-menu a {
    padding: 10px 20px !important;
    white-space: nowrap;
    display: flex !important;
    align-items: center;
    gap: 6px;
    color: #222 !important;
    text-decoration: none !important;
  }

  /* Caret inline with text */
  .elementor-nav-menu--main .sub-menu a .sub-arrow {
    display: inline-flex !important;
    align-items: center;
    margin-left: 4px;
  }

  /* Dropdown items: hover & active — white text on navy */
  .elementor-nav-menu--main .sub-menu a:hover,
  .elementor-nav-menu--main .sub-menu a:focus,
  .elementor-nav-menu--main .sub-menu a.elementor-item-active,
  .elementor-nav-menu--main .sub-menu .sub-menu a:hover,
  .elementor-nav-menu--main .sub-menu .sub-menu a:focus,
  .elementor-nav-menu--main .sub-menu .sub-menu a.elementor-item-active,
  .elementor-33 .elementor-element.elementor-element-48f6f970 .elementor-nav-menu--main .sub-menu a:hover,
  .elementor-33 .elementor-element.elementor-element-48f6f970 .elementor-nav-menu--main .sub-menu a:focus,
  .elementor-33 .elementor-element.elementor-element-48f6f970 .elementor-nav-menu--main .sub-menu a.elementor-item-active {
    background-color: #1D305E !important;
    color: #fff !important;
  }

  .elementor-nav-menu--main .sub-menu a:hover *,
  .elementor-nav-menu--main .sub-menu a:focus *,
  .elementor-nav-menu--main .sub-menu a.elementor-item-active *,
  .elementor-33 .elementor-element.elementor-element-48f6f970 .elementor-nav-menu--main .sub-menu a:hover *,
  .elementor-33 .elementor-element.elementor-element-48f6f970 .elementor-nav-menu--main .sub-menu a:focus *,
  .elementor-33 .elementor-element.elementor-element-48f6f970 .elementor-nav-menu--main .sub-menu a.elementor-item-active * {
    color: #fff !important;
  }
}

/* Tablet/mobile: hamburger menu toggle behavior */
@media (max-width: 1024px) {
  /* Hide desktop nav, show hamburger */
  .elementor-nav-menu--main {
    display: none !important;
  }

  .elementor-menu-toggle {
    display: flex !important;
    z-index: 99999 !important;
  }

  /* Allow dropdown to escape narrow column */
  .elementor-location-header .elementor-column,
  .elementor-location-header .elementor-widget-wrap,
  .elementor-location-header .elementor-widget-container,
  .elementor-location-header .elementor-widget-nav-menu {
    overflow: visible !important;
  }

  /* Dropdown: hidden by default */
  .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    display: none !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-height: calc(100vh - 80px) !important;
    height: auto !important;
    z-index: 99998 !important;
    background: #fff !important;
    overflow-y: auto !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
    transform: none !important;
  }

  /* Dropdown: shown when hamburger is active */
  .elementor-menu-toggle.elementor-active + .elementor-nav-menu--dropdown.elementor-nav-menu__container {
    display: block !important;
    max-height: 100vh !important;
    transform: none !important;
    overflow-y: auto !important;
  }

  /* Also handle the widget CSS toggle pattern */
  .elementor-nav-menu--toggle .elementor-menu-toggle.elementor-active + .elementor-nav-menu__container {
    display: block !important;
    max-height: 100vh !important;
    transform: none !important;
    overflow-y: auto !important;
  }

  .elementor-nav-menu--toggle .elementor-menu-toggle:not(.elementor-active) + .elementor-nav-menu__container {
    display: none !important;
    max-height: 0 !important;
    transform: none !important;
  }

  /* Mobile sub-menu accordion */
  .elementor-nav-menu--dropdown .menu-item-has-children > .sub-menu {
    display: none !important;
    position: static !important;
    box-shadow: none !important;
    background: transparent !important;
    padding-left: 15px !important;
  }

  .elementor-nav-menu--dropdown .menu-item-has-children.sub-menu-open > .sub-menu {
    display: block !important;
  }

  .elementor-nav-menu--stretch .elementor-nav-menu__container.elementor-nav-menu--dropdown {
    position: fixed !important;
    width: 100vw !important;
    left: 0 !important;
  }
}

/* === Fix 4: Gallery Grid + Lightbox === */
.e-gallery-container.e-gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 10px !important;
  position: relative !important;
}

.e-gallery-container.e-gallery-grid .e-gallery-item {
  position: relative !important;
  width: auto !important;
  height: auto !important;
  left: auto !important;
  top: auto !important;
}

.e-gallery-container.e-gallery-grid .e-gallery-item .e-gallery-image {
  padding-bottom: 100% !important;
  background-size: cover !important;
  background-position: center !important;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.e-gallery-container.e-gallery-grid .e-gallery-item:hover .e-gallery-image {
  transform: scale(1.02);
}

@media (max-width: 1024px) {
  .e-gallery-container.e-gallery-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .e-gallery-container.e-gallery-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Lightbox */
#lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

#lightbox-overlay.active {
  display: flex;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
}

.lb-img-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 88vh;
}

.lb-img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  transition: opacity 0.3s;
}

.lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 2;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  line-height: 1;
}

.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 28px;
  padding: 12px 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.lb-prev:hover, .lb-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-spinner {
  display: none;
  position: absolute;
  z-index: 1;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lb-spin 0.8s linear infinite;
}

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

/* === Fix 7: Smooth Scroll === */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

/* === Hide Elementor gallery overlay title/caption === */
.elementor-gallery-item__overlay {
  display: none !important;
}

/* === Reviews Carousel === */

/* Override the inline freeze rules for reviews widget */
.elementor-widget-reviews.e-widget-swiper .swiper-wrapper {
  overflow: visible !important;
  flex-wrap: nowrap !important;
}

.elementor-widget-reviews.e-widget-swiper .swiper-slide {
  display: flex !important;
  flex-shrink: 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Override the mobile hide-all-slides rule */
@media (max-width: 1024px) {
  .elementor-widget-reviews.e-widget-swiper .swiper-slide {
    display: flex !important;
    flex: none !important;
    max-width: none !important;
  }

  .elementor-widget-reviews.e-widget-swiper .swiper-slide:not(:first-child) {
    display: flex !important;
  }
}

/* Show arrows for reviews carousel */
.elementor-widget-reviews.e-widget-swiper .elementor-swiper-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.15) !important;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
  color: #1D305E !important;
}

.elementor-widget-reviews.e-widget-swiper .elementor-swiper-button:hover {
  background: rgba(0, 0, 0, 0.3) !important;
}

.elementor-widget-reviews.e-widget-swiper .elementor-swiper-button i {
  color: #1D305E !important;
  font-size: 18px;
}

.elementor-widget-reviews.e-widget-swiper .swiper {
  overflow: hidden !important;
}
