/**
 * @file
 * FlowDrop Playground Component Styles
 *
 * Styles for the interactive workflow playground interface.
 */

/* ===== Container ===== */
.fd-playground {
  display: flex;
  flex-direction: column;
  background-color: var(--fd-background);
  color: var(--fd-foreground);
  font-family: var(--fd-font-family, system-ui, -apple-system, sans-serif);
  position: relative;
  overflow: hidden;
}

/* ===== Header ===== */
.fd-playground__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  min-height: 56px;
  padding: 0 1rem;
  background-color: var(--fd-playground-header-bg, #0f0f0f);
  border-bottom: 1px solid var(--fd-playground-header-border, #2a2a2a);
  z-index: 100;
}

.fd-playground__header-start {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.fd-playground__header-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Back button */
.fd-playground__back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--fd-muted-foreground);
  background-color: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.fd-playground__back-btn:hover {
  background-color: var(--fd-playground-btn-hover-bg, #2a2a2a);
  color: var(--fd-foreground);
  text-decoration: none;
}

.fd-playground__back-btn:active {
  background-color: var(--fd-playground-btn-active-bg, #333);
}

.fd-playground__back-btn svg {
  width: 20px;
  height: 20px;
}

/* Header divider */
.fd-playground__header-divider {
  width: 1px;
  height: 24px;
  background-color: var(--fd-playground-header-border, #2a2a2a);
}

/* Workflow info */
.fd-playground__workflow-info {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.fd-playground__workflow-label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fd-primary);
  line-height: 1;
}

.fd-playground__workflow-name {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fd-foreground);
  line-height: 1.3;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Action button */
.fd-playground__action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fd-muted-foreground);
  background-color: transparent;
  border: 1px solid var(--fd-playground-btn-border, #3a3a3a);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}

.fd-playground__action-btn:hover {
  background-color: var(--fd-playground-btn-hover-bg, #2a2a2a);
  color: var(--fd-foreground);
  border-color: var(--fd-playground-btn-hover-border, #4a4a4a);
  text-decoration: none;
}

.fd-playground__action-btn:active {
  background-color: var(--fd-playground-btn-active-bg, #333);
}

.fd-playground__action-btn svg {
  width: 18px;
  height: 18px;
}

/* Hide text on small screens */
@media (max-width: 480px) {
  .fd-playground__action-btn span {
    display: none;
  }

  .fd-playground__action-btn {
    padding: 0.5rem;
  }

  .fd-playground__workflow-name {
    max-width: 150px;
  }
}

/* ===== Content Container ===== */
.fd-playground__content {
  position: relative;
  flex: 1;
  overflow: hidden;
}

/* ===== Loading State ===== */
.fd-playground__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  background-color: var(--fd-background);
  z-index: 50;
}

.fd-playground__loading-spinner {
  width: 48px;
  height: 48px;
  animation: fd-playground-spin 1s linear infinite;
}

.fd-playground__spinner-icon {
  width: 100%;
  height: 100%;
  color: var(--fd-primary);
}

.fd-playground__loading-text {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--fd-muted-foreground);
}

@keyframes fd-playground-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ===== Error State ===== */
.fd-playground--error {
  display: flex;
  align-items: center;
  justify-content: center;
}

.fd-playground__error {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  max-width: 400px;
}

.fd-playground__error-icon {
  color: var(--fd-error);
  margin-bottom: 1rem;
}

.fd-playground__error-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--fd-foreground);
  margin: 0 0 0.5rem;
}

.fd-playground__error-message {
  font-size: 0.875rem;
  color: var(--fd-muted-foreground);
  margin: 0 0 1rem;
}

.fd-playground__error-hint {
  font-size: 0.75rem;
  color: var(--fd-muted-foreground);
  margin: 0;
}

/* ===== Hidden when Svelte mounts ===== */
.fd-playground[data-flowdrop-initialized="true"] .fd-playground__loading {
  display: none;
}

/* Content should fill available space when initialized */
.fd-playground[data-flowdrop-initialized="true"] .fd-playground__content {
  display: flex;
  flex-direction: column;
}