/* Enhanced Frontend Styles for WP Survey Plugin */

/* Flexbox container for questions */
.survey-questions-container {
  display: flex;
  flex-wrap: wrap;
  margin-left: -10px;
  margin-right: -10px;
  gap: 20px;
}

/* Container for the entire survey */
.survey-container {
  max-width: 1200px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  color: #333;
  line-height: 1.5;
}

/* Base styles for all questions */
.survey-question {
  box-sizing: border-box;
  background-color: #f9f9fa;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin: 0;
}

.survey-question:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Width variants */
.question-full-width {
  width: calc(100% - 20px);
}

.question-half-width {
  width: calc(50% - 20px);
}

.question-third-width {
  width: calc(33.333% - 20px);
}

/* Question header styling */
.survey-question-header {
  margin-bottom: 20px;
}

.survey-question-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #212529;
  margin-top: 0;
  margin-bottom: 8px;
  line-height: 1.4;
}

.survey-question-header p {
  color: #555;
  font-size: 0.95rem;
  margin-top: 5px;
  margin-bottom: 0;
  line-height: 1.5;
}

/* Form elements styling */
.survey-question input[type="text"],
.survey-question textarea {
  width: 100%;
  border: 1px solid #dfe1e5;
  border-radius: 8px;
  font-size: 1rem;
  color: #3c4043;
  background-color: #fff;
  box-sizing: border-box;
  padding: 12px 16px;
  margin-bottom: 10px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.survey-question select {
  width: 100%;
  border: 1px solid #dfe1e5;
  border-radius: 8px;
  font-size: 1rem;
  color: #3c4043;
  background-color: #fff;
  box-sizing: border-box;
  padding: 12px 16px;
  margin-bottom: 10px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  cursor: pointer;
}

.survey-question textarea {
  min-height: 120px;
  resize: vertical;
}

.survey-question input[type="text"]:focus,
.survey-question textarea:focus,
.survey-question select:focus {
  outline: none;
  border-color: #4285f4;
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.survey-question input[type="text"]::placeholder,
.survey-question textarea::placeholder {
  color: #9aa0a6;
}

/* Radio and checkbox styles */
.survey-question label {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
}

.survey-question input[type="radio"],
.survey-question input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  cursor: pointer;
  accent-color: #4285f4;
}

.survey-question input[type="radio"] + span,
.survey-question input[type="checkbox"] + span {
  font-size: 1rem;
  color: #3c4043;
}

/* Required field indication */
.survey-question.required {
  border-left: 3px solid #ea4335;
}

.required-indicator {
  color: #ea4335;
  font-weight: bold;
  margin-left: 4px;
}

/* Error message styling */
.error-message {
  color: #ea4335;
  font-size: 0.9rem;
  margin-top: 8px;
  padding: 8px 12px;
  background-color: rgba(234, 67, 53, 0.1);
  border-radius: 4px;
  display: inline-block;
}

/* Form footer */
.survey-form-footer {
  margin-top: 40px;
  padding-top: 20px;
  text-align: center;
  border-top: 1px solid #eee;
}

/* Submit button styling */
#submit-survey {
  background-color: #4285f4;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(66, 133, 244, 0.3);
}

#submit-survey:hover {
  background-color: #3367d6;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(66, 133, 244, 0.4);
}

#submit-survey:active {
  transform: translateY(0);
}

/* Success message styling */
.success-message {
  background-color: #e6f4ea;
  color: #1e8e3e;
  padding: 18px;
  margin: 20px 0;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  display: none;
}

.success-message:not(:empty) {
  display: block;
}

/* GDPR container styling */
.survey-gdpr-container {
  margin: 30px 0 20px;
  padding: 24px;
  background-color: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #eee;
}

.gdpr-checkbox {
  margin-bottom: 14px;
}

.gdpr-checkbox:last-child {
  margin-bottom: 0;
}

.gdpr-checkbox label {
  display: flex;
  align-items: flex-start;
}

.gdpr-checkbox input[type="checkbox"] {
  margin-top: 3px;
}

.gdpr-checkbox span {
  font-size: 0.95rem;
  line-height: 1.5;
}

.gdpr-checkbox a {
  color: #4285f4;
  text-decoration: none;
}

.gdpr-checkbox a:hover {
  text-decoration: underline;
}

.gdpr-error-message {
  color: #ea4335;
  font-size: 0.9rem;
  margin-bottom: 15px;
  padding: 8px 12px;
  background-color: rgba(234, 67, 53, 0.1);
  border-radius: 4px;
}

/* Loading state for submit button */
#submit-survey.loading {
  position: relative;
  padding-right: 40px;
  pointer-events: none;
  opacity: 0.8;
}

#submit-survey.loading:after {
  content: "";
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .question-half-width,
  .question-third-width {
    width: calc(100% - 20px);
  }

  .survey-question {
    padding: 18px;
  }

  .survey-question-header h3 {
    font-size: 1.1rem;
  }

  .survey-question input[type="text"],
  .survey-question textarea,
  .survey-question select {
    padding: 10px 14px;
  }

  #submit-survey {
    width: 100%;
    padding: 12px;
  }
}
