/* Bajareque: barra superior, menú lateral y diseño responsive */

/* ---------- Barra superior ---------- */

.barra {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .75rem;
  height: var(--barra-alto); padding: 0 .75rem 0 1rem;
  background: var(--espresso); color: #fff;
}
.marca {
  color: #fff; text-decoration: none; font-weight: 600; font-size: 1.4rem; letter-spacing: .01em;
  text-transform: lowercase; white-space: nowrap;
}
.marca:hover { color: #fff; }
.marca::after {
  content: ""; display: inline-block; width: .35em; height: .35em; margin-left: .15em;
  border-radius: 50% 0 50% 50%; transform: rotate(-45deg); background: var(--caramelo);
}
.barra-seccion {
  color: #E8DCCD; font-weight: 600; padding-left: .75rem; margin-left: .25rem;
  border-left: 1px solid rgba(255, 255, 255, .2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.barra-derecha { margin-left: auto; display: flex; align-items: center; gap: .6rem; min-width: 0; }
.barra-boton {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-width: var(--toque); min-height: var(--toque); padding: 0 .6rem;
  border: 0; border-radius: var(--radio); background: none; color: #fff;
  font: inherit; font-weight: 700; cursor: pointer;
}
.barra-boton:hover { background: rgba(255, 255, 255, .12); }
.barra-boton svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.boton-menu { display: none; margin-left: -.4rem; }

.idiomas { display: flex; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; padding: 2px; }
.idiomas button {
  min-width: 40px; min-height: 36px; padding: 0 .55rem; border: 0; border-radius: 999px;
  background: none; color: #E8DCCD; font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
}
.idiomas button.activo { background: var(--crema); color: var(--espresso); }

.barra-usuario { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; min-width: 0; }
.barra-nombre { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 18ch; }
.barra-rol { font-size: .78rem; color: #F0C9A8; font-weight: 600; }

/* ---------- Contenedor y menú lateral ---------- */

.contenedor {
  display: grid; grid-template-columns: 236px minmax(0, 1fr);
  min-height: calc(100vh - var(--barra-alto));
}
.menu {
  position: sticky; top: var(--barra-alto); align-self: start;
  height: calc(100vh - var(--barra-alto)); overflow-y: auto;
  background: var(--espresso); padding: .75rem .6rem;
}
.menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.menu a {
  display: flex; align-items: center; gap: .75rem;
  min-height: var(--toque); padding: .5rem .75rem; border-radius: var(--radio);
  color: #EADFD3; text-decoration: none; font-weight: 600;
}
.menu a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.menu a.activo { background: var(--caramelo); color: #fff; }
.menu .icono { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.menu-abierto { position: absolute; opacity: 0; pointer-events: none; }
.menu-fondo { display: none; }

.contenido { padding: 1.5rem clamp(1rem, 3vw, 2rem) 2rem; min-width: 0; }

/* ---------- Páginas públicas (login y registro) ---------- */

.contenido-publico {
  min-height: calc(100vh - var(--barra-alto) - 48px);
  display: grid; place-items: center; padding: 2rem 1rem;
}
.caja-acceso { width: 100%; max-width: 440px; }
.caja-acceso-ancha { max-width: 640px; }
.caja-acceso h1 { font-size: 1.5rem; }
.caja-acceso .lema { color: var(--texto-suave); margin-bottom: 1.25rem; }

.pie { text-align: center; font-size: .82rem; color: var(--texto-suave); padding: .9rem 1rem; }
.con-sesion .pie { border-top: 1px solid var(--borde); }

/* ---------- Tablet: menú de solo íconos ---------- */

@media (max-width: 1099px) {
  .contenedor { grid-template-columns: 76px minmax(0, 1fr); }
  .menu { padding: .75rem .5rem; }
  .menu a { justify-content: center; padding: .5rem; }
  .menu a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .barra-seccion { display: none; }
}

/* ---------- Celular y pantallas de tablet: menú desplegable ---------- */

@media (max-width: 640px) {
  .contenedor { grid-template-columns: minmax(0, 1fr); }
  .boton-menu { display: inline-flex; }
  .barra { gap: .4rem; padding: 0 .4rem 0 .75rem; }
  .marca { font-size: 1.15rem; }
  .texto-salir { display: none; }
  .barra-derecha { gap: .35rem; }
  .barra-nombre { max-width: 10ch; font-size: .85rem; }
  .barra-rol { font-size: .72rem; }
  .idiomas button { min-width: 34px; padding: 0 .35rem; }
  .contenido { padding: 1.1rem .9rem 1.5rem; }
  h1 { font-size: 1.35rem; }
}

/* El menú como cajón: en celular siempre; en Nueva venta y Cola en cualquier tamaño */
@media (max-width: 640px) {
  .menu {
    position: fixed; top: var(--barra-alto); left: 0; bottom: 0; z-index: 35;
    width: min(280px, 82vw); height: auto;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .menu a { justify-content: flex-start; padding: .5rem .75rem; }
  .menu a span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .menu-abierto:checked ~ .contenedor .menu { transform: none; }
  .menu-abierto:checked ~ .contenedor .menu-fondo {
    display: block; position: fixed; inset: var(--barra-alto) 0 0 0; z-index: 30; background: rgba(42, 33, 28, .45);
  }
}

.modo-tablet .contenedor { grid-template-columns: minmax(0, 1fr); }
.modo-tablet .boton-menu { display: inline-flex; }
.modo-tablet .menu {
  position: fixed; top: var(--barra-alto); left: 0; bottom: 0; z-index: 35;
  width: min(280px, 82vw); height: auto;
  transform: translateX(-100%); transition: transform .2s ease;
}
.modo-tablet .menu a { justify-content: flex-start; padding: .5rem .75rem; }
.modo-tablet .menu a span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
.modo-tablet .menu-abierto:checked ~ .contenedor .menu { transform: none; }
.modo-tablet .menu-abierto:checked ~ .contenedor .menu-fondo {
  display: block; position: fixed; inset: var(--barra-alto) 0 0 0; z-index: 30; background: rgba(42, 33, 28, .45);
}
.modo-tablet .barra-seccion { display: block; }
@media (max-width: 640px) { .modo-tablet .barra-seccion { display: none; } }

@media (max-width: 380px) {
  .barra-usuario { max-width: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  .menu { transition: none; }
}
