/* build/css/sidebar.css — Rediseño del menú lateral (claro y moderno)
   Se carga DESPUÉS de app.css, así que estas reglas ganan.
   Recordar: html { font-size: 62.5% } => 1rem = 10px. */

/* ---------- Overlay de fondo ---------- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1400;
}
.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Evita el scroll del fondo cuando el menú está abierto */
body.sidebar-abierto {
  overflow: hidden;
}

/* Que la sección de contacto no quede tapada por el navbar fijo
   al saltar/scrollear desde "Contactanos". */
#info {
  scroll-margin-top: 11rem;
}

/* ---------- Panel ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  background: #ffffff;
  color: #2b2b2b;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
  box-shadow: 4px 0 28px rgba(0, 0, 0, 0.18);
  z-index: 1500;
  font-family: "Montserrat", sans-serif;
}
.sidebar.open {
  transform: translateX(0);
}

/* ---------- Header ---------- */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.8rem 2rem;
  border-bottom: 1px solid #eee;
  margin: 0;
}
.sidebar-brand {
  font-size: 2.1rem;
  font-weight: 800;
  color: #bc171f;
  letter-spacing: 0.02em;
}
.sidebar-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  font-size: 2.1rem;
  line-height: 1;
  padding: 0.4rem;
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease;
}
.sidebar-close:hover {
  color: #bc171f;
  background: #f5f5f5;
}

/* ---------- Sección de cuenta ---------- */
.sidebar-cuenta {
  padding: 1.6rem 2rem;
  border-bottom: 1px solid #f0f0f0;
}

/* Logueado: avatar + saludo (oculto por defecto) */
.sb-cuenta-logueado {
  display: none;
  align-items: center;
  gap: 1.2rem;
}
.sb-cuenta-avatar {
  width: 4.2rem;
  height: 4.2rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #fdeaea;
  color: #bc171f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
}
.sb-cuenta-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.sb-cuenta-saludo {
  font-size: 1.3rem;
  color: #999;
}
.sb-cuenta-nombre {
  font-size: 1.8rem;
  font-weight: 700;
  color: #2b2b2b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Anónimo: botón ingresar */
.sb-btn-ingresar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  width: 100%;
  padding: 1.2rem 1.4rem;
  border: none;
  border-radius: 1rem;
  background: #bc171f;
  color: #fff;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.sb-btn-ingresar:hover {
  background: #9c1212;
  transform: translateY(-1px);
}

/* Alternancia logueado / anónimo (auth.js pone body.usuario-logueado) */
body.usuario-logueado .sb-cuenta-logueado {
  display: flex;
}
body.usuario-logueado .sb-btn-ingresar {
  display: none;
}
.sb-solo-logueado {
  display: none !important;
}
body.usuario-logueado .sb-solo-logueado {
  display: flex !important;
}

/* ---------- Menú ---------- */
.sidebar-menu {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.2rem 1.2rem 2.4rem;
  list-style: none;
  margin: 0;
}

.sb-section-label {
  margin: 1.6rem 0 0.6rem;
  padding: 0 1rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b5b5b5;
}

/* Links e items (Inicio, Ver todos, Contactanos, Mis pedidos, etc.) */
.sb-link,
.submenu-toggle {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  width: 100%;
  text-align: left;
  padding: 1.2rem 1.4rem;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 0.9rem;
  background: none;
  color: #2b2b2b;
  font-family: inherit;
  font-size: 1.55rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.sb-link i,
.submenu-toggle > i {
  color: #b0b0b0;
  font-size: 1.6rem;
  width: 2rem;
  text-align: center;
  transition: color 0.18s ease;
}
.sb-link:hover,
.submenu-toggle:hover {
  background: #f6f4f2;
  color: #bc171f;
  border-left-color: #bc171f;
}
.sb-link:hover i,
.submenu-toggle:hover > i {
  color: #bc171f;
}

/* La flecha del toggle queda pegada a la derecha */
.submenu-toggle {
  justify-content: space-between;
}
.submenu-toggle > span {
  flex: 1;
}
.arrow-icon {
  transition: transform 0.28s ease;
  font-size: 1.3rem !important;
}
.arrow-icon.rotate {
  transform: rotate(90deg);
}

/* Submenú colapsable */
.submenu {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: max-height 0.32s ease, opacity 0.28s ease, transform 0.28s ease;
  margin: 0.2rem 0 0.4rem 1.6rem;
  padding-left: 1.2rem;
  border-left: 2px solid #f0ecea;
  display: flex;
  flex-direction: column;
}
.submenu.show {
  max-height: 600px;
  opacity: 1;
  transform: translateY(0);
}
.submenu a {
  display: block;
  padding: 0.85rem 1rem;
  color: #6b6b6b;
  font-size: 1.4rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 0.7rem;
  transition: color 0.18s ease, background 0.18s ease;
}
.submenu a:hover {
  color: #bc171f;
  background: #f6f4f2;
}

/* Divisor */
.sb-divider {
  height: 1px;
  background: #eee;
  margin: 1.4rem 1rem;
}

/* Cerrar sesión */
.sb-logout {
  color: #c0392b;
}
.sb-logout i {
  color: #c0392b;
}
.sb-logout:hover {
  background: #fdeaea;
  color: #a93226;
  border-left-color: #c0392b;
}
.sb-logout:hover i {
  color: #a93226;
}
