/* Smart Scan Pro — adaptation mobile (téléphone et app installée).
   Chargé APRÈS les styles de chaque page : il ne fait que corriger l'affichage
   sur petit écran, le design ordinateur reste inchangé. */

/* Barre d'état iPhone (app installée) : le contenu ne passe pas dessous. */
header { padding-top: max(16px, env(safe-area-inset-top)); }
body { padding-bottom: env(safe-area-inset-bottom); }

@media (max-width: 760px) {
  html, body { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
  * { min-width: 0; }
  img, svg, canvas, video, iframe { max-width: 100%; }
  body { word-break: break-word; }

  /* ── En-tête compact ── */
  header {
    padding: max(10px, env(safe-area-inset-top)) 12px 10px !important;
    gap: 8px; flex-wrap: wrap;
  }
  .logo-img { width: 30px !important; height: 30px !important; }
  .logo { font-size: 15px !important; letter-spacing: .5px; white-space: nowrap; }
  .tagline, #user-email { display: none !important; }
  .hd-right { gap: 6px !important; flex-wrap: wrap; justify-content: flex-end; }
  .hd-right button, .hd-right select { padding: 6px 10px !important; font-size: 12px !important; }

  /* ── Menus : une ligne qui défile au doigt, collée en haut ── */
  nav {
    flex-wrap: nowrap !important; overflow-x: auto; overflow-y: hidden;
    padding: 0 8px !important; gap: 2px !important;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  nav::-webkit-scrollbar { display: none; }
  nav .nav-btn { flex: 0 0 auto; white-space: nowrap; padding: 12px 10px !important; font-size: 12px !important; scroll-snap-align: start; }
  nav.nav-market, header + nav { position: sticky; top: 0; z-index: 50; background: var(--bg, #060a10); }

  /* ── Contenu ── */
  .wrap { padding: 12px !important; max-width: 100% !important; }

  /* Barres de recherche / filtres : tout passe à la ligne, gros boutons tactiles */
  .scan-bar, .custom-row, .filter-bar, .watchlist { flex-wrap: wrap !important; gap: 8px !important; }
  .scan-bar > *, .custom-row > * { flex: 1 1 140px; }
  button, select, input, .nav-btn { min-height: 40px; }
  input, select, textarea { font-size: 16px !important; } /* évite le zoom auto de l'iPhone */

  /* Grilles → une colonne */
  .copilot-grid, .plan-grid, .diag-triggers, .xc-grid, [class*="-grid"] { grid-template-columns: 1fr !important; }

  /* Tableaux larges : défilement horizontal au lieu de déborder */
  table, .scr-table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  th, td { padding: 8px 10px !important; font-size: 12px !important; }

  /* Graphique TradingView plus bas sur téléphone */
  .tv-chart-card { height: 440px !important; }

  /* Cartes et blocs : marges réduites */
  .xc-card, .co-card, [class*="card"] { padding: 12px !important; }
  .analysis-meta, .sent-row { flex-wrap: wrap; }
}

/* App installée (plein écran) : pas de surbrillance au toucher, défilement fluide */
@media (display-mode: standalone) {
  * { -webkit-tap-highlight-color: transparent; }
  html { overscroll-behavior-y: none; }
}
