/* ==========================================
   CUSTOM PROPERTIES — TraQ! NPS
   Cores, tipografia e texturas do layout.md
   ========================================== */

:root {
  --font: 'Plus Jakarta Sans', sans-serif;

  /* Palette */
  --bg: #03243E;
  --surface: #0A3A5C;
  --surface-hover: #0D4A72;
  --accent: #F1E41A;
  --text: #FFFFFF;
  --text-muted: rgba(255, 255, 255, 0.55);
  --text-subtle: rgba(255, 255, 255, 0.3);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  /* NPS */
  --nps-detractor: #EF4444;
  --nps-passive: #F1E41A;
  --nps-promoter: #10B981;

  /* Semantic */
  --error: #EF4444;
  --success: #10B981;
}

/* ==========================================
   RESET
   ========================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

h1,
h2,
h3 {
  font-family: var(--font);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

input,
textarea {
  font: inherit;
  color: inherit;
}

/* ==========================================
   BACKGROUND GLOW
   ========================================== */

.bg-glow {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(10, 58, 92, 0.5) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================
   PROGRESS BAR — "The Pulse Line"
   ========================================== */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  z-index: 100;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #F1E41A, #10B981);
  border-radius: 0 999px 999px 0;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   WELCOME STEP
   ========================================== */

.step-inner--welcome {
  text-align: center;
}

.step-inner--welcome .step-title {
  margin-bottom: 0.75rem;
}

.step-inner--welcome .step-subtitle {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.0625rem;
}

.welcome-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 2rem;
  background: linear-gradient(135deg, rgba(241, 228, 26, 0.12), rgba(16, 185, 129, 0.12));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.step-actions--center {
  justify-content: center;
}

.step-actions--center .btn-next {
  margin-left: auto !important;
  margin-right: auto !important;
}

.btn-start {
  padding: 1rem 2.5rem;
  font-size: 1.0625rem;
}

/* ==========================================
   STEPS — "The Conversation Frame"
   ========================================== */

#nps-form {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.step {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 3rem);
  opacity: 0;
  visibility: hidden;
  transform: translateY(30px);
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s 0.5s;
  z-index: 1;
}

.step.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0s 0s;
  z-index: 2;
}

.step.exiting {
  opacity: 0;
  transform: translateY(-30px);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 1, 1),
    transform 0.3s cubic-bezier(0.4, 0, 1, 1);
  z-index: 1;
}

.step-inner {
  width: 100%;
  max-width: 640px;
}

/* ==========================================
   STEP COUNTER — "The Whisper"
   ========================================== */

.step-counter {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

/* ==========================================
   STEP TITLE — "The Voice"
   ========================================== */

.step-title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2rem;
}

.step-title.has-subtitle {
  margin-bottom: 0.75rem;
}

/* ==========================================
   STEP SUBTITLE — "The Context"
   ========================================== */

.step-subtitle {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* ==========================================
   NPS SCALE — "The Spectrum"
   ========================================== */

.nps-scale {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.nps-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.125rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nps-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

.nps-btn:active {
  transform: scale(0.97);
}

/* NPS selected: diminish siblings */
.nps-scale.has-selection .nps-btn:not(.selected) {
  opacity: 0.4;
}

/* Detractor selected */
.nps-btn.selected[data-category="detractor"] {
  background: var(--nps-detractor);
  border-color: var(--nps-detractor);
  color: #fff;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
  opacity: 1;
}

/* Passive selected */
.nps-btn.selected[data-category="passive"] {
  background: var(--nps-passive);
  border-color: var(--nps-passive);
  color: #03243E;
  box-shadow: 0 0 30px rgba(241, 228, 26, 0.3);
  opacity: 1;
}

/* Promoter selected */
.nps-btn.selected[data-category="promoter"] {
  background: var(--nps-promoter);
  border-color: var(--nps-promoter);
  color: #fff;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
  opacity: 1;
}

/* Selection pulse animation */
@keyframes nps-pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

.nps-btn.selected {
  animation: nps-pulse 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nps-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-bottom: 0;
}

/* ==========================================
   EXPERIENCE SCALE — "The Mood Board"
   ========================================== */

.experience-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.625rem;
  margin: 2rem 0 0;
}

.exp-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 0.5rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.exp-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

.exp-btn:active {
  transform: scale(0.97);
}

.exp-icon {
  font-size: 2rem;
  line-height: 1;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.exp-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  line-height: 1.2;
  transition: color 0.25s ease;
}

/* Diminish siblings */
.experience-scale.has-selection .exp-btn:not(.selected) {
  opacity: 0.4;
}

.exp-btn.selected {
  background: rgba(241, 228, 26, 0.08);
  border: 2px solid var(--accent);
  box-shadow: 0 0 25px rgba(241, 228, 26, 0.12);
  opacity: 1;
}

.exp-btn.selected .exp-label {
  color: var(--accent);
}

.exp-btn.selected .exp-icon {
  transform: scale(1.15);
}

/* Emoji bounce on selection */
@keyframes emoji-bounce {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1.15);
  }
}

.exp-btn.just-selected .exp-icon {
  animation: emoji-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================
   LOYALTY OPTIONS — "The Verdict"
   ========================================== */

.loyalty-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 2rem 0 0;
}

.loyalty-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 1rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.loyalty-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
}

.loyalty-btn:active {
  transform: scale(0.97);
}

.loyalty-btn svg {
  opacity: 0.4;
  transition: all 0.25s ease;
}

.loyalty-btn span {
  font-size: 0.9375rem;
  font-weight: 600;
}

/* Diminish siblings */
.loyalty-options.has-selection .loyalty-btn:not(.selected) {
  opacity: 0.4;
}

/* Sim */
.loyalty-btn.selected[data-value="Sim"] {
  background: rgba(16, 185, 129, 0.08);
  border: 2px solid var(--nps-promoter);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.15);
  opacity: 1;
}

.loyalty-btn.selected[data-value="Sim"] svg {
  color: var(--nps-promoter);
  opacity: 1;
}

/* Talvez */
.loyalty-btn.selected[data-value="Talvez"] {
  background: rgba(241, 228, 26, 0.08);
  border: 2px solid var(--accent);
  box-shadow: 0 0 25px rgba(241, 228, 26, 0.15);
  opacity: 1;
}

.loyalty-btn.selected[data-value="Talvez"] svg {
  color: var(--accent);
  opacity: 1;
}

/* Nao */
.loyalty-btn.selected[data-value="Nao"] {
  background: rgba(239, 68, 68, 0.08);
  border: 2px solid var(--nps-detractor);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.15);
  opacity: 1;
}

.loyalty-btn.selected[data-value="Nao"] svg {
  color: var(--nps-detractor);
  opacity: 1;
}

/* ==========================================
   TEXTAREA — "The Open Canvas"
   ========================================== */

.form-textarea {
  width: 100%;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  font-size: 1rem;
  color: var(--text);
  resize: vertical;
  min-height: 140px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-textarea::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.form-textarea:hover:not(:focus) {
  border-color: rgba(255, 255, 255, 0.18);
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(241, 228, 26, 0.15);
}

.form-textarea.error {
  border-color: var(--error);
}

/* ==========================================
   STEP ACTIONS — "The Flow Controls"
   ========================================== */

.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2.5rem;
  width: 100%;
  gap: 1rem;
}

.btn-prev {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-prev:hover {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.05);
}

.btn-prev:active {
  transform: scale(0.97);
}

.btn-next,
.btn-submit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #03243E;
  background: var(--accent);
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: auto;
}

/* Override margin for centered buttons */
.step-actions--center .btn-next,
.step-actions--center .btn-submit,
.step-actions--center .btn-start {
  margin-left: auto !important;
  margin-right: auto !important;
}

.btn-next:hover:not(:disabled),
.btn-submit:hover:not(:disabled) {
  background: #fff;
  box-shadow: 0 0 30px rgba(241, 228, 26, 0.25);
  transform: translateY(-2px);
}

.btn-next:active:not(:disabled),
.btn-submit:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-next:disabled,
.btn-submit:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ==========================================
   KEYBOARD HINT
   ========================================== */

.keyboard-hint {
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.2);
  margin-top: 0.75rem;
}

.keyboard-hint kbd {
  display: inline-block;
  padding: 0.1em 0.4em;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Hide on touch devices */
@media (hover: none) {
  .keyboard-hint {
    display: none;
  }
}

/* ==========================================
   FORM FEEDBACK — Floating
   ========================================== */

.form-feedback {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.875rem 1.5rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 200;
  display: none;
  max-width: 90%;
  text-align: center;
}

.form-feedback.success {
  display: block;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.form-feedback.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================
   RESPONSIVE — Mobile < 480px
   ========================================== */

@media (max-width: 480px) {
  .step {
    align-items: flex-start;
    padding-top: 15vh;
  }

  /* NPS scale: 2 rows */
  .nps-scale {
    grid-template-columns: repeat(6, 1fr);
  }

  .nps-btn {
    font-size: 0.9375rem;
  }

  /* Experience */
  .experience-scale {
    gap: 0.375rem;
  }

  .exp-btn {
    padding: 1rem 0.25rem;
  }

  .exp-icon {
    font-size: 1.5rem;
  }

  .exp-label {
    font-size: 0.625rem;
  }

  /* Loyalty */
  .loyalty-options {
    gap: 0.5rem;
  }

  .loyalty-btn {
    padding: 1.5rem 0.5rem;
  }

  .loyalty-btn svg {
    width: 24px;
    height: 24px;
  }

  /* Navigation: stack vertical */
  .step-actions {
    flex-direction: column-reverse;
    gap: 0.75rem;
  }

  .btn-next,
  .btn-submit {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }

  .btn-prev {
    width: 100%;
    justify-content: center;
  }

  /* Textarea */
  .form-textarea {
    min-height: 120px;
  }
}