/* Health Assessment Widget Styles */
.health-assessment-container {
  max-width: 800px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
    sans-serif;
}

.health-assessment-form {
  background-color: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.health-assessment-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group label {
  font-weight: 600;
  color: #333;
  font-size: 16px;
}

.form-group select {
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 16px;
  background: #fff;
  transition: border-color 0.3s ease;
}

.form-group select:focus {
  outline: none;
  border-color: #14707b;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.form-group textarea {
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 16px;
  background: #fff;
  transition: border-color 0.3s ease;
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
  line-height: 1.5;
}

.form-group textarea:focus {
  outline: none;
  border-color: #14707b;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.form-group textarea::placeholder {
  color: #999;
  opacity: 1;
}

.field-description {
  font-size: 14px;
  color: #666;
  font-style: italic;
  margin-top: -8px;
  margin-bottom: 8px;
}

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fff;
  position: relative;
  font-size: 14px;
  min-height: 40px;
}

.checkbox-label:hover {
  border-color: #14707b;
  background: #f8f9fa;
}

.checkbox-label input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid #ddd;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked {
  background: #14707b;
  border-color: #14707b;
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: "✓";
  color: white;
  font-size: 11px;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
  display: none;
}

.checkmark {
  display: none;
}

/* Show/Hide functionality for checkbox groups */
.checkbox-group-container {
  position: relative;
}

.checkbox-group {
  transition: max-height 0.4s ease-out;
  overflow: hidden;
}

.checkbox-group.collapsed {
  max-height: 120px; /* Shows approximately 2-3 options */
}

.checkbox-group.expanded {
  max-height: 1000px; /* Large enough to show all options */
}

/* Fade overlay at bottom when collapsed */
.checkbox-group-container::after {
  content: "";
  position: absolute;
  bottom: 50px; /* Height of the button */
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.95));
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.checkbox-group-container.expanded::after {
  opacity: 0;
}

/* Ensure button is above the fade overlay */
.show-more-btn {
  background: transparent;
  border: 1px solid #14707b;
  color: #14707b;
  padding: 8px 20px;
  font-size: 14px;
  border-radius: 25px;
  cursor: pointer;
  margin: 15px auto 0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 140px;
  position: relative;
  z-index: 2;
  font-weight: 500;
  backdrop-filter: blur(1px);
}

.show-more-btn:hover {
  background: #14707b;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 124, 186, 0.2);
}

.show-more-btn:focus {
  outline: 2px solid #14707b;
  outline-offset: 2px;
}

.show-more-btn .arrow {
  transition: transform 0.3s ease;
  font-size: 12px;
}

.show-more-btn.expanded .arrow {
  transform: rotate(180deg);
}

/* Ensure checkbox labels are always visible */
.checkbox-label {
  opacity: 1;
  transition: border-color 0.3s ease, background-color 0.3s ease;
  max-height: none;
  overflow: visible;
}

.health-assessment-submit-btn {
  background: #fc7244;
  color: #ffffff;
  border: none;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
  text-align: center;
}

.health-assessment-submit-btn:hover {
  background: #fc7244;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.health-assessment-submit-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.health-assessment-reset-btn {
  background: transparent;
  color: #666;
  border: 2px solid #ddd;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
  text-align: center;
}

.health-assessment-reset-btn:hover {
  background: #f8f9fa;
  color: #333;
  border-color: #14707b;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.health-assessment-reset-btn:focus {
  outline: 2px solid #14707b;
  outline-offset: 2px;
}

.results-actions,
.error-actions {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.health-assessment-loading {
  text-align: center;
  padding: 40px 20px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-top: 20px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #14707b;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.health-assessment-loading p {
  color: #666;
  font-size: 16px;
  margin: 0;
}

.health-assessment-results {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 25px;
  margin-top: 20px;
}

.health-assessment-results ul,
.health-assessment-results ol {
  margin-bottom: 15px;
  padding-left: 20px;
}

.health-assessment-results li {
  margin-bottom: 4px;
}

.health-assessment-error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  padding: 20px;
  margin-top: 20px;
  border-left: 4px solid #dc3545;
}

.error-message {
  color: #721c24;
  margin: 0;
  font-size: 16px;
}

.captcha-group {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

/* Responsive Design */
@media (min-width: 769px) {
  .checkbox-group {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .health-assessment-container {
    padding: 15px;
  }

  .health-assessment-form {
    padding: 20px;
  }

  .health-assessment-title {
    font-size: 24px;
  }

  .checkbox-group {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .checkbox-label {
    padding: 6px 10px;
    font-size: 13px;
    min-height: 36px;
  }

  .checkbox-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
  }

  .health-assessment-submit-btn {
    padding: 14px 28px;
    font-size: 16px;
  }

  .health-assessment-reset-btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .checkbox-group.collapsed {
    max-height: 80px; /* Smaller height for mobile */
  }

  .checkbox-group-container::after {
    bottom: 40px; /* Adjust for smaller button */
    height: 40px;
  }

  .show-more-btn {
    padding: 6px 12px;
    font-size: 13px;
    min-width: 120px;
  }
}

@media (max-width: 480px) {
  .health-assessment-container {
    padding: 10px;
  }

  .health-assessment-form {
    padding: 15px;
  }

  .health-assessment-title {
    font-size: 22px;
  }

  .health-assessment-description {
    font-size: 14px;
  }

  .form-group label {
    font-size: 14px;
  }

  .form-group select {
    padding: 10px 12px;
    font-size: 14px;
  }

  .form-group textarea {
    padding: 10px 12px;
    font-size: 14px;
    min-height: 80px;
  }

  .field-description {
    font-size: 12px;
  }

  .checkbox-label {
    padding: 5px 8px;
    font-size: 12px;
    min-height: 32px;
    gap: 6px;
  }

  .checkbox-label input[type="checkbox"] {
    width: 12px;
    height: 12px;
  }

  .checkbox-label input[type="checkbox"]:checked::after {
    font-size: 9px;
  }

  .health-assessment-submit-btn {
    padding: 12px 24px;
    font-size: 16px;
  }

  .health-assessment-reset-btn {
    padding: 8px 16px;
    font-size: 12px;
  }

  .checkbox-group.collapsed {
    max-height: 60px; /* Even smaller for very small screens */
  }

  .checkbox-group-container::after {
    bottom: 30px; /* Adjust for smaller button */
    height: 30px;
  }

  .show-more-btn {
    padding: 5px 10px;
    font-size: 12px;
    min-width: 100px;
  }
}

/* Animation for form reveal */
.health-assessment-form-wrapper {
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Focus styles for accessibility */
.form-group select:focus,
.form-group textarea:focus,
.checkbox-label:focus-within,
.health-assessment-submit-btn:focus {
  outline: 2px solid #14707b;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .health-assessment-submit-btn,
  .health-assessment-loading,
  .captcha-group {
    display: none;
  }

  .health-assessment-results {
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}
