/* ==========================================================================
   Páginas legais (Política de Privacidade / Termos) — DriveMoc
   Folha autossuficiente: não depende de variáveis de outro design system.
   Paleta: azul #0047BB / #002D7A, claro #1E88E5, acento #FF9800, navy #0A1733.
   ========================================================================== */

:root {
  --dm-primary: #0047BB;
  --dm-primary-dark: #002D7A;
  --dm-primary-light: #1E88E5;
  --dm-accent: #FF9800;
  --dm-navy: #0A1733;
  --dm-ink: #1a2438;
  --dm-body: #3a465e;
  --dm-muted: #6b7ea3;
  --dm-line: #e6ebf4;
  --dm-page: #f4f7fd;
  --dm-shadow: 0 24px 60px -28px rgba(10, 20, 50, 0.35);
}

.legal-page,
.legal-page * {
  font-family: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--dm-line);
}

.nav-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.navbar .logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 20px;
  color: var(--dm-navy);
  letter-spacing: -0.02em;
}

.logo-icon-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 11px;
  background: #fff;
  border: 1px solid #eaeef6;
  box-shadow: 0 2px 10px rgba(10, 20, 50, 0.12);
  padding: 4px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 15px;
  font-weight: 600;
  color: #46546f;
}

.nav-links a {
  color: #46546f;
  transition: color 0.18s ease;
}

.nav-links a:hover {
  color: var(--dm-primary);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 99px;
  background: var(--dm-navy);
  margin: 4px 0;
}

/* ---------- Container ---------- */
.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Cabeçalho da página ---------- */
.legal-page {
  position: relative;
  min-height: 80vh;
  padding: 72px 0 96px;
  background: linear-gradient(180deg, var(--dm-page) 0%, #eaf0fb 100%);
  overflow: hidden;
}

.legal-page::before,
.legal-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.legal-page::before {
  top: -120px;
  right: -100px;
  width: 320px;
  height: 320px;
  background: rgba(0, 71, 187, 0.16);
}

.legal-page::after {
  left: -80px;
  bottom: 40px;
  width: 260px;
  height: 260px;
  background: rgba(255, 152, 0, 0.12);
}

.legal-header {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: 40px;
}

.section-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(0, 71, 187, 0.08);
  color: var(--dm-primary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legal-header h1 {
  margin: 16px 0 0;
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: var(--dm-navy);
  font-weight: 800;
}

.legal-updated {
  margin-top: 12px;
  color: var(--dm-muted);
  font-size: 0.92rem;
  font-weight: 500;
}

/* ---------- Abas Passageiros / Motoristas ---------- */
.legal-tabs {
  display: inline-flex;
  gap: 6px;
  margin-top: 26px;
  padding: 6px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--dm-line);
  box-shadow: 0 10px 26px -18px rgba(10, 20, 50, 0.4);
}

.legal-tab {
  padding: 10px 22px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #5a6b8c;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease;
}

.legal-tab:hover {
  color: var(--dm-primary);
}

.legal-tab.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--dm-primary) 0%, var(--dm-primary-light) 100%);
  box-shadow: 0 14px 26px -12px rgba(0, 71, 187, 0.7);
}

/* ---------- Documento (conteúdo vindo do Firestore) ---------- */
.legal-content {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 48px 52px;
  border-radius: 22px;
  background: #ffffff;
  border: 1px solid var(--dm-line);
  box-shadow: var(--dm-shadow);
  color: var(--dm-body);
  font-size: 1rem;
  line-height: 1.8;
}

.legal-content h1,
.legal-content h2,
.legal-content h3,
.legal-content h4 {
  margin: 30px 0 12px;
  line-height: 1.25;
  color: var(--dm-primary-dark);
  font-weight: 800;
}

.legal-content > h1:first-child,
.legal-content > h2:first-child,
.legal-content .legal-doc > :first-child {
  margin-top: 0;
}

.legal-content h1 {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.legal-content h2 {
  font-size: 1.3rem;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--dm-line);
}

.legal-content h3 {
  font-size: 1.08rem;
  color: var(--dm-primary);
}

.legal-content h4 {
  font-size: 0.98rem;
  color: var(--dm-primary);
}

.legal-content p,
.legal-content li,
.legal-content span,
.legal-content font {
  color: var(--dm-body);
}

.legal-content p,
.legal-content ul,
.legal-content ol,
.legal-content blockquote {
  margin: 0 0 16px;
}

.legal-content ul,
.legal-content ol {
  padding-left: 22px;
}

.legal-content li {
  margin-bottom: 6px;
}

.legal-content li::marker {
  color: var(--dm-primary);
}

.legal-content a {
  color: var(--dm-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-content a:hover {
  color: var(--dm-primary-dark);
}

.legal-content strong,
.legal-content b {
  color: var(--dm-ink);
  font-weight: 700;
}

.legal-content i {
  color: var(--dm-muted);
}

.legal-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.94rem;
}

.legal-content th,
.legal-content td {
  border: 1px solid var(--dm-line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.legal-content th {
  background: #eef3fc;
  color: var(--dm-primary-dark);
}

.legal-content img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  margin: 12px 0;
}

.legal-content blockquote {
  padding: 14px 18px;
  border-left: 4px solid var(--dm-accent);
  border-radius: 0 12px 12px 0;
  background: rgba(255, 152, 0, 0.08);
}

.legal-content hr {
  border: 0;
  border-top: 1px solid var(--dm-line);
  margin: 24px 0;
}

/* ---------- Estados de carregamento / vazio ---------- */
.legal-loading,
.legal-empty {
  text-align: center;
  color: var(--dm-muted);
  padding: 42px 10px;
}

.legal-loading::before {
  content: '';
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(0, 71, 187, 0.16);
  border-top-color: var(--dm-accent);
  margin-right: 10px;
  vertical-align: middle;
  animation: legal-spin 0.9s linear infinite;
}

@keyframes legal-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Footer ---------- */
.footer {
  background: var(--dm-navy);
  color: #9fb4da;
  padding: 60px 0 30px;
}

.footer-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand .footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 20px;
  color: #ffffff;
}

.footer-brand p {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.65;
  color: #7e93bc;
  max-width: 300px;
}

.footer-links h4 {
  margin: 0 0 16px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.footer-links a {
  display: block;
  margin-bottom: 11px;
  color: #9fb4da;
  font-size: 14.5px;
  font-weight: 500;
  transition: color 0.18s ease;
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-bottom {
  max-width: 1160px;
  margin: 0 auto;
  padding: 22px 24px 0;
  font-size: 13px;
  color: #6b7ea3;
}

.footer-bottom-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
}

.footer-bottom-row p {
  margin: 0;
}

.dm-developed-by {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #9fb4da;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.dm-developed-by:hover {
  color: #ffffff;
}

.dm-developed-by img {
  display: block;
  height: 42px;
  width: auto;
  max-width: 110px;
  object-fit: contain;
  background: transparent;
}

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: block;
  }

  .legal-content {
    padding: 30px 22px;
    border-radius: 18px;
  }

  .legal-tabs {
    flex-wrap: wrap;
    justify-content: center;
  }

  .footer-container {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
}

@media (max-width: 520px) {
  .legal-page {
    padding: 48px 0 64px;
  }

  .footer-container {
    grid-template-columns: 1fr;
  }
}

/* Modo embed (WebView nos apps) */
body.legal-embed .navbar,
body.legal-embed .footer,
body.legal-embed .legal-tabs {
  display: none !important;
}

body.legal-embed .legal-page {
  padding: 16px 0 32px;
}

body.legal-embed .legal-header {
  padding-top: 8px;
}

body.legal-embed .legal-content {
  margin-top: 0;
}
