/**
 * BraxDriver App Web — coluna 650px + laterais Campanhas | Parceiros.
 * Framework7 corre dentro de .nex-app-column (#app).
 */

:root {
  --nex-web-app-width: 650px;
  --brax-navy: #002038;
  --brax-blue: #0060C8;
  --brax-shade: #004A9E;
  --nex-web-ad-bg: #e8eef5;
  --nex-web-ad-border: #d5dee8;
  --nex-web-ad-text: #002038;
  --nex-web-ad-muted: #5b6b7c;
}

html {
  height: 100%;
  background: #d9e3ee;
}

body.nex-web-body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--nex-web-ad-text);
  background: linear-gradient(180deg, #eef3f8 0%, #d7e2ee 100%);
}

html:not(.mobi-shell-ready) #mobiAppColumn > #app {
  opacity: 0;
}

html.mobi-shell-ready #mobiAppColumn > #app {
  opacity: 1;
  transition: opacity 0.18s ease;
}

.nex-web-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(var(--nex-web-app-width), 100%) minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  align-items: stretch;
  overflow: hidden;
}

.nex-web-layout > .nex-web-ad,
.nex-web-layout > .nex-app-column {
  min-height: 0;
}

.nex-app-column {
  position: relative;
  width: 100%;
  max-width: var(--nex-web-app-width);
  margin: 0 auto;
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(0, 32, 56, 0.08),
    0 12px 40px rgba(0, 32, 56, 0.16);
  overflow: hidden;
}

.nex-app-column #app {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

body.nex-web-body #app > .statusbar {
  flex: 0 0 0;
  height: 0;
  min-height: 0;
  overflow: hidden;
  pointer-events: none;
}

body.nex-web-body html.mobi-shell-ready #app,
body.nex-web-body #app {
  position: relative !important;
  flex: 1 1 auto !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
}

body.nex-web-body #navegacao {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

body.nex-web-body.mobi-battery-banner-active {
  padding-top: 0 !important;
}

body.nex-web-body #mobiBatteryLowBanner {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  inset: auto !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  z-index: 40 !important;
}

body.nex-web-body.mobi-battery-banner-active #navegacao {
  min-height: 0 !important;
}

body.nex-web-body #navegacao > .page {
  position: relative !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}

body.nex-web-body #navegacao .page-content {
  height: auto !important;
  overflow: visible !important;
}

/* Mapa do motorista: UI em position:absolute. height:auto no .page colapsa o centro (tela branca). */
body.nex-web-body #navegacao:has(> .mobi-op-page),
body.nex-web-body #navegacao:has(> .mobi-live-page) {
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}

body.nex-web-body #navegacao > .page.mobi-op-page,
body.nex-web-body #navegacao > .page.mobi-live-page {
  flex: 1 1 auto !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
}

body.nex-web-body #navegacao .mobi-op-page > .page-content,
body.nex-web-body #navegacao .mobi-live-page > .page-content {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.nex-web-body .mobi-op-page.is-driver-online .mobi-op-campaigns,
body.nex-web-body .mobi-op-campaigns.is-hidden-online,
body.nex-web-body .mobi-op-campaigns[hidden] {
  display: none !important;
}

body.nex-web-body .mobi-rate-backdrop,
body.nex-web-body .mobi-rate-sheet {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
}

/* F7: no tablet o toast ia para fora da coluna de 650px (mesmo problema do popup). */
body.nex-web-body .notification {
  left: 50% !important;
  right: auto !important;
  width: min(420px, calc(100% - 24px)) !important;
  max-width: 420px !important;
  margin-left: 0 !important;
  transform: translateX(-50%);
}

#logoInicio.nex-splash-pending {
  width: 50px;
  height: 50px;
  max-width: 50px;
  max-height: 50px;
  opacity: 0;
}

.nex-web-ad {
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 16px 12px;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.nex-web-ad--left {
  justify-content: flex-end;
  padding-right: 16px;
}

.nex-web-ad--right {
  justify-content: flex-start;
  padding-left: 16px;
}

.nex-web-ad__inner {
  width: 100%;
  max-width: 320px;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.nex-web-ad__head {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.nex-web-ad__badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brax-navy);
  border-radius: 999px;
  padding: 5px 11px;
}

.nex-web-ad--right .nex-web-ad__badge {
  background: linear-gradient(135deg, var(--brax-navy) 0%, var(--brax-blue) 100%);
}

.nex-web-ad__kicker {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--nex-web-ad-muted);
}

.nex-web-ad__count {
  margin-left: 6px;
  font-weight: 600;
  opacity: 0.7;
}

.nex-web-ad__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 10px 18px 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 32, 56, 0.45) rgba(0, 32, 56, 0.08);
}

.nex-web-ad__list::-webkit-scrollbar {
  width: 8px;
}

.nex-web-ad__list::-webkit-scrollbar-track {
  background: rgba(0, 32, 56, 0.08);
  border-radius: 99px;
}

.nex-web-ad__list::-webkit-scrollbar-thumb {
  background: rgba(0, 32, 56, 0.42);
  border-radius: 99px;
}

.mobi-web-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--nex-web-ad-border);
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 32, 56, 0.05);
}

.mobi-web-card--partner {
  border-color: rgba(0, 96, 200, 0.22);
}

.mobi-web-card__thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: #e8eef5;
}

.mobi-web-card__icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 96, 200, 0.1);
  color: var(--brax-blue);
}

.mobi-web-card__icon .mdi {
  font-size: 22px;
  line-height: 1;
}

.mobi-web-card--partner .mobi-web-card__icon {
  background: rgba(0, 32, 56, 0.08);
  color: var(--brax-navy);
}

.mobi-web-card__chip {
  display: inline-block;
  margin-bottom: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brax-blue);
}

.mobi-web-card__body {
  min-width: 0;
  flex: 1;
  padding-top: 1px;
}

.mobi-web-card__title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--brax-navy);
}

.mobi-web-card__text {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--nex-web-ad-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mobi-web-empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  background: #fff;
  border: 1px dashed var(--nex-web-ad-border);
  border-radius: 16px;
}

.mobi-web-empty .mdi {
  display: block;
  margin: 0 auto 8px;
  font-size: 28px;
  color: var(--brax-blue);
  opacity: 0.7;
}

.mobi-web-empty p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--brax-navy);
}

.mobi-web-empty small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--nex-web-ad-muted);
}

@media (max-width: 1100px) {
  .nex-web-layout {
    grid-template-columns: 1fr;
  }

  .nex-web-ad {
    display: none;
  }

  .nex-app-column {
    max-width: 100%;
    box-shadow: none;
  }
}

@media (min-width: 1101px) {
  /* Só overlays no body (viewport). Popup/sheet ficam DENTRO de #app — left:calc os empurrava para fora. */
  body.nex-web-body > .dialog-backdrop,
  body.nex-web-body > .dialog,
  body.nex-web-body > .popup-backdrop,
  body.nex-web-body > .sheet-modal-backdrop,
  body.nex-web-body > .panel,
  body.nex-web-body > .panel-backdrop {
    left: max(0px, calc((100vw - min(var(--nex-web-app-width), 100vw)) / 2)) !important;
    right: auto !important;
    width: min(var(--nex-web-app-width), 100vw) !important;
    max-width: var(--nex-web-app-width);
  }
}

/* F7 ≥630px: popup tablet (left:50% + margin negativo) sai da coluna → tela branca. */
body.nex-web-body .popup.modal-in,
body.nex-web-body .popup:not(.popup-tablet-fullscreen).modal-in,
body.nex-web-body .sheet-modal.modal-in {
  display: block !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 13000 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

@media (min-width: 630px) and (min-height: 630px) {
  body.nex-web-body .popup:not(.popup-tablet-fullscreen),
  body.nex-web-body .popup:not(.popup-tablet-fullscreen).modal-in {
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    transform: none !important;
  }
}

body.nex-web-body .popup,
body.nex-web-body .sheet-modal {
  overflow: hidden;
}

body.nex-web-body .popup > .view,
body.nex-web-body .popup > .view > .page,
body.nex-web-body .sheet-modal > .view,
body.nex-web-body .sheet-modal > .view > .page {
  height: 100%;
}

body.nex-web-body .popup .page-content,
body.nex-web-body .sheet-modal .page-content {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

.nex-pwa-install {
  --nex-pwa-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  position: absolute;
  right: 12px;
  bottom: var(--nex-pwa-bottom);
  left: auto;
  z-index: 99990;
  width: min(280px, calc(100% - 24px));
  box-sizing: border-box;
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  transition:
    transform 0.32s cubic-bezier(0.34, 1.2, 0.64, 1),
    opacity 0.28s ease;
}

.nex-pwa-install--visible {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.nex-pwa-install__inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 12px 10px;
  background: #fff;
  border: 1px solid rgba(0, 96, 200, 0.18);
  border-radius: 16px;
  box-shadow:
    0 4px 6px rgba(0, 32, 56, 0.06),
    0 16px 40px rgba(0, 32, 56, 0.16);
}

.nex-pwa-install__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.nex-pwa-install__actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.nex-pwa-install__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
}

.nex-pwa-install__copy {
  flex: 1;
  min-width: 0;
}

.nex-pwa-install__title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--brax-navy);
  line-height: 1.3;
}

.nex-pwa-install__desc {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.4;
  color: #64748b;
}

.nex-pwa-install__btn {
  appearance: none;
  box-sizing: border-box;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.nex-pwa-install__btn--primary {
  color: #fff !important;
  background: linear-gradient(135deg, var(--brax-navy) 0%, var(--brax-blue) 100%) !important;
}

.nex-pwa-install__btn--ghost {
  color: #475569 !important;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0;
}

@media (max-width: 1100px) {
  .nex-pwa-install {
    position: fixed;
    --nex-pwa-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    bottom: var(--nex-pwa-bottom);
    width: min(280px, calc(100vw - 24px));
    z-index: 999999;
  }
}

html.nex-web-needs-upgrade #app,
html.nex-web-needs-upgrade #mobiPwaInstallBar {
  display: none !important;
}

.nex-web-upgrade {
  position: absolute;
  inset: 0;
  z-index: 30000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  background: #eef3f8;
}

html.nex-web-needs-upgrade .nex-web-upgrade {
  display: flex !important;
}

.nex-web-upgrade__card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 22px 18px 18px;
  text-align: center;
  box-shadow: 0 12px 36px rgba(0, 32, 56, 0.12);
}

.nex-web-upgrade__logo {
  border-radius: 16px;
  margin-bottom: 12px;
}

.nex-web-upgrade__title {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--brax-navy);
}

.nex-web-upgrade__lead {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #475569;
}

.nex-web-upgrade__retry {
  appearance: none;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 11px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brax-navy) 0%, var(--brax-blue) 100%);
  cursor: pointer;
}
