/* Variables CSS */
:root {
  --navbar-height: 1.5cm;
  --navbar-padding-left: 1cm;
  --navbar-padding-right: 0.5cm;
  --navbar-bg: #5ab507;
  --active-bg: #468704;
  --nav-item-width: 170px;
  --logo-margin-right: 20px;
  --divider-margin: 0.2cm;
  --font-primary: "Noto Sans JP", sans-serif;
  --font-secondary: "Roboto", sans-serif;
  --nav-item-font-size: 21pt;
  --nav-active-left: -13px;
  --nav-active-right: -13px;
  --nav-active-top: -8px;
  --nav-active-bottom: -8px;
}

/* Carga de fuentes locales */
@font-face {
  font-family: "Noto Sans JP";
  src: url("../Fonts/NotoSansJP-ExtraBold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}
@font-face {
  font-family: "Roboto";
  src: url("../Fonts/Roboto-VariableFont_wdth,wght.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: var(--font-primary);
}

/* Navbar principal */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--navbar-bg);
  height: var(--navbar-height);
  padding: 0 var(--navbar-padding-right) 0 var(--navbar-padding-left);
  display: flex;
  align-items: center;
  z-index: 4;
}


.navbar-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.nav-items {
  display: contents;
}

/* Dividers: solo separadores */
.divider {
  flex: none;
  margin: 0 var(--divider-margin);
}
.divider svg {
  width: 10px;
  height: 40px;
  display: block;
}

/* Secciones fijas para logo y nav-items */
.nav-logo,
.nav-item {
  width: var(--nav-item-width);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Logo */
.nav-logo img {
  max-height: 1cm;
  width: auto;
  margin-right: var(--logo-margin-right);
}

.nav-item.contacto {
  text-decoration: none; /* Quita el subrayado */
  color: inherit; /* Usa el color heredado en lugar del azul predeterminado */
  display: flex;
  align-items: center;
  gap: 5px; /* Espacio entre icono y texto */
}

.nav-item.contacto:hover {
  color: black; /* Cambia de color al pasar el mouse (opcional, verde de WhatsApp) */
}

/* Aplica el estilo a cualquier botón dentro de elementos de navegación */
.nav-logo button,
.nav-item button {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: none;
    border: none;
    opacity: 0;
    cursor: pointer;
    z-index: 2; /* Asegura que esté sobre el contenido */
}

/* Asegura que los contenedores sean relativos para que el botón funcione correctamente */
.nav-logo,
.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Elementos de navegación */
.nav-item {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: var(--nav-item-font-size);
  white-space: nowrap;
  position: relative;
  padding: 0 0.1cm;
  overflow: visible;
}

/* Estado activo: cuadro detrás del texto */
.nav-item.active {
  position: relative;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  top: var(--nav-active-top);
  bottom: var(--nav-active-bottom);
  left: var(--nav-active-left);
  right: var(--nav-active-right);
  background-color: var(--active-bg);
  z-index: 0;
}
.nav-item.active span {
  position: relative;
  z-index: 1;
  color: #ffffff;
}

/* Modificación para iniciar-sesion */
.nav-item.iniciar-sesion.active::before {
  top: -10px; /* Ajustar el tamaño superior */
  bottom: 4px; /* Ajustar el tamaño inferior */
  left: -13px; /* Ajustar el tamaño izquierdo */
  right: -13px; /* Ajustar el tamaño derecho */
}

/* Secciones especiales: contacto, iniciar sesión */
.nav-item.contacto {
  gap: 0.1cm;
}
.icon-contacto svg {
  width: 20px;
  height: 26px;
}

.nav-item.iniciar-sesion {
  font-size: 18.5pt;
}
.nav-item.iniciar-sesion .icon-iniciar svg {
  width: 40px;
  height: 100%;
}
.iniciar-text {
  display: flex;
  flex-direction: column;
}
.iniciar-text span {
  line-height: 1;
}
/* Sección de búsqueda */
.search-bar {
  flex: 1;
  height: 1.2cm;
  border: none;
  border-radius: 0.2cm 0 0 0.2cm;
  padding: 0 0.5cm;
  font-family: var(--font-secondary);
  font-size: 18pt;
  box-sizing: border-box;
}

.search-button {
  width: 1.5cm;
  height: 1.2cm;
  background-color: var(--active-bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 0.3cm 0.3cm 0;
  cursor: pointer;
}

.search-button svg {
  width: 30px;
  height: 30px;
  fill: #ffffff;
}

/* Sección de búsqueda ocupa el espacio restante */
.search-section {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
}

.search-form {
  display: flex;
  width: 100%;
}

/* Estilos para el botón "Cerrar Sesión" */
.logout-button {
    display: none; /* Hidden by default */
    position: absolute;
    top: 60px; /* Move the button far below the navbar */
    left: 905px;
    transform: translateX(-50%);
    padding: 10px 20px;
    background-color: red;
    color: white;
    box-shadow: black 0px 0px 10px 0px;
    font-family: var(--font-secondary);
    font-size: 18pt;  
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    z-index: 3; /* Ensure it appears above other elements */
}
.logout-button:hover {
    background-color: darkred;
}

.hamburger {
  display: none;
}

@media (max-width: 965px) {
  .navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    height: 80px;
  }

  .nav-logo {
    margin-right: auto;
    padding-left: 0;
    width: auto;
    min-width: 44px;
    display: flex;
    align-items: center;
  }
  .nav-logo img {
    margin-right: 0;
    max-height: 54px;
    max-width: 90vw;
    height: auto;
    width: auto;
    display: block;
  }

  .nav-logo button, .nav-item button {
    display: block;
    width: 100%;
    text-align: left !important;
    padding: 10px 20px;
    background-color: #5ab507;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: white;
    border-bottom: 1px solid white;
  }

  .nav-items {
    display: none;
    flex-direction: column;
    background-color: #5ab507;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    padding: 10px 0;
    z-index: 1000;
  }

  .nav-items.show {
    display: flex;
  }

  .nav-item, .nav-form, .contacto, .iniciar-sesion {
    padding: 12px 20px;
    border-bottom: 1px solid white;
    width: 100%;
  }

  .nav-item span, .contacto span, .iniciar-sesion span {
    color: white;
    font-size: 18px;
  }

  .hamburger {
    display: flex;
    font-size: 34px;
    background: none;
    border: none;
    color: white;
    margin-left: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    height: 54px;
    width: 54px;
  }

  .divider {
    display: none;
  }
  .nav-logo img {
    max-height: 36px;
    max-width: 85%;
    margin-right: 5px;
  }
    .navbar {
    height: 70px;
    min-height: 70px;
  }

  .logout-button {
    display: none; /* Hidden by default */
    position: absolute;
    top: 350px; /* Move the button far below the navbar */
    left:180px;
    transform: translateX(-50%);
    padding: 10px 20px;
    background-color: red;
    color: white;
    box-shadow: black 0px 0px 10px 0px;
    font-family: var(--font-secondary);
    font-size: 18pt;  
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    z-index: 3; /* Ensure it appears above other elements */
  }
}
