:root {
  --dooh-ink: #232323;
  --dooh-sub: #6b6b6b;
  --dooh-line: #e7e4dc;
  --dooh-orange: #f58220;
  --dooh-bg: #fdf7e1;
  --dooh-blue-bg: #eaf2ff;
  --dooh-blue-tx: #2f6fed;
  --dooh-purple-bg: #f4eafd;
  --dooh-purple-tx: #9b4fde;
}

/* =========================================================
   ESTRUTURA PRINCIPAL
   ========================================================= */

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
}

html { scrollbar-gutter: stable; }
body { font-family: "Sora", sans-serif; }

.dooh-catalog {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 26px;
  overflow: visible;
  color: var(--dooh-ink);
  background: var(--dooh-bg);
  border-radius: 16px;
}

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

.mapa-dica.visivel {
  opacity: 1;
}


/* =========================================================
   KPIs
   ========================================================= */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card {
  padding: 16px 18px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--dooh-line);
  border-radius: 12px;
}

.kpi-num { font-size: 24px; font-weight: 800; line-height: 1.2; }
.kpi-num.blue { color: var(--dooh-blue-tx); }
.kpi-num.purple { color: var(--dooh-purple-tx); }
.kpi-lbl { margin-top: 2px; color: var(--dooh-sub); font-size: 11.5px; }

/* =========================================================
   FILTROS
   ========================================================= */

.filter-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; width: 100%; }
.filter-row.filter-row-2 { align-items: stretch; margin-bottom: 22px; }

.search-box { position: relative; width: 100%; }
.search-box input {
  width: 100%; padding: 10px 14px 10px 36px; color: var(--dooh-ink);
  font-family: inherit; font-size: 13.5px; background: #fff;
  border: 1px solid var(--dooh-line); border-radius: 9px; outline: none;
}
.search-box input:focus { border-color: var(--dooh-orange); }
.search-box svg { position: absolute; top: 50%; left: 11px; opacity: 0.4; transform: translateY(-50%); }

select.dooh-select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 36px 0 12px;
  color: #232323 !important;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  background-color: #ffffff !important;
  border: 1px solid var(--dooh-line);
  border-radius: 9px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232323' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

select.dooh-select option {
  color: #232323 !important;
  background-color: #ffffff !important;
}

/* =========================================================
   PERÍODO
   ========================================================= */

.periodo-field {
  display: flex;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.periodo-top {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--dooh-line);
  border-radius: 9px;
}

.periodo-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.periodo-label {
  min-width: 24px;
  color: var(--dooh-sub);
  font-size: 12.5px;
  font-weight: 600;
}

.date-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  width: 100%;
}

.date-input-wrap input[type="date"] {
  width: 100% !important;
  height: 38px;
  padding: 0 10px 0 34px !important;
  color: #232323 !important;
  font-family: inherit;
  font-size: 13px;
  background: #fdfdfd !important;
  border: 1px solid var(--dooh-line) !important;
  border-radius: 7px;
  box-sizing: border-box;
}

.date-input-wrap svg {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: #888;
  pointer-events: none;
}

/* =========================================================
   RESULTADOS / UX
   ========================================================= */

.resultados-bar { display: flex; align-items: center; justify-content: space-between; min-width: 0; margin: 2px 0 12px; color: var(--dooh-sub); font-size: 11.5px; }
.resultados-bar #contadorResultados { font-weight: 600; }

.catalogo-corpo { width: 100%; max-width: 100%; min-width: 0; display: block; min-height: 0; }
.lista-coluna, .cidade-group, .cards-grid { width: 100%; max-width: 100%; min-width: 0; }
.cart-chips { min-width: 0; max-height: 76px; overflow-y: auto; overscroll-behavior: contain; }

.catalogo-topo {
  position: fixed; right: 18px; bottom: 92px; z-index: 999; display: none; align-items: center;
  justify-content: center; width: 38px; height: 38px; padding: 0; color: #fff;
  font-family: "Sora", sans-serif; font-size: 20px; background: var(--dooh-ink);
  border: 0; border-radius: 50%; box-shadow: 0 6px 18px rgba(0,0,0,.22); cursor: pointer;
}
.catalogo-topo.visivel { display: flex; }

/* =========================================================
   MAPA
   ========================================================= */

.mapa-coluna {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  height: clamp(280px, 32vw, 420px);
  min-height: 280px;
  margin-bottom: 22px;
  overflow: hidden;
  border-radius: 14px;
}

#mapaCatalogo {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden;
}

#mapaCatalogo:fullscreen { border-radius: 0; }
#mapaCatalogo:fullscreen .leaflet-container { height: 100vh; }

.mapa-fullscreen {
  position: absolute; top: 12px; right: 12px; z-index: 500; display: flex; align-items: center;
  justify-content: center; width: 34px; height: 34px; color: #232323; background: #fff;
  border: 1px solid #ddd; border-radius: 8px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); cursor: pointer;
}
.mapa-fullscreen:hover { background: #f5f5f5; }
.mapa-fullscreen svg { width: 17px; height: 17px; }

.mapa-dica {
  position: absolute; bottom: 14px; left: 50%; z-index: 500; padding: 8px 14px; color: #fff;
  font-size: 12px; white-space: nowrap; background: rgba(35, 35, 35, 0.9); border-radius: 20px;
  opacity: 0; pointer-events: none; transform: translateX(-50%); transition: opacity 0.2s;
}
.mapa-dica b { color: var(--dooh-orange); font-weight: 600; }

.mapa-erro-catalogo { position: absolute; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; padding: 20px; color: #8a8580; font-size: 12.5px; text-align: center; }

/* Leaflet */
.leaflet-popup-content-wrapper { color: #fff; background: #232323; border-radius: 10px; }
.leaflet-popup-tip { background: #232323; }
.leaflet-popup-content { margin: 10px 12px; font-family: "Sora", sans-serif; font-size: 12.5px; }
.leaflet-popup-content b { font-size: 13px; }
.pin-marker { width: 26px; height: 32px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)); }
.pin-marker.selecionado { width: 34px; height: 42px; }

/* =========================================================
   LISTA E CARDS
   ========================================================= */

.cidade-group { margin-bottom: 30px; }
.cidade-title { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 15px; font-weight: 700; }
.cidade-title .dot { width: 8px; height: 8px; flex: 0 0 8px; background: var(--dooh-orange); border-radius: 50%; }
.cidade-title .count { color: var(--dooh-sub); font-size: 12.5px; font-weight: 400; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.ponto-card {
  max-width: 320px; width: 100%; overflow: hidden; padding: 10px 10px 0;
  background: #fff; border: 1px solid var(--dooh-line); border-radius: 14px; transition: box-shadow 0.15s;
}
.ponto-card.selecionado { outline: 2px solid var(--dooh-orange); }

.titulo-overlay {
  position: absolute; right: 0; bottom: 0; left: 0; z-index: 2; padding: 22px 12px 10px;
  color: #fff; font-size: 14px; font-weight: 600; line-height: 1.2;
  background: linear-gradient(to top, rgba(20, 20, 20, 0.88), rgba(20, 20, 20, 0)); border-radius: 0 0 14px 14px;
}

.card-body { padding: 12px 3px 14px; }
.codigo-tag { display: inline-block; margin-bottom: 8px; padding: 3px 8px; color: #fff; font-size: 9.5px; font-weight: 400; background: var(--dooh-orange); border-radius: 6px; }
.ponto-rua { margin-bottom: 1px; color: var(--dooh-ink); font-size: 14px; font-weight: 600; }
.ponto-bairro, .ponto-cidade { margin-bottom: 1px; color: var(--dooh-sub); font-size: 11.5px; }
.ponto-cidade { margin-bottom: 10px; }

.meta { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; padding: 9px 0; color: #5a5548; font-size: 11.5px; border-top: 1px solid var(--dooh-line); border-bottom: 1px solid var(--dooh-line); }
.meta-row { display: flex; align-items: center; gap: 7px; }
.meta-row b { color: var(--dooh-ink); font-weight: 600; }
.mini-icon { flex: 0 0 13px; width: 13px; height: 13px; color: #8a8580; }

.balloon-row { display: flex; gap: 8px; }
.balloon { flex: 1; padding: 7px 8px; text-align: center; border-radius: 9px; }
.balloon.blue { background: var(--dooh-blue-bg); }
.balloon.purple { background: var(--dooh-purple-bg); }
.balloon .n { font-size: 13.5px; font-weight: 600; }
.balloon.blue .n { color: var(--dooh-blue-tx); }
.balloon.purple .n { color: var(--dooh-purple-tx); }
.balloon .l { color: var(--dooh-sub); font-size: 9px; }

.select-btn {
  width: 100%; margin-top: 10px; margin-bottom: 10px; padding: 8px; color: var(--dooh-orange);
  font-family: inherit; font-size: 12.5px; font-weight: 700; background: #fff;
  border: 1.5px solid var(--dooh-orange); border-radius: 8px; cursor: pointer; transition: 0.15s;
}
.select-btn.ativo { color: #fff; background: var(--dooh-orange); }

.empty-note { padding: 30px; color: var(--dooh-sub); font-size: 13px; text-align: center; }

/* =========================================================
   CARRINHO
   ========================================================= */

.cart-bar { position: sticky; bottom: 14px; z-index: 1000; display: flex; align-items: center; gap: 16px; margin-top: 24px; padding: 12px 16px; color: #fff; background: var(--dooh-ink); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.cart-count { display: flex; flex-shrink: 0; align-items: baseline; gap: 6px; white-space: nowrap; }
.cart-count .n { color: var(--dooh-orange); font-size: 17px; font-weight: 700; line-height: 1; }
.cart-count .l { color: #e8e5df; font-size: 13px; font-weight: 400; }
.cart-chips { display: flex; flex: 1; flex-wrap: wrap; gap: 7px; min-width: 0; padding: 2px 0; }
.cart-chip { display: flex; flex-shrink: 0; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; color: #fff; font-size: 12px; white-space: nowrap; background: #333; border-radius: 20px; }
.cart-chip button { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; color: #fff; font-size: 11px; line-height: 1; background: #4a4a4a; border: 0; border-radius: 50%; cursor: pointer; }
.cart-chip button:hover { color: #111; background: var(--dooh-orange); }
.cart-empty { color: #8a8580; font-size: 12px; }
.cart-actions { display: flex; flex-shrink: 0; gap: 10px; }
.cart-actions button { padding: 10px 18px; color: #fdf7e1; font-family: "Sora", sans-serif; font-size: 12.5px; font-weight: 600; background: var(--dooh-orange); border: 0; border-radius: 5px; cursor: pointer; transition: background 0.15s; }
.cart-actions button:hover { background: #ff9a00; }

/* =========================================================
   FOTO DO CARD + ÍCONE DE ZOOM
   ========================================================= */

.ponto-photo { position: relative; z-index: 2; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: linear-gradient(160deg, #2c2c2c, #1e1e1e); border-radius: 14px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18); cursor: pointer; }
.ponto-photo img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.ponto-photo:hover img { transform: scale(1.04); }

/* Lupa Circular - SEM texto */
.zoom-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  pointer-events: none;
  transition: background 0.2s ease, transform 0.2s ease;
}
.ponto-photo:hover .zoom-badge {
  background: var(--dooh-orange);
  transform: scale(1.1);
}
.zoom-badge svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

/* =========================================================
   LIGHTBOX CENTRALIZADO (DENTRO DE IFRAME OU DIRETO)
   ========================================================= */

html.lightbox-aberto, body.lightbox-aberto { overflow: hidden !important; }

#lightboxFoto.lightbox-overlay {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2147483647;
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
  background: rgba(10, 10, 10, 0.94);
}
#lightboxFoto.lightbox-overlay.ativo { display: flex; }

/* Modo Standalone (Aberto direto fora de iframe) */
body:not(.is-iframe) #lightboxFoto.lightbox-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
}

#lightboxFoto .lightbox-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 90vw;
  max-height: 85vh;
  margin: 0 auto;
}

#lightboxFoto .lightbox-content img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

#lightboxFoto .lightbox-caption { margin-top: 12px; color: #fff; font-size: 13px; font-weight: 600; text-align: center; }
#lightboxFoto .lightbox-counter { margin-top: 4px; color: rgba(255, 255, 255, 0.7); font-size: 11px; }

#lightboxFoto .lightbox-close {
  position: absolute; top: 15px; right: 20px; z-index: 10; display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; color: #fff; font-size: 28px; background: rgba(255, 255, 255, 0.18); border: 0; border-radius: 50%; cursor: pointer;
}
#lightboxFoto .lightbox-close:hover { background: var(--dooh-orange); }

#lightboxFoto .lightbox-nav {
  position: absolute; top: 50%; z-index: 10; display: flex; align-items: center; justify-content: center;
  width: 42px; height: 56px; color: #fff; font-size: 30px; background: rgba(255, 255, 255, 0.18); border: 0; border-radius: 8px; cursor: pointer; transform: translateY(-50%);
}
#lightboxFoto .lightbox-nav:hover { background: var(--dooh-orange); }
#lightboxFoto .lightbox-prev { left: 15px; }
#lightboxFoto .lightbox-next { right: 15px; }

/* =========================================================
   MEDIA QUERY MOBILE
   ========================================================= */

@media (max-width: 768px) {
  .dooh-catalog { padding: 14px; }
  
  /* Verticaliza os 3 quadros de KPIs (Pontos, Audiência e Impactos) */
  .kpi-row { 
    grid-template-columns: 1fr !important; 
    gap: 10px !important; 
  }
  .kpi-card { 
    padding: 12px 14px !important; 
  }

  /* Filtros e Período em coluna no Mobile */
  .filter-row, .filter-row-2 { 
    flex-direction: column !important; 
    gap: 10px !important; 
  }
  .filter-row-2 > * { width: 100% !important; }
  .periodo-field { flex-direction: column !important; gap: 10px !important; }
  
  /* Grid dos cards em 1 coluna */
  .cards-grid { grid-template-columns: 1fr !important; }
  .ponto-card { max-width: 100% !important; }

  /* -------------------------------------------------------
     DESATIVA O LIGHTBOX E ESCONDE A LUPA NO MOBILE
     ------------------------------------------------------- */
  .zoom-badge {
    display: none !important; /* Esconde o ícone de lupa */
  }
  
  .ponto-photo {
    pointer-events: none !important; /* Desativa o clique/toque na foto que abriria o Lightbox */
    cursor: default !important;
  }
  
  /* Carrinho e Botão Topo */
  .cart-bar { flex-direction: column !important; align-items: stretch !important; bottom: 8px; padding: 12px; }
  .cart-actions, .cart-actions button { width: 100%; }
  .catalogo-topo { right: 12px; bottom: 70px; width: 36px; height: 36px; }
}