/* Loading, empty, and error states for spec generation and the workspace. */

.flow-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  width: min(100%, 520px);
  margin: 0.5rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid #e7e7e7;
  border-radius: 14px;
  background: #fff;
  color: #171717;
  font-family: "Montserrat", "Segoe UI", sans-serif;
  text-align: start;
}

.workspace-grid > .flow-state,
.workspace-grid > .flow-loading {
  grid-column: 1 / -1;
  width: min(100%, 640px);
}

.flow-state__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: #171717;
}

.flow-state__message,
.flow-state__next {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #333;
}

.flow-state__next-label {
  font-weight: 700;
}

.flow-state__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.flow-state__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #171717;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.flow-state__btn--primary {
  background: #b33a00;
  border-color: #b33a00;
  color: #fff;
}

.flow-state__btn--primary:hover,
.flow-state__btn--secondary:hover {
  background: #9a3412;
  border-color: #9a3412;
  color: #fff;
}

.flow-state__btn:focus-visible {
  outline: 2px solid #171717;
  outline-offset: 2px;
}

.flow-progress {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: min(100%, 320px);
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: #fff7f3;
  border: 1px solid #f0d2c4;
  color: #171717;
  font-family: "Montserrat", "Segoe UI", sans-serif;
}

.flow-progress__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.flow-progress__current {
  margin: 0;
  font-size: 0.85rem;
  color: #333;
}

.flow-progress__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.flow-progress__step {
  font-size: 0.8rem;
  color: #666;
}

.flow-progress__step.is-current {
  color: #171717;
  font-weight: 700;
}

.flow-progress__step.is-done {
  color: #3d3d3d;
}

.flow-progress__track,
.flow-loading__track {
  height: 6px;
  border-radius: 999px;
  background: #f0e4dc;
  overflow: hidden;
}

.flow-progress__fill,
.flow-loading__fill {
  display: block;
  height: 100%;
  background: #b33a00;
}

.flow-loading__fill {
  width: 40%;
  animation: flow-loading-slide 1.2s ease-in-out infinite;
}

@keyframes flow-loading-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

.flow-loading {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(100%, 640px);
}

.flow-loading__label {
  margin: 0;
  font-family: "Montserrat", "Segoe UI", sans-serif;
  font-size: 0.95rem;
  color: #333;
}

.flow-skeleton {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.flow-skeleton__card {
  height: 112px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f3f3f3 0%, #e7e7e7 50%, #f3f3f3 100%);
  background-size: 200% 100%;
  animation: flow-skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes flow-skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.lb-msg--creating .flow-progress,
.lb-msg--flow .flow-state {
  width: min(100%, 360px);
}

.flow-generation-host:not([hidden]) {
  margin: 0 0 0.75rem;
}

.spec-viewer-page #error .flow-state {
  margin: 1.5rem auto;
}

@media (max-width: 640px) {
  .flow-state,
  .flow-progress,
  .flow-loading {
    width: 100%;
  }

  .flow-state__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .flow-state__btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-loading__fill,
  .flow-skeleton__card {
    animation: none;
  }
}
