/* ═══════════════════════════════════════════════════════
   BigCapital Herramientas — Dark Theme + Navbar estándar
   Versión: 1.0 · Abril 2026
   ═══════════════════════════════════════════════════════ */

/* ── Variables globales dark — paleta v2 contraste mejorado ── */
:root {
  --bc-bg:     #0a0d13;
  --bc-sf:     #1c2230;
  --bc-sf2:    #2a3140;
  --bc-bd:     #3a4458;
  --bc-tx:     #f0f4fa;
  --bc-tx2:    #d0dbe8;
  --bc-tx3:    #9ba8bc;
  --bc-g:      #7DC242;
  --bc-g2:     #5fa832;
  --bc-rd:     #f87171;
  --bc-pp:     #a78bfa;
  --bc-cy:     #38bdf8;
  --bc-yw:     #fbbf24;
  --bc-nav-h:  60px;
  --bc-shadow: 0 10px 30px rgba(0,0,0,.45);   /* sombra de capas flotantes (globo, panel, barra de guardado) */
}

/* ── Navbar estándar ── */
.bc-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--bc-nav-h);
  background: var(--bc-bg);
  border-bottom: 1px solid var(--bc-bd);
  /* Grid 3 columnas: back | logo (centro real) | derecha. Evita que el logo
     centrado se encime con los indicadores/usuario (2026-05-30). */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 2px 16px rgba(0,0,0,.4);
}

/* Botón ← Herramientas */
.bc-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--bc-tx3);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--bc-bd);
  background: transparent;
  transition: all .2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.bc-back:hover {
  color: var(--bc-g);
  border-color: var(--bc-g);
  background: rgba(125,194,66,.08);
  transform: translateX(-2px);
}

/* Logo — centrado por la columna central del grid (sin position:absolute) */
.bc-nav__logo {
  justify-self: center;
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  pointer-events: auto;
}
.bc-nav__logo img {
  height: 32px;
  width: auto;
}

/* Separador flexible (legacy, por compatibilidad) */
.bc-nav__sep {
  flex: 1;
}

/* Indicadores UF / USD */
.bc-indicators {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bc-ind {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--bc-tx2);
  background: var(--bc-sf);
  border: 1px solid var(--bc-bd);
  border-radius: 20px;
  padding: 4px 10px;
  white-space: nowrap;
}
.bc-ind .bc-ind-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--bc-g);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Zona derecha: indicadores + nombre broker + cerrar sesión.
   min-width:0 permite que el track del grid (1fr) se achique de verdad en vez
   de forzar el nav entero a superar el viewport; overflow-x:auto da un scroll
   interno como red de seguridad si aun así no entra todo (ej. "Cerrar sesión"
   quedaba inalcanzable en mobile — el nav es position:fixed, sin scroll propio
   de página que lo compense). En desktop nunca se activa (no hay overflow real). */
.bc-nav__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  justify-self: end;
  min-width: 0;
  max-width: 100%;
}
.bc-broker-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--bc-tx2);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bc-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--bc-g);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(125,194,66,.3);
  background: rgba(125,194,66,.08);
  text-decoration: none;
  white-space: nowrap;
  transition: all .2s;
}
.bc-admin-link:hover {
  background: rgba(125,194,66,.18);
  border-color: var(--bc-g);
  color: var(--bc-g);
}
.bc-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--bc-tx3);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--bc-bd);
  background: transparent;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}
.bc-logout-btn:hover {
  color: var(--bc-rd);
  border-color: rgba(248,113,113,.4);
  background: rgba(248,113,113,.06);
}

/* Spacer para compensar el navbar fijo */
.bc-nav-spacer {
  height: var(--bc-nav-h);
}

/* ── Navegación rápida entre secciones (dropdown en el navbar) ── */
.bc-quicknav {
  position: relative;
}
.bc-quicknav__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--bc-tx2);
  background: var(--bc-sf);
  border: 1px solid var(--bc-bd);
  border-radius: 20px;
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  white-space: nowrap;
}
.bc-quicknav__btn:hover,
.bc-quicknav__btn[aria-expanded="true"] {
  border-color: var(--bc-g);
  color: var(--bc-g);
}
.bc-quicknav__btn .bc-quicknav__chev {
  transition: transform .2s;
}
.bc-quicknav__btn[aria-expanded="true"] .bc-quicknav__chev {
  transform: rotate(180deg);
}
.bc-quicknav__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: var(--bc-sf);
  border: 1px solid var(--bc-bd);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .15s, transform .15s, visibility .15s;
  z-index: 1100;
}
.bc-quicknav__menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.bc-quicknav__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--bc-tx2);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.bc-quicknav__item:hover {
  background: var(--bc-bg);
  color: var(--bc-tx);
}
.bc-quicknav__item.active {
  color: var(--bc-g);
  font-weight: 700;
  background: rgba(125,194,66,.08);
  cursor: default;
  pointer-events: none;
}
.bc-quicknav__icon {
  font-size: 14px;
  line-height: 1;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .bc-quicknav__btn span:not(.bc-quicknav__chev) { display: none; }
  .bc-quicknav__btn { padding: 6px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .bc-quicknav__menu,
  .bc-quicknav__btn .bc-quicknav__chev {
    transition: none;
  }
}

/* ── Navbar en celular (21-oct-2026): dos filas — arriba volver + logo, abajo los botones —
   para que «Ir a», el usuario y «Cerrar sesión» no se salgan de la pantalla. La portada
   (.bc-nav--index) tiene su propia versión. --bc-nav-h crece y lo siguen el espaciador y
   las barras pegajosas que usan esa variable. */
@media (max-width: 640px) {
  :root { --bc-nav-h: 104px; }
  .bc-nav:not(.bc-nav--index) {
    grid-template-columns: auto 1fr;
    grid-template-rows: 52px 44px;
    align-content: start;
    row-gap: 0;
    padding: 0 12px;
  }
  .bc-nav:not(.bc-nav--index) .bc-nav__logo { justify-self: end; }
  .bc-nav:not(.bc-nav--index) .bc-nav__sep { display: none; }
  .bc-nav:not(.bc-nav--index) .bc-nav__right {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: flex-end;
    gap: 8px;
    overflow-x: auto;
  }
}

/* ── Media: ocultar indicadores en móvil pequeño ── */
@media (max-width: 480px) {
  .bc-indicators { display: none; }
  .bc-broker-name { display: none; }
  .bc-nav { padding: 0 12px; }
}

/* Botón flotante "Reportar falla" (inyectado por reportar-falla.js en TODAS las
   páginas) — en mobile tapaba los botones de acción de las filas al hacer scroll
   (confirmado con elementFromPoint: el click en "Ver"/"PDF" abría el reporte de
   falla en vez de la acción real). Se reduce a un FAB circular solo-ícono, mucho
   más chico que la píldora de escritorio (44×44 vs 135×37), para minimizar el
   área de overlap. font-size:0 colapsa el texto original ("🐞 Reportar falla",
   un solo nodo de texto que no se puede recortar por CSS) y el ::before muestra
   solo el ícono. */
@media (max-width: 640px) {
  #bc-reportar-falla-btn {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    font-size: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  #bc-reportar-falla-btn::before {
    content: '🐞';
    font-size: 19px;
  }
}
