/* ==========================================================================
   AI Roadmap Demo  —  .demo-*
   Loaded by: demo.html, resume.html

   resume.html reuses the form, field and loading styles from here rather than
   duplicating them, so this file is NOT demo.html-only. Check both pages
   before changing a .demo-* rule.

   Perceived-speed work matters here: generation takes ~10s, so the page shows
   structure immediately rather than a dead spinner.
   ========================================================================== */

/* --- Form ---------------------------------------------------------------- */

.demo-field {
  margin-bottom: 1.5rem;
}

.demo-input,
.demo-textarea,
.demo-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-dark);
  background: #fff;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.demo-textarea {
  resize: vertical;
  min-height: 88px;
}

.demo-input:focus,
.demo-textarea:focus,
.demo-select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.demo-input.is-invalid,
.demo-textarea.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.demo-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.demo-char-count {
  font-size: 0.8rem;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.demo-char-count.is-visible {
  opacity: 1;
}

.demo-char-count.is-near {
  color: #b45309;
}

/* --- Example prefill ----------------------------------------------------- */

.demo-example-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 2rem;
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}

.demo-example-text {
  font-size: 0.9rem;
  color: var(--text-light);
  margin: 0;
}

.demo-example-btn {
  border: 1.5px solid var(--primary-blue);
  color: var(--primary-blue);
  background: #fff;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.demo-example-btn:hover {
  background: var(--primary-blue);
  color: #fff;
}

/* --- Submit button ------------------------------------------------------- */

.demo-submit:disabled {
  opacity: 0.75;
  cursor: progress;
}

.demo-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 0.5rem;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: demo-spin 0.7s linear infinite;
}

@keyframes demo-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Status line --------------------------------------------------------- */

.demo-status {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-light);
  min-height: 1.4rem;
  margin-top: 1rem;
}

.demo-error {
  text-align: center;
  color: #dc2626;
  font-weight: 500;
  margin-top: 1rem;
}

/* --- Phase cards --------------------------------------------------------- */

.demo-phase {
  background: #fff;
  border: 1px solid #e8edf3;
  border-radius: 14px;
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
}

.demo-phase-days {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary-blue);
  background: rgba(59, 130, 246, 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.demo-phase-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1.1rem;
  line-height: 1.3;
}

.demo-todo-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.demo-todo {
  position: relative;
  padding-left: 1.9rem;
  margin-bottom: 0.7rem;
  line-height: 1.6;
}

.demo-todo::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--primary-blue);
}

.demo-milestone {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.9rem 1.1rem;
  background: rgba(249, 115, 22, 0.07);
  border-left: 3px solid var(--accent-orange);
  border-radius: 0 8px 8px 0;
  line-height: 1.55;
}

.demo-milestone-label {
  font-weight: 700;
  color: #c2410c;
  white-space: nowrap;
}

/* Staggered reveal — each card lands just after the one above it. */
.demo-reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: demo-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.demo-reveal:nth-child(2) {
  animation-delay: 0.09s;
}
.demo-reveal:nth-child(3) {
  animation-delay: 0.18s;
}

@keyframes demo-rise {
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Skeleton ------------------------------------------------------------ */

.demo-skeleton-line {
  height: 0.85rem;
  border-radius: 6px;
  margin-bottom: 0.7rem;
  background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%);
  background-size: 400% 100%;
  animation: demo-shimmer 1.5s ease-in-out infinite;
}

.demo-skeleton-line.is-title {
  height: 1.4rem;
  width: 55%;
  margin-bottom: 1.2rem;
}

.demo-skeleton-line.is-short {
  width: 70%;
}

.demo-skeleton-line.is-pill {
  height: 1.3rem;
  width: 88px;
  border-radius: 999px;
  margin-bottom: 1rem;
}

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

/* --- Result actions ------------------------------------------------------ */

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 2rem;
}

.demo-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1.5px solid #d7dee8;
  background: #fff;
  color: var(--text-dark);
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    color 0.18s ease,
    background 0.18s ease;
}

.demo-action:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.demo-action.is-done {
  border-color: #16a34a;
  color: #16a34a;
}

.demo-disclaimer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 1.5rem;
  line-height: 1.6;
}

/* --- Motion and print ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .demo-reveal,
  .demo-skeleton-line,
  .demo-spinner {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

@media print {
  header,
  footer,
  .demo-actions,
  .demo-example-bar,
  #roadmapForm,
  .hero-gradient {
    display: none !important;
  }
  .demo-phase {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

@media (max-width: 640px) {
  .demo-phase {
    padding: 1.25rem;
  }
  .demo-milestone {
    flex-direction: column;
    gap: 0.25rem;
  }
  .demo-action {
    flex: 1 1 auto;
    justify-content: center;
  }
}

/* --- Wizard --------------------------------------------------------------- */

.demo-progress-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  padding: 1rem 0 1.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid #eef2f7;
}

.demo-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-light);
}

.demo-progress-pct {
  font-weight: 700;
  color: var(--primary-blue);
  font-variant-numeric: tabular-nums;
}

.demo-progress-track {
  height: 7px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.demo-progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-blue), #60a5fa);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.demo-progress-bar.is-complete {
  background: linear-gradient(90deg, #16a34a, #4ade80);
}

/* Steps: only one is mounted at a time, so transitions stay simple. */
.demo-step {
  display: none;
  animation: demo-step-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.demo-step.is-active {
  display: block;
}

@keyframes demo-step-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.demo-step-kicker {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-blue);
  margin-bottom: 0.4rem;
}

.demo-step-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.demo-step-hint {
  color: var(--text-light);
  margin-bottom: 1.75rem;
  line-height: 1.6;
}

.demo-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 2rem;
}

.demo-back {
  border: none;
  background: none;
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.55rem 0.25rem;
}

.demo-back:hover {
  color: var(--text-dark);
}

.demo-back[hidden] {
  visibility: hidden;
}

.demo-next {
  margin-left: auto;
}

.demo-hint-key {
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.75rem;
}

.demo-hint-key kbd {
  font-family: inherit;
  font-size: 0.75rem;
  border: 1px solid #d7dee8;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  background: #f8fafc;
}

/* --- Review step --------------------------------------------------------- */

.demo-review-list {
  border: 1px solid #e8edf3;
  border-radius: 12px;
  overflow: hidden;
}

.demo-review-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.94rem;
}

.demo-review-row:last-child {
  border-bottom: none;
}

.demo-review-key {
  flex: 0 0 40%;
  color: var(--text-light);
}

.demo-review-val {
  flex: 1;
  color: var(--text-dark);
  font-weight: 600;
  word-break: break-word;
}

.demo-review-edit {
  border: none;
  background: none;
  color: var(--primary-blue);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

.demo-review-edit:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .demo-review-row {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .demo-review-key {
    flex: 0 0 100%;
  }
  .demo-step-title {
    font-size: 1.28rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-step {
    animation: none !important;
  }
  .demo-progress-bar {
    transition: none !important;
  }
}
