/* CRM Code Gate Frontend Styles */

/* Loading spinner */
.crm-loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: crm-spin 0.6s linear infinite;
}

@keyframes crm-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Form transitions */
.crm-form-step {
  animation: crm-fade-in 0.3s ease-in;
}

@keyframes crm-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Input focus effects */
.crm-field input:focus {
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Button disabled state */
.crm-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Survey button - prevent collapse during loading */
#survey-question-form button[type="submit"] {
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure button loading spinner is properly displayed */
#survey-question-form .button-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* Button loading spinner should match button-text line height */
#survey-question-form .button-loading svg {
  display: block;
}

/* Error animation */
.crm-error {
  animation: crm-shake 0.3s ease-in-out;
}

@keyframes crm-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* Survey-specific styles */
.survey-option {
  transition: all 0.2s ease;
}

.survey-option label {
  user-select: none;
}

.survey-option input[type="radio"],
.survey-option input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.survey-option input[type="radio"]:checked,
.survey-option input[type="checkbox"]:checked {
  accent-color: var(--color-primary, #ec4899);
}

/* Survey question title and instructions styling */
.survey-question-title {
  font-family: var(--font-bebas, "Bebas Neue", sans-serif);
  font-size: 2.5rem;
  font-weight: bold;
  text-transform: uppercase;
  color: #e91e8c;
  margin-bottom: 0.5rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.survey-question-instructions {
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 2rem !important; /* Ensure margin isn't overridden by universal selector */
  font-weight: 400;
}

/* Responsive adjustments for question title */
@media (max-width: 768px) {
  .survey-question-title {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .survey-question-title {
    font-size: 1.75rem;
  }

  .survey-question-instructions {
    font-size: 0.875rem;
  }
}

/* Enhanced progress bar container */
.survey-progress-container {
  position: relative;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

/* Progress bar with green gradient - no shimmer animation */
#survey-progress-bar {
  background: linear-gradient(90deg, #10b981, #34d399);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Progress label positioned on the right */
.survey-progress-label {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: #1f2937;
  font-weight: 600;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Survey step transitions (matching existing form transitions) */
#step-survey.exit,
#step-survey-complete.exit,
#step-thankyou.exit {
  animation: survey-fade-out 0.4s ease-out forwards;
}

#step-survey.page-step,
#step-survey-complete.page-step {
  animation: survey-fade-in 0.4s ease-in forwards;
}

@keyframes survey-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

@keyframes survey-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Survey error message animation */
#survey-error {
  animation: survey-error-shake 0.3s ease-in-out;
}

@keyframes survey-error-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* Mobile responsive improvements */
@media (max-width: 480px) {
  .crm-code-gate-wrapper {
    padding: 10px;
  }

  .crm-form-step {
    padding: 20px 15px;
  }

  .crm-field input {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .crm-button {
    font-size: 18px;
    padding: 14px;
  }

  .survey-option label {
    padding: 12px;
    font-size: 15px;
  }
}

