/* =========================================
   VARIABLES & CONFIGURACIÓN
   ========================================= */
:root {
  --top-header-bg: #fff;
  --header-bg: #1e1348;
  --header-text: #ffffff;
  --header-accent: #91ffcf;
  --header-height: 87px;
  --header-height-mobile: 68px;
  --header-radius: 999px;
}

/* =========================================
        ESTILOS BASE (DESKTOP FIRST)
  ========================================= */

.c-header {
  position: relative;
  z-index: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.c-header__top-bar {
  background-color: var(--top-header-bg);
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding-left: var(--grid-margin);
  padding-right: var(--grid-margin);
  min-height: 44px;
  align-items: center;
}

.c-header__top-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
}

.c-header__top-list a {
  text-decoration: none;
  color: var(--header-bg);
  font-family: var(--font-family);
  font-weight: 500;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s;
}

.c-header__top-list a:hover {
  opacity: 0.7;
}

.c-header__top-list img {
  display: block;
}

.c-header__bar-box {
  position: relative;
  z-index: 100;
  padding: 0 1rem;
  padding-left: var(--grid-margin);
  padding-right: var(--grid-margin);
  width: 100%;
}
.c-header__bar {
  position: relative;
  background-color: var(--header-bg);
  height: var(--header-height);
  border-radius: var(--header-radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  box-shadow: 0 10px 30px rgba(21, 0, 53, 0.2);
  transition: all 0.3s ease;
}

.c-header__logo a {
  display: block;
  line-height: 0;
  text-decoration: none;
}
.c-header__logo-img {
  height: 40px;
  width: auto;
  display: block;
  object-fit: contain;
}

.c-header__desktop-group {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 2rem;
}

.c-header__menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.5rem;
  align-items: center;
}

.c-header__menu .menu-item {
  position: relative;
}

.c-header__menu .menu-item a {
  color: var(--header-text);
  text-decoration: none;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 14px;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  position: relative;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
}

.c-header__menu .menu-item a:hover,
.c-header__menu .current-menu-item > a,
.c-header__menu .is-open > a {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--header-accent);
}

.c-header__menu .menu-item > a::before {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 8px;
  height: 8px;
  background-color: var(--header-accent);
  border-radius: 50%;
  transform: translateX(-50%) scale(0);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.c-header__menu .current-menu-item > a::before,
.c-header__menu .is-open > a::before { 
  transform: translateX(-50%) scale(1);
  bottom: -4px;
}

.c-header__menu .has-dropdown {
  position: static; 
}

.c-header__menu .has-dropdown > a {
  padding-right: 2.2rem;
}

.c-header__menu .has-dropdown > a::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 12px;
  height: 12px;
  background-color: currentColor;
  -webkit-mask-image: url("/wp-content/themes/text/assets/icons/chevron-down.svg");
  mask-image: url("/wp-content/themes/text/assets/icons/chevron-down.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  transform: translateY(-50%) rotate(180deg);
  transition: transform 0.3s ease;
}

.c-header__menu .has-dropdown.is-open > a::after {
  transform: translateY(-50%) rotate(0deg);
}

/* =========================================
   ESTILOS DEL DROPDOWN (MENÚ DESKTOP)
   ========================================= */
.c-header__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  background: white;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 10;
}

.c-header__menu .has-dropdown.is-open .c-header__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.c-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px; 
}

.c-dropdown-item {
  position: relative;
  display: block;
  aspect-ratio: 4/3;
  text-decoration: none;
  z-index: 0; 
}

.c-dropdown-item::before {
  content: "";
  position: absolute;
  top: -12px;
  bottom: -12px;
  left: 20px; 
  right: 20px;
  background-color: var(--header-accent); 
  border-radius: 24px; 
  z-index: -1; 
  opacity: 0; 
  transform: scaleY(0.8); 
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

.c-dropdown-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px; 
  display: block;
}

.c-dropdown-item span {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 30px 10px 15px 10px;
  color: white;
  font-weight: 500;
  font-size: clamp(18px, 12.91px + 1.59vw, 32px);
  text-align: center;
  background: linear-gradient(transparent, rgba(30, 19, 72, 0.9));
  z-index: 1;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  transition: color 0.3s ease; 
}

.c-dropdown-item:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

.c-dropdown-item:hover span {
  color: var(--header-accent);
  font-weight: 700;
}

.c-header__menu .menu-item a.c-dropdown-item{
  padding: 0;
}

.c-header__search button {
  width: 48px;
  height: 48px;
  background-color: var(--header-accent);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s;
}
.c-header__search button:hover {
  transform: scale(1.05);
}

.c-header__mobile-actions,
.c-mobile-menu {
  display: none;
}

/* =========================================
  RESPONSIVE (TABLET Y MÓVIL < 992px)
  ========================================= */
@media (max-width: 992px) {
  .c-header{
    padding-top: 1rem;
  }
  .c-header__bar {
    height: var(--header-height-mobile);
  }

  .c-header__desktop-group,
  .c-header__top-bar {
    display: none;
  }

  .c-header__mobile-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
  }
  .c-header__mobile-actions button {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .c-mobile-menu.is-open {
    display: flex;
  }

  .c-mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--header-bg);
    z-index: 9999;
    flex-direction: column;
    overflow-y: auto;
  }

  .c-mobile-menu__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 1.5rem;
  }
  .c-mobile-menu__close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
  }

  .c-mobile-menu__nav {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  .c-mobile-menu__list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  .c-mobile-menu__list > li {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .c-mobile-menu__list > li > a {
    color: var(--header-text);
    font-family: var(--font-family);
    font-size: 36px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 10px;
    transition: color 0.3s ease; 
  }

  .c-mobile-menu__list > li > a:hover,
  .c-mobile-menu__list .current-menu-item > a,
  .c-mobile-menu__list > li > a.is-expanded { 
    color: var(--header-accent); 
  }

  .c-mobile-menu__list > li > a::before {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 8px;
    height: 8px;
    background-color: var(--header-accent);
    border-radius: 50%;
    transform: translateX(-50%) scale(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .c-mobile-menu__list > li > a:hover::before,
  .c-mobile-menu__list .current-menu-item > a::before,
  .c-mobile-menu__list > li > a.is-expanded::before { 
    transform: translateX(-50%) scale(1);
  }

  .c-mobile-menu__list .has-dropdown > a::after {
    content: "";
    display: block;
    width: 24px;
    height: 24px;
    background-color: currentColor; 
    -webkit-mask-image: url("/wp-content/themes/text/assets/icons/chevron-down.svg");
    mask-image: url("/wp-content/themes/text/assets/icons/chevron-down.svg");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    transform: rotate(180deg);
    transition: transform 0.3s ease;
  }

  .c-mobile-menu__list .has-dropdown > a.is-expanded::after {
    transform: rotate(0deg); 
  }

  /* --- DROPDOWN RESPONSIVE --- */
  .c-mobile-menu__list .c-header__dropdown {
    position: static;
    box-shadow: none;
    background: transparent;
    width: 100%;
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    margin-top: 0; 
    padding: 0; 
    transition: grid-template-rows 0.4s ease, opacity 0.4s ease, margin-top 0.4s ease, visibility 0.4s;
  }

  .c-mobile-menu__list .c-header__dropdown > .c-dropdown-grid {
    overflow: hidden; 
    min-height: 0;
    padding: 0; 
    transition: padding 0.4s ease;
  }

  .c-mobile-menu__list .has-dropdown > a.is-expanded + .c-header__dropdown > .c-dropdown-grid {
    padding: 1rem;
  }
  .c-mobile-menu__list .has-dropdown > a.is-expanded + .c-header__dropdown {
    grid-template-rows: 1fr; 
    opacity: 1;
    visibility: visible;
    margin-top: 20px; 
  }

  .c-mobile-menu__list .c-dropdown-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .c-mobile-menu__list .c-dropdown-item {
    border-radius: 12px;
  }

  .c-mobile-menu__list .c-dropdown-item span {
    padding: 20px 5px 10px 5px;
  }

  /* Footer */
  .c-mobile-menu__footer {
    background-color: #ffffff;
    padding: 2.5rem 2rem;
  }

  .c-mobile-menu__footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .c-mobile-menu__footer li {
    margin-bottom: 1rem;
  }
  .c-mobile-menu__footer a {
    color: #5a5a7a;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 400;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity 0.2s;
  }

  .c-mobile-menu__footer a:hover {
    opacity: 0.7;
    color: var(--header-bg);
  }

  .c-mobile-menu__footer img {
    display: block;
    width: 20px;
    height: 20px;
  }
}

/* =========================================
   VARIACIÓN HOME
  ========================================= */

body.home .c-header__bar-box {
  border-radius: 0;
  background-color: var(--header-bg);
  box-shadow: none;
  padding: 0 3rem;
}

@media (max-width: 992px) {
  body.home .c-header {
    padding-top: 0;
  }
  body.home .c-header__bar-box {
    padding: 1rem;
  }

}

@media (max-width: 768px) {
  .c-header__logo-img {
    height: 27px;
  }
  .c-header__mobile-actions button img{
    width: 24px;
    height: 24px;
  }
}

/* =========================================
   FIX: WORDPRESS ADMIN BAR
  ========================================= */
.admin-bar .c-mobile-menu {
  top: 32px;
  height: calc(100vh - 32px);
}
@media screen and (max-width: 782px) {
  .admin-bar .c-mobile-menu {
    top: 46px;
    height: calc(100vh - 46px);
  }
}


/* =========================================
   CLASS: header-absolut-position
  ========================================= */
@media (max-width: 768px) {
  .header-absolut-position .c-header {
    position: absolute;
    width: 100%;
    z-index: 10;
  }
}

/* =========================================
   HEADER SHAPE
   CLASS: header-with-shape
   ========================================= */
.c-header__shape {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%); 
  top: 44px; 
  width: 320px; 
  z-index: -1; 
  pointer-events: none;
}

body.header-with-shape .c-header__shape {
  display: block;
}

@media (max-width: 768px) {
  .c-header__shape {
    width: 240px;
  }
}