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

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

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

.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;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
  text-decoration: none;
  color: var(--fd-muted-foreground);
  border: none;
  border-radius: 8px;
  background-color: transparent;
}

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

.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 {
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fd-primary);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1;
}

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

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

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

.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;
  overflow: hidden;
  flex: 1;
}

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

.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;
  color: var(--fd-muted-foreground);
  font-size: 0.875rem;
}

@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;
  max-width: 400px;
  padding: 2rem;
  text-align: center;
}

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

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

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

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

/* ===== 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;
}
