:root {
  --background: 260 20% 97%;
  --foreground: 270 40% 15%;
  --card: 0 0% 100%;
  --primary: 270 65% 35%;
  --primary-foreground: 0 0% 100%;
  --muted: 270 12% 93%;
  --muted-foreground: 270 10% 50%;
  --border: 270 15% 88%;
  --destructive: 0 84.2% 60.2%;
  --font-heading: "Sora", sans-serif;
  --font-body: "Avenir Next", "Avenir", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
}

.calculator-page {
  width: 100%;
  min-height: 100vh;
  padding: 48px 16px 64px;
  background: hsl(var(--background));
}

.app-header {
  padding-bottom: 32px;
  text-align: center;
}

.brand-logo {
  height: 56px;
  width: auto;
  margin: 0 auto 24px;
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin-bottom: 24px;
  padding: 6px 16px;
  border-radius: 9999px;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.025em;
}

.tool-badge svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
}

h1 {
  color: hsl(var(--foreground));
  font-size: 30px;
  line-height: 1.2;
}

h1 span {
  color: hsl(var(--primary));
}

.lead {
  max-width: 448px;
  margin: 16px auto 0;
  color: hsl(var(--muted-foreground));
  font-size: 16px;
  line-height: 1.5;
}

.calculator-panel {
  width: 100%;
  max-width: 576px;
  margin: 0 auto;
}

.progress {
  display: flex;
  gap: 8px;
  margin: 0 4px 40px;
}

.progress__bar {
  height: 6px;
  flex: 1;
  border-radius: 9999px;
  background: hsl(var(--muted));
  transition: background 0.5s ease;
}

.progress__bar.is-active {
  background: hsl(var(--primary));
}

.step,
.result {
  display: none;
}

.step.is-active,
.result.is-active {
  display: block;
  animation: countIn 0.28s ease;
}

.step__icon {
  margin-bottom: 16px;
}

.step__icon svg {
  width: 24px;
  height: 24px;
  color: hsl(var(--primary));
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step h2 {
  color: hsl(var(--foreground));
  font-size: 24px;
  line-height: 1.375;
}

.step__hint {
  margin: 12px 0 0;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
}

.field {
  display: block;
  margin-top: 32px;
  position: relative;
}

.field input {
  width: 100%;
  min-height: 64px;
  padding: 16px;
  border: 1px solid hsl(var(--border));
  border-radius: 16px;
  color: hsl(var(--foreground));
  background: hsl(var(--card));
  font-size: 24px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder {
  color: hsl(var(--muted-foreground) / 0.4);
}

.field input:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.30);
}

.field--money::before,
.field--minutes::after {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  pointer-events: none;
}

.field--money::before {
  content: "R$";
  left: 16px;
}

.field--money input {
  padding-left: 48px;
}

.field--minutes::after {
  content: "min";
  right: 16px;
}

.field--minutes input {
  padding-right: 64px;
}

.result-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
}

.result-title svg {
  width: 24px;
  height: 24px;
  color: hsl(var(--destructive));
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-title h2 {
  color: hsl(var(--foreground));
  font-size: 24px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
}

.metric {
  padding: 24px;
  border: 1px solid hsl(var(--border));
  border-radius: 16px;
  background: hsl(var(--card) / 0.70);
  box-shadow: 0 8px 32px hsl(270 65% 35% / 0.08);
  backdrop-filter: blur(10px);
}

.metric--highlight {
  border-color: transparent;
  color: hsl(var(--primary-foreground));
  background: linear-gradient(135deg, hsl(270 65% 35%) 0%, hsl(340 75% 55%) 100%);
}

.metric span {
  display: block;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  font-weight: 500;
}

.metric--highlight span {
  color: hsl(var(--primary-foreground) / 0.70);
}

.metric strong {
  display: block;
  margin-top: 4px;
  color: hsl(var(--foreground));
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
}

.metric--highlight strong {
  color: hsl(var(--primary-foreground));
}

.metric small {
  display: block;
  margin-top: 8px;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.metric--highlight small {
  color: hsl(var(--primary-foreground) / 0.60);
}

.result-note {
  margin: 8px 0 0;
  padding-top: 8px;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  text-align: center;
}

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: hsl(var(--destructive));
  font-size: 14px;
  font-weight: 500;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

.btn {
  width: 100%;
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn--primary {
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
}

.btn--secondary {
  color: hsl(var(--primary));
  background: hsl(var(--muted));
}

.btn:hover {
  opacity: 0.90;
}

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

#reset-button {
  display: none;
}

.reset-button {
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px auto 0;
  border: 0;
  color: hsl(var(--primary));
  background: transparent;
  font-size: 14px;
  font-weight: 500;
}

.reset-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.is-result .progress,
.is-result #next-button {
  display: none;
}

.is-result #reset-button {
  display: flex;
}

@keyframes countIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 640px) {
  h1 {
    font-size: 36px;
  }

  .step h2 {
    font-size: 30px;
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: 48px;
    line-height: 1;
  }
}
