/* ==========================================================================
   Mapa Free Flow - Design System & Modern UI Styles
   ========================================================================== */

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

:root {
  /* Brand & Core Palette */
  --primary: #7C3AED;
  --primary-gradient: linear-gradient(135deg, #7C3AED 0%, #6366F1 100%);
  --primary-hover: #6D28D9;
  --primary-soft: #F5F3FF;
  --primary-glow: rgba(124, 58, 237, 0.28);

  /* Neutrals */
  --slate-900: #0F172A;
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50: #F8FAFC;
  --surface: #FFFFFF;

  /* Status Colors */
  --status-op: #10B981;
  --status-op-soft: rgba(16, 185, 129, 0.12);
  --status-op-glow: rgba(16, 185, 129, 0.35);

  --status-inst: #F59E0B;
  --status-inst-soft: rgba(245, 158, 11, 0.12);

  --status-breve: #F43F5E;
  --status-breve-soft: rgba(244, 63, 94, 0.12);

  /* Map Canvas Colors */
  --map-ocean: #F0F4F8;
  --map-ocean-grid: rgba(148, 163, 184, 0.12);
  --map-land: #FFFFFF;
  --map-land-stroke: #CBD5E1;
  --map-land-hover: #EEF2FF;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Manrope', 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radii & Shadows */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-subtle: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-floating: 0 20px 40px -8px rgba(15, 23, 42, 0.16), 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 25px var(--primary-glow);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--slate-50);
  color: var(--slate-900);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Root Container
   -------------------------------------------------------------------------- */
.widget-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
  background: var(--surface);
  box-shadow: var(--shadow-subtle);
}

/* --------------------------------------------------------------------------
   Header / Topbar
   -------------------------------------------------------------------------- */
.widget-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--slate-200);
  height: 56px;
  flex-shrink: 0;
  z-index: 30;
  transition: background 0.2s ease;
}

.widget-brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.widget-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--slate-900);
}

.widget-brand img {
  height: 26px;
  width: auto;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.05));
}

.brand-divider {
  width: 1px;
  height: 20px;
  background: var(--slate-200);
}

.widget-brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.widget-brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  color: var(--slate-900);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-title-text {
  white-space: nowrap;
}


/* Quick Filter Pills (Top Bar) */
.quick-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.quick-pills::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--slate-200);
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.pill-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.pill-btn.active {
  background: var(--primary-gradient);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.widget-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.embed-topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.embed-topbar-btn:hover {
  background: var(--slate-50);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(124, 58, 237, 0.12);
}

.embed-topbar-btn svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.cta-topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  background: var(--primary-gradient);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--primary-glow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cta-topbar-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--primary-glow);
  filter: brightness(1.05);
}

.cta-topbar-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.cta-topbar-btn:hover svg {
  transform: translateX(2px);
}

/* Mobile Toggle Switch */
.mobile-view-toggle {
  display: none;
  background: var(--slate-100);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--slate-200);
}

.mobile-toggle-btn {
  padding: 5px 12px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-500);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mobile-toggle-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}

/* --------------------------------------------------------------------------
   Body Layout: Sidebar + Canvas
   -------------------------------------------------------------------------- */
.widget-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  flex: 1;
  min-height: 0;
  height: calc(100% - 56px);
  position: relative;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.map-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--slate-200);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  z-index: 10;
  container-type: inline-size;
  container-name: sidebar;
}

.sidebar-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--slate-200);
  background: var(--surface);
  flex-shrink: 0;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.3px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.results-badge {
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(124, 58, 237, 0.15);
  transition: all 0.2s ease;
}

/* Search Box */
.search-box {
  position: relative;
  margin-bottom: 10px;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
  font-size: 13px;
  font-family: var(--font-sans);
  background: var(--slate-50);
  color: var(--slate-900);
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-clear-btn {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  background: var(--slate-200);
  color: var(--slate-600);
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.search-clear-btn.visible {
  display: flex;
}

.search-clear-btn:hover {
  background: var(--slate-300);
  color: var(--slate-900);
}

/* Custom PE Select Components (Matching pe-portal / Radix UI design) */
.filters-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  width: 100%;
}

.pe-select {
  position: relative;
  min-width: 0;
  width: 100%;
}

.pe-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
  background: #FFFFFF;
  color: var(--slate-800);
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  transition: all 0.18s ease;
}

.pe-select-trigger:hover {
  border-color: var(--slate-300);
  background: var(--slate-50);
}

.pe-select.open .pe-select-trigger,
.pe-select-trigger:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
  background: #FFFFFF;
}

.pe-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
  text-align: left;
}

.pe-select-chevron {
  width: 14px;
  height: 14px;
  color: var(--slate-400);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.pe-select.open .pe-select-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.pe-select-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 140px;
  max-height: 220px;
  overflow-y: auto;
  background: #FFFFFF;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-floating);
  padding: 4px;
  z-index: 100;
  display: none;
}

.pe-select.open .pe-select-popover {
  display: block;
  animation: selectPopIn 0.15s ease-out;
}

@keyframes selectPopIn {
  0% {
    opacity: 0;
    transform: translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.pe-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--slate-700);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  box-sizing: border-box;
}

.pe-select-item:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}

.pe-select-item.selected {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.pe-select-item .check-icon {
  width: 14px;
  height: 14px;
  color: var(--primary);
  flex-shrink: 0;
  margin-left: 6px;
}

/* Legend */
.legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--slate-500);
  padding-top: 8px;
  border-top: 1px solid var(--slate-100);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.op { background: var(--status-op); box-shadow: 0 0 6px var(--status-op-glow); }
.status-dot.inst { background: var(--status-inst); }
.status-dot.breve { background: var(--status-breve); }

.legend-pe-icon {
  width: 11px;
  height: 11px;
  display: inline-block;
  vertical-align: -1px;
}

/* --------------------------------------------------------------------------
   Results List
   -------------------------------------------------------------------------- */
.results-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 10px;
  scroll-behavior: smooth;
}

.results-list::-webkit-scrollbar {
  width: 5px;
}

.results-list::-webkit-scrollbar-track {
  background: transparent;
}

.results-list::-webkit-scrollbar-thumb {
  background: var(--slate-200);
  border-radius: 4px;
}

.results-list::-webkit-scrollbar-thumb:hover {
  background: var(--slate-300);
}

.result-item {
  position: relative;
  padding: 11px 14px 11px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--slate-100);
  box-shadow: var(--shadow-subtle);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-item::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 12px;
  bottom: 12px;
  width: 3.5px;
  border-radius: 3px;
  background: var(--bar-color, #CBD5E1);
  transition: transform 0.2s ease;
}

.result-item:hover {
  background: var(--slate-50);
  border-color: var(--slate-200);
  transform: translateX(3px);
}

.result-item:hover::before {
  transform: scaleY(1.15);
}

.result-item.active {
  background: #F8F5FE;
  border-color: #DDD6FE;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.08);
  transform: translateX(4px);
}

.result-item.active::before {
  background: var(--primary);
  width: 4px;
}

.result-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.35;
  margin-bottom: 3px;
}

.result-item-meta {
  font-size: 11.5px;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  gap: 6px;
}

.empty-results {
  text-align: center;
  padding: 40px 16px;
  color: var(--slate-400);
  font-size: 13px;
}

.empty-results svg {
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  color: var(--slate-300);
}

.empty-reset-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(124, 58, 237, 0.2);
  cursor: pointer;
  transition: all 0.15s ease;
}

.empty-reset-filter-btn:hover {
  background: var(--primary);
  color: #FFFFFF;
}

/* --------------------------------------------------------------------------
   Sidebar Footer: Placa Mercosul Card
   -------------------------------------------------------------------------- */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--slate-200);
  background: #F8FAFC;
  flex-shrink: 0;
}

.plate-card-mockup {
  background: var(--surface);
  border: 1px solid #003399;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 51, 153, 0.08);
  transition: box-shadow 0.2s ease;
}

.plate-card-mockup:focus-within {
  box-shadow: 0 6px 18px rgba(0, 51, 153, 0.16);
}

/* Blue Header on Mercosul Plate */
.plate-header-stripe {
  background: #003399;
  color: #FFFFFF;
  padding: 3px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.plate-country-tag {
  display: flex;
  align-items: center;
  gap: 4px;
}

.plate-flag {
  width: 14px;
  height: 9px;
  border-radius: 1px;
  background: linear-gradient(180deg, #009c3b 0%, #009c3b 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plate-flag-lozenge {
  width: 8px;
  height: 5px;
  background: #ffdf00;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.plate-body-row {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  gap: 6px;
  background: #FFFFFF;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.plate-input-field {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  height: 32px;
  padding: 0 4px;
  border: none;
  background: transparent;
  font-family: var(--font-mono), var(--font-sans);
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #0F172A;
  outline: none;
  box-sizing: border-box;
}

.plate-input-field::placeholder {
  color: #94A3B8;
  letter-spacing: 1px;
  font-weight: 600;
  font-size: 13px;
}

.plate-submit-btn {
  flex-shrink: 0;
  height: 30px;
  padding: 0 10px;
  background: var(--primary-gradient);
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.plate-submit-btn .btn-text-short {
  display: none;
}

.plate-submit-btn .btn-text-full {
  display: inline;
}

.plate-submit-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-0.5px);
}

/* Fallback e adaptação para containers e sidebars estreitos */
@container sidebar (max-width: 335px) {
  .plate-body-row {
    padding: 4px 4px;
    gap: 4px;
  }
  .plate-input-field {
    font-size: 13.5px;
    letter-spacing: 1px;
    padding: 0 3px;
  }
  .plate-input-field::placeholder {
    font-size: 12px;
    letter-spacing: 0.5px;
  }
  .plate-submit-btn {
    padding: 0 8px;
    font-size: 11px;
  }
  .plate-submit-btn .btn-text-full {
    display: none;
  }
  .plate-submit-btn .btn-text-short {
    display: inline;
  }
}

@media (max-width: 380px) {
  .sidebar-footer {
    padding: 10px 10px;
  }
  .plate-submit-btn .btn-text-full {
    display: none;
  }
  .plate-submit-btn .btn-text-short {
    display: inline;
  }
}

.plate-error-msg {
  display: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--status-breve);
  margin-top: 5px;
  padding-left: 2px;
}

/* --------------------------------------------------------------------------
   Map Viewport Canvas
   -------------------------------------------------------------------------- */
.map-viewport {
  position: relative;
  background: var(--map-ocean);
  background-image: 
    radial-gradient(var(--map-ocean-grid) 1px, transparent 1px);
  background-size: 24px 24px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.map-viewport.dragging {
  cursor: grabbing;
}

#mapSvg {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* State Geometries */
.state-path {
  fill: var(--map-land);
  stroke: var(--map-land-stroke);
  stroke-width: 1.1;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 0.18s ease;
}

.state-path:hover {
  fill: var(--map-land-hover);
}

.state-path.active-state {
  fill: #EDE9FE;
}

/* SVG Markers */
.marker-pin {
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-box: fill-box;
  transform-origin: center;
}

.marker-pin:hover {
  transform: scale(1.35);
}

.marker-pin.selected {
  transform: scale(1.45);
}

.marker-pin-circle {
  stroke: #FFFFFF;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.pe-logo-icon-group path {
  vector-effect: non-scaling-stroke;
}

/* PE Marker Padrão (Operando) - Borda Roxa Oficial */
.marker-pin.is-pe .marker-pin-circle {
  fill: #FFFFFF !important;
  stroke: #7C3AED !important;
  stroke-width: 1.3px !important;
  filter: drop-shadow(0 1.5px 4px rgba(124, 58, 237, 0.25));
}

/* PE com integração pendente: o pórtico COBRA hoje, mas o pagamento ainda não é
   pelo PE. Mantém o roxo (não é "sem cobrança") e traceja para diferenciar. */
.marker-pin.is-pe.pe-integracao-pendente .marker-pin-circle {
  stroke-width: 1.8px !important;
  stroke-dasharray: 3 2;
}

.marker-pin.is-pe:hover .marker-pin-circle {
  fill: #F5F3FF !important;
  stroke: #6D28D9 !important;
  filter: drop-shadow(0 3px 8px rgba(124, 58, 237, 0.4));
}

.marker-pin.selected.is-pe .marker-pin-circle {
  fill: #FFFFFF !important;
  stroke: #7C3AED !important;
  stroke-width: 2.2px !important;
  filter: drop-shadow(0 0 0 3px #DDD6FE) drop-shadow(0 4px 10px rgba(124, 58, 237, 0.4)) !important;
}

/* PE Marker Em Breve - Borda Vermelha de Destaque */
.marker-pin.is-pe.pe-em-breve .marker-pin-circle {
  fill: #FFFFFF !important;
  stroke: #EF4444 !important;
  stroke-width: 1.8px !important;
  filter: drop-shadow(0 1.5px 5px rgba(239, 68, 68, 0.35)) !important;
}

.marker-pin.is-pe.pe-em-breve:hover .marker-pin-circle {
  fill: #FEF2F2 !important;
  stroke: #DC2626 !important;
  filter: drop-shadow(0 3px 8px rgba(239, 68, 68, 0.5)) !important;
}

.marker-pin.selected.is-pe.pe-em-breve .marker-pin-circle {
  fill: #FFFFFF !important;
  stroke: #DC2626 !important;
  stroke-width: 2.4px !important;
  filter: drop-shadow(0 0 0 3px #FECACA) drop-shadow(0 4px 10px rgba(239, 68, 68, 0.45)) !important;
}

/* PE Marker Sem Cobrança - Borda Âmbar */
.marker-pin.is-pe.pe-instalado .marker-pin-circle {
  fill: #FFFFFF !important;
  stroke: #F59E0B !important;
  stroke-width: 1.8px !important;
  filter: drop-shadow(0 1.5px 4px rgba(245, 158, 11, 0.3)) !important;
}

.marker-pin.is-pe.pe-instalado:hover .marker-pin-circle {
  fill: #FFFBEB !important;
  stroke: #D97706 !important;
  filter: drop-shadow(0 3px 8px rgba(245, 158, 11, 0.45)) !important;
}

.marker-pin.selected.is-pe.pe-instalado .marker-pin-circle {
  fill: #FFFFFF !important;
  stroke: #D97706 !important;
  stroke-width: 2.4px !important;
  filter: drop-shadow(0 0 0 3px #FDE68A) drop-shadow(0 4px 10px rgba(245, 158, 11, 0.4)) !important;
}

.marker-pin:hover .marker-pin-circle {
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.35));
}

/* Selection ring for non-PE markers (100% smooth, zero lag) */
.marker-pin.selected:not(.is-pe) .marker-pin-circle {
  stroke: var(--slate-900);
  stroke-width: 2.2;
  filter: drop-shadow(0 4px 12px rgba(15, 23, 42, 0.4));
}

/* Floating Tooltip */
.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  transform: translate(-50%, -140%);
  opacity: 0;
  transition: opacity 0.15s cubic-bezier(0.16, 1, 0.3, 1), transform 0.15s ease;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.map-tooltip.show {
  opacity: 1;
  transform: translate(-50%, -130%);
}

/* Zoom Controls */
.zoom-controls {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 5px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--slate-200);
  z-index: 20;
}

.zoom-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--slate-700);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.zoom-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  transform: scale(1.05);
}

.zoom-btn:active {
  transform: scale(0.95);
}

.zoom-btn svg {
  width: 17px;
  height: 17px;
}

/* --------------------------------------------------------------------------
   Detail Card (Glassmorphic Floating Hero)
   -------------------------------------------------------------------------- */
.detail-card {
  position: absolute;
  left: 20px;
  bottom: 20px;
  width: 350px;
  max-width: calc(100% - 40px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-floating);
  border: 1px solid rgba(255, 255, 255, 0.8);
  outline: 1px solid var(--slate-200);
  padding: 18px;
  z-index: 25;
  display: none;
  animation: cardSpringIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.detail-card.show {
  display: block;
}

@keyframes cardSpringIn {
  0% {
    transform: translateY(24px) scale(0.95);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.detail-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.detail-badges-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detail-close-btn {
  position: static;
  width: 26px;
  height: 26px;
  border: none;
  background: var(--slate-100);
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.detail-close-btn:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.detail-uf-chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-600);
  background: var(--slate-100);
  padding: 2px 7px;
  border-radius: 6px;
}

.detail-pe-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(124, 58, 237, 0.15);
  padding: 2px 7px;
  border-radius: 6px;
}

.detail-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.35;
  margin-bottom: 12px;
}

.detail-table {
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--slate-50);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--slate-200);
  margin-bottom: 14px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  gap: 8px;
}

.detail-label {
  color: var(--slate-500);
  font-weight: 600;
  flex-shrink: 0;
}

.detail-value {
  color: var(--slate-800);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.detail-value.highlight-price {
  color: var(--primary);
  font-weight: 800;
  font-size: 13px;
}

/* Payment Action Banner inside Card */
.detail-payment-cta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.payment-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  height: auto;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-gradient);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  box-shadow: 0 4px 14px var(--primary-glow);
  box-sizing: border-box;
  overflow: hidden;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.payment-link-btn span {
  display: inline-block;
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.payment-link-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.payment-link-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.payment-link-btn:hover svg {
  transform: translateX(3px);
}

.payment-secondary-notice {
  font-size: 11px;
  color: var(--slate-500);
  text-align: center;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   Embed Modal (Incorporar no meu site)
   -------------------------------------------------------------------------- */
.embed-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.embed-modal-backdrop.show {
  display: flex;
  opacity: 1;
}

.embed-modal-card {
  width: 580px;
  max-width: 100%;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0,0,0,0.06);
  overflow: hidden;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.embed-modal-backdrop.show .embed-modal-card {
  transform: scale(1) translateY(0);
}

.embed-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--slate-100);
}

.embed-modal-title-group {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.embed-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(124, 58, 237, 0.08);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.embed-modal-icon svg {
  width: 20px;
  height: 20px;
}

.embed-modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 3px;
}

.embed-modal-header p {
  font-size: 13px;
  color: var(--slate-500);
  line-height: 1.4;
}

.embed-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--slate-100);
  color: var(--slate-500);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.embed-modal-close:hover {
  background: var(--slate-200);
  color: var(--slate-800);
}

.embed-modal-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.embed-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.embed-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.embed-field-header label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate-700);
}

.embed-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 6px;
  background: var(--primary-gradient);
  color: #FFFFFF;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(124, 58, 237, 0.25);
}

.embed-copy-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.embed-copy-btn.secondary {
  background: var(--slate-100);
  color: var(--slate-700);
  box-shadow: none;
}

.embed-copy-btn.secondary:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

.embed-copy-btn.copied {
  background: #10B981 !important;
  color: #FFFFFF !important;
}

.embed-copy-btn svg {
  width: 13px;
  height: 13px;
}

.embed-field-group textarea {
  width: 100%;
  height: 84px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--slate-800);
  line-height: 1.5;
  resize: none;
  box-sizing: border-box;
}

.embed-field-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.embed-url-input-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--slate-800);
  box-sizing: border-box;
}

.embed-url-input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.embed-features-list {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--slate-600);
}

.embed-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.embed-feature-check {
  color: var(--primary);
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 1260px) {
  .brand-title-text {
    display: none;
  }
}

@media (max-width: 1040px) {
  .embed-topbar-btn .embed-btn-text {
    display: none;
  }
  .embed-topbar-btn {
    padding: 6px 9px;
  }
}

@media (max-width: 860px) {
  .widget-topbar {
    padding: 0 14px;
    gap: 10px;
    height: 56px;
  }
  .quick-pills {
    display: none;
  }
  .brand-divider,
  .widget-brand-title {
    display: none;
  }
  .widget-brand img {
    height: 28px;
    width: auto;
  }
  .widget-topbar-actions {
    display: none;
  }
  .mobile-view-toggle {
    display: inline-flex;
    margin-left: auto;
  }
  .widget-body {
    grid-template-columns: 1fr;
  }

  .widget-body.view-list .map-sidebar {
    display: flex;
    width: 100%;
  }
  .widget-body.view-list .map-viewport {
    display: none;
  }

  .widget-body.view-map .map-sidebar {
    display: none;
  }
  .widget-body.view-map .map-viewport {
    display: block;
  }

  .detail-card {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }
}
