/* Home Rotas GO — layout centralizado e estável no mobile */
:root {
  --home-bg: #0f172a;
  --home-card: #1e293b;
  --home-text: #f8fafc;
  --home-muted: #94a3b8;
  --home-primary: #f97316;
  --home-primary-hover: #ea580c;
  --nav-h: 64px;
  --home-max: 480px; /* coluna central tipo app */
}

*,
*::before,
*::after { box-sizing: border-box; }

body.home-app {
  background: var(--home-bg);
  color: var(--home-text);
  margin: 0;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}

/* Coluna central — evita “descentralizar” em telas largas */
.home-shell {
  width: 100%;
  max-width: var(--home-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 12px;
  padding-right: 12px;
}

.home-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: env(safe-area-inset-top, 0);
}

.home-search {
  display: flex;
  align-items: stretch;
  background: var(--home-card);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  overflow: hidden;
}
.home-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--home-text);
  padding: 10px 14px;
  font-size: 0.95rem;
  outline: none;
  box-shadow: none !important;
}
.home-search input::placeholder { color: var(--home-muted); }
.home-search .btn {
  flex-shrink: 0;
  border: 0;
  border-radius: 0;
  padding: 0 16px;
  background: var(--home-primary);
  color: #fff;
}

.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--home-muted);
  margin-bottom: 2px;
}
.section-title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
  line-height: 1.3;
}

/* Destaques */
.featured-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  padding: 4px 2px 12px;
  margin: 0 -2px;
  -webkit-overflow-scrolling: touch;
}
.featured-track::-webkit-scrollbar { height: 3px; }
.featured-track::-webkit-scrollbar-thumb {
  background: var(--home-primary);
  border-radius: 4px;
}

/* Carrossel de destaques — wrapper com setas + viewport */
.featured-carousel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.featured-viewport {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.featured-viewport .featured-track {
  cursor: grab;
  touch-action: pan-y;
}
.featured-viewport .featured-track:active {
  cursor: grabbing;
}
.featured-nav {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: var(--home-card);
  color: var(--home-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  padding: 0;
  z-index: 2;
}
.featured-nav:hover {
  background: var(--home-primary);
  border-color: var(--home-primary);
  color: #fff;
}
.featured-nav:focus-visible {
  outline: 2px solid var(--home-primary);
  outline-offset: 2px;
}
.featured-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.featured-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(148, 163, 184, 0.35);
  transition: background 0.2s ease, transform 0.2s ease;
}
.featured-dot.active {
  background: var(--home-primary);
  transform: scale(1.35);
}
.featured-counter {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--home-text);
  opacity: 0.75;
}
.featured-dot:focus-visible {
  outline: 2px solid var(--home-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .featured-track { scroll-behavior: auto; }
  .featured-dot { transition: none; }
}

.feat-card {
  /* Relativo ao próprio .featured-track (container real do carrossel), não a 78vw
     (viewport inteira). Com as setas ocupando espaço lateral, 78vw podia ser maior
     que o espaço realmente visível e cortar o botão do WhatsApp na lateral. */
  flex: 0 0 min(260px, 84%);
  scroll-snap-align: start;
  background: var(--home-card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.12);
  position: relative;
  display: flex;
  flex-direction: column;
}
.feat-card.is-pro {
  border-color: rgba(249, 115, 22, 0.55);
}
.feat-card .feat-img {
  height: 110px;
  width: 100%;
  object-fit: cover;
  background: #0b1220;
  display: block;
}
.feat-card .feat-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
/* Garante que o botão "Ver anúncio" trunque o texto em vez de empurrar o
   botão do WhatsApp para fora do card, e que o WhatsApp nunca seja espremido. */
.feat-card .feat-body .btn-rg.flex-grow-1 {
  min-width: 0;
}
.feat-card .feat-body .btn-wa,
.feat-card .feat-body [data-share-id] {
  flex-shrink: 0;
}
.feat-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
}
.feat-badge.pro { background: #f97316; color: #fff; }
.feat-badge.basico { background: #6366f1; color: #fff; }
.feat-badge.destaque { background: #eab308; color: #1e293b; }

/* Lista próximos — grid fixo da linha */
.near-card {
  background: var(--home-card);
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  padding: 12px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  margin-bottom: 10px;
  align-items: start;
  width: 100%;
}
.near-card img,
.near-card .near-ph {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: #0b1220;
}
.near-card .near-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--home-muted);
  margin: 0;
}
.near-card .near-content {
  min-width: 0; /* text-truncate funciona */
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.near-card .near-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.25;
  margin: 0;
  /* até 2 linhas */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.near-meta {
  font-size: 0.78rem;
  color: var(--home-muted);
  line-height: 1.35;
  margin: 0;
}
.near-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 4px 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.near-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.near-actions .btn {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.city-select {
  background: var(--home-card);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--home-text);
  border-radius: 8px;
  font-size: 0.85rem;
  padding: 6px 10px;
  max-width: 100%;
}

/* Bottom nav centrada na coluna */
.home-bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--home-max);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #0b1220;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  display: flex;
  align-items: flex-start;
  z-index: 200;
}
.home-bottom-nav a,
.home-bottom-nav button {
  flex: 1;
  background: none;
  border: 0;
  color: var(--home-muted);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.65rem;
  font-weight: 600;
  height: var(--nav-h);
  padding: 0;
  position: relative;
}
.home-bottom-nav a.active {
  color: var(--home-primary);
}
.home-bottom-nav .nav-fab {
  flex: 0 0 auto;
  width: 64px;
  height: var(--nav-h);
  margin-top: 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
  color: var(--home-muted);
  font-size: 0.65rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding-top: 0;
}
.home-bottom-nav .nav-fab-circle {
  width: 48px;
  height: 48px;
  margin-top: -14px;
  border-radius: 50%;
  background: var(--home-primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}
.home-bottom-nav .nav-fab-label {
  color: var(--home-muted);
  line-height: 1;
  margin-top: 2px;
}

.offcanvas-home {
  background: var(--home-bg);
  color: var(--home-text);
  max-width: min(100vw, var(--home-max));
}
.offcanvas-home .offcanvas-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.plan-card {
  background: var(--home-card);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  margin-bottom: 10px;
}
.plan-card.pro { border-color: rgba(249, 115, 22, 0.5); }
.plan-card.basico { border-color: rgba(99, 102, 241, 0.45); }
.plan-card.destaque { border-color: rgba(234, 179, 8, 0.45); }
.plan-card.verificacao { border-color: rgba(56, 189, 248, 0.45); }
.plan-card.avulso { border-color: rgba(34, 197, 94, 0.45); }
.plan-card.basic { border-color: rgba(99, 102, 241, 0.45); }

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #38bdf8;
  font-weight: 600;
}
.verified-badge i { font-size: 0.9em; }

.bump-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #22c55e;
  font-weight: 600;
}
.bump-badge i { font-size: 0.9em; }

.btn-rg {
  background: var(--home-primary);
  border: 1px solid var(--home-primary);
  color: #fff;
}
.btn-rg:hover { background: var(--home-primary-hover); color: #fff; }
.btn-rg-outline {
  border: 1px solid var(--home-primary);
  color: var(--home-primary);
  background: transparent;
}
.btn-wa {
  background: #22c55e;
  border: 1px solid #22c55e;
  color: #fff;
  width: 36px;
  padding: 6px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.empty-hint { color: var(--home-muted); font-size: 0.9rem; }

/* Cards das categorias do painel "O que você quer vender?" (Veículos/Imóveis) —
   ícone dentro de um badge circular laranja suave + rótulo, num card com
   fundo levemente destacado do offcanvas. Visual mais "premium" no lugar do
   botão plano com ícone solto de antes. */
.category-soon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: .85rem .4rem .7rem;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 14px;
  background: var(--home-card);
  color: var(--home-text);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.category-soon-btn:hover,
.category-soon-btn:focus-visible {
  border-color: rgba(249, 115, 22, .45);
  background: rgba(249, 115, 22, .08);
}
.category-soon-btn:active { transform: scale(.97); }
.category-soon-btn span:last-child {
  font-size: .8rem;
  line-height: 1.15;
  font-weight: 500;
}
.cat-icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(249, 115, 22, .14);
  flex-shrink: 0;
}
.cat-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--home-primary);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Categoria "Carros" já funciona (as demais ainda são "em breve") — borda
   quadrada laranja pra destacar que esse ícone já está ativo. */
.category-active-btn {
  border: 2px solid #f97316 !important;
  border-radius: 14px !important;
  position: relative;
}
.category-active-btn::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f97316;
  box-shadow: 0 0 0 2px var(--bs-body-bg, #0d1117);
}

.fav-btn {
  flex-shrink: 0;
  line-height: 1;
  padding: 0 !important;
}

/* Desktop: continua coluna estreita no centro */
@media (min-width: 768px) {
  :root { --home-max: 520px; }
}


/* Tema claro da home — o theme.js alterna data-bs-theme no <html>. */
html[data-bs-theme="light"] {
  --home-bg: #f8fafc;
  --home-card: #ffffff;
  --home-text: #1e293b;
  --home-muted: #64748b;
}

html[data-bs-theme="light"] body.home-app {
  background: var(--home-bg);
  color: var(--home-text);
}

html[data-bs-theme="light"] .home-topbar {
  background: rgba(248, 250, 252, 0.95);
  border-bottom-color: rgba(100, 116, 139, 0.2);
}

html[data-bs-theme="light"] .home-topbar .text-white {
  color: var(--home-text) !important;
}

html[data-bs-theme="light"] .home-topbar .btn-outline-light {
  color: var(--home-text);
  border-color: rgba(100, 116, 139, 0.45);
}

html[data-bs-theme="light"] .home-topbar .btn-outline-light:hover,
html[data-bs-theme="light"] .home-topbar .btn-outline-light:focus-visible {
  color: #fff;
  background: var(--home-primary);
  border-color: var(--home-primary);
}

html[data-bs-theme="light"] .home-bottom-nav {
  background: #ffffff;
  border-top-color: rgba(100, 116, 139, 0.2);
}

html[data-bs-theme="light"] .feat-card,
html[data-bs-theme="light"] .near-card,
html[data-bs-theme="light"] .plan-card,
html[data-bs-theme="light"] .offcanvas-home {
  border-color: rgba(100, 116, 139, 0.2);
}

html[data-bs-theme="light"] .feat-card .feat-img,
html[data-bs-theme="light"] .near-card img,
html[data-bs-theme="light"] .near-card .near-ph {
  background: #e2e8f0;
}

html[data-bs-theme="light"] .near-desc {
  color: #475569;
}

html[data-bs-theme="light"] .offcanvas-home {
  background: var(--home-bg);
  color: var(--home-text);
}

html[data-bs-theme="light"] .offcanvas-home .btn-close-white {
  filter: none;
}

html[data-bs-theme="light"] .home-bottom-nav a,
html[data-bs-theme="light"] .home-bottom-nav button {
  color: var(--home-muted);
}

html[data-bs-theme="light"] .home-bottom-nav a.active {
  color: var(--home-primary);
}

html[data-bs-theme="light"] .home-bottom-nav .nav-fab-label {
  color: var(--home-muted);
}

html[data-bs-theme="light"] .modal-content {
  background: #ffffff !important;
  color: var(--home-text) !important;
}

html[data-bs-theme="light"] .modal-content .form-select,
html[data-bs-theme="light"] .modal-content .form-control {
  background: #ffffff !important;
  color: var(--home-text) !important;
  border-color: #cbd5e1 !important;
}

html[data-bs-theme="light"] .modal-content .btn-close-white {
  filter: none;
}


/* ===== Estado (topo) + campo de cidade digitável ===== */
.state-wrap { position: relative; }
.state-switch {
  display: inline-flex; align-items: center; gap: .35rem;
  background: transparent; color: #fff; font-weight: 800; letter-spacing: .06em; font-size: 1.05rem;
  border: 1.5px solid rgba(255,255,255,.4); border-radius: 999px; padding: .15rem .8rem;
}
.state-switch:disabled { opacity: 1; cursor: default; }              /* travado, mas sem parecer "apagado" */
.state-switch:not(:disabled):hover { border-color: var(--home-primary); }
.state-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 1085; min-width: 190px;
  background: var(--home-card); color: var(--home-text); border: 1px solid rgba(148,163,184,.25);
  border-radius: 10px; padding: 6px; box-shadow: 0 10px 28px rgba(0,0,0,.4);
}
.state-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: inherit; padding: .5rem .6rem; border-radius: 8px; }
.state-menu button:hover, .state-menu button.active { background: rgba(249,115,22,.16); }

.city-field {
  display: flex; align-items: center; gap: 8px;
  background: var(--home-card); border: 1px solid rgba(148,163,184,.25); border-radius: 8px; padding: 0 10px;
}
.city-field:focus-within { border-color: var(--home-primary); }
.city-field i { color: var(--home-primary); }
.city-input {
  flex: 1 1 auto; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent;
  color: var(--home-text); font-size: .95rem; padding: 10px 0; text-overflow: ellipsis;
}
.city-input::placeholder { color: var(--home-muted); }
html[data-bs-theme="light"] .state-switch { color: #0f172a; border-color: rgba(15,23,42,.35); }
