.drop-menu,
.mega-box,
.subdrop-menu {
  position: absolute;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
}

.drop-menu li a,
.mega-links li a {
  font-weight: 400;
  text-transform: none;
  transition: 0.2s ease-in-out;
}

:root {
  --red-disney: #cf2223;
  --red-white: #f73434;
  --text-color-light: #fff;
  --text-color-mega-link: #eaeaea;
  --bg-dark-primary: #1e1e1e;
  --bg-dark-secondary: #242526;
  --bg-dark-tertiary: #2c2d2e;
  --bg-gradient-nav: linear-gradient(
    180deg,
    #0e1012 -50.62%,
    rgba(14, 16, 18, 0) 100%
  );
  --font-primary: "Poppins", sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-primary);
}

html {
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

a {
  color: var(--red-disney);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

nav {
  position: absolute;
  width: 100%;
  z-index: 99;
  background: var(--bg-gradient-nav);
}

nav .wrapper-nav {
  position: relative;
  max-width: 1300px;
  height: 70px;
  margin: auto;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.presupuestar-btn,
.wrapper-nav .logo {
  flex-shrink: 0;
}

.wrapper-nav .logo a img {
  width: 180px;
  height: 60px;
  object-fit: contain;
}

.btn-presupuestar {
  display: inline-block;
  padding: 12px 24px;
  background: var(--red-disney);
  color: var(--text-color-light);
  font-weight: 600;
  border-radius: 4px;
  transition: background-color 0.3s;
  text-align: center;
}

.drop-menu,
.subdrop-menu {
  width: 250px;
  padding: 10px 0;
}

.btn-presupuestar:hover {
  background: var(--red-white);
}

.mobile-submenu-trigger,
.nav-links-megamenu .mobile-item,
.wrapper-nav .btn,
nav input[type="checkbox"] {
  display: none;
}

.nav-links-megamenu .desktop-item {
  display: inline-block;
}

.wrapper-nav .nav-links-megamenu {
  display: flex;
  justify-content: center;
  flex-grow: 1;
  gap: 10px;
  align-items: center;
}

.nav-links-megamenu li {
  display: flex;
  align-items: center;
  min-height: 45px;
  position: relative;
}

.nav-links-megamenu li a.desktop-item {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-color-light);
  border-radius: 8px;
  outline: transparent solid 3px;
  outline-offset: 3px;
  transition: var(--transition-smooth);
  background-color: transparent;
}

.nav-links-megamenu li a.desktop-item:focus-visible,
.nav-links-megamenu li a.desktop-item:hover {
  background-color: var(--red-disney);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.nav-links-megamenu li a.desktop-item:focus-visible {
  outline-color: var(--red-disney);
}

.nav-links-megamenu li.has-mega-menu {
  position: static;
}

.drop-menu,
.mega-box {
  top: 85px;
  left: 0;
  background: var(--bg-dark-secondary);
  border-radius: 8px;
  transform: translateY(-10px);
  transition:
    opacity 0.3s,
    transform 0.3s,
    visibility 0s 0.3s;
  will-change: transform, opacity;
}

.nav-links-megamenu li:hover > .drop-menu,
.nav-links-megamenu li:hover > .mega-box {
  top: 70px;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity 0.3s,
    transform 0.3s,
    visibility;
}

.drop-menu li.has-submenu {
  position: relative;
}

.drop-menu li a {
  width: 100%;
  padding: 8px 20px;
  border-radius: 0;
  color: var(--text-color-light);
}

.drop-menu li.has-submenu > a::after {
  content: "›";
  float: right;
  font-size: 1.2em;
  font-weight: 700;
  margin-left: 5px;
}

.drop-menu li a:focus-visible,
.drop-menu li a:hover,
.subdrop-menu li a:focus-visible,
.subdrop-menu li a:hover {
  background-color: var(--red-disney);
  color: var(--text-color-light);
}

.subdrop-menu {
  top: -10px;
  left: 100%;
  background: var(--bg-dark-tertiary);
  border-radius: 8px;
  transform: translateX(-10px);
  transition: 0.3s;
}

.drop-menu li.has-submenu:hover > .subdrop-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.mega-box {
  width: 100%;
  padding: 20px 30px;
}

.mega-box .content {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 30px;
}

.mega-box .row-menu {
  flex: 1;
  line-height: 1.6;
}

.mega-links li a {
  padding: 8px 12px;
  color: var(--text-color-mega-link);
  font-size: 14px;
}

.mega-links li a:focus-visible,
.mega-links li a:hover {
  background-color: var(--red-disney);
  color: #fff;
  transform: translateX(4px);
}

/* El menú de escritorio solo cabe desde ~1240px: por debajo se usa el menú móvil (antes 1024px) */
@media screen and (max-width: 1240px) {
  .desktop-item,
  .presupuestar-btn {
    display: none !important;
  }

  #menu-btn:checked ~ .close-btn,
  .mobile-submenu-trigger,
  .nav-links-megamenu .mobile-item,
  .wrapper-nav .btn {
    display: block;
  }

  .wrapper-nav .btn {
    cursor: pointer;
    background: 0 0;
    border: none;
    padding: 0;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 101;
  }

  #menu-btn:checked ~ .menu-btn,
  .drop-menu li.has-submenu > a::after,
  .nav-links-megamenu li.has-mega-menu,
  .wrapper-nav .close-btn {
    display: none;
  }

  #menu-btn:checked ~ .nav-links-megamenu {
    left: 0;
  }

  .nav-links-megamenu {
    position: fixed;
    top: 0;
    left: -100%;
    height: 100%;
    width: 90%;
    max-width: 380px;
    background: #1e1e1e;
    padding: 70px 30px 30px;
    overflow-y: auto;
    transition: left 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }

  .nav-links-megamenu li {
    display: block;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .drop-menu li:last-child a,
  .nav-links-megamenu li:last-of-type,
  .subdrop-menu li:last-child a {
    border-bottom: none;
  }

  .nav-links-megamenu li a.mobile-item,
  .nav-links-megamenu li label.mobile-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 30px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-color-light);
    text-align: left !important;
    transition: color 0.2s;
    cursor: pointer;
    position: relative;
  }

  .nav-links-megamenu li a.mobile-item:hover,
  .nav-links-megamenu li label.mobile-item:hover {
    color: var(--red-disney);
  }

  .nav-links-megamenu li label.mobile-item::after {
    content: "+";
    position: absolute;
    right: 30px;
    font-size: 22px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.3s;
  }

  input[type="checkbox"]:checked + label.mobile-item::after {
    transform: rotate(45deg);
  }

  .drop-menu,
  .subdrop-menu {
    position: static;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 5px 0 10px;
    transition: max-height 0.3s ease-in-out;
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--red-disney);
    border-radius: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .drop-menu li,
  .subdrop-menu li {
    border-bottom: none;
    padding: 10px 15px 10px 12px;
  }

  .drop-menu li a,
  .subdrop-menu li a {
    font-size: 14px;
    font-weight: 400;
    text-transform: none;
    color: #dcdcdc;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .drop-menu li a:hover,
  .subdrop-menu li a:hover {
    color: var(--text-color-light);
    background-color: transparent;
  }

  .mobile-submenu-trigger {
    position: absolute;
    right: 10px;
    top: 0;
    width: 50px;
    height: 100%;
    z-index: 2;
  }

  #showDrop1:checked ~ .drop-menu,
  #showDrop2:checked ~ .drop-menu,
  #showDrop3:checked ~ .drop-menu,
  #showDrop4:checked ~ .drop-menu,
  #showDrop5:checked ~ .drop-menu,
  #showMega:checked ~ .mega-box,
  #showSub1:checked ~ .subdrop-menu,
  #showSub2:checked ~ .subdrop-menu,
  #showSub3:checked ~ .subdrop-menu,
  #showSub4:checked ~ .subdrop-menu,
  #showSub5:checked ~ .subdrop-menu,
  #showSub6:checked ~ .subdrop-menu {
    max-height: 100vh;
  }
}

@media screen and (max-width: 480px) {
  .nav-links-megamenu li a.mobile-item,
  .nav-links-megamenu li label.mobile-item {
    padding: 16px 20px;
  }

  .nav-links-megamenu li label.mobile-item::after {
    right: 20px;
  }
}
