/* ============================================
   Cascarón de navegación — richbm.app v2
   ============================================
   Especificación visual aprobada 2026-09-23. Todo sale de los tokens de
   styles.css (`:root` y `[data-theme="dark"]`), así el modo oscuro funciona
   sin reglas duplicadas. Nada de colores fijos acá.

   Se activa con `body.shell-on`, que pone shell.js. Sin esa clase la app se
   ve como antes — es el interruptor para volver atrás sin revertir nada. */

/* El menú viejo sigue en el DOM porque todo el resto del código lo usa para
   navegar; solo deja de mostrarse. */
body.shell-on .nav-menu { display: none; }

/* ---------- Sidebar: 11 secciones ---------- */

.shell-nav {
  list-style: none;
  margin: 0;
  padding: 0.85rem 0.7rem;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-border) transparent;
}
.shell-nav::-webkit-scrollbar { width: 6px; }
.shell-nav::-webkit-scrollbar-track { background: transparent; }
.shell-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 3px; }

.shell-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.56rem 0.7rem;
  border-radius: 10px;
  font-size: 0.845rem;
  font-weight: 500;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.shell-nav-link:hover {
  background: var(--bg-muted);
  color: var(--sidebar-text-strong);
}
.shell-nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  font-weight: 600;
}

.shell-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.shell-nav-label { flex: 1; min-width: 0; }

.shell-nav-count {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.shell-nav-link.active .shell-nav-count {
  color: var(--accent-hover);
  background: var(--accent-soft);
}
.shell-nav-count.hidden { display: none; }

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

/* Va dentro de .content, que trae padding 1.75rem 2rem: el margen negativo lo
   cancela para que la barra llegue de borde a borde y quede pegada arriba. */
body.shell-on .shell-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: -1.75rem -2rem 1.5rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--sidebar-border);
}

.shell-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 2rem;
  min-height: 56px;
  box-sizing: border-box;
}

.shell-spacer { flex: 1; }

.shell-scope:empty { display: none; }

/* El selector de tienda/marca se muda acá desde el pie del sidebar. En la fase 2
   este mismo hueco pasa a ser el selector de país. */
body.shell-on #active-store-wrap {
  padding: 0 !important;
  min-width: 190px;
}
body.shell-on .sidebar-store-label { display: none; }
body.shell-on .sidebar-store-select {
  margin-top: 0 !important;
  padding: 0.44rem 0.6rem !important;
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
}

/* La búsqueda global también se muda: deja de flotar abajo a la derecha y pasa
   a vivir en la barra, conservando su lógica y su atajo Cmd+K. */
body.shell-on .global-search {
  position: static;
  bottom: auto;
  right: auto;
  width: 330px;
  z-index: auto;
}
body.shell-on .global-search-box {
  border-radius: 10px;
  background: var(--bg-soft);
  box-shadow: none;
  padding: 0.38rem 0.7rem;
}
body.shell-on .global-search-results {
  position: absolute;
  top: calc(100% + 6px);
  bottom: auto;
  left: 0;
  right: auto;
  width: 420px;
  max-width: 90vw;
}
body.shell-on #shell-search-slot { position: relative; }

.shell-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.shell-icon-btn:hover { background: var(--bg-muted); }

.shell-bell-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  box-sizing: border-box;
  padding: 0 4px;
  background: #b45309;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shell-bell-count.critical { background: #991b1b; }
.shell-bell-count.hidden { display: none; }

/* ---------- Pestañas de la sección ---------- */

.shell-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 2rem 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.shell-tabs::-webkit-scrollbar { display: none; }
.shell-tabs.hidden { display: none; }

.shell-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  background: transparent;
  border: none;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.845rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.shell-tab:hover { background: var(--bg-muted); color: var(--text); }
.shell-tab.active {
  background: var(--bg-muted);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.shell-tab-count {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--card-bg);
  padding: 0.05rem 0.34rem;
  border-radius: 999px;
}
.shell-tab.active .shell-tab-count {
  color: var(--accent-hover);
  background: var(--accent-soft);
}

/* ---------- Pantallas chicas ---------- */

@media (max-width: 900px) {
  body.shell-on .shell-topbar { margin-left: -1rem; margin-right: -1rem; }
  .shell-header { padding: 0.6rem 1rem; flex-wrap: wrap; }
  .shell-tabs { padding: 0 1rem 0.5rem; }
  body.shell-on .global-search { width: 100%; }
  body.shell-on .global-search-results { width: 100%; }
}
