/**
 * Professional Gauges Stylesheet
 *
 * Enterprise-grade styling for score gauges (horizontal, semicircle, line)
 * - Zero toy-like visuals
 * - Smooth animations
 * - Responsive design
 * - Accessibility-first
 */

/* ============================================
   CONTAINER
   ============================================ */
.professional-gauges-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0; /* REMOVIDO: deixar padding ao parent */
  background: transparent; /* Transparent - inherit from parent card */
  border-radius: 0; /* REMOVIDO: deixar ao parent */
  box-shadow: none; /* No shadow - parent card has shadow */
  display: flex;
  flex-direction: column;
  align-items: center; /* Center children horizontally */
  justify-content: center; /* Center children vertically */
}

.dark .professional-gauges-container {
  background: #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ============================================
   HEADER
   ============================================ */
.gauge-header {
  margin-bottom: 0; /* REMOVIDO: sem margin (título já tem) */
  text-align: center;
  width: 100%;
}

.gauge-title {
  font-size: 1.625rem; /* Ajuste sutil: ligeiramente menor (26px → 26px) */
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.375rem 0; /* Ajuste sutil: menos espaço abaixo */
}

.dark .gauge-title {
  color: #f1f5f9;
}

.gauge-subtitle {
  font-size: 0.9375rem; /* Ajuste sutil: 15px para melhor hierarquia */
  color: #64748b;
  margin: 0;
  line-height: 1.4; /* Melhor legibilidade */
}

.dark .gauge-subtitle {
  color: #94a3b8;
}

/* ============================================
   HORIZONTAL BARS (RECOMMENDED)
   ============================================ */
.gauge-section {
  width: 100%;
}

.gauge-row {
  margin-bottom: 1.75rem;
}

.gauge-row-main {
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
}

.dark .gauge-row-main {
  border-bottom-color: #334155;
}

.gauge-label-group {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gauge-label {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}

.dark .gauge-label {
  color: #cbd5e1;
}

.gauge-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.legend-before {
  color: #94a3b8;
  font-weight: 500;
}

.legend-arrow {
  color: #cbd5e1;
  font-weight: 400;
}

.legend-after {
  color: #137fec;
  font-weight: 700;
}

.legend-delta {
  color: #059669;
  font-weight: 700;
  background: #d1fae5;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

.dark .legend-delta {
  background: #064e3b;
  color: #6ee7b7;
}

/* Gauge Bar Container */
.gauge-bar-container {
  position: relative;
  width: 100%;
  height: 32px;
}

.gauge-bar-bg {
  position: relative;
  width: 100%;
  height: 100%;
  background: #f1f5f9;
  border-radius: 16px;
  overflow: hidden;
}

.dark .gauge-bar-bg {
  background: #0f172a;
}

.gauge-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 16px;
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0; /* Start at 0 for animation */
}

.gauge-bar-fill.animated {
  width: var(--target-width, 0%) !important; /* Override inline style after animation starts */
}

.gauge-bar-before {
  background: linear-gradient(90deg, #cbd5e1 0%, #94a3b8 100%);
  opacity: 0.6;
  z-index: 1;
}

.gauge-bar-after {
  background: linear-gradient(90deg, #137fec 0%, #0c63c7 100%);
  opacity: 1;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(19, 127, 236, 0.3);
}

/* ============================================
   SEMICIRCLE GAUGES
   ============================================ */
.gauge-semicircle {
  padding: 0; /* REMOVIDO: padding desnecessário */
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.semicircle-grid {
  display: grid !important; /* REVERTIDO: grid 2x2 como estava */
  grid-template-columns: repeat(2, 1fr) !important; /* 2 colunas lado a lado */
  gap: 1.5rem; /* 24px gap - melhor spacing visual */
  margin: 0 auto; /* Center the grid itself */
  padding: 0; /* REMOVIDO: padding desnecessário */
  max-width: 360px; /* Ligeiramente mais largo para melhor proporção */
  width: 100%; /* Responsive */
  max-height: none; /* Remove max-height restriction */
  background: transparent;
  align-items: center !important; /* Vertically center items */
  justify-items: center !important; /* Horizontally center items */
  place-items: center !important; /* Perfect centering (shorthand) */
  justify-content: center; /* Center grid content */
  align-content: center; /* Center rows */
}

.semicircle-item {
  height: 150px; /* REVERTIDO: tamanho original */
  width: 150px; /* Square proportions */
  max-width: 150px; /* Fixed max size */
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent;
  padding: 0;
  margin: 0 auto; /* Center within grid cell */
  position: relative; /* For absolute positioning of children if needed */
}

.semicircle-svg {
  width: 120px; /* REVERTIDO: tamanho original */
  height: 120px; /* Square */
  max-width: 120px; /* Max size */
  display: block !important; /* Remove inline spacing */
  margin: 0 auto; /* Center */
  transform: rotate(-90deg); /* Rotate for proper gauge orientation */
}

.semicircle-bg {
  opacity: 0.15;
}

.semicircle-arc {
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.semicircle-arc-before {
  stroke: #94a3b8;
  opacity: 0.6;
}

.semicircle-arc-after {
  stroke: #137fec;
  filter: drop-shadow(0 2px 4px rgba(19, 127, 236, 0.3));
}

.semicircle-score-before {
  font-size: 14px;
  font-weight: 600;
  fill: #94a3b8;
}

.semicircle-arrow {
  font-size: 12px;
  fill: #cbd5e1;
}

.semicircle-score-after {
  font-size: 16px;
  font-weight: 700;
  fill: #137fec; /* Primary color from site */
}


/* ============================================
   PROFESSIONAL RING GAUGES (220° - New Styles)
   ============================================ */
/* New SVG size for 220° rings (reduzido para gauges menores) */
.semicircle-svg-professional {
  width: 160px;
  height: 110px;
}

/* Full circular background ring (360°) */
.ring-bg {
  opacity: 0.2;
}

/* Progress arcs with smooth animation */
.ring-arc {
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.ring-arc-before {
  stroke: #cbd5e1;
  opacity: 0.5;
}

.ring-arc-after {
  /* Color set dynamically via inline gradient */
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

/* Animated state */
.ring-arc.animated {
  stroke-dashoffset: 0 \!important;
}

/* Score text styling for 220° rings - SIMPLIFICADO (apenas score final) */
.ring-score-main {
  font-size: 32px;
  font-weight: 700;
  /* Color set dynamically via inline fill attribute */
}

/* Score styling moved to consolidated section above */

.semicircle-label {
  margin-top: 0.5rem;
  text-align: center;
}

.semicircle-label-text {
  display: block;
  font-size: 0.8125rem; /* Ajuste sutil: 13px (mais discreto) */
  font-weight: 600; /* Ajuste sutil: mais peso para destaque */
  text-transform: uppercase;
  letter-spacing: 0.06em; /* Ajuste sutil: mais tracking */
  color: #475569; /* Ajuste sutil: mais contraste (text-gray-700) */
  margin-bottom: 0.25rem;
}

.dark .semicircle-label-text {
  color: #cbd5e1;
}

.semicircle-delta {
  font-size: 0.8125rem; /* Ajuste sutil: 13px (consistência) */
  color: #059669; /* Ajuste sutil: verde mais saturado */
  font-weight: 700; /* Ajuste sutil: mais peso */
  background: transparent; /* No background for cleaner look */
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

.dark .semicircle-delta {
  background: #064e3b;
  color: #6ee7b7;
}

/* ============================================
   LINE GAUGES (MINIMALIST)
   ============================================ */
.gauge-line {
  padding: 1rem;
}

.line-gauge {
  margin-bottom: 1.5rem;
}

.line-gauge-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.line-gauge-label {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}

.dark .line-gauge-label {
  color: #cbd5e1;
}

.line-gauge-scores {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.line-score-before {
  color: #94a3b8;
  font-weight: 500;
}

.line-arrow {
  color: #cbd5e1;
}

.line-score-after {
  color: #137fec;
  font-weight: 700;
}

.line-delta {
  color: #059669;
  font-weight: 700;
  background: #d1fae5;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

.dark .line-delta {
  background: #064e3b;
  color: #6ee7b7;
}

.line-gauge-bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: #f1f5f9;
  border-radius: 2px;
  overflow: hidden;
}

.dark .line-gauge-bar {
  background: #0f172a;
}

.line-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 2px;
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
}

.line-fill.animated {
  width: var(--target-width, 0%) !important;
}

.line-fill-before {
  background: #94a3b8;
  opacity: 0.6;
  z-index: 1;
}

.line-fill-after {
  background: #137fec;
  opacity: 1;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(19, 127, 236, 0.4);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
  .professional-gauges-container {
    padding: 1.5rem;
  }

  .gauge-title {
    font-size: 1.5rem;
  }

  .gauge-label-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .semicircle-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .line-gauge-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .professional-gauges-container {
    padding: 1rem;
  }

  .gauge-title {
    font-size: 1.25rem;
  }

  .gauge-row {
    margin-bottom: 1.25rem;
  }

  .semicircle-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes gaugeGrow {
  from {
    width: 0;
  }
  to {
    width: var(--target-width);
  }
}

/* Accessibility: Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .gauge-bar-fill,
  .semicircle-arc,
  .line-fill {
    transition: none;
  }
}
