/**
 * Kibo Journey Custom Styles
 * 
 * Additional styles to help with WordPress integration
 * Version 1.3.10: Added direct HTML form implementation styles
 */

/* General styles for the React app container */
.kibo-journey-react-app {
  min-height: 500px;
  width: 100%;
  display: block;
  position: relative;
}

/* Fix for Share Story page */
body.kibo-page-share-story .kibo-journey-react-app,
.kibo-journey-share-story .kibo-journey-react-app,
[data-page="share-story"].kibo-journey-react-app {
  min-height: 800px; /* Ensure enough space for the form */
}

/* Ensure the Share Story form is visible */
.share-story-form,
.share-story-container,
[data-route="/share-story"] .share-story-container {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Direct HTML form implementation styles */
.kibo-direct-share-form {
  display: none; /* Hidden by default, shown via JavaScript */
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-top: 30px;
  margin-bottom: 30px;
}

.kibo-direct-share-form h2 {
  color: #333;
  margin-bottom: 20px;
  text-align: center;
  font-size: 24px;
}

.kibo-direct-share-form p {
  margin-bottom: 20px;
  text-align: center;
  font-size: 16px;
  line-height: 1.5;
}

.kibo-share-story-form .form-group {
  margin-bottom: 20px;
}

.kibo-share-story-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  font-size: 16px;
}

.kibo-share-story-form input,
.kibo-share-story-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  font-family: inherit;
}

.kibo-share-story-form textarea {
  min-height: 150px;
}

.kibo-share-story-form .submit-button {
  background-color: #0073aa;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  transition: background-color 0.3s ease;
}

.kibo-share-story-form .submit-button:hover {
  background-color: #005177;
}

/* Share Story fallback form styles - kept for backward compatibility */
.share-story-fallback {
  display: none; /* Hidden by default, shown if React fails */
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.share-story-fallback h2 {
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

.share-story-fallback p {
  margin-bottom: 20px;
  text-align: center;
}

.share-story-fallback-form .form-group {
  margin-bottom: 15px;
}

.share-story-fallback-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.share-story-fallback-form input,
.share-story-fallback-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.share-story-fallback-form .submit-button {
  background-color: #0073aa;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.share-story-fallback-form .submit-button:hover {
  background-color: #005177;
}

/* Screen reader text for accessibility */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* Loading indicator */
.kibo-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  width: 100%;
}

.kibo-loading::after {
  content: "";
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: kibo-spin 1s linear infinite;
}

@keyframes kibo-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Fix for WordPress themes that might interfere with React styling */
.kibo-journey-react-app input,
.kibo-journey-react-app button,
.kibo-journey-react-app textarea,
.kibo-journey-react-app select,
.kibo-direct-share-form input,
.kibo-direct-share-form button,
.kibo-direct-share-form textarea,
.kibo-direct-share-form select {
  max-width: none; /* Override WordPress default max-width */
}

/* Ensure form elements in the React app are properly styled */
.kibo-journey-react-app form,
.kibo-direct-share-form form {
  width: 100%;
}

/* Fix for WordPress themes that might add margins to the container */
.kibo-journey-page {
  margin: 0 auto;
  padding: 0;
  width: 100%;
  max-width: 100%;
}

/* Share Story specific styles */
.share-story-page,
.share-story-container {
  display: block;
  width: 100%;
  max-width: 100%;
}

/* Fix for WordPress themes that might hide the Share Story content */
.share-story-page .form-section,
.share-story-container .form-section {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Ensure Share Story form inputs are visible */
.share-story-form input,
.share-story-form textarea,
.share-story-form select,
.kibo-direct-share-form input,
.kibo-direct-share-form textarea,
.kibo-direct-share-form select {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Fix for WordPress admin bar overlapping the React app */
body.admin-bar .kibo-journey-react-app {
  margin-top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar .kibo-journey-react-app {
    margin-top: 46px;
  }
}

/* Additional styles for Share Story page to ensure visibility */
body.kibo-page-share-story .share-story-container,
body.kibo-page-share-story .share-story-form,
.kibo-journey-share-story .share-story-container,
.kibo-journey-share-story .share-story-form {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Fix for WordPress themes that might hide form elements */
.kibo-journey-react-app .share-story-form label,
.kibo-journey-react-app .share-story-form input,
.kibo-journey-react-app .share-story-form textarea,
.kibo-journey-react-app .share-story-form button,
.kibo-direct-share-form label,
.kibo-direct-share-form input,
.kibo-direct-share-form textarea,
.kibo-direct-share-form button {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Make sure the Share Story page has enough space */
.kibo-journey-page.kibo-journey-share-story {
  min-height: 800px;
} 