/* ═══════════════════════════════════════════════════════════
   GlobeFarer BugFix v9 — carregado ÚLTIMO, sobrescreve tudo
   ═══════════════════════════════════════════════════════════ */

/* ── 1. SIDEBAR: corrige position:sticky que quebrava mobile ── */
.sidebar {
  position: fixed !important;
  top: var(--nav-h) !important;
  left: 0 !important;
  width: var(--sidebar-w) !important;
  height: calc(100svh - var(--nav-h)) !important;
  overflow-y: auto;
  z-index: 800 !important;
  background: var(--white);
  border-right: var(--border);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  transition: transform .26s cubic-bezier(.4,0,.2,1);
}

/* Desktop: sidebar sempre visível */
@media (min-width: 769px) {
  .sidebar { transform: translateX(0) !important; }
  .sidebar-overlay { display: none !important; }
  .dash-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0,1fr);
    padding-top: var(--nav-h);
    min-height: 100svh;
  }
  .dash-main { grid-column: 2; min-width: 0; }
}

/* Mobile: sidebar oculta, aparece ao toggle */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
  }
  .dash-layout { grid-template-columns: 1fr !important; padding-top: var(--nav-h); }
  .dash-main   { grid-column: 1 !important; }
  .hamburger   { display: flex !important; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; top: var(--nav-h); background: rgba(0,0,0,.35); z-index: 799; }
  .sidebar-overlay.open { display: block; }
}

/* ── 2. NAVBAR: sempre visível e acima de tudo ── */
.navbar {
  position: fixed !important;
  top: 0; left: 0; right: 0;
  z-index: 1000 !important;
  height: var(--nav-h);
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: var(--border);
}

/* ── 3. TOPBAR: não quebra em mobile ── */
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 10px;
  padding: 0 16px;
}
.dashboard-topbar-left  { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; }
.dashboard-topbar-right { display: flex; align-items: center; gap: 8px;  min-width: 0; }

.topbar-icon-btn { width: 38px; height: 38px; padding: 0; justify-content: center; flex-shrink: 0; }
.topbar-main-btn { flex-shrink: 0; }

.dashboard-user-chip {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--white); border: var(--border); border-radius: 999px;
  padding: 5px 10px; flex-shrink: 0;
}

@media (max-width: 768px) {
  .dashboard-user-chip-texts { display: none; }
  .topbar-main-text { display: none; }
  .topbar-main-btn  { width: 38px; padding: 0; }
}

/* ── 4. HAMBURGER: sempre visível no mobile ── */
@media (min-width: 769px) {
  .hamburger { display: none; }
}
.hamburger {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r3); color: var(--ink); cursor: pointer;
  background: none; border: none; flex-shrink: 0;
  transition: background .15s;
}
.hamburger:hover { background: var(--gray-f0); }
.hamburger svg   { pointer-events: none; display: block; }

/* ── 5. HERO (index.html): fix layout mobile ── */
@media (max-width: 768px) {
  .hero {
    padding-top: calc(var(--nav-h) + 32px);
    min-height: auto;
    padding-bottom: 48px;
  }
  .hero-h1 { font-size: clamp(2.2rem, 10vw, 3.2rem); line-height: 1.05; }
  .hero-body { font-size: .95rem; }
  .hero-actions { flex-direction: column; gap: 10px; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .hero-stats { gap: 20px; margin-top: 32px; flex-wrap: wrap; }
  .hero-stat-num { font-size: 1.6rem; }
  .hero > .container > div[style] { grid-template-columns: 1fr !important; }
}

/* ── 6. DASHBOARD PÁGINA: padding correto no mobile ── */
.dash-page { display: none; padding: 28px 24px; }
.dash-page.active { display: block; animation: fadeIn .2s ease; }

@media (max-width: 768px) {
  .dash-page { padding: 18px 14px; }
  .dash-page-head h1 { font-size: 1.35rem; }
}
@media (max-width: 480px) {
  .dash-page { padding: 14px 12px; }
}

/* ── 7. OVERVIEW HERO GRID ── */
@media (max-width: 900px) {
  .overview-hero-grid { grid-template-columns: 1fr !important; }
  .overview-mini-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 480px) {
  .overview-mini-grid { grid-template-columns: 1fr 1fr !important; }
  .stats-row { grid-template-columns: 1fr 1fr !important; }
  .quick-grid { grid-template-columns: 1fr 1fr !important; }
}

/* ── 8. STATS ROW ── */
.stat-chip { font-size:.62rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; padding:3px 9px; border-radius:999px; background:var(--gray-f0); color:var(--gray-7); }
.stat-chip.active  { background:var(--yellow-bg); color:var(--yellow-dark); }
.stat-chip.success { background:#edf8ef; color:#20714d; }
.stat-chip.neutral { background:#eef5ff; color:#295ea8; }

/* ── 9. FORMULÁRIO: evita overflow em mobile ── */
@media (max-width: 640px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr !important; gap: 0 !important; }
  .form-span-2           { grid-column: auto !important; }
}

/* ── 10. TOOLBAR ── */
@media (max-width: 640px) {
  .toolbar-grid { grid-template-columns: 1fr !important; }
}

/* ── 11. MODAL: tela cheia no mobile ── */
@media (max-width: 640px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal-xl {
    border-radius: 20px 20px 0 0 !important;
    max-height: 96svh !important;
    max-width: 100% !important;
    width: 100%;
    margin: 0;
  }
}

/* ── 12. SHIPMENT FORM SHELL: empilha no mobile ── */
@media (max-width: 900px) {
  .shipment-form-shell  { grid-template-columns: 1fr !important; }
  .shipment-form-side   { order: -1; }
  .sticky-side-card     { position: relative !important; top: auto !important; }
  .shipment-map-card    { height: 220px; }
}

/* ── 13. TABLE → CARDS no mobile ── */
@media (max-width: 768px) {
  .table-wrap           { display: none !important; }
  .shipment-mobile-list { display: flex !important; flex-direction: column; gap: 12px; margin-top: 8px; }
}

/* ── 14. TRACK SEARCH GRID ── */
.track-search-grid { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-bottom: 14px; }
@media (max-width: 500px) {
  .track-search-grid { grid-template-columns: 1fr; }
  .track-search-grid .btn { width: 100%; }
}

/* ── 15. SIMULATE: empilha em mobile ── */
.simulate-shell { display: flex; flex-direction: column; gap: 0; }
@media (max-width: 700px) {
  .t-selector { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 420px) {
  .t-selector { grid-template-columns: 1fr 1fr !important; }
}

/* ── 16. WALLET: fix mobile ── */
@media (max-width: 640px) {
  .v9-wallet-layout { grid-template-columns: 1fr !important; }
  .v9-tabs          { overflow-x: auto; }
  .v9-tab           { padding: 11px 14px; font-size: .78rem; }
  .v9-pix-box       { flex-direction: column; align-items: center; }
  .v9-card-row      { grid-template-columns: 1fr !important; }
  .v9-quick-vals    { flex-wrap: wrap; }
  .v9-quick-vals .btn { flex: 1 1 calc(33% - 8px); min-width: 0; text-align: center; justify-content: center; }
  .v9-form-stack > .btn { width: 100% !important; align-self: stretch; }
  .v9-boleto-actions { flex-direction: column; }
  .v9-boleto-actions .btn { width: 100%; }
}

/* ── 17. INTEGRAÇÕES ── */
@media (max-width: 640px) {
  .v9-int-grid { grid-template-columns: 1fr !important; }
}

/* ── 18. PROFILE / SETTINGS ── */
@media (max-width: 768px) {
  .profile-layout, .settings-layout { grid-template-columns: 1fr !important; }
}

/* ── 19. DETAIL GRID ── */
@media (max-width: 640px) {
  .detail-grid         { grid-template-columns: 1fr 1fr !important; }
  .detail-address-grid { grid-template-columns: 1fr !important; }
}

/* ── 20. FOOTER ── */
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr !important; gap: 24px; }
}

/* ── 21. SERVICES GRID ── */
@media (max-width: 768px) {
  .dashboard-services-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 480px) {
  .dashboard-services-grid { grid-template-columns: 1fr !important; }
}

/* ── 22. TOAST: mobile full width ── */
@media (max-width: 480px) {
  #toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast { min-width: auto; max-width: 100%; }
}

/* ── 23. BRAND LOGO no dashboard ── */
.dashboard-brand img { height: 26px; width: auto; display: block; }

/* ── 24. OVERFLOW GLOBAL ── */
html, body { overflow-x: hidden; max-width: 100vw; }

/* ── 25. SMOOTH scroll do modal body ── */
.modal { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ── 26. INPUT: evita zoom no iOS (font-size mín 16px) ── */
@media (max-width: 768px) {
  .form-input, .form-select, .form-textarea {
    font-size: 16px !important;
  }
}

/* ── INDEX.HTML: hero e simulação responsivos ── */
.gf-hero-wrap {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 72px;
  align-items: center;
  padding: 56px 0 72px;
}
.gf-sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 72px;
  align-items: start;
}

@media (max-width: 900px) {
  .gf-hero-wrap {
    grid-template-columns: 1fr !important;
    gap: 32px;
    padding: 40px 0 48px;
  }
  .gf-sim-grid {
    grid-template-columns: 1fr !important;
    gap: 32px;
  }
  .hero-card {
    max-width: 480px;
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .gf-hero-wrap {
    padding: 28px 0 36px;
    gap: 24px;
  }
  .hero-h1 {
    font-size: clamp(2rem, 9vw, 3rem) !important;
  }
  .hero-stats {
    flex-wrap: wrap;
    gap: 16px 28px;
  }
  .hero-actions {
    flex-direction: column;
    gap: 10px;
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }
  /* Navbar links escondidos no mobile */
  .nav-links { display: none !important; }
}

/* ── NAVBAR MOBILE: hamburger para index.html ── */
.nav-hamburger {
  display: none;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  border-radius: var(--r3);
}
.nav-hamburger:hover { background: var(--gray-f0); }
@media (max-width: 768px) {
  .nav-hamburger { display: flex !important; }
}

/* ── LOGIN / REGISTER: centraliza melhor no mobile ── */
.auth-shell, .login-shell {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}
@media (max-width: 480px) {
  .auth-card, .login-card {
    padding: 24px 18px !important;
    border-radius: 16px !important;
  }
}

/* ── TRANSPORT GRID ── */
@media (max-width: 640px) {
  .transport-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 400px) {
  .transport-grid { grid-template-columns: 1fr !important; }
}

/* ── SECTION GENÉRICA ── */
@media (max-width: 768px) {
  .section-h2 { font-size: 1.5rem !important; }
  .section { padding: 48px 0 !important; }
}

/* ── FOOTER responsivo ── */
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 500px) {
  .footer-grid { grid-template-columns: 1fr !important; }
}
