/**
 * Sitio Recanto do Queijo - Mapa Interativo & Navegação
 * CSS Styling - Paleta da Marca: #2C3A20 (Verde Artesanal), #E7B445 (Dourado Queijo), #F4F0E6 (Linho Creme)
 */

:root {
  --recanto-primary: #2C3A20;
  --recanto-primary-light: #3d502d;
  --recanto-accent: #E7B445;
  --recanto-accent-hover: #cf9b2d;
  --recanto-dark: #1D1D1B;
  --recanto-bg-light: #FAF8F4;
  --recanto-bg-cream: #F4F0E6;
  --recanto-border: #E5DFD3;
  --recanto-text: #2c3a20;
  --recanto-text-muted: #666e60;
  --recanto-shadow: 0 4px 16px rgba(44, 58, 32, 0.08);
  --recanto-radius: 10px;
}

.recanto-map-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--recanto-text);
  background: var(--recanto-bg-light);
  border: 1px solid var(--recanto-border);
  border-radius: var(--recanto-radius);
  box-shadow: var(--recanto-shadow);
  overflow: hidden;
  margin: 25px 0;
  display: flex;
  flex-direction: column;
}

/* Header & Search Bar */
.recanto-map-header {
  background: var(--recanto-primary);
  color: #ffffff;
  padding: 18px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.recanto-map-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.recanto-map-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.recanto-map-badge {
  background: var(--recanto-accent);
  color: var(--recanto-primary);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
}

.recanto-map-search-bar {
  flex: 1;
  max-width: 440px;
  min-width: 260px;
}

.recanto-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.recanto-search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #8b9683;
  stroke-width: 2;
  pointer-events: none;
}

#recanto-search-input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--recanto-dark);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

#recanto-search-input:focus {
  background: #ffffff;
  border-color: var(--recanto-accent);
  box-shadow: 0 0 0 3px rgba(231, 180, 69, 0.35);
}

#recanto-search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  font-size: 18px;
  color: #888;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}

/* Mobile Tabs */
.recanto-mobile-tabs {
  display: none;
  background: var(--recanto-bg-cream);
  border-bottom: 1px solid var(--recanto-border);
}

.recanto-tab-btn {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 14px;
  color: var(--recanto-text-muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.recanto-tab-btn.active {
  color: var(--recanto-primary);
  background: #ffffff;
  border-bottom: 3px solid var(--recanto-accent);
}

/* Main Grid Body */
.recanto-map-body {
  display: flex;
  height: 680px;
  position: relative;
  overflow: hidden;
}

/* Sidebar Navigation */
.recanto-sidebar {
  width: 380px;
  min-width: 320px;
  background: #ffffff;
  border-right: 1px solid var(--recanto-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  z-index: 10;
}

.recanto-sidebar-header {
  padding: 12px 16px;
  background: var(--recanto-bg-cream);
  border-bottom: 1px solid var(--recanto-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recanto-sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--recanto-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recanto-btn-reset-map {
  background: #ffffff;
  border: 1px solid var(--recanto-border);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--recanto-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.recanto-btn-reset-map:hover {
  background: var(--recanto-primary);
  color: #ffffff;
  border-color: var(--recanto-primary);
}

/* Scrollable Tree Container */
.recanto-tree-nav, .recanto-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--recanto-border) transparent;
}

.recanto-tree-nav::-webkit-scrollbar,
.recanto-search-results::-webkit-scrollbar {
  width: 6px;
}
.recanto-tree-nav::-webkit-scrollbar-thumb,
.recanto-search-results::-webkit-scrollbar-thumb {
  background: var(--recanto-border);
  border-radius: 4px;
}

/* Estado Item */
.recanto-state-item {
  border-bottom: 1px solid #f0ece1;
}

.recanto-state-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: #ffffff;
  transition: background 0.15s ease;
  user-select: none;
}

.recanto-state-header:hover {
  background: #faf8f2;
}

.recanto-state-header.expanded {
  background: #f4f0e4;
  border-left: 4px solid var(--recanto-accent);
}

.recanto-state-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recanto-uf-badge {
  background: var(--recanto-primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.recanto-state-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--recanto-primary);
}

.recanto-state-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recanto-count-badge {
  background: #eee9dc;
  color: var(--recanto-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
}

.recanto-arrow-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #777;
  stroke-width: 2;
  transition: transform 0.2s ease;
}

.recanto-state-header.expanded .recanto-arrow-icon {
  transform: rotate(90deg);
  stroke: var(--recanto-primary);
}

/* Cidades List */
.recanto-cities-list {
  display: none;
  background: #fdfdfc;
  padding: 4px 0 6px 12px;
  border-left: 3px solid #e2ddd1;
  margin-left: 16px;
}

.recanto-city-item {
  margin: 3px 0;
}

.recanto-city-header {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.15s;
  user-select: none;
}

.recanto-city-header:hover {
  background: #f2eee2;
}

.recanto-city-header.expanded {
  background: #e9e4d5;
  font-weight: 700;
  color: var(--recanto-primary);
}

.recanto-city-name {
  color: #333;
}

.recanto-city-badge {
  background: #e5dfd2;
  color: #555;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Pins List inside City */
.recanto-pins-list {
  display: none;
  padding: 6px 4px 8px 8px;
}

.recanto-pin-card {
  background: #ffffff;
  border: 1px solid var(--recanto-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.recanto-pin-card:hover {
  border-color: var(--recanto-accent);
  box-shadow: 0 3px 10px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.recanto-pin-card.active {
  border-color: var(--recanto-primary);
  background: #faf8f2;
  border-left: 4px solid var(--recanto-primary);
}

.recanto-pin-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--recanto-primary);
  margin-bottom: 4px;
}

.recanto-pin-cnpj {
  font-size: 11px;
  color: #777;
  margin-bottom: 4px;
}

.recanto-pin-address {
  font-size: 12px;
  color: #444;
  line-height: 1.4;
  margin-bottom: 6px;
}

.recanto-pin-products {
  font-size: 11px;
  color: var(--recanto-primary-light);
  background: #f1ede3;
  padding: 3px 6px;
  border-radius: 4px;
  display: inline-block;
  line-height: 1.3;
}

/* Search Results Panel */
.recanto-results-count {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  background: var(--recanto-bg-cream);
  border-bottom: 1px solid var(--recanto-border);
  color: var(--recanto-primary);
}

.recanto-results-list {
  padding: 12px;
}

/* Map Container */
.recanto-map-container {
  flex: 1;
  height: 100%;
  position: relative;
}

#recanto-leaflet-map {
  width: 100%;
  height: 100%;
  background: #f2efe9;
}

/* Loader Overlay */
.recanto-map-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  font-size: 14px;
  font-weight: 600;
  color: var(--recanto-primary);
}

.recanto-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid var(--recanto-border);
  border-top-color: var(--recanto-accent);
  border-radius: 50%;
  animation: recanto-spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

/* Custom Marker Pin */
.recanto-custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.recanto-pin-svg-wrap {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.3));
  transition: transform 0.2s ease;
}

.recanto-custom-marker:hover .recanto-pin-svg-wrap {
  transform: scale(1.2);
}

/* Leaflet Cluster Overrides */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(44, 58, 32, 0.4) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: var(--recanto-primary) !important;
  color: var(--recanto-accent) !important;
  font-weight: 700 !important;
  font-family: inherit !important;
  font-size: 12px !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* Custom Leaflet Popup */
.leaflet-popup-content-wrapper {
  border-radius: 10px !important;
  padding: 0 !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
  border: 1px solid var(--recanto-border);
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
  width: 290px !important;
}

.recanto-popup-content {
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.recanto-popup-badge {
  background: var(--recanto-bg-cream);
  color: var(--recanto-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 6px;
}

.recanto-popup-title {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--recanto-primary);
}

.recanto-popup-cnpj {
  font-size: 11px;
  color: #777;
  margin-bottom: 8px;
}

.recanto-popup-address {
  font-size: 12px;
  color: #444;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.recanto-popup-products {
  font-size: 11px;
  color: #555;
  background: #f7f5ed;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.recanto-popup-products strong {
  color: var(--recanto-primary);
}

.recanto-popup-btn-route {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--recanto-primary);
  color: #ffffff !important;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.2s ease;
  box-sizing: border-box;
}

.recanto-popup-btn-route:hover {
  background: var(--recanto-primary-light);
  color: var(--recanto-accent) !important;
}

/* Responsive Media Queries */
@media (max-width: 900px) {
  .recanto-map-body {
    height: 600px;
  }
  .recanto-sidebar {
    width: 320px;
  }
}

@media (max-width: 768px) {
  .recanto-map-header {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
  }
  
  .recanto-map-search-bar {
    max-width: 100%;
  }

  .recanto-mobile-tabs {
    display: flex;
  }

  .recanto-map-body {
    height: 520px;
    flex-direction: column;
  }

  .recanto-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--recanto-border);
    display: flex;
  }

  .recanto-map-container {
    width: 100%;
    height: 100%;
  }

  /* When map tab is active on mobile */
  .recanto-map-body.show-map .recanto-sidebar {
    display: none !important;
  }
  .recanto-map-body.show-list .recanto-map-container {
    display: none !important;
  }
}
