/* ============================================================================
   LionTaxdeed — Mobile / PWA stylesheet
   Estrategia: mobile-first ADITIVO. No reescribe los layouts de escritorio;
   añade la bottom-nav táctil y reorganiza el shell en ≤768px. Reutiliza los
   tokens globales (--accent, --surface-*, --ink-*) inyectados en research.html.erb.
   Las reglas por-rama (Ficha, Mapa, Auctions, Kanban, Market) viven más abajo,
   namespaced por pantalla.
   ============================================================================ */

/* ── PWA: botón "Instalar app" en el header (desktop + móvil) ─────────────── */
.pwa-install-btn {
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  font: 600 12.5px var(--font-sans, "Inter", sans-serif);
  color: #1E3A5F;
  background: oklch(0.94 0.04 158);
  border: 1px solid var(--border, #E2E8F0);
  transition: background 160ms ease;
  /* display lo controla el Stimulus controller (inline-flex al mostrarse) */
}
.pwa-install-btn:hover { background: oklch(0.90 0.05 158); }
.pwa-install-btn svg { flex: none; }

/* Pista de instalación iOS (Safari no tiene prompt programático). La inyecta
   el install-prompt controller al tocar el botón en iPhone/iPad. */
.pwa-ios-hint {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 58px);
  right: 12px;
  left: 12px;
  margin-left: auto;
  max-width: 320px;
  z-index: 60;
  padding: 12px 14px;
  border-radius: 12px;
  font: 500 13px/1.45 var(--font-sans, "Inter", sans-serif);
  color: #1E3A5F;
  background: #fff;
  border: 1px solid var(--border, #E2E8F0);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}
.pwa-ios-hint::after {
  content: "";
  position: absolute;
  top: -7px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-left: 1px solid var(--border, #E2E8F0);
  border-top: 1px solid var(--border, #E2E8F0);
  transform: rotate(45deg);
}

/* ── Bottom navigation — oculta en desktop, visible en móvil ──────────────── */
.mobile-nav { display: none; }

/* ============================================================================
   BREAKPOINT MÓVIL — ≤768px
   ============================================================================ */
@media (max-width: 768px) {

  /* ── Header: colapsa el nav inline (lo cubre la bottom-nav) ────────────── */
  .app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .header-nav { display: none; }
  .brand-name { font-size: 19px; }
  .brand-mark { width: 28px; height: 28px; }

  /* El bloque derecho no debe desbordar: oculta el plan-pill y comprime. */
  .header-right { gap: 8px; }
  .header-right .plan-pill { display: none; }
  .user-pill span { display: none; }            /* solo avatar en móvil */
  .user-pill { padding: 4px; }
  .pwa-install-btn span { display: none; }       /* solo el ícono de descarga */
  .pwa-install-btn { padding: 7px; }

  /* Dropdown de usuario / notif: ancho seguro dentro del viewport. */
  #notif-bell-panel {
    width: min(340px, calc(100vw - 24px)) !important;
    right: -8px !important;
  }

  /* ── Main: deja espacio para la bottom-nav fija ────────────────────────── */
  .rn-main {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  /* ── Bottom navigation bar ─────────────────────────────────────────────── */
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: var(--surface-1, #fff);
    border-top: 1px solid var(--border, #E2E8F0);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 14px oklch(0.18 0.015 158 / 0.06);
  }
  .mobile-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px 6px;
    min-height: 56px;
    text-decoration: none;
    color: var(--ink-3, #6B7280);
    font: 500 10px var(--font-sans, "Inter", sans-serif);
    letter-spacing: -0.01em;
    transition: color 140ms ease;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-nav__item svg { width: 22px; height: 22px; }
  .mobile-nav__item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-nav__item.is-active { color: var(--accent, #1E3A5F); font-weight: 600; }
  .mobile-nav__item.is-active svg { stroke-width: 2.4; }

  /* ── Flash: ancho completo cómodo ──────────────────────────────────────── */
  .flash { margin: 10px 14px 0; }
}

/* ============================================================================
   RESPONSIVE POR-RAMA (≤768px) — añadido por los agentes de Fase 2.2.
   Cada bloque va namespaced por su pantalla para evitar colisiones.
   ============================================================================ */
