/* ============================================================
   NUTRI HOSPITALAR — mobile.css
   CSS global para otimização mobile (beira de leito)
   Breakpoints: 768px (tablet) e 480px (celular)
   ============================================================ */

/* ── NAV MOBILE ─────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Nav: esconder menu desktop, mostrar hamburguer */
  nav {
    padding: 0 1rem !important;
    height: auto !important;
    flex-wrap: wrap;
    position: fixed !important;
    top: 0; left: 0; right: 0;
    z-index: 200;
  }

  nav > ul {
    display: none !important;
  }

  /* Botão hamburguer */
  .nav-hamburger {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
  }

  .nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: all .25s;
  }

  /* Menu mobile aberto */
  .nav-menu-mobile {
    display: none;
    position: fixed;
    top: 52px;
    left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: .5rem 0 1rem;
    z-index: 199;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    max-height: calc(100vh - 52px);
    overflow-y: auto;
  }

  .nav-menu-mobile.open {
    display: block;
  }

  .nav-menu-mobile a {
    display: block;
    padding: .7rem 1.25rem;
    font-size: .85rem;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    letter-spacing: .04em;
  }

  .nav-menu-mobile a:last-child { border-bottom: none; }
  .nav-menu-mobile a:hover { color: var(--accent); background: var(--bg); }

  .nav-menu-mobile .mob-section {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--accent);
    padding: .9rem 1.25rem .3rem;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
  }

  /* Ajuste body para nav fixa */
  body { padding-top: 52px; }

  /* ── HERO ── */
  .hero {
    grid-template-columns: 1fr !important;
    min-height: auto !important;
    padding-top: 0 !important;
  }

  .hero-left {
    padding: 2rem 1.25rem 1.5rem !important;
  }

  .hero h1 {
    font-size: clamp(2rem, 8vw, 3rem) !important;
  }

  .hero-right {
    padding: 0 1.25rem 2rem !important;
  }

  .hero-cards {
    grid-template-columns: 1fr 1fr !important;
    gap: .75rem !important;
  }

  .hcard:nth-child(2),
  .hcard:nth-child(3) {
    margin-top: 0 !important;
  }

  .hero-stats {
    gap: 1.5rem !important;
  }

  /* ── LAYOUT GERAL ── */
  .calc-layout {
    grid-template-columns: 1fr !important;
    padding: 0 1rem 2rem !important;
    gap: 1.25rem !important;
  }

  .form-card {
    position: static !important;
  }

  .wrap,
  .main,
  .page-header,
  .back-buttons,
  .etapa-bar {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .section {
    padding: 2.5rem 1rem !important;
  }

  .divider {
    margin: 0 1rem !important;
  }

  /* ── GRIDS ── */
  .summary-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .detail-grid,
  .comparar-inputs,
  .g2, .g3, .g4 {
    grid-template-columns: 1fr !important;
  }

  .topics-grid,
  .articles-grid,
  .proto-grid,
  .about-layout,
  .topics-2col {
    grid-template-columns: 1fr !important;
  }

  /* ── FORMULÁRIOS ── */
  .form-row {
    grid-template-columns: 1fr !important;
  }

  .form-body {
    padding: 1rem !important;
  }

  .form-group input,
  .form-group select,
  .comparar-field input,
  .comparar-field select {
    font-size: 16px !important; /* evita zoom automático no iOS */
  }

  /* ── BOTÕES ── */
  .btn-row {
    grid-template-columns: 1fr !important;
  }

  .hero-actions {
    flex-direction: column !important;
  }

  /* ── RESULTADO / COMPARAÇÃO ── */
  .comparar-graficos {
    flex-direction: column !important;
  }

  .grafico-item {
    width: 100% !important;
  }

  /* ── FOOTER ── */
  footer {
    flex-direction: column !important;
    text-align: center !important;
    padding: 1rem !important;
    gap: .75rem !important;
  }

  .footer-legal {
    text-align: center !important;
    white-space: normal !important;
  }

  /* ── TABS ── */
  .tabs {
    gap: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .tab-btn {
    font-size: .72rem !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
  }

  /* ── CARDS RESULTADO ── */
  .result-card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: .5rem !important;
  }

  .score-display {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem !important;
    padding: 1.25rem !important;
  }

  /* ── NRS / ETAPA BAR ── */
  .etapa-bar {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .etapa-divider {
    max-width: 24px !important;
  }

  /* ── IMC CAMPOS ── */
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }

}

/* ── CELULAR PEQUENO (480px) ── */
@media (max-width: 480px) {

  .hero-cards {
    grid-template-columns: 1fr !important;
  }

  .summary-grid {
    grid-template-columns: 1fr !important;
  }

  .hcard {
    padding: 1.1rem 1.25rem !important;
  }

  .page-header h1,
  .page-header .page-title {
    font-size: 1.7rem !important;
  }

  .form-card-header {
    padding: 1rem !important;
  }

  nav .nav-brand .nav-name {
    font-size: 1rem !important;
  }

}

/* ── HAMBURGUER — esconder em desktop ── */
.nav-hamburger {
  display: none;
}

/* Menu mobile sempre oculto por padrão — só abre no mobile ao clicar */
.nav-menu-mobile {
  display: none !important;
}

@media (max-width: 768px) {
  .nav-menu-mobile.open {
    display: block !important;
  }
}