/* Motometria Shell — Topbar, Footer, ProductSwitcher, CookieBanner
   Standalone CSS, only depends on CSS variables from tokens.css (graceful fallbacks).
   Applied in ALL 4Me apps to give consistent Motometria look-and-feel.
   v1 — 2026-04-23 T11 */

:root {
  --mtm-topbar-h: 64px;
  --mtm-product-accent: var(--product-accent, #2563eb);
}

/* ============================================================
   TOPBAR — fixed 64px, brand left, nav center, actions right
   ============================================================ */
.mtm-topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--mtm-topbar-h);
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: #0f172a;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.mtm-topbar.scrolled {
  box-shadow: 0 6px 20px -10px rgba(15, 23, 42, 0.15);
  border-bottom-color: transparent;
}
.mtm-topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--mtm-product-accent) 30%, var(--mtm-product-accent) 70%, transparent 100%);
  opacity: 0.35;
  pointer-events: none;
}

/* Dark theme override (apps que são dark) */
[data-theme="dark"] .mtm-topbar,
body[data-product="social"] .mtm-topbar,
body[data-product="whatsapp"] .mtm-topbar,
body.mtm-dark .mtm-topbar {
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  border-bottom-color: rgba(248, 250, 252, 0.08);
}
[data-theme="dark"] .mtm-topbar .mtm-topbar-brand strong,
body[data-product="social"] .mtm-topbar .mtm-topbar-brand strong,
body[data-product="whatsapp"] .mtm-topbar .mtm-topbar-brand strong,
body.mtm-dark .mtm-topbar .mtm-topbar-brand strong { color: #f8fafc; }
[data-theme="dark"] .mtm-topbar .mtm-topbar-brand small,
body[data-product="social"] .mtm-topbar .mtm-topbar-brand small,
body[data-product="whatsapp"] .mtm-topbar .mtm-topbar-brand small,
body.mtm-dark .mtm-topbar .mtm-topbar-brand small { color: #94a3b8; }
[data-theme="dark"] .mtm-topbar .mtm-btn-ghost,
body[data-product="social"] .mtm-topbar .mtm-btn-ghost,
body[data-product="whatsapp"] .mtm-topbar .mtm-btn-ghost,
body.mtm-dark .mtm-topbar .mtm-btn-ghost { color: #cbd5e1; }
[data-theme="dark"] .mtm-topbar .mtm-btn-ghost:hover,
body[data-product="social"] .mtm-topbar .mtm-btn-ghost:hover,
body[data-product="whatsapp"] .mtm-topbar .mtm-btn-ghost:hover,
body.mtm-dark .mtm-topbar .mtm-btn-ghost:hover { background: rgba(248, 250, 252, 0.08); color: #fff; }

.mtm-topbar-left { display: flex; align-items: center; gap: 16px; }
.mtm-topbar-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
  transition: opacity .15s ease;
}
.mtm-topbar-logo:hover { opacity: 0.85; }
.mtm-topbar-logo-mark {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb 0%, var(--mtm-product-accent) 100%);
  color: #fff;
  font-weight: 800; font-size: 18px; letter-spacing: -0.5px;
  box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.25);
}
.mtm-topbar-brand {
  display: flex; flex-direction: column; line-height: 1.1;
}
.mtm-topbar-brand strong {
  font-size: 15px; font-weight: 700; color: #0f172a;
}
.mtm-topbar-brand small {
  font-size: 11px; font-weight: 500; color: #64748b; margin-top: 1px;
}

.mtm-topbar-nav {
  display: flex; align-items: center; gap: 4px;
  flex: 1;
  justify-content: center;
}
.mtm-topbar-nav a {
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  font-size: 14px; font-weight: 500;
  opacity: 0.75;
  transition: all .15s ease;
}
.mtm-topbar-nav a:hover { opacity: 1; background: rgba(15, 23, 42, 0.04); }
.mtm-topbar-nav a.active {
  opacity: 1;
  color: var(--mtm-product-accent);
  background: color-mix(in srgb, var(--mtm-product-accent) 10%, transparent);
}

.mtm-topbar-right {
  display: flex; align-items: center; gap: 6px;
}
.mtm-btn-ghost {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: #475569;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  position: relative;
}
.mtm-btn-ghost:hover { background: rgba(15, 23, 42, 0.05); color: #0f172a; }
.mtm-btn-ghost svg { width: 20px; height: 20px; }

.mtm-btn-ghost .mtm-badge {
  position: absolute;
  top: 6px; right: 6px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--mtm-product-accent);
  color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px;
  text-align: center;
}

@media (max-width: 768px) {
  .mtm-topbar { padding: 0 12px; }
  .mtm-topbar-brand small { display: none; }
  .mtm-topbar-nav { display: none; }
  .mtm-btn-ghost { width: 36px; height: 36px; }
}

/* ============================================================
   PRODUCT SWITCHER — dropdown grid com 6 apps
   ============================================================ */
.mtm-switcher-wrap { position: relative; }
.mtm-switcher-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  box-shadow: 0 20px 50px -15px rgba(15, 23, 42, 0.25);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  z-index: 1001;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
[data-theme="dark"] .mtm-switcher-panel,
body[data-product="social"] .mtm-switcher-panel,
body[data-product="whatsapp"] .mtm-switcher-panel,
body.mtm-dark .mtm-switcher-panel {
  background: #1e293b;
  border-color: rgba(248, 250, 252, 0.1);
}
.mtm-switcher-wrap.is-open .mtm-switcher-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mtm-switcher-header {
  grid-column: span 2;
  padding: 8px 10px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.mtm-switcher-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  transition: all .15s ease;
  animation: mtm-fade-in .3s ease both;
}
.mtm-switcher-item:nth-child(2) { animation-delay: .04s; }
.mtm-switcher-item:nth-child(3) { animation-delay: .08s; }
.mtm-switcher-item:nth-child(4) { animation-delay: .12s; }
.mtm-switcher-item:nth-child(5) { animation-delay: .16s; }
.mtm-switcher-item:nth-child(6) { animation-delay: .20s; }
.mtm-switcher-item:nth-child(7) { animation-delay: .24s; }
.mtm-switcher-item:hover {
  transform: translateY(-2px);
  border-color: var(--mtm-switch-accent, rgba(15, 23, 42, 0.1));
  background: color-mix(in srgb, var(--mtm-switch-accent, #2563eb) 6%, transparent);
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--mtm-switch-accent, #2563eb) 40%, transparent);
}
.mtm-switcher-item.current {
  background: color-mix(in srgb, var(--mtm-switch-accent, #2563eb) 10%, transparent);
  border-color: var(--mtm-switch-accent, rgba(15, 23, 42, 0.15));
}
.mtm-switcher-item-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--mtm-switch-accent, #2563eb);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
  margin-bottom: 4px;
}
.mtm-switcher-item strong { font-size: 13px; font-weight: 700; }
.mtm-switcher-item small { font-size: 11px; opacity: 0.7; }

@keyframes mtm-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   NOTIFICATION PANEL
   ============================================================ */
.mtm-notif-wrap { position: relative; }
.mtm-notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 320px; background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08); border-radius: 14px;
  box-shadow: 0 20px 50px -15px rgba(15, 23, 42, 0.25);
  padding: 8px; z-index: 1001;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity .18s, transform .18s;
}
[data-theme="dark"] .mtm-notif-panel,
body[data-product="social"] .mtm-notif-panel,
body[data-product="whatsapp"] .mtm-notif-panel,
body.mtm-dark .mtm-notif-panel { background: #1e293b; border-color: rgba(248,250,252,.1); color: #f8fafc; }
.mtm-notif-wrap.is-open .mtm-notif-panel {
  opacity: 1; transform: translateY(0); pointer-events: auto;
}
.mtm-notif-item {
  padding: 10px 12px; border-radius: 8px; font-size: 13px;
  display: flex; gap: 10px; align-items: flex-start;
  transition: background .15s;
}
.mtm-notif-item:hover { background: rgba(15, 23, 42, 0.04); }
.mtm-notif-item-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0;
  background: var(--mtm-product-accent);
}

/* ============================================================
   FOOTER — 3 cols: ecossistema / empresa / legal + copyright
   ============================================================ */
.mtm-footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 48px 24px 24px;
  font-family: 'Inter', system-ui, sans-serif;
  margin-top: auto;
}
.mtm-footer-inner {
  max-width: 1200px; margin: 0 auto;
}
.mtm-footer-cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(248, 250, 252, 0.08);
}
.mtm-footer-brand h4 {
  font-size: 16px; font-weight: 800; color: #fff;
  margin-bottom: 8px;
}
.mtm-footer-brand p {
  font-size: 13px; line-height: 1.6; color: #94a3b8; max-width: 300px;
}
.mtm-footer-col h5 {
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #f8fafc;
  margin-bottom: 14px;
}
.mtm-footer-col ul { list-style: none; padding: 0; margin: 0; }
.mtm-footer-col li { margin-bottom: 8px; }
.mtm-footer-col a {
  color: #94a3b8; text-decoration: none; font-size: 13px;
  transition: color .15s ease;
}
.mtm-footer-col a:hover { color: var(--mtm-product-accent); }
.mtm-footer-col a[data-accent] {
  color: var(--mtm-footer-accent, #94a3b8);
}

.mtm-footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 24px;
  font-size: 12px;
  color: #64748b;
}
.mtm-footer-bottom strong { color: #cbd5e1; }
.mtm-footer-livro {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: rgba(248, 250, 252, 0.04);
  border: 1px solid rgba(248, 250, 252, 0.08);
  border-radius: 20px;
  color: #cbd5e1; text-decoration: none;
  font-size: 11px; font-weight: 600;
  transition: all .15s;
}
.mtm-footer-livro:hover { background: rgba(248, 250, 252, 0.08); color: #fff; }

@media (max-width: 768px) {
  .mtm-footer-cols { grid-template-columns: 1fr; gap: 28px; }
  .mtm-footer { padding: 32px 16px 20px; }
}

/* ============================================================
   COOKIE BANNER — bottom-right, 3 options, dismissible
   ============================================================ */
.mtm-cookie {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  box-shadow: 0 20px 50px -10px rgba(15, 23, 42, 0.25);
  padding: 20px;
  z-index: 9999;
  font-family: 'Inter', system-ui, sans-serif;
  color: #0f172a;
  transform: translateY(calc(100% + 30px));
  transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}
.mtm-cookie.is-visible { transform: translateY(0); }
.mtm-cookie h4 {
  font-size: 15px; font-weight: 700; margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.mtm-cookie p {
  font-size: 13px; line-height: 1.55; color: #475569; margin-bottom: 14px;
}
.mtm-cookie p a { color: var(--mtm-product-accent); text-decoration: underline; }
.mtm-cookie-actions {
  display: flex; flex-direction: column; gap: 6px;
}
.mtm-cookie-btn {
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.mtm-cookie-btn.primary {
  background: var(--mtm-product-accent);
  color: #fff;
}
.mtm-cookie-btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.mtm-cookie-btn.ghost {
  background: transparent;
  color: #475569;
  border: 1px solid rgba(15, 23, 42, 0.15);
}
.mtm-cookie-btn.ghost:hover { background: rgba(15, 23, 42, 0.04); }

@media (max-width: 480px) {
  .mtm-cookie { left: 10px; right: 10px; bottom: 10px; width: auto; }
}

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.mtm-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.mtm-page > main,
.mtm-page > .mtm-main { flex: 1 0 auto; }

/* ============================================================
   PRODUCT-ACCENT PER BODY[data-product]
   ============================================================ */
body[data-product="pricer"]   { --mtm-product-accent: #8b5cf6; }
body[data-product="mailsign"] { --mtm-product-accent: #f59e0b; }
body[data-product="whatsapp"] { --mtm-product-accent: #25d366; }
body[data-product="social"]   { --mtm-product-accent: #ec4899; }
body[data-product="slot"]     { --mtm-product-accent: #06b6d4; }
body[data-product="crm"]      { --mtm-product-accent: #10b981; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .mtm-topbar, .mtm-cookie, .mtm-switcher-panel, .mtm-notif-panel,
  .mtm-switcher-item, .mtm-cookie-btn {
    transition: none !important;
    animation: none !important;
  }
}
