/* ===== AI Center — Single Page Auto-play Terminal ===== */

/* ── 베이스 ── */
.ai-page {
  background: #0a0b14;
  color: #e5e7eb;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

/* 파이프라인 끝나면 스크롤 허용 */
.ai-page.pipeline-done {
  overflow: auto;
  height: auto;
}

/* 모바일 메뉴 열렸을 때 overflow 허용 */
.ai-page.menu-open {
  overflow: visible;
}

body.mobile-menu-open .ai-page {
  overflow: visible;
}

/* 모바일 메뉴 다크 테마 */
.ai-page .mobile-menu-content {
  background: #111827;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-page .mobile-menu-header .logo text {
  fill: #fff !important;
}

.ai-page .mobile-menu-nav a {
  color: rgba(255, 255, 255, 0.7);
}

.ai-page .mobile-menu-nav a:hover,
.ai-page .mobile-menu-nav a.active {
  color: #fff;
}

.ai-page .mobile-menu-close {
  color: rgba(255, 255, 255, 0.5);
}

.ai-page *,
.ai-page *::before,
.ai-page *::after {
  box-sizing: border-box;
}

/* ── 다크 헤더 ── */
.ai-page .header {
  background: rgba(10, 11, 20, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-page .header .nav-link {
  color: rgba(255, 255, 255, 0.7);
}

.ai-page .header .nav-link:hover,
.ai-page .header .nav-link.active {
  color: #fff;
}

.ai-page .header .logo text:first-of-type {
  fill: #fff;
}

.ai-page .mobile-menu-btn span {
  background: #fff;
}

/* ── 인트로 (타이핑 → 사라짐) ── */
.ai-intro {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0b14;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.ai-intro.fade-out {
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

.ai-intro-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ai-intro-bg .grid-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(91, 79, 229, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 79, 229, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}

.ai-intro-bg .glow-1 {
  position: absolute;
  width: 600px;
  height: 600px;
  background: #5B4FE5;
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0.25;
  top: -200px;
  left: -150px;
}

.ai-intro-bg .glow-2 {
  position: absolute;
  width: 400px;
  height: 400px;
  background: #8B5CF6;
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0.2;
  bottom: -150px;
  right: -100px;
}

.intro-terminal {
  width: 680px;
  max-width: 90vw;
  background: #111827;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.intro-terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.t-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.t-dot.red { background: #EF4444; }
.t-dot.yellow { background: #F59E0B; }
.t-dot.green { background: #10B981; }

.intro-terminal-title {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
}

.intro-terminal-body {
  padding: 2rem;
  min-height: 80px;
}

.intro-prompt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
}

.intro-prompt .ps1 {
  color: #10B981;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.intro-prompt .cursor {
  display: inline-block;
  width: 9px;
  height: 1.15em;
  background: #5B4FE5;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  flex-shrink: 0;
}

@keyframes blink {
  50% { opacity: 0; }
}

.intro-subtitle {
  margin-top: 2rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.intro-subtitle span {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.2);
  animation: pulse-hint 2s ease-in-out infinite;
}

@keyframes pulse-hint {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.4; }
}

/* ── 메인 섹션 (터미널 + 사이드) ── */
.ai-main {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 65px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.ai-main.visible {
  opacity: 1;
}

.pipeline-done .ai-main {
  height: auto;
  min-height: 100vh;
}

/* ── 프로그레스 바 ── */
.pipeline-progress {
  flex-shrink: 0;
  padding: 0.75rem 2rem;
  background: rgba(10, 11, 20, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar {
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3B82F6, #8B5CF6, #10B981, #F59E0B, #EF4444);
  border-radius: 2px;
  transition: width 0.8s ease;
}

.stage-indicators {
  display: flex;
  justify-content: space-between;
}

.stage-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.3s ease;
}

.stage-dot-circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.stage-dot.active .stage-dot-circle {
  background: var(--dot-color);
  border-color: var(--dot-color);
  box-shadow: 0 0 10px var(--dot-color);
}

.stage-dot.done .stage-dot-circle {
  background: var(--dot-color);
  border-color: var(--dot-color);
  opacity: 0.4;
}

.stage-dot-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.15);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
}

.stage-dot.active .stage-dot-label {
  color: rgba(255, 255, 255, 0.7);
}

.stage-dot.done .stage-dot-label {
  color: rgba(255, 255, 255, 0.3);
}

/* ── 메인 레이아웃 ── */
.pipeline-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  min-height: 0; /* grid 내부 overflow 허용 */
}

/* ── 메인 터미널 ── */
.main-terminal {
  background: #111827;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.main-terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.main-terminal-title {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.3);
}

.main-terminal-body {
  flex: 1;
  padding: 1rem 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.75;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.main-terminal-body::-webkit-scrollbar {
  width: 5px;
}
.main-terminal-body::-webkit-scrollbar-track {
  background: transparent;
}
.main-terminal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

/* ── 터미널 라인 ── */
.tl {
  white-space: pre-wrap;
  word-break: break-all;
  padding: 1px 0;
}

.tl-header {
  color: #60A5FA;
  font-weight: 700;
  font-size: 0.8rem;
}

.tl-system {
  color: #A78BFA;
  font-weight: 600;
}

.tl-info { color: rgba(255, 255, 255, 0.5); }
.tl-cmd { color: rgba(255, 255, 255, 0.65); }
.tl-warn { color: #FBBF24; }
.tl-success { color: #34D399; }

.tl-tree {
  color: rgba(255, 255, 255, 0.35);
  padding-left: 1.5rem;
}

.tl-box {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.7rem;
}

.tl-box-item {
  /* padding 제거, spacer로 정렬 */
}

.tl-box-end {
  /* padding 제거, spacer로 정렬 */
}

.tl-time-spacer {
  display: inline-block;
  width: 8.5ch; /* [HH:MM:SS] 와 동일 너비 */
}

.tl-box-title {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

.tl-box-line {
  color: rgba(255, 255, 255, 0.12);
}

.tl-link { color: #60A5FA; }

.tl-divider {
  color: #A78BFA;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.3rem 0;
}

.tl-result { color: rgba(255, 255, 255, 0.75); }

.tl-prompt-line {
  color: rgba(255, 255, 255, 0.6);
  padding-top: 0.3rem;
}

.tl-blank { height: 0.4em; }

.tl-time {
  color: rgba(255, 255, 255, 0.18);
  margin-right: 0.5rem;
}

.tl-bracket {
  font-weight: 700;
  margin-right: 0.5rem;
}

.tl-arrow {
  color: #5B4FE5;
  margin-right: 0.3rem;
}

.tl-command { color: #C4B5FD; }
.tl-warn-icon { margin-right: 0.3rem; }
.tl-ok { margin-right: 0.3rem; }
.tl-indent { color: transparent; }

.tl-url {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tl-ps1 {
  color: #10B981;
  margin-right: 0.5rem;
}

.tl-typing {
  border-right: 2px solid #5B4FE5;
  animation: blink 1s step-end infinite;
}

.tl-stage-divider {
  padding: 0.75rem 0 0.3rem;
  margin-top: 0.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* ── 사이드 패널 ── */
.side-panel-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}

.side-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 1.5rem;
  transition: border-color 0.5s ease;
  flex: 1;
}

.sp-enter {
  animation: sp-slide-in 0.4s ease;
}

@keyframes sp-slide-in {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

.sp-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
}

.sp-icon { font-size: 1.1rem; }

.sp-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.sp-desc {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.sp-tools-label {
  display: block;
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}

.sp-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.sp-tool {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.02);
}

/* ── CTA (터미널 하단) ── */
.ai-cta {
  flex-shrink: 0;
  text-align: center;
  padding: 1rem 2rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.ai-cta.visible {
  opacity: 1;
  transform: translateY(0);
}

.ai-cta-text {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}

.ai-cta-text strong {
  color: #fff;
  font-weight: 700;
}

.ai-cta-buttons {
  display: flex;
  gap: 0.75rem;
}

.btn-primary-ai {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.5rem;
  background: linear-gradient(135deg, #5B4FE5, #8B5CF6);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-primary-ai:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(91, 79, 229, 0.4);
}

.btn-outline-ai {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.5rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-outline-ai:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.btn-replay {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-replay:hover {
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
}

/* ── 푸터 다크 ── */
.ai-page .footer {
  background: #060710;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: none;
}

.pipeline-done .footer {
  display: block;
}

/* ── MCP 카드 섹션 ── */
.mcp-cards-section {
  padding: 6rem 2rem;
  background: #0f1020;
  display: none;
}

.pipeline-done .mcp-cards-section {
  display: block;
}

.mcp-cards-section .section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.mcp-cards-section .section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: #8B5CF6;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 0.75rem;
}

.mcp-cards-section .section-title {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.3;
}

.mcp-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
}

.mcp-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 1.75rem 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
}

.mcp-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.mcp-card:hover {
  border-color: var(--card-color, rgba(255, 255, 255, 0.12));
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.mcp-card-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.mcp-card-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.25rem;
}

.mcp-card-tag {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--card-color, #8B5CF6);
  margin-bottom: 0.75rem;
  display: block;
}

.mcp-card-desc {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.6;
}

/* ── 하단 CTA 섹션 ── */
.ai-cta-section {
  padding: 5rem 2rem;
  background: linear-gradient(180deg, #0f1020 0%, #1a1040 100%);
  text-align: center;
  display: none;
}

.pipeline-done .ai-cta-section {
  display: block;
}

.ai-cta-section h2 {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 0.75rem;
}

.ai-cta-section p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 2.5rem;
}

.ai-cta-section .cta-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* ── 반응형 MCP 카드 ── */
@media (max-width: 1024px) {
  .mcp-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .mcp-cards-section {
    padding: 4rem 1rem;
  }

  .mcp-cards-section .section-title {
    font-size: 1.5rem;
  }

  .mcp-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .mcp-card {
    padding: 1.25rem 1rem;
  }

  .ai-cta-section h2 {
    font-size: 1.5rem;
  }

  .ai-cta-section .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
}

/* ── 반응형 ── */
@media (max-width: 1024px) {
  .pipeline-layout {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .side-panel-wrap {
    display: none; /* 모바일에서는 터미널만 */
  }
}

@media (max-width: 768px) {
  .ai-page {
    height: 100vh;
    height: 100dvh;
  }

  .intro-terminal {
    width: 95vw;
  }

  .intro-prompt {
    font-size: 0.8rem;
  }

  .pipeline-progress {
    padding: 0.5rem 1rem;
  }

  .stage-dot-label {
    font-size: 0.45rem;
  }

  .main-terminal-body {
    font-size: 0.62rem;
    padding: 0.75rem;
  }

  .ai-cta {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .ai-cta-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tl, .sp-enter, .intro-prompt .cursor, .ai-intro {
    animation: none !important;
    transition: none !important;
  }
}
