/* ============================================
   CSS APRIMORADO - MÓDULO DE RESULTADOS
   Tema: Alinhado com programacoes.css
   ============================================ */

/* Melhorias de inputs e formulários */
#custos-form input[type="text"],
#custos-form input[type="number"],
#custos-form select {
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

#custos-form input[type="text"]:hover:not(:disabled),
#custos-form input[type="number"]:hover:not(:disabled),
#custos-form select:hover:not(:disabled) {
  border-color: #94a3b8;
}

#custos-form input[type="text"]:disabled,
#custos-form input[type="number"]:disabled,
#custos-form select:disabled {
  background-color: #f1f5f9;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Cards mais modernos */
.card-surface {
  position: relative;
  overflow: hidden;
}

.card-surface::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #059669);
  opacity: 0.8;
}

/* Badges mais bonitos */
.pedagio-badge {
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pedagio-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
}

/* Botões com melhor feedback visual */
.btn-primary,
.btn-secondary {
  position: relative;
  overflow: hidden;
}

.btn-primary::before,
.btn-secondary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn-primary:active::before,
.btn-secondary:active::before {
  width: 300px;
  height: 300px;
}

/* Resumo Operacional - Cards mais destacados */
#custos-form ~ section article {
  transition: all 0.3s ease;
  position: relative;
}

#custos-form ~ section article::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.5), rgba(255,255,255,0));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#custos-form ~ section article:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.2);
}

#custos-form ~ section article:hover::after {
  opacity: 1;
}

/* Animação suave para números */
#custos-form ~ section article p {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Toggle de modo mais bonito */
#custos-mode-toggle {
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.custos-mode-btn {
  position: relative;
  z-index: 1;
}

.custos-mode-btn.active {
  box-shadow: 0 4px 8px -2px rgba(16, 185, 129, 0.4);
}

/* Lista de pedágios mais visual */
#custos-pedagios-lista li {
  transition: all 0.2s ease;
}

#custos-pedagios-lista li:hover {
  background-color: rgba(16, 185, 129, 0.08) !important;
  transform: translateX(4px);
}

/* Botão de atualizar distância destacado */
#custos-btn-distancia {
  box-shadow: 0 2px 8px -2px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
}

#custos-btn-distancia:hover:not(:disabled) {
  box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

#custos-btn-distancia:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Indicador de API mais visual */
#custos-api-status-indicator {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
}

.api-status-loading {
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 12px rgba(37, 99, 235, 0.4);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 20px rgba(37, 99, 235, 0.6);
  }
}

/* Feedback mais destacado */
#custos-feedback {
  font-weight: 500;
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.1);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tabelas mais elegantes */
table {
  border-collapse: separate;
  border-spacing: 0;
}

table thead th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  z-index: 10;
}

table tbody tr {
  transition: all 0.2s ease;
}

table tbody tr:hover {
  background-color: rgba(16, 185, 129, 0.05);
  transform: scale(1.01);
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.1);
}

/* Tooltips mais bonitos */
.tooltip-content {
  backdrop-filter: blur(8px);
  background-color: rgba(30, 41, 59, 0.95);
}

/* Progress bar mais suave */
.progress-bar.active {
  background-size: 200% 100%;
  background-image: linear-gradient(
    90deg,
    #10b981 0%,
    #059669 25%,
    #10b981 50%,
    #059669 75%,
    #10b981 100%
  );
}

/* Toast notifications mais destacados */
.toast {
  animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.2);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Fieldsets mais organizados */
fieldset {
  position: relative;
  padding-top: 0.5rem;
}

fieldset legend {
  font-weight: 600;
  color: #334155;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0.5rem;
}

/* Grid de inputs mais harmônico */
.grid {
  gap: 1.5rem;
}

/* Badges de status melhorados */
.pedagio-badge-google {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-color: #3b82f6;
}

.pedagio-badge-tollguru {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #10b981;
}

.pedagio-badge-manual {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-color: #94a3b8;
}

/* Melhor hierarquia visual */
h1 {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  position: relative;
  padding-bottom: 0.75rem;
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, #10b981, transparent);
  border-radius: 2px;
}

/* Inputs com ícones mais visuais */
label {
  font-weight: 500;
  color: #475569;
}

/* Separadores mais sutis */
.border-t {
  border-top-width: 1px;
  border-style: solid;
  border-image: linear-gradient(90deg, transparent, #e2e8f0, transparent) 1;
}

/* Responsividade melhorada */
@media (max-width: 768px) {
  .grid {
    gap: 1rem;
  }

  #custos-form ~ section article {
    margin-bottom: 1rem;
  }

  table {
    font-size: 0.85rem;
  }
}

/* Skeleton loading para melhor UX */
.loading-skeleton {
  background: linear-gradient(
    90deg,
    #f1f5f9 0%,
    #e2e8f0 50%,
    #f1f5f9 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 0.5rem;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Melhor contraste em foco */
input:focus,
select:focus,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Breadcrumb melhorado */
nav a {
  position: relative;
  transition: color 0.2s ease;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: #10b981;
  transition: width 0.3s ease;
}

nav a:hover::after {
  width: 100%;
}

/* Scroll suave */
html {
  scroll-behavior: smooth;
}

/* Melhor espaçamento */
section + section {
  margin-top: 1.5rem;
}

/* ============================================
   MELHORIAS DE LAYOUT - PARÂMETROS DO CENÁRIO
   Organização visual, agrupamento e hierarquia
   ============================================ */

/* Seções de parâmetros com barra lateral colorida */
.parametros-section {
  padding: 1.25rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  position: relative;
  margin-bottom: 1rem;
}

.parametros-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border-radius: 0.75rem 0 0 0.75rem;
  opacity: 0.6;
}

/* Destaque para campos preenchidos */
#custos-form input:not(:placeholder-shown):not([readonly]):not([disabled]),
#custos-form select:not([value=""]):not([disabled]) {
  background-color: #f0fdf4 !important;
  border-color: #86efac !important;
}

/* Destaque para campos vazios obrigatórios */
#custos-form input:placeholder-shown.required-field,
#custos-form select[value=""]:required {
  border-left: 3px solid #fbbf24;
}

/* Badges de status */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-badge-filled {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.status-badge-empty {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.status-badge-readonly {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #a5b4fc;
}

/* Grupo de campos relacionados */
.field-group {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1rem;
}

.field-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #cbd5e1;
}

.field-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #475569;
  letter-spacing: 0.05em;
}

/* Compactar espaçamento */
.compact-grid {
  display: grid;
  gap: 0.75rem;
}

.compact-label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.compact-label span {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
}

.compact-input {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
  transition: all 0.2s ease;
}

.compact-input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
  outline: none;
}

.compact-input:hover:not(:disabled):not([readonly]) {
  border-color: #94a3b8;
}

/* Info cards mais compactos */
.info-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}

.info-card-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
}

.info-card-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
}

/* Botão de ação destacado mas compacto */
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  font-size: 0.813rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.action-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.action-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Separador visual sutil */
.visual-separator {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, #cbd5e1 50%, transparent 100%);
  margin: 1.25rem 0;
}

/* Tooltip melhorado */
.info-icon {
  width: 1rem;
  height: 1rem;
  color: #94a3b8;
  cursor: help;
  transition: color 0.2s ease;
}

.info-icon:hover {
  color: #10b981;
}

/* Feedback visual para campos */
.field-hint {
  font-size: 0.688rem;
  color: #64748b;
  margin-top: 0.25rem;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Redução de espaçamento no formulário */
#custos-form {
  gap: 0.75rem;
}

#custos-form fieldset {
  padding-top: 0.25rem;
}

#custos-form legend {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #475569;
  letter-spacing: 0.05em;
  padding: 0 0.25rem;
  margin-bottom: 0.5rem;
}

/* Labels mais compactos */
#custos-form label span {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
}

/* Inputs e selects com tamanho otimizado */
#custos-form input,
#custos-form select {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* Grid com menos espaçamento */
#custos-form .grid {
  gap: 1rem;
}

/* Cards de informação do veículo mais compactos */
#custos-consumo-info,
#custos-horas-info {
  font-size: 0.875rem;
}

/* Reduzir padding dos fieldsets */
#custos-form fieldset.space-y-4 {
  gap: 0.75rem;
}

/* Melhorar visualização da lista de pedágios */
#custos-pedagios-lista {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem;
  background: #fafafa;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
}

#custos-pedagios-lista:empty::after {
  content: 'Nenhum pedágio adicionado.';
  display: block;
  text-align: center;
  padding: 1rem;
  color: #92400e;
  background: #fef3c7;
  border: 1px dashed #fbbf24;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-style: italic;
}

/* Melhorar espaçamento dos badges de pedágio */
.pedagio-badge {
  font-size: 0.625rem;
  padding: 0.25rem 0.625rem;
}

/* Responsividade - manter legibilidade em telas menores */
@media (max-width: 1024px) {
  .parametros-section {
    padding: 1rem;
  }

  .field-group {
    padding: 0.75rem;
  }

  #custos-form .grid {
    gap: 0.75rem;
  }
}
