:root {
  /* Tema */
  --background: #09090b;
  --foreground: #fafafa;
  --card: #09090b;
  --card-foreground: #fafafa;
  --popover: #09090b;
  --popover-foreground: #fafafa;
  --primary: #fafafa;
  --primary-foreground: #18181b;
  --secondary: #27272a;
  --secondary-foreground: #fafafa;
  --muted: #27272a;
  --muted-foreground: #a1a1aa;
  --accent: #27272a;
  --accent-foreground: #fafafa;
  --border: #27272a;
  --input: #27272a;
  --ring: #d4d4d8;
  --radius: 0.5rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--background);
  color: var(--foreground);
  padding: 1.5rem;
}

/* Grade */
.bg-overlay {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
  z-index: -1;
}

/* Cards */
.form-container {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  position: relative;
  transition: all 0.3s ease;
}

/* Template da tela inicial */
.form-container.is-welcome {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

/* Barra de progesso da tela inicial */
.form-container.is-welcome .progress-bar-container {
  opacity: 0;
}

.progress-bar-container {
  width: 100%;
  height: 4px;
  background: var(--secondary);
  border-radius: 999px;
  margin-bottom: 2rem;
  overflow: hidden;
  transition: opacity 0.3s ease;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-card {
  display: none;
  animation: fadeIn 0.2s ease-out forwards;
}

.step-card.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-number {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.25rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.step-desc {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.input-wrapper {
  margin-bottom: 1rem;
}

.input-wrapper label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.group-label {
  display: block;
  color: var(--foreground);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  background: transparent;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
}

/* Radio dos cards */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

/* Opção do scroll */
.options-grid::-webkit-scrollbar,
.equipment-grid::-webkit-scrollbar {
  width: 6px;
}

.options-grid::-webkit-scrollbar-track,
.equipment-grid::-webkit-scrollbar-track {
  background: transparent;
}

.options-grid::-webkit-scrollbar-thumb,
.equipment-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.radio-card {
  display: flex;
  align-items: center;
  padding: 0.875rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.radio-card input {
  margin-right: 0.75rem;
  accent-color: var(--primary);
}

.radio-card:hover {
  background: var(--accent);
  border-color: var(--ring);
}

/* Grade das armas */
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.equip-card {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.equip-card:hover {
  background: var(--accent);
  border-color: var(--ring);
}

.equip-card.selected {
  border-color: var(--ring);
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--ring);
}

.equip-img-wrapper {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.equip-img-wrapper img {
  max-height: 100%;
  max-width: 80%;
  object-fit: contain;
}

.equip-name {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Container dos botões padronizados */
.card-actions {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;

  align-items: center;
  /*deixar botao à direita*/
  gap: 1rem;
  margin-top: 2rem;
  width: 100%;
}

/* Quando tiver a classe space-between (nas etapas com botão Voltar) */
.card-actions.space-between {
  justify-content: space-between;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 1rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

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

.btn-next,
.btn-submit {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-next:hover:not(:disabled),
.btn-submit:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-prev {
  background: transparent;
  border-color: var(--border);
  color: var(--foreground);
}

.btn-prev:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

/* Modal Popover */
.popover-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.equip-popover {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -45%);
  width: 90%;
  max-width: 440px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  z-index: 60;
  opacity: 0;
  transition: all 0.2s ease;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 1);
}

.popover-overlay.active,
.equip-popover.active {
  display: block;
  opacity: 1;
}

.equip-popover.active {
  transform: translate(-50%, -50%);
}

.btn-close-popover {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
}

.btn-close-popover:hover {
  color: var(--foreground);
}

.popover-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.popover-img-box {
  width: 80px;
  height: 60px;
  background: var(--accent);
  border-radius: calc(var(--radius) - 2px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
}

.popover-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popover-features {
  list-style: none;
  margin-bottom: 1.5rem;
}

.popover-features li {
  position: relative;
  padding-left: 1rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.popover-features li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--foreground);
  font-weight: bold;
}

.hidden {
  display: none;
}

#card-success {
  text-align: center;
  padding: 2rem 0;
}

.success-icon {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

/* Botão do Popover de Equipamentos */
.btn-primary-full {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Centraliza o texto e o ícone */
  gap: 0.5rem;
  /* Espaço entre o ícone e o texto */
  background: var(--primary);
  color: var(--primary-foreground);
  height: 2.75rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
  margin-top: 1rem;
}

.btn-primary-full:hover {
  opacity: 0.9;
}

.btn-primary-full.btn-outline {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-primary-full.btn-outline:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.welcome-logo-container {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1.5rem;
}

.welcome-logo {
  width: 100%;
  max-width: 120px;
  height: auto;
  object-fit: contain;
  filter: invert(1);
}

/* animação de envio */
#card-success {
  display: none;
}

#card-success.active {
  display: block;
  animation: fadeIn 0.4s ease-out forwards;
}

.animate-check path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: drawCheck 0.6s ease-out 0.2s forwards;
}

@keyframes drawCheck {
  to {
    stroke-dashoffset: 0;
  }
}

/* responsividade */

@media (max-width: 640px) {

  body {
    padding: 1rem;
  }

  .form-container {
    padding: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .step-desc {
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
  }

  .options-grid {
    max-height: 280px !important;
  }

  .radio-card {
    padding: 0.75rem;
  }

  /* mantém as duas colunas na grade de armas, mas com espaços entre elas */
  .equipment-grid {
    gap: 0.5rem;
  }

  .equip-card {
    padding: 0.75rem 0.25rem;
  }

  .equip-img-wrapper {
    height: 40px;
    margin-bottom: 0.4rem;
  }

  .equip-name {
    font-size: 0.6rem;
  }

  /* modal detalhes de arma */
  .equip-popover {
    width: 95%;
    padding: 1.25rem;
  }

  .popover-header {
    gap: 0.75rem;
    padding-right: 1.5rem;
  }

  .popover-img-box {
    width: 60px;
    height: 50px;
  }

  .popover-header h3 {
    font-size: 1rem;
  }

  .popover-features li {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
  }

  .welcome-logo {
    max-width: 100px;
  }
}

/* para telas menores */
@media (max-width: 400px) {

  /* Transforma os botões de ação em uma coluna empilhada */
  .card-actions {
    flex-direction: column-reverse;
    gap: 0.75rem;
    margin-top: 1.5rem !important;
  }

  .welcome-logo {
    max-width: 100px;
  }

  /* aqui faz os botões ocuparem 100% da largura da tela */
  .btn {
    width: 100%;
    height: 2.75rem;
  }

  /* remove espaços que aparecem nas telas de pc */
  .card-actions .btn-prev {
    margin-right: 0 !important;
  }

  .card-actions .btn-next,
  .card-actions .btn-submit {
    margin-left: 0 !important;
  }
}

/* deixa o card do Rifle de Precisao com 100% em telas maiores */
@media (min-width: 769px) {
  .equipment-grid .equip-card:last-child {
    grid-column: 1 / -1;
  }
}

/*para telas menores, fatra o grid separar cada card por linha*/
@media (max-width: 768px) {
  .equipment-grid {
    grid-template-columns: 1fr !important;
  }
}