/* Graph Tables - Tabelas Compactas para Dados dos Gráficos */

.graph-table-wrapper {
  background: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin-bottom: 1.5rem;
  margin-top: 1rem;
  overflow: hidden;
}

/* Espaçamento quando a tabela vem logo após um título */
#weather-forecast-charts h1 {
  margin-bottom: 1.5rem;
}

h1 + #forecast-tables-container {
  margin-top: 1rem;
}

#forecast-tables-container .graph-table-wrapper {
  margin-top: 0;
}

/* Filtros */
.graph-table-filters {
  padding: 0.75rem 1rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.graph-table-filter-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  flex: 1;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 0 1 auto;
  min-width: 150px;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
}

.filter-input,
.filter-select {
  padding: 0.4rem 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.2s;
  height: 2.75rem;
  box-sizing: border-box;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.filter-btn-clear {
  padding: 0.4rem 0.8rem;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.filter-btn-clear:hover {
  background: #dc2626;
}

/* Filtros de Range (Min/Max) */
.filter-range {
  display: flex;
  gap: 0.25rem;
}

.filter-input-min,
.filter-input-max {
  padding: 0.4rem 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.2s;
  flex: 1;
  min-width: 60px;
  height: 2.75rem;
  box-sizing: border-box;
}

.filter-input-min:focus,
.filter-input-max:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Datepicker Container */
.date-picker-container {
  position: relative;
  display: flex;
  align-items: center;
  height: 2.75rem;
}

.date-filter-input {
  padding: 0.4rem 0.6rem 0.4rem 2rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.2s;
  width: 100%;
  height: 2.75rem;
  box-sizing: border-box;
}

.date-filter-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.date-picker-container i {
  position: absolute;
  left: 0.5rem;
  pointer-events: none;
  font-size: 0.875rem;
}

/* Container da tabela */
.graph-table-container {
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.graph-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.graph-table thead {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  border-bottom: 2px solid #e5e7eb;
}

.graph-table-header {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.graph-table-header:hover {
  background: #e5e7eb;
}

.graph-table-body {
  background: white;
}

.graph-table-row {
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.2s;
}

.graph-table-row:hover {
  background: #f9fafb;
}

.graph-table-cell {
  padding: 0.5rem 0.75rem;
  text-align: left;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.graph-table-cell:first-child {
  font-weight: 500;
  color: #1f2937;
}

/* Paginação */
.graph-table-pagination {
  padding: 0.75rem 1rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  flex-wrap: wrap;
}

.pagination-controls {
  display: flex;
  gap: 0.25rem;
}

.pagination-btn {
  padding: 0.35rem 0.5rem;
  border: 1px solid #d1d5db;
  background: white;
  color: #374151;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 28px;
}

.pagination-btn:hover:not(.active) {
  border-color: #3b82f6;
  color: #3b82f6;
}

.pagination-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Info */
.graph-table-info {
  padding: 0.5rem 1rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  text-align: center;
  font-size: 0.75rem;
  color: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
  .graph-table-wrapper {
    margin: 0;
    border-radius: 4px;
  }

  .graph-table-filters {
    padding: 0.5rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .filter-group {
    min-width: unset;
    width: 100%;
  }

  .filter-input,
  .filter-select,
  .filter-input-min,
  .filter-input-max {
    width: 100%;
    font-size: 16px;
    padding: 0.5rem;
  }

  .filter-range {
    flex-direction: column;
    gap: 0.5rem;
  }

  .filter-input-min,
  .filter-input-max {
    min-width: unset;
  }

  .graph-table-filter-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .filter-btn-clear {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.875rem;
  }

  .graph-table-cell {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
  }

  .graph-table-header {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
  }

  .graph-table-info {
    padding: 0.5rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* Estado vazio */
.graph-table-empty {
  padding: 2rem;
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

/* Extra small devices */
@media (max-width: 480px) {
  .graph-table-filters {
    padding: 0.5rem;
  }

  .filter-group label {
    font-size: 0.7rem;
  }

  .filter-input,
  .filter-select,
  .filter-input-min,
  .filter-input-max {
    font-size: 14px;
    padding: 0.45rem 0.4rem;
  }

  .graph-table-info {
    font-size: 0.7rem;
  }

  .pagination-controls {
    gap: 0.2rem;
  }

  .pagination-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    min-width: 24px;
  }
}
