/**
 * Custom Mega Menu Styles
 * Independent styles - no PrestaShop dependencies
 */

/* Reset and Base Styles */
.custom-megamenu-wrapper {
  position: relative;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  z-index: 1000;
}

/* Visibility classes */
.custom-megamenu-visibility-none {
  display: none !important;
}

/* PC only - hide mobile toggle, show nav on desktop */
.custom-megamenu-visibility-pc .custom-megamenu-mobile-toggle {
  display: none !important;
}

@media screen and (max-width: 991px) {
  .custom-megamenu-visibility-pc .custom-megamenu-wrapper {
    display: none !important;
  }
}

@media screen and (min-width: 992px) {
  .custom-megamenu-visibility-pc .custom-megamenu-nav {
    display: block !important;
  }
}

/* Mobile only - hide on desktop, show mobile toggle on mobile */
.custom-megamenu-visibility-mobile .custom-megamenu-nav {
  display: none !important;
}

@media screen and (min-width: 992px) {
  .custom-megamenu-visibility-mobile .custom-megamenu-wrapper {
    display: none !important;
  }
}

@media screen and (max-width: 991px) {
  .custom-megamenu-visibility-mobile .custom-megamenu-wrapper {
    display: block !important;
  }
  
  .custom-megamenu-visibility-mobile .custom-megamenu-mobile-toggle {
    display: flex !important;
  }
  
  .custom-megamenu-visibility-mobile .custom-megamenu-nav.active {
    display: block !important;
  }
}

@media screen and (min-width: 992px) {
  .custom-megamenu-wrapper {
    position: static;
  }
}

/* Mobile Toggle Button */
.custom-megamenu-mobile-toggle {
  display: none;
  background: none;
  border: none;
  border-top: 1px solid #e3e3e3;
  border-bottom: 1px solid #e3e3e3;
  cursor: pointer;
  padding: 10px 15px;
  position: relative;
  z-index: 1001;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  margin-left: 0;
  width: 100%;
}

.custom-megamenu-toggle-text {
  display: none;
  font-size: 16px;
  font-weight: 500;
  color: #333;
  text-transform: uppercase;
}

@media screen and (max-width: 991px) {
  .custom-megamenu-mobile-toggle {
    padding-left: 25px;
    margin-bottom: 25px;
    padding-top: 20px;
    padding-bottom: 20px;
    margin-top: 10px;
    border-top: 1px solid #e3e3e3;
    border-bottom: 1px solid #e3e3e3;
  }

  .custom-megamenu-mobile-toggle.active {
    border-bottom: none;
    margin-bottom: 0px;
    padding-bottom: 10px;
  }
}

.custom-megamenu-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
}

.custom-megamenu-hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: #333;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.custom-megamenu-mobile-toggle.active .custom-megamenu-hamburger span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.custom-megamenu-mobile-toggle.active .custom-megamenu-hamburger span:nth-child(2) {
  opacity: 0;
}

.custom-megamenu-mobile-toggle.active .custom-megamenu-hamburger span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Main Navigation */
.custom-megamenu-nav {
  width: 100%;
}

@media screen and (min-width: 992px) {
  .custom-megamenu-nav {
    background: #ff4c4c;
  }
}

.custom-megamenu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.custom-megamenu-item {
  position: relative;
  margin: 0;
  padding: 0;
}

.custom-megamenu-link {
  display: block;
  padding: 15px 20px;
  color: #ffffff !important;
  background-color: #ff4c4c;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  transition: color 0.3s ease, background-color 0.3s ease, font-weight 0.3s ease;
  position: relative;
  white-space: nowrap;
}

.custom-megamenu-link:hover {
  color: #ffffff !important;
  background-color: #c30000;
  font-weight: 600;
}

.custom-megamenu-link:visited {
  color: #ffffff !important;
}

.custom-megamenu-arrow {
  display: inline-block;
  margin-left: 5px;
  font-size: 10px;
  transition: transform 0.3s ease;
}

.custom-megamenu-item:hover .custom-megamenu-arrow {
  transform: rotate(180deg);
}

/* Submenu Styles - Desktop */
.custom-megamenu-submenu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-width: 1320px;
  list-style: none;
  margin: 0;
  padding: 10px;
  background-color: #de7d7e;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  z-index: 1000;
}

@media screen and (min-width: 992px) {
  .custom-megamenu-wrapper {
    position: relative;
    margin-bottom: 10px;
  }

  .custom-megamenu-submenu {
    position: absolute;
    left: 0;
    width: 1320px;
    max-width: 1320px;
    transform: translateY(-10px);
    border-top: 1px solid #D1D5D7;
    background-color: #F7F8F9;
    -moz-box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    -webkit-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    padding: 20px;
  }

  .custom-megamenu-item:hover .custom-megamenu-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

@media screen and (min-width: 992px) and (max-width: 1320px) {
  .custom-megamenu-submenu {
    width: 100vw;
    max-width: 100vw;
  }
}

@media screen and (max-width: 991px) {
  .custom-megamenu-submenu {
    position: static;
    width: 100%;
    max-width: 100%;
    left: auto;
    margin-left: 0;
  }

  .custom-megamenu-item:hover .custom-megamenu-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

.custom-megamenu-subitem {
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  min-width: 180px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

@media screen and (min-width: 992px) {
  .custom-megamenu-subitem {
    flex: 0 0 calc(25% - 1px);
    max-width: calc(25% - 1px);
    min-width: calc(25% - 1px);
    border-bottom: none;
    border-right: none;
  }
}

/* Remove right border for every 2nd item (2 columns layout) on mobile/tablet */
@media screen and (max-width: 991px) {
  .custom-megamenu-subitem:nth-child(2n) {
    border-right: none;
  }

  .custom-megamenu-subitem:last-child:nth-child(odd) {
    border-right: none;
  }
}

.custom-megamenu-sublink {
  display: block;
  padding: 12px 15px;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s ease, background-color 0.3s ease;
  white-space: nowrap;
}

@media screen and (min-width: 992px) {
  .custom-megamenu-sublink {
    color: #000000 !important;
  }

  .custom-megamenu-sublink:hover {
    color: #000000 !important;
    background-color: rgba(0, 0, 0, 0.05);
  }

  .custom-megamenu-sublink:visited {
    color: #000000 !important;
  }
}

@media screen and (max-width: 991px) {
  .custom-megamenu-sublink:hover {
    color: #000000 !important;
    background-color: rgba(255, 255, 255, 0.1);
  }

  .custom-megamenu-sublink:visited {
    color: #000000 !important;
  }
}

/* Mobile Styles */
@media screen and (max-width: 991px) {
  .custom-megamenu-wrapper {
    max-width: 100%;
  }

  .custom-megamenu-mobile-toggle {
    display: flex;
  }

  .custom-megamenu-toggle-text {
    display: block;
  }

  .custom-megamenu-nav {
    position: relative;
    width: 100%;
    display: none;
    background-color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
    z-index: 1000;
  }

  .custom-megamenu-nav.active {
    display: block;
  }

  .custom-megamenu-list {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    margin: 0;
  }

  .custom-megamenu-item {
    width: 100%;
    border-bottom: 1px solid #f0f0f0;
  }

  .custom-megamenu-link {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
  }

  .custom-megamenu-arrow {
    transform: rotate(-90deg);
    transition: transform 0.3s ease;
    font-size: 12px;
  }

  .custom-megamenu-item.active .custom-megamenu-arrow {
    transform: rotate(0deg);
  }

  /* Mobile Submenu */
  .custom-megamenu-submenu {
    position: static !important;
    display: none !important;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    left: auto;
    margin-left: 0;
    flex-direction: column;
    list-style: none;
  }

  .custom-megamenu-item.active .custom-megamenu-submenu {
    display: flex !important;
  }

  .custom-megamenu-subitem {
    border-bottom: 1px solid #e0e0e0;
    border-right: none;
  }

  .custom-megamenu-subitem:last-child {
    border-bottom: none;
  }

  .custom-megamenu-sublink {
    padding: 12px 20px 12px 40px;
    pointer-events: auto;
    cursor: pointer;
    color: #212529 !important;
    font-weight: 500;
  }
}

/* Tablet Styles */
@media screen and (min-width: 992px) and (max-width: 1199px) {
  .custom-megamenu-link {
    padding: 12px 15px;
    font-size: 15px;
  }
}

/* Large Desktop Styles */
@media screen and (min-width: 1200px) {
  .custom-megamenu-link {
    padding: 15px 25px;
    font-size: 16px;
  }

  .custom-megamenu-submenu {
    width: 100%;
    max-width: 1320px;
  }

  .custom-megamenu-subitem {
    min-width: 200px;
  }
}

