/* ==========================================================================
   Página "Comunidade" — landing de benefícios (deslogado) + casca do mapa
   (logado). Autocontido no padrão das landings: o portal público NÃO carrega
   o app.css do Vite e o tailwind-built.css é purgado, então todo utilitário
   usado aqui é backfilled em hex literal + classes semânticas .cmty-*.
   Dark mode co-locado no fim (html.dark .community-page, tokens vnv-dark.css).
   Cache-bust por filemtime (ThemeAssets) — sem bump de theme.version.
   ========================================================================== */

/* ---- Backfill de utilitários Tailwind usados nos blades ----------------- */
.community-page .max-w-7xl { max-width: 80rem; }
.community-page .max-w-2xl { max-width: 42rem; }
.community-page .max-w-4xl { max-width: 56rem; }
.community-page .mx-auto { margin-left: auto; margin-right: auto; }
.community-page .py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.community-page .px-4 { padding-left: 1rem; padding-right: 1rem; }
.community-page .p-6 { padding: 1.5rem; }
.community-page .px-4.py-2 { padding: 0.5rem 1rem; }
.community-page .pb-8 { padding-bottom: 2rem; }
.community-page .mb-2 { margin-bottom: 0.5rem; }
.community-page .mb-3 { margin-bottom: 0.75rem; }
.community-page .mb-4 { margin-bottom: 1rem; }
.community-page .mb-6 { margin-bottom: 1.5rem; }
.community-page .mb-8 { margin-bottom: 2rem; }
.community-page .mb-10 { margin-bottom: 2.5rem; }
.community-page .mb-12 { margin-bottom: 3rem; }
.community-page .mb-24 { margin-bottom: 6rem; }
.community-page .mt-6 { margin-top: 1.5rem; }
.community-page .gap-2 { gap: 0.5rem; }
.community-page .gap-8 { gap: 2rem; }
.community-page .grid { display: grid; gap: 2rem; }
.community-page .inline-flex { display: inline-flex; align-items: center; }
.community-page .items-center { align-items: center; }
.community-page .text-center { text-align: center; }
.community-page .rounded-full { border-radius: 9999px; }
.community-page .font-bold { font-weight: 700; }
.community-page .font-semibold { font-weight: 600; }
.community-page .font-medium { font-weight: 500; }
.community-page .uppercase { text-transform: uppercase; }
.community-page .tracking-wider { letter-spacing: 0.05em; }
.community-page .leading-relaxed { line-height: 1.625; }
.community-page .text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.community-page .text-2xl { font-size: 1.5rem; line-height: 2rem; }
.community-page .text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.community-page .text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.community-page .text-gray-900 { color: #111827; }
.community-page .text-gray-600 { color: #4b5563; }
.community-page .text-gray-500 { color: #6b7280; }
.community-page .text-gray-400 { color: #9ca3af; }
.community-page .h-4 { height: 1rem; }
.community-page .w-4 { width: 1rem; }
.community-page .h-6 { height: 1.5rem; }
.community-page .w-6 { width: 1.5rem; }

@media (min-width: 640px) {
    .community-page .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
    .community-page .sm\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
    .community-page .sm\:text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
}

@media (min-width: 768px) {
    .community-page .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .community-page .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .community-page .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
    .community-page .lg\:text-5xl { font-size: 3rem; line-height: 1.1; }
    .community-page .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- Hero ---------------------------------------------------------------- */
.cmty-badge {
    background: #f3f4f6;
    color: #374151;
}

.cmty-hero-ctas {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .cmty-hero-ctas { flex-direction: row; }
}

/* Botão primário: padrão das landings (bg #030712, hover #1f2937). */
.cmty-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.75rem 1.5rem;
    background: #030712;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.cmty-btn-primary:hover {
    background: #1f2937;
    color: #fff;
    text-decoration: none;
}

.cmty-btn-primary:active { transform: scale(0.98); }

/* Botão outline: contorno preto, preenche de preto só no hover (plano mensal). */
.cmty-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: #030712;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid #030712;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.cmty-btn-outline:hover {
    background: #030712;
    color: #fff;
    text-decoration: none;
}

.cmty-btn-outline:active { transform: scale(0.98); }

.cmty-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cmty-btn-ghost:hover {
    border-color: #9ca3af;
    background: #f9fafb;
    color: #111827;
    text-decoration: none;
}

/* ---- Cards de benefício (padrão .feature-card das landings) -------------- */
.cmty-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.875rem;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cmty-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* ---- Como funciona (passos numerados) ------------------------------------ */
.cmty-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 1rem;
    border-radius: 9999px;
    background: #030712;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

/* ---- Preço ---------------------------------------------------------------- */
.cmty-price-grid {
    display: grid;
    gap: 1.5rem;
    max-width: 48rem;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .cmty-price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cmty-price-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    background: #fff;
    text-align: left;
}

.cmty-price-card--featured { border: 2px solid #030712; }

.cmty-price-badge {
    position: absolute;
    top: -0.75rem;
    right: 1.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background: #030712;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
}

.cmty-price {
    font-size: 2.25rem;
    font-weight: 700;
    color: #111827;
}

.cmty-price-features {
    list-style: none;
    margin: 0 0 2rem;
    padding: 0;
    flex: 1;
}

.cmty-price-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.375rem 0;
    font-size: 0.875rem;
    color: #4b5563;
}

.cmty-price-features li svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
    color: #059669;
}

.cmty-price-card .cmty-btn-primary,
.cmty-price-card .cmty-btn-outline { width: 100%; }

/* ---- CTA final (faixa escura) --------------------------------------------- */
.cmty-final {
    padding: 4rem 1.5rem;
    border-radius: 1.25rem;
    background: #030712;
    color: #fff;
    text-align: center;
}

.cmty-final h2 { color: #fff; }

.cmty-final-subtitle { color: #9ca3af; }

.cmty-btn-final {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.75rem 1.75rem;
    background: #fff;
    color: #030712;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.75rem;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.cmty-btn-final:hover {
    background: #e5e7eb;
    color: #030712;
    text-decoration: none;
}

.cmty-btn-final:active { transform: scale(0.98); }

/* ---- Casca do mapa (logado) ------------------------------------------------
   Full-viewport abaixo do header (mesma geometria da home-radar); o Leaflet
   monta em #vnv-community-map na fase do mapa. --------------------------------- */
.community-map-shell {
    position: relative;
    /* Isola o subtree do mapa num stacking context próprio: o Leaflet injeta
       panes/controles com z-index até 1000 (e loading 900 / locate 800) que,
       sem isto, vazam pro contexto raiz e passam por cima do header (50), do
       chat dock (60) e dos dropdowns do menu. Confinados aqui, ficam abaixo. */
    isolation: isolate;
    height: calc(100vh - 4rem);
    min-height: 30rem;
}

.cmty-map-canvas {
    position: absolute;
    inset: 0;
    background: #eef2f5;
}

.cmty-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

/* sr-only escopado (backfill — o portal não carrega o preflight do app.css):
   h1 acessível da variante logada, invisível sem tirar do acessibility tree. */
.cmty-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ---- Movimento reduzido ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .community-page * { transition: none !important; }
}

/* ==========================================================================
   DARK MODE — escopo html.dark .community-page. Rampa carvão neutro invertida
   (vnv-dark.css): brand-50/100 = superfícies elevadas, brand-200/300 = bordas,
   brand-800/900 = texto claro. Botão primário INVERTE (claro sobre escuro).
   ========================================================================== */
html.dark .community-page .text-gray-900 { color: var(--color-brand-900); }
html.dark .community-page .text-gray-600 { color: var(--color-brand-600); }
html.dark .community-page .text-gray-500 { color: var(--color-brand-500); }
html.dark .community-page .text-gray-400 { color: var(--color-brand-400); }

html.dark .cmty-badge {
    background: var(--color-brand-100);
    color: var(--color-brand-800);
}

html.dark .cmty-btn-primary {
    background: var(--color-brand-800);
    color: #141414;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.5);
}
html.dark .cmty-btn-primary:hover {
    background: var(--color-brand-700);
    color: #141414;
}

html.dark .cmty-btn-outline {
    background: transparent;
    color: var(--color-brand-800);
    border-color: var(--color-brand-800);
}
html.dark .cmty-btn-outline:hover {
    background: var(--color-brand-800);
    color: #141414;
}

html.dark .cmty-btn-ghost {
    color: var(--color-brand-800);
    border-color: var(--color-brand-300);
}
html.dark .cmty-btn-ghost:hover {
    border-color: var(--color-brand-400);
    background: var(--color-brand-100);
    color: var(--color-brand-900);
}

html.dark .cmty-card {
    background: var(--color-brand-50);
    border-color: var(--color-brand-200);
}

html.dark .cmty-step-num {
    background: var(--color-brand-800);
    color: #141414;
}

html.dark .cmty-price-card {
    background: var(--color-brand-50);
    border-color: var(--color-brand-200);
}
html.dark .cmty-price-card--featured { border-color: var(--color-brand-600); }

html.dark .cmty-price-badge {
    background: var(--color-brand-800);
    color: #141414;
}

html.dark .cmty-price { color: var(--color-brand-900); }

html.dark .cmty-price-features li { color: var(--color-brand-600); }
html.dark .cmty-price-features li svg { color: var(--color-success-500); }

html.dark .cmty-final {
    background: var(--color-brand-100);
    color: var(--color-brand-900);
}
html.dark .cmty-final h2 { color: var(--color-brand-900); }
html.dark .cmty-final-subtitle { color: var(--color-brand-600); }

html.dark .cmty-btn-final {
    background: var(--color-brand-800);
    color: #141414;
}
html.dark .cmty-btn-final:hover {
    background: var(--color-brand-700);
    color: #141414;
}

html.dark .cmty-map-canvas { background: #121212; }
html.dark .cmty-map-loading { color: var(--color-brand-500); }
