/* ============================================
   AI Opportunity Explorer — Styles
   Brand: #2563eb | Mobile-first | Zero deps
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #eff6ff;
  --brand-bg: #f0f5ff;
  --orange: #f97316;
  --green: #10b981;
  --purple: #8b5cf6;
  --navy: #0f172a;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 32px rgba(37, 99, 235, 0.1);
  --duration: 0.25s;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.app-header {
  background: var(--brand);
  color: white;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.25);
  position: relative;
  z-index: 20;
}

.app-header__left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header__back {
  color: white;
  text-decoration: none;
  font-size: 20px;
  line-height: 1;
  opacity: 0.8;
}

.app-header__back:hover {
  opacity: 1;
}

.app-header__title {
  font-size: 16px;
  font-weight: 700;
}

.app-header__subtitle {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 1px;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
}

.mode-toggle__btn {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 18px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-family: var(--font);
}

.mode-toggle__btn.is-active {
  background: white;
  color: var(--brand);
  font-weight: 600;
}

/* ── Stepper ── */
.stepper {
  background: var(--card);
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stepper__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--border-light);
  color: var(--text-light);
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}

.stepper__dot.is-done {
  background: #dcfce7;
  color: #16a34a;
}

.stepper__dot.is-active {
  background: var(--brand);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.stepper__line {
  flex: 1;
  height: 2px;
  background: var(--border-light);
  transition: background var(--duration) var(--ease);
}

.stepper__line.is-done {
  background: #86efac;
}

.stepper__label {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Main Container ── */
.app-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 100px;
}

.context-card {
  background: linear-gradient(135deg, #ffffff, #eff6ff);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.context-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.context-card__desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}

.context-card__meta {
  font-size: 12px;
  color: var(--brand-dark);
  margin-top: 8px;
}

.context-card__preview {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.context-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.context-card__btn {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
}

.context-card__btn--primary {
  background: var(--brand);
  color: #fff;
}

.context-card__btn--ghost {
  background: #fff;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── Step Section ── */
.step-section {
  display: none;
  animation: fadeIn var(--duration) var(--ease);
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--navy);
}

.step-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Category Cards (Step 1) ── */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.category-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-align: left;
  font-family: var(--font);
}

.category-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.category-card.is-active {
  border-color: var(--brand);
  background: var(--brand-light);
}

.category-card__icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.category-card__name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--navy);
}

.category-card__desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.category-card__count {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--brand);
  font-weight: 600;
}

/* ── Industry Cards (Step 2) ── */
.industry-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.industry-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-align: left;
  font-family: var(--font);
  width: 100%;
}

.industry-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.industry-card.is-active {
  border-color: var(--brand);
  background: var(--brand-light);
}

.industry-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.industry-card__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

.industry-card__stars {
  display: flex;
  gap: 2px;
}

.star {
  font-size: 12px;
  color: #d4d4d8;
}

.star.is-filled {
  color: #fbbf24;
}

.industry-card__summary {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.industry-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 500;
}

/* ── Pain Point Cards (Step 3) ── */
.pain-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pain-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-align: left;
  font-family: var(--font);
  width: 100%;
}

.pain-card:hover {
  border-color: var(--brand);
}

.pain-card.is-active {
  border-color: var(--brand);
  background: var(--brand-light);
}

.pain-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pain-card__severity {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}

.pain-card__severity.high {
  background: #fef2f2;
  color: #dc2626;
}
.pain-card__severity.medium {
  background: #fffbeb;
  color: #d97706;
}
.pain-card__severity.low {
  background: #f0fdf4;
  color: #16a34a;
}

.pain-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.pain-card__symptoms {
  margin-top: 8px;
  padding-left: 16px;
  list-style: none;
}

.pain-card__symptoms li {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  position: relative;
  padding-left: 4px;
}

.pain-card__symptoms li::before {
  content: "·";
  position: absolute;
  left: -12px;
  color: var(--brand);
  font-weight: bold;
}

.pain-card__interview {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fffbeb;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: #92400e;
  line-height: 1.6;
}

.pain-card__interview strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Solution Cards (Step 4) ── */
.solution-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.solution-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.solution-card__header {
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--duration) var(--ease);
}

.solution-card__header:hover {
  background: var(--brand-light);
}

.solution-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.solution-card__difficulty {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.solution-card__arrow {
  font-size: 14px;
  transition: transform var(--duration) var(--ease);
  color: var(--text-muted);
}

.solution-card.is-open .solution-card__arrow {
  transform: rotate(180deg);
}

.solution-card__body {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border-light);
}

.solution-card.is-open .solution-card__body {
  display: block;
}

.solution-card__desc {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 12px;
}

.solution-card__flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

.flow-box {
  background: var(--brand-light);
  border-radius: var(--radius-xs);
  padding: 8px;
  text-align: center;
}

.flow-box__label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.flow-box__content {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
}

.flow-arrow {
  color: var(--brand);
  font-size: 16px;
  text-align: center;
}

.solution-card__stacks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.stack-chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 14px;
  background: #f0fdf4;
  color: #15803d;
  font-weight: 500;
}

.solution-card__anti {
  padding: 10px 12px;
  background: #fef2f2;
  border-radius: var(--radius-xs);
  font-size: 12px;
  color: #991b1b;
  line-height: 1.6;
  margin-bottom: 12px;
}

.solution-card__mode {
  padding: 10px 12px;
  background: var(--brand-light);
  border-radius: var(--radius-xs);
  font-size: 12px;
  line-height: 1.6;
  color: var(--brand-dark);
}

/* ── Validation Plan (Step 5) ── */
.validation-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.validation-card__section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.validation-card__section:last-child {
  border-bottom: none;
}

.validation-card__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.validation-card__text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.validation-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.timeline-item__day {
  flex-shrink: 0;
  width: 50px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  padding-top: 2px;
}

.timeline-item__text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

.signal-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.signal-box {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  line-height: 1.6;
}

.signal-box.success {
  background: #f0fdf4;
  color: #166534;
}

.signal-box.fail {
  background: #fef2f2;
  color: #991b1b;
}

.signal-box strong {
  display: block;
  margin-bottom: 3px;
}

/* ── Bookmark Bar ── */
.bookmark-bar {
  margin-top: 20px;
  padding: 12px 16px;
  background: #fffbeb;
  border-radius: var(--radius);
  border: 1px solid #fde68a;
}

.bookmark-bar__title {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 6px;
}

.bookmark-bar__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bookmark-chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 14px;
  background: white;
  border: 1px solid #fde68a;
  color: #92400e;
  cursor: pointer;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 4px;
}

.bookmark-chip__remove {
  font-size: 14px;
  opacity: 0.5;
}

/* ── Sticky Footer Actions ── */
.footer-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  z-index: 15;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}

.footer-actions .btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-prev {
  background: var(--border-light);
  color: var(--text-muted);
}

.btn-prev:hover {
  background: var(--border);
}

.btn-next {
  background: var(--brand);
  color: white;
}

.btn-next:hover {
  background: var(--brand-dark);
}

.btn-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-bookmark {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border) !important;
  flex: 0 0 auto;
  width: 44px;
}

.btn-bookmark.is-saved {
  color: #f59e0b;
  border-color: #fde68a !important;
  background: #fffbeb;
}

.btn-share {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border) !important;
  flex: 0 0 auto;
  width: 44px;
}

/* ── SEO / Static Content ── */
.seo-section {
  max-width: 720px;
  margin: 40px auto 0;
  padding: 0 16px 60px;
}

.seo-section h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}

.seo-section p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 12px;
}

.seo-section details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}

.seo-section summary {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--navy);
}

.seo-section details[open] summary {
  border-bottom: 1px solid var(--border-light);
}

.seo-section details p {
  padding: 12px 16px;
  margin: 0;
}

/* ── Print Styles ── */
@media print {
  .app-header,
  .stepper,
  .footer-actions,
  .mode-toggle,
  .bookmark-bar,
  .btn-bookmark,
  .btn-share {
    display: none !important;
  }

  body {
    background: white;
    font-size: 12pt;
  }

  .app-main {
    padding: 0;
    max-width: 100%;
  }

  .step-section {
    display: block !important;
    page-break-inside: avoid;
  }

  .solution-card__body {
    display: block !important;
  }

  .solution-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    margin-bottom: 12px;
  }

  .validation-card {
    break-inside: avoid;
  }
}

/* ── Responsive ── */
@media (min-width: 640px) {
  .category-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .app-main {
    padding: 24px 24px 100px;
  }

  .step-title {
    font-size: 24px;
  }
}

/* ── Tool Stack ── */
.tool-stack-section {
  margin-top: 0;
}

.tool-stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.tool-stack-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.tool-stack-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  gap: 6px;
}

.tool-stack-card__name {
  font-weight: 700;
  font-size: 14px;
  color: var(--navy);
}

.tool-stack-card__price {
  font-size: 11px;
  background: #f0fdf4;
  color: #16a34a;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tool-stack-card__platform {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.tool-stack-card__use {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
