/* Reset e Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
}

/* Dashboard Layout */
.dashboard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left .title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.header-left .subtitle {
  color: #64748b;
  font-size: 0.875rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #f1f5f9;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: pulse 2s infinite;
}

.status-dot.connected {
  background: #10b981;
}

.status-dot.loading {
  background: #f59e0b;
}

.status-dot.error {
  background: #ef4444;
}

.logout-button {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-left: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.logout-button:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.logout-button:active {
  transform: translateY(0);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Main Content */
.main {
  flex: 1;
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Tab Navigation */
.tab-section {
  margin-bottom: 2rem;
}

.tab-navigation {
  display: flex;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 1rem;
  padding: 0.75rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(226, 232, 240, 0.8);
  gap: 0.5rem;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.tab-navigation::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #06b6d4);
}

.tab-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: none;
  background: transparent;
  border-radius: 0.75rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.875rem;
  position: relative;
  overflow: hidden;
  min-height: 48px;
}

.tab-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 0.75rem;
}

.tab-button:hover {
  background: rgba(99, 102, 241, 0.05);
  color: #6366f1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.tab-button:hover::before {
  opacity: 0.05;
}

.tab-button.active {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.tab-button.active::before {
  opacity: 0;
}

.tab-button.active:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.tab-icon {
  font-size: 1.1rem;
  width: 1.1rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.tab-button span {
  position: relative;
  z-index: 1;
}

/* Tab Content */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Metrics Section */
.metrics-section {
  margin-bottom: 2rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.metric-card {
  background: #ffffff;
  padding: 2rem 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
  min-height: 120px;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

.metric-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
}

.metric-title {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 400;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 2rem;
  font-weight: 500;
  color: #1e293b;
  margin-bottom: 0.75rem;
  line-height: 1;
  word-break: break-word;
  overflow-wrap: break-word;
}

.metric-change {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.7rem;
  font-weight: 400;
  border: 1px solid transparent;
}

.metric-change.positive {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border-color: #bbf7d0;
}

.metric-change.negative {
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  color: #dc2626;
  border-color: #fecaca;
}

/* Charts Section */
.charts-section {
  margin-bottom: 2rem;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 1200px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: #ffffff;
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
}

.chart-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.chart-header p {
  color: #64748b;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.chart-container {
  height: 450px;
  position: relative;
}

/* Table Section */
.table-section {
  margin-bottom: 2rem;
}

.table-card {
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.table-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.table-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.table-header p {
  color: #64748b;
  font-size: 0.875rem;
}

.table-container {
  overflow-x: auto;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
}

.leads-table th {
  background: #f8fafc;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: #475569;
  font-size: 0.875rem;
  border-bottom: 1px solid #e2e8f0;
}

.leads-table td {
  padding: 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}

.leads-table tbody tr:hover {
  background: #f8fafc;
}

.loading-row {
  text-align: center;
  color: #64748b;
  font-style: italic;
}

/* Badges */
.origin-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.origin-badge.whatsapp {
  background: #dcfce7;
  color: #166534;
}

.origin-badge.site {
  background: #dbeafe;
  color: #1e40af;
}

.origin-badge.instagram {
  background: #fce7f3;
  color: #be185d;
}

.origin-badge.google {
  background: #fef3c7;
  color: #92400e;
}

.origin-badge.flowtalks {
  background: #e0e7ff;
  color: #3730a3;
}

.origin-badge.indicação {
  background: #f0fdf4;
  color: #15803d;
}

.origin-badge.contatos {
  background: #f1f5f9;
  color: #475569;
}

.origin-badge.aluguel {
  background: #fef2f2;
  color: #dc2626;
}

.origin-badge.facebook {
  background: #dbeafe;
  color: #1e40af;
}

.origin-badge.zapp {
  background: #f0fdf4;
  color: #15803d;
}

/* Message cell */
.message-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Map Container */
.map-container {
  margin-bottom: 2rem;
  border-radius: 0.5rem;
  overflow: hidden;
}

/* Map Stats */
.map-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.map-stat-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.map-stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
  line-height: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
}

/* Custom Popup Styles */
.custom-popup {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-width: 200px;
}

.popup-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.popup-stats {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
}

.popup-stat {
  text-align: center;
  flex: 1;
}

.popup-stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: #6366f1;
  margin-bottom: 0.25rem;
}

.popup-stat-label {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive Map Stats */
@media (max-width: 768px) {
  .map-stats {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .map-stat-item {
    padding: 1rem;
    gap: 0.75rem;
  }
  
  .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
  }
  
  .stat-value {
    font-size: 1.25rem;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
}

/* Metric icons */
.metric-icon {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  flex-shrink: 0;
}

.metric-icon i {
  font-size: 1.5rem;
}

.metric-content {
  flex: 1;
  min-width: 0;
}

.feature-item span:last-child {
  color: #475569;
  font-weight: 500;
}

/* Chart Legend Hover Effects */
.chartjs-legend li {
  cursor: pointer !important;
  transition: opacity 0.2s ease;
}

.chartjs-legend li:hover {
  opacity: 0.7;
}

/* Chart Legend Items */
.chart-legend li {
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-legend li:hover {
  opacity: 0.7;
  transform: scale(1.05);
}

/* All Chart Legend Elements */
canvas + div ul li,
.chart-container ul li,
[class*="legend"] li {
  cursor: pointer !important;
  transition: opacity 0.2s ease;
}

canvas + div ul li:hover,
.chart-container ul li:hover,
[class*="legend"] li:hover {
  opacity: 0.7;
}

/* Chart.js Generated Legend */
.chartjs-legend {
  cursor: pointer;
}

.chartjs-legend li {
  cursor: pointer !important;
  transition: opacity 0.2s ease;
}

.chartjs-legend li:hover {
  opacity: 0.7;
}

/* Universal Legend Hover */
ul li {
  cursor: pointer !important;
  transition: opacity 0.2s ease;
}

ul li:hover {
  opacity: 0.7;
}

/* Force cursor pointer on all interactive elements */
* {
  cursor: default;
}

li, span, div[role="button"], button {
  cursor: pointer !important;
}

li:hover, span:hover, div[role="button"]:hover, button:hover {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

/* Chart.js Specific Legend */
.chartjs-legend ul li {
  cursor: pointer !important;
  transition: opacity 0.2s ease;
}

.chartjs-legend ul li:hover {
  opacity: 0.7;
}

/* Force Cursor Pointer on All Chart Elements */
div[style*="display: flex"] li,
div[style*="display: flex"] span,
.chart-container * li,
.chart-container * span {
  cursor: pointer !important;
}

/* Chart.js Legend Override */
.chartjs-legend {
  cursor: pointer !important;
}

.chartjs-legend * {
  cursor: pointer !important;
}

/* All List Items in Charts */
.chart-container li,
.chart-container ul li,
canvas + * li,
canvas + * ul li {
  cursor: pointer !important;
  transition: opacity 0.2s ease;
}

.chart-container li:hover,
.chart-container ul li:hover,
canvas + * li:hover,
canvas + * ul li:hover {
  opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 1400px) {
  .tab-navigation {
    padding: 0.625rem;
  }

  .tab-button {
    padding: 0.875rem 1rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 1200px) {
  .tab-navigation {
    gap: 0.375rem;
    padding: 0.5rem;
  }

  .tab-button {
    padding: 0.75rem 0.875rem;
    font-size: 0.8rem;
    gap: 0.5rem;
  }

  .tab-icon {
    font-size: 1rem;
  }
}

@media (max-width: 900px) {
  .tab-navigation {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .tab-button {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
  }
}

/* Responsive */
@media (max-width: 1400px) {
  .main {
    padding: 1.5rem;
  }
  
  .chart-container {
    height: 400px;
  }
}

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .main {
    padding: 1.25rem;
  }
  
  .chart-container {
    height: 350px;
  }
  
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .metric-card {
    padding: 1.5rem;
  }
  
  .metric-value {
    font-size: 1.8rem;
  }
}

@media (max-width: 900px) {
  .tab-navigation {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .tab-button {
    flex: 1;
    min-width: calc(50% - 0.25rem);
    font-size: 0.8rem;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 1rem;
  }
  
  .header {
    padding: 1rem;
  }
  
  .header-content {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .header-right {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .logout-button {
    margin-left: 0;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
  
  .header-left .title {
    font-size: 1.25rem;
  }
  
  .header-left .subtitle {
    font-size: 0.8rem;
  }
  
  .tab-navigation {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .tab-button {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .metric-card {
    padding: 1.25rem;
    gap: 1rem;
    min-height: 100px;
  }
  
  .metric-icon {
    width: 3rem;
    height: 3rem;
  }
  
  .metric-icon i {
    font-size: 1.25rem;
  }
  
  .metric-title {
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
  }
  
  .metric-value {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
  }
  
  .metric-change {
    font-size: 0.65rem;
    padding: 0.4rem 0.6rem;
  }
  
  .chart-container {
    height: 280px;
  }
  
  .chart-card {
    padding: 1.25rem;
  }
  
  .chart-header h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
  }
  
  .chart-header p {
    font-size: 0.8rem;
    margin-bottom: 1rem;
  }
  
  .leads-table th,
  .leads-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
  }
  
  .table-header h3 {
    font-size: 1rem;
  }
  
  .table-header p {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .main {
    padding: 0.75rem;
  }
  
  .header {
    padding: 0.75rem;
  }
  
  .header-left .title {
    font-size: 1.1rem;
  }
  
  .header-left .subtitle {
    font-size: 0.75rem;
  }
  
  .tab-navigation {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .tab-button {
    padding: 0.875rem 1rem;
    font-size: 0.8rem;
    min-height: 44px;
    gap: 0.5rem;
  }

  .tab-icon {
    font-size: 1rem;
  }
  
  .metrics-grid {
    gap: 0.75rem;
  }
  
  .metric-card {
    padding: 1rem;
    gap: 0.75rem;
    min-height: 90px;
  }
  
  .metric-icon {
    width: 2.5rem;
    height: 2.5rem;
  }
  
  .metric-icon i {
    font-size: 1rem;
  }
  
  .metric-title {
    font-size: 0.65rem;
    margin-bottom: 0.4rem;
  }
  
  .metric-value {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
  }
  
  .metric-change {
    font-size: 0.6rem;
    padding: 0.3rem 0.5rem;
  }
  
  .chart-container {
    height: 250px;
  }
  
  .chart-card {
    padding: 1rem;
  }
  
  .chart-header h3 {
    font-size: 0.9rem;
  }
  
  .chart-header p {
    font-size: 0.75rem;
  }
  
  .leads-table th,
  .leads-table td {
    padding: 0.6rem 0.4rem;
    font-size: 0.75rem;
  }
  
  .leads-table {
    min-width: 1000px;
  }
  
  .leads-table th:nth-child(1),
  .leads-table td:nth-child(1) {
    width: 50px;
  }
  
  .leads-table th:nth-child(2),
  .leads-table td:nth-child(2) {
    width: 120px;
  }
  
  .leads-table th:nth-child(3),
  .leads-table td:nth-child(3) {
    width: 100px;
  }
  
  .leads-table th:nth-child(4),
  .leads-table td:nth-child(4) {
    width: 120px;
  }
  
  .leads-table th:nth-child(5),
  .leads-table td:nth-child(5) {
    width: 80px;
  }
  
  .leads-table th:nth-child(6),
  .leads-table td:nth-child(6) {
    width: 120px;
  }
  
  .leads-table th:nth-child(7),
  .leads-table td:nth-child(7) {
    width: 60px;
  }
  
  .leads-table th:nth-child(8),
  .leads-table td:nth-child(8) {
    width: 100px;
  }
  
  .leads-table th:nth-child(9),
  .leads-table td:nth-child(9) {
    width: 80px;
  }
  
  .table-header {
    padding: 1rem;
  }
  
  .table-header h3 {
    font-size: 0.9rem;
  }
  
  .table-header p {
    font-size: 0.75rem;
  }
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
  .dashboard {
    min-height: 100vh;
  }
  
  .status-indicator {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }
  
  .status-dot {
    width: 6px;
    height: 6px;
  }
  
  /* Improve touch targets */
  .tab-button {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  .metric-card {
    touch-action: manipulation;
  }
  
  /* Better scrolling */
  .table-container {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Optimize chart legends for mobile */
  .chart-card canvas {
    max-width: 100%;
    height: auto;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  .main {
    padding: 0.5rem;
  }
  
  .header {
    padding: 0.5rem;
  }
  
  .header-left .title {
    font-size: 1rem;
  }
  
  .header-left .subtitle {
    font-size: 0.7rem;
  }
  
  .metric-card {
    padding: 0.8rem;
    gap: 0.6rem;
    min-height: 80px;
  }
  
  .metric-icon {
    width: 2rem;
    height: 2rem;
  }
  
  .metric-icon i {
    font-size: 0.9rem;
  }
  
  .metric-title {
    font-size: 0.6rem;
  }
  
  .metric-value {
    font-size: 1.1rem;
  }
  
  .metric-change {
    font-size: 0.55rem;
    padding: 0.25rem 0.4rem;
  }
  
  .chart-container {
    height: 220px;
  }
  
  .chart-card {
    padding: 0.8rem;
  }
}

/* Chart Toggle Button */
.chart-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-toggle-btn {
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.chart-toggle-btn:hover {
  background: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4);
}

.chart-toggle-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

/* New Controls Styles */
.period-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.period-filter label {
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
}

.period-select, .service-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: white;
  font-size: 0.875rem;
  color: #374151;
  transition: all 0.2s ease;
}

.period-select:focus, .service-select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.custom-date-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #f8fafc;
  border-radius: 0.375rem;
  border: 1px solid #e2e8f0;
}

.date-input {
  padding: 0.375rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  color: #374151;
}

.apply-btn {
  padding: 0.375rem 0.75rem;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.apply-btn:hover {
  background: #4f46e5;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.service-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.service-select {
  min-width: 150px;
}

/* Enhanced Map Statistics */
.map-stats {
  display: none; /* Hidden since we moved stats to metrics section */
}

/* Improved Metric Cards for Map */
.metric-card .metric-icon {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.metric-card .metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.metric-card .metric-label {
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.metric-card .metric-change {
  font-size: 0.75rem;
  font-weight: 500;
}

.metric-card .metric-change.positive {
  color: #10b981;
}

/* Pagination Controls */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid #d1d5db;
  background: white;
  color: #374151;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.pagination-btn:hover:not(:disabled) {
  background: #6366f1;
  color: white;
  border-color: #6366f1;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

/* Responsive adjustments for new controls */
@media (max-width: 768px) {
  .table-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .chart-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .custom-date-range {
    flex-direction: column;
    align-items: stretch;
  }
  
  .pagination-controls {
    flex-direction: column;
    gap: 0.5rem;
  }
}

.chart-toggle-btn i {
  font-size: 0.875rem;
}

/* Responsive adjustments for toggle button */
@media (max-width: 768px) {
  .chart-toggle-btn {
    width: 32px;
    height: 32px;
    padding: 0.375rem;
  }
  
  .chart-toggle-btn i {
    font-size: 0.75rem;
  }
}

/* ===== ESTILOS PARA CONTROLES DO MAPA ===== */

.map-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.map-search {
  display: flex;
  flex: 1;
  min-width: 300px;
}

.map-search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem 0 0 0.5rem;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.map-search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.map-search-btn {
  padding: 0.75rem 1rem;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 0 0.5rem 0.5rem 0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-search-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.map-filters {
  display: flex;
  gap: 0.5rem;
}

.map-filter-select {
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.map-filter-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Legenda do Mapa */
.map-legend {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

.map-legend h4 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
}

.map-legend h5 {
  margin: 1rem 0 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
}

.legend-items {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.precision-items {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.precision-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.precision-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.precision-marker.state {
  background-color: #ef4444;
}

.precision-marker.city {
  background-color: #f59e0b;
}

.precision-marker.cep {
  background-color: #10b981;
}

.precision-marker.ddd {
  background-color: #8b5cf6;
}

/* Responsive para controles do mapa */
@media (max-width: 768px) {
  .map-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .map-search {
    min-width: auto;
  }
  
  .legend-items {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .precision-items {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Botão de Toggle para Tabelas */
.table-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4);
}

.toggle-btn:active {
  transform: translateY(0);
}

.toggle-btn i {
  font-size: 0.875rem;
}

/* Responsividade para controles de tabela */
@media (max-width: 768px) {
  .table-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}