/* Layout General */
.m3-app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.m3-top-app-bar {
  height: 64px;
  background-color: var(--md-sys-color-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.m3-top-app-bar__title {
  font-size: 22px;
  font-weight: 400;
  color: var(--md-sys-color-on-surface);
}

.m3-main-container {
  flex: 1;
  display: flex;
  width: 100%;
}

.m3-content {
  flex: 1;
  padding: 24px 16px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  transition: margin-left 0.25s var(--md-sys-motion-easing-emphasized), width 0.25s var(--md-sys-motion-easing-emphasized);
}

/* Barra de navegación inferior (Móvil) */
.m3-navigation-bar {
  height: 80px;
  background-color: var(--md-sys-color-surface-container);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  position: sticky;
  bottom: 0;
  z-index: 10;
  transition: width 0.25s var(--md-sys-motion-easing-emphasized), padding 0.25s var(--md-sys-motion-easing-emphasized), align-items 0.25s var(--md-sys-motion-easing-emphasized);
}

.m3-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  gap: 4px;
  width: 64px;
  cursor: pointer;
}

.m3-nav-item .icon-wrapper {
  height: 32px;
  width: 64px;
  border-radius: var(--md-sys-shape-corner-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.m3-nav-item:hover .icon-wrapper {
  background-color: var(--md-sys-color-surface-container-high);
}

.m3-nav-item--active {
  color: var(--md-sys-color-on-surface);
}

.m3-nav-item--active .icon-wrapper {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

/* Barra de navegación responsiva (Móvil: inferior, Escritorio: lateral) */
@media (min-width: 600px) {
  .m3-navigation-bar {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 16px;
    padding-top: 24px;
    width: 80px;
    height: calc(100vh - 64px);
    position: fixed;
    left: 0;
    top: 64px;
    bottom: auto;
    border-top: none;
    border-right: 1px solid var(--md-sys-color-outline-variant);
    background-color: var(--md-sys-color-surface-container);
    z-index: 100;
  }

  .m3-nav-item {
    width: 100%;
    height: auto;
    padding: 8px 0;
  }

  /* Desplazar el contenido principal solo si la barra de navegación está presente */
  .m3-app-shell:has(.m3-navigation-bar) .m3-content {
    margin-left: 80px;
    width: calc(100% - 80px);
  }

  /* Estado Expandido de la Barra Lateral en Escritorio */
  .m3-navigation-bar--expanded {
    width: 240px !important;
    align-items: flex-start !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  #nav-toggle-btn {
    display: flex !important;
    margin-top: auto !important;
    border: none !important;
    background: transparent !important;
    color: inherit !important;
    cursor: pointer !important;
    width: 100% !important;
    padding: 8px 0 !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Ocultar texto en colapsado */
  #nav-toggle-text {
    display: none !important;
  }

  .m3-navigation-bar--expanded #nav-toggle-btn {
    padding: 0 16px !important;
    height: 56px !important;
  }

  /* Mostrar texto en expandido */
  .m3-navigation-bar--expanded #nav-toggle-text {
    display: inline-block !important;
    font-size: 14px !important;
    font-weight: 500 !important;
  }

  .m3-navigation-bar--expanded .m3-nav-item {
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    height: 56px !important;
    padding: 0 16px !important;
    border-radius: var(--md-sys-shape-corner-full) !important;
    font-size: 14px !important;
    text-align: left !important;
  }

  .m3-navigation-bar--expanded .m3-nav-item .icon-wrapper {
    width: 24px !important;
    height: 24px !important;
    background-color: transparent !important;
    color: inherit !important;
  }

  .m3-navigation-bar--expanded .m3-nav-item:hover .icon-wrapper {
    background-color: transparent !important;
  }

  .m3-navigation-bar--expanded .m3-nav-item--active {
    background-color: var(--md-sys-color-secondary-container) !important;
    color: var(--md-sys-color-on-secondary-container) !important;
  }

  .m3-navigation-bar--expanded .m3-nav-item--active .icon-wrapper {
    color: inherit !important;
  }

  /* Desplazar el contenido principal más a la derecha cuando esté expandido */
  .m3-app-shell:has(.m3-navigation-bar--expanded) .m3-content {
    margin-left: 240px !important;
    width: calc(100% - 240px) !important;
  }
}

/* Ocultar botón de menú en móvil */
@media (max-width: 599px) {
  #nav-toggle-btn {
    display: none !important;
  }
}
