/* Scoped styles for embedded custom forms - only affects .custom-form container */

.custom-form {
  box-sizing: border-box;
}

.custom-form *,
.custom-form *::before,
.custom-form *::after {
  box-sizing: border-box;
}

/* Custom Form Styles */
.custom-form {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  margin: 0 auto; /* Center the form */
}

.custom-form .form-header {
  /* Background color will be set by custom styles */
  padding: 2rem;
}

.custom-form .form-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.custom-form .form-description {
  opacity: 0.9;
  font-size: 1rem;
  margin: 0;
}

.custom-form .form-content {
  padding: 2rem;
}

/* Multi-column row layout */
.custom-form .form-row {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.custom-form .form-row .form-question {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

@media (max-width: 640px) {
  .custom-form .form-row {
    grid-template-columns: 1fr !important;
  }
}

.custom-form .form-question {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e2e8f0;
}

.custom-form .form-question:last-of-type {
  border-bottom: none;
}

.custom-form .question-label {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.custom-form .required {
  color: #e53e3e;
  margin-left: 0.25rem;
}

.custom-form .question-description {
  color: #718096;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Input Styles */
.custom-form .text-input,
.custom-form .textarea-input,
.custom-form .select-input,
.custom-form .date-input,
.custom-form .time-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s;
}

.custom-form .text-input:focus,
.custom-form .textarea-input:focus,
.custom-form .select-input:focus,
.custom-form .date-input:focus,
.custom-form .time-input:focus {
  outline: none;
  border-color: #667eea;
}

.custom-form .textarea-input {
  resize: vertical;
  min-height: 100px;
}

/* Radio and Checkbox Groups */
.custom-form .radio-group,
.custom-form .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.custom-form .radio-option,
.custom-form .checkbox-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  background: #ffffff;
}

.custom-form .radio-option:hover,
.custom-form .checkbox-option:hover {
  border-color: #667eea;
  background: #f7fafc;
}

.custom-form .radio-option input,
.custom-form .checkbox-option input {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

/* Image Options - Grid layout when options have images */
.custom-form .radio-group.has-images,
.custom-form .checkbox-group.has-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.custom-form .radio-option.has-image,
.custom-form .checkbox-option.has-image {
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  padding: 0;
  overflow: hidden;
  display: flex;
}

.custom-form .option-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
  margin: 0;
}

.custom-form .radio-option.has-image span,
.custom-form .checkbox-option.has-image span {
  font-size: 0.9rem;
  margin: 0;
}

.custom-form .radio-option.has-image input,
.custom-form .checkbox-option.has-image input {
  margin: 0;
}

.custom-form .option-label-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  margin-top: auto;
  background: var(--option-label-bg, #ffffff);
  border-top: 1px solid #e2e8f0;
  flex: 1;
  width: 100%;
}

/* Linear Scale */
.custom-form .linear-scale {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.custom-form .scale-label {
  font-size: 0.9rem;
  color: #718096;
  font-weight: 500;
}

.custom-form .scale-options {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

.custom-form .scale-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.custom-form .scale-option input {
  cursor: pointer;
  width: 20px;
  height: 20px;
  margin-bottom: 0.25rem;
}

.custom-form .scale-number {
  font-size: 0.9rem;
  color: #718096;
  font-weight: 600;
}

/* Slider Scale */
.custom-form .slider-scale {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.custom-form .slider-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.custom-form .scale-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.custom-form .scale-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.custom-form .scale-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #667eea;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.custom-form .scale-slider::-webkit-slider-thumb:hover {
  background: #5568d3;
  transform: scale(1.1);
}

.custom-form .scale-slider::-moz-range-thumb:hover {
  background: #5568d3;
  transform: scale(1.1);
}

.custom-form .slider-value-display {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
  min-width: 2rem;
  text-align: center;
}

/* Rating Styles */
.custom-form .rating-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.custom-form .rating-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.custom-form .rating-option input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.custom-form .rating-icon {
  font-size: 3rem;
  transition: all 0.2s;
  filter: grayscale(100%);
  opacity: 0.4;
}

.custom-form .rating-option:hover .rating-icon {
  filter: grayscale(0%);
  opacity: 0.8;
  transform: scale(1.1);
}

.custom-form .rating-option input:checked ~ .rating-icon {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.15);
}

/* SVG Star Rating Styles */
.custom-form .rating-star {
  width: 48px;
  height: 48px;
  fill: #cbd5e0;
  stroke: #a0aec0;
  stroke-width: 1;
  transition: all 0.2s ease;
  cursor: pointer;
}

.custom-form .rating-option:hover .rating-star {
  fill: #fbbf24;
  stroke: #f59e0b;
  transform: scale(1.1);
}

.custom-form .rating-option input:checked ~ .rating-star {
  fill: #fbbf24;
  stroke: #f59e0b;
  transform: scale(1.05);
}

.custom-form .rating-value {
  font-size: 0.85rem;
  color: #718096;
  margin-top: 0.25rem;
}

/* Grid Question Styles */
.custom-form .grid-question {
  overflow-x: auto;
  margin: 1rem 0;
}

.custom-form .grid-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.custom-form .grid-table th,
.custom-form .grid-table td {
  padding: 0.75rem;
  text-align: center;
  border: 1px solid #e2e8f0;
}

.custom-form .grid-table th {
  background: #f7fafc;
  font-weight: 600;
  font-size: 0.9rem;
  color: #2d3748;
}

.custom-form .grid-table th:first-child {
  text-align: left;
  background: transparent;
  border: none;
}

.custom-form .grid-row-label {
  font-weight: 500;
  text-align: left;
  color: #2d3748;
  background: #f7fafc;
}

.custom-form .grid-cell {
  background: white;
  transition: background-color 0.2s;
}

.custom-form .grid-cell:hover {
  background: #f7fafc;
}

.custom-form .grid-cell input[type="radio"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  margin: 0;
}

/* Email Copy Section */
.custom-form .form-email-copy {
  margin: 1.5rem 0;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.custom-form .form-email-copy .checkbox-option {
  border: none;
  padding: 0;
}

.custom-form .form-email-copy .checkbox-option:hover {
  background: transparent;
  border: none;
}

/* Form Actions */
.custom-form .form-actions {
  display: flex;
  justify-content: flex-start;
  padding-top: 1rem;
}

.custom-form .submit-btn,
.custom-form .submit-another-btn {
  padding: 0.875rem 2.5rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.custom-form .submit-btn:hover,
.custom-form .submit-another-btn:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.custom-form .submit-btn:active,
.custom-form .submit-another-btn:active {
  transform: translateY(0);
}

/* Success Message */
.custom-form .form-success {
  padding: 3rem 2rem;
  text-align: center;
}

.custom-form .form-success h2 {
  color: #2d3748;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.custom-form .form-success p {
  color: #718096;
  margin-bottom: 2rem;
}

/* Error Message */
.custom-form .error {
  background: #fed7d7;
  color: #c53030;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #e53e3e;
}

/* Unsupported Message */
.custom-form .unsupported {
  color: #718096;
  font-style: italic;
}

/* Loading State */
.custom-form .loading {
  text-align: center;
  padding: 2rem;
  color: #718096;
}

.custom-form .loading::after {
  content: '...';
  animation: custom-form-dots 1.5s steps(4, end) infinite;
}

@keyframes custom-form-dots {
  0%, 20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%, 100% {
    content: '...';
  }
}

/* Responsive */
@media (max-width: 768px) {
  .custom-form .form-header {
    padding: 1.5rem;
  }

  .custom-form .form-title {
    font-size: 1.5rem;
  }

  .custom-form .form-content {
    padding: 1.5rem;
  }

  .custom-form .linear-scale {
    flex-direction: column;
    align-items: flex-start;
  }

  .custom-form .scale-options {
    width: 100%;
  }
}

/* Text-based Linear Scale Styles */
.custom-form .scale-option-label {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.custom-form .scale-option-label:hover {
  border-color: var(--primary-color, #4a9d7e);
  background: #f7fafc;
}

.custom-form .scale-option-label input[type="radio"] {
  margin-right: 0.75rem;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.custom-form .scale-option-label input[type="radio"]:checked {
  accent-color: var(--primary-color, #4a9d7e);
}

.custom-form .scale-option-text {
  font-size: 1rem;
  color: #2d3748;
}

/* Enhanced Star Rating Hover Effect */
.custom-form .rating-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.custom-form .rating-option {
  position: relative;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.custom-form .rating-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Default state - gray stars */
.custom-form .rating-option img,
.custom-form .rating-star {
  width: 48px;
  height: 48px;
  filter: grayscale(100%) brightness(1.5);
  transition: all 0.2s ease;
}

/* Hovered state - gold stars */
.custom-form .rating-option.hovered img,
.custom-form .rating-option.hovered .rating-star {
  filter: grayscale(0%) brightness(1) !important;
}

/* Selected state - gold stars */
.custom-form .rating-option.selected img,
.custom-form .rating-option.selected .rating-star {
  filter: grayscale(0%) brightness(1) !important;
  transform: scale(1.05);
}

/* Grid Table Improvements */
.custom-form .grid-table {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.custom-form .grid-table input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary-color, #4a9d7e);
}

.custom-form .grid-table td {
  background: white;
  transition: background-color 0.15s ease;
}

.custom-form .grid-table tr:hover td {
  background: #f7fafc;
}

.custom-form .grid-table-validation {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 4px;
  font-size: 0.875rem;
  color: #92400e;
}

.custom-form .grid-table-validation::before {
  content: '⚠️';
  font-size: 1rem;
}

/* Fix description text styling */
.custom-form .field-description {
  color: var(--description-color, #718096);
  font-size: 0.875rem;
  margin-top: 0.25rem;
  line-height: 1.5;
}

/* Image Element Styles */
.custom-form .form-question-image {
  text-align: center;
}

.custom-form .form-image {
  display: flex;
  justify-content: center;
}

.custom-form .form-image img {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.custom-form .image-caption {
  font-size: 0.9rem;
  color: #718096;
  margin-bottom: 0.75rem;
  font-style: italic;
}
