/* CSS Variables for theming support */
:root {
  --educo-bg-color: #ffffff;
  --educo-text-color: #2d3748;
  --educo-border-color: #e2e8f0;
  --educo-error-bg: #fed7d7;
  --educo-error-text: #9b2c2c;
  --educo-spinner-color: #3182ce;
}

/* Shadow DOM host styles - isolates from external styles without breaking internal ones */
:host {
  display: block;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--educo-text-color, #2d3748);
  background-color: transparent;
  /* Reset inherited text properties from host page */
  font-style: normal;
  font-weight: normal;
  text-align: left;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
}

/* Shadow DOM container */
.educo-shadow-container {
  display: block;
  width: 100%;
}

.educo-wrapper {
  position: relative;
  overflow: hidden;
  color: var(--educo-text-color, #2d3748);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.educo-spinner {
  text-align: center;
  padding: 20px;
}

.spinner-circle {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid var(--educo-spinner-color, #3498db);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

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

.educo-spinner p {
  margin: 0;
  color: var(--educo-text-color, #666);
  font-size: 14px;
}

/* Error states */
.educo-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--educo-error-text, #721c24);
  background-color: var(--educo-error-bg, #f8d7da);
  border-radius: 4px;
  margin: 20px;
}

.educo-error-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.8;
}

.educo-error-message {
  font-size: 16px;
  margin-bottom: 20px;
  line-height: 1.4;
}

.educo-error-actions {
  margin-top: 20px;
}

.educo-retry-btn {
  background-color: #dc3545;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.educo-retry-btn:hover {
  background-color: #c82333;
}

.educo-retry-btn:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Customizable theme classes */
.educo-theme-light {
  --educo-bg-color: #ffffff;
  --educo-text-color: #2d3748;
  --educo-border-color: #e2e8f0;
  --educo-spinner-color: #3182ce;
}

.educo-theme-dark {
  --educo-bg-color: #2d3748;
  --educo-text-color: #e2e8f0;
  --educo-border-color: #4a5568;
  --educo-spinner-color: #63b3ed;
}

/* Additional customizable classes for users */
.educo-custom-border {
  border-width: 2px;
  border-style: solid;
}

.educo-custom-shadow {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.educo-custom-rounded {
  border-radius: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .educo-wrapper {
    min-height: 300px;
  }

  .educo-error {
    padding: 20px 15px;
    margin: 10px;
  }

  .educo-error-icon {
    font-size: 32px;
  }

  .educo-error-message {
    font-size: 14px;
  }
}
