@charset "UTF-8";

/* [AI 데모 위젯]
 * 새 디자인 시스템을 도입하지 않는다. 색·보더·배경은 전부 homepage_tokens.css의 변수만 쓰고,
 * 버튼은 기존 .btn(primary/outline + 크기), 입력은 기존 .form-input 을 그대로 재사용한다.
 * 그래서 라이트/다크 전환은 :root.light-mode 토큰 오버라이드로 자동 처리된다.
 * 반투명 값을 직접 쓴 곳만 .light-mode 짝을 따로 둔다.
 */

/* ===== 히어로 ===== */
.ai-hero {
  padding: 100px 0 60px;
  text-align: center;
  border-bottom: none; /* 전역 section 규칙의 구분선을 히어로에서만 뺀다 */
}

.ai-hero h1 {
  font-size: 3rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 16px;
  line-height: 1.2;
}

.ai-hero p {
  color: var(--text-sub);
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto;
  word-break: keep-all;
}

/* ===== 상시 안내 + 혼잡도 배지 ===== */
.ai-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

.ai-info-text {
  flex: 1 1 420px;
  min-width: 0;
}

.ai-info-main {
  color: var(--text-main);
  font-size: 0.92rem;
  line-height: 1.6;
  word-break: keep-all;
}

.ai-info-sub {
  margin-top: 6px;
  color: var(--text-sub);
  font-size: 0.85rem;
  line-height: 1.6;
  word-break: keep-all;
}

.ai-queue-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  transition: 0.3s;
}

.ai-queue-badge.is-busy {
  background: rgba(234, 179, 8, 0.12);
  color: #eab308;
  border-color: rgba(234, 179, 8, 0.3);
}

.ai-queue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: ai-pulse 1.6s ease-in-out infinite;
}

/* 기능별 예상 시간 */
.ai-eta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-sub);
  font-size: 0.82rem;
  word-break: keep-all;
}

.ai-eta i {
  color: var(--primary);
}

/* ===== 탭 (솔루션 상세의 .sol-cat-tab 톤을 그대로 따름) ===== */
.ai-demo-section {
  padding: 40px 0 100px;
}

.ai-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 32px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.ai-tabs::-webkit-scrollbar {
  display: none;
}

.ai-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-sub);
  cursor: pointer;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}

.ai-tab:hover {
  color: var(--text-main);
}

.ai-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.light-mode .ai-tab:hover {
  color: #0f172a;
}

/* hidden 속성이 항상 이기도록.
 * .ai-panel / .ai-notice 처럼 display 를 선언한 요소는 작성자 스타일이 UA 의
 * [hidden]{display:none} 을 덮어써서 숨겨지지 않는다. id 셀렉터로 특이도를 올려 되돌린다. */
#ai-demo-root [hidden] {
  display: none;
}

/* ===== 패널 (기존 .value-card / .contact-form 표면 패턴) ===== */
.ai-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 32px;
  transition: 0.3s;
}

.ai-panel-head h2 {
  font-size: 1.5rem;
  color: var(--text-main);
  margin-bottom: 8px;
}

.ai-panel-head p {
  color: var(--text-sub);
  font-size: 0.95rem;
  margin-bottom: 8px;
  word-break: keep-all;
}

.ai-panel-head .ai-eta {
  margin-bottom: 24px;
}

/* ===== 대화 ===== */
.ai-chat-log {
  height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--bg-deep);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  margin-bottom: 16px;
}

.ai-msg {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.ai-msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-msg-bot {
  align-self: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.ai-msg-error {
  border-color: #ef4444;
  color: #ef4444;
}

/* 응답 대기 중 말풍선 — 스피너 + 진행 문구 */
.ai-msg-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-sub);
}

.ai-chat-empty {
  margin: auto;
  color: var(--text-sub);
  font-size: 0.9rem;
  text-align: center;
  word-break: keep-all;
}

/* ===== 입력 행 ===== */
.ai-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.ai-row .form-input {
  flex: 1;
}

/* 전역 textarea.form-input(height:120px)을 대화 입력에서만 낮춘다 */
textarea.ai-chat-input {
  height: 56px;
  min-height: 56px;
  max-height: 160px;
  resize: none;
  line-height: 1.5;
}

.ai-row .btn {
  align-self: stretch;
}

.ai-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  color: var(--text-sub);
  font-size: 0.9rem;
  word-break: keep-all;
}

.ai-status.is-error {
  color: #ef4444;
}

.ai-counter {
  color: var(--text-sub);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ===== 스피너 (기존에 로딩 UI가 없어 새로 정의) ===== */
@keyframes ai-spin {
  to {
    transform: rotate(360deg);
  }
}

.ai-spinner {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  border-top-color: var(--primary);
  animation: ai-spin 0.7s linear infinite;
}

/* ===== 이미지 ===== */
.ai-options {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.ai-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-sub);
  font-size: 0.9rem;
}

.ai-option select.form-input {
  width: auto;
  padding: 10px 14px;
  cursor: pointer;
}

.ai-check {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.ai-hint {
  color: var(--text-sub);
  font-size: 0.8rem;
  word-break: keep-all;
}

.ai-option select.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-image-stage {
  margin-top: 24px;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--img-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}

.ai-image-stage img {
  display: block;
  max-width: 100%;
  height: auto;
}

.ai-image-placeholder {
  color: var(--text-sub);
  font-size: 0.9rem;
  padding: 20px;
  text-align: center;
  word-break: keep-all;
}

.ai-enhanced {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-deep);
  border: 1px solid var(--card-border);
  border-radius: 8px;
}

.ai-enhanced-label {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ai-enhanced p {
  color: var(--text-sub);
  font-size: 0.9rem;
  line-height: 1.6;
  word-break: keep-all;
}

/* ===== 음성 ===== */
.ai-voice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.ai-voice-card {
  background: var(--bg-deep);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
}

.ai-voice-card h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.ai-voice-card > p {
  color: var(--text-sub);
  font-size: 0.9rem;
  margin-bottom: 6px;
  word-break: keep-all;
}

.ai-voice-card .ai-eta {
  margin-bottom: 20px;
}

.ai-transcript {
  margin-top: 16px;
  min-height: 84px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: keep-all;
}

.ai-transcript:empty::before {
  content: attr(data-placeholder);
  color: var(--text-sub);
}

.ai-audio {
  width: 100%;
  margin-top: 16px;
}

.ai-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: ai-pulse 1s ease-in-out infinite;
}

@keyframes ai-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

/* ===== 고지 / 안내 ===== */
.ai-notice {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: var(--text-sub);
  font-size: 0.85rem;
  line-height: 1.6;
  word-break: keep-all;
}

.ai-notice i {
  margin-top: 3px;
  color: var(--primary);
}

/* 비활성 상태 — 전역 .btn 에 영향 주지 않도록 위젯 안으로 한정 */
#ai-demo-root .btn:disabled,
#ai-demo-root .ai-tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#ai-demo-root .btn:disabled:hover {
  transform: none;
}

/* ===== 반응형 (기존 브레이크포인트와 동일한 지점) ===== */
@media (max-width: 900px) {
  .ai-voice-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .ai-hero {
    padding: 60px 0 40px;
  }
  .ai-hero h1 {
    font-size: 2rem;
  }
  .ai-panel {
    padding: 20px;
  }
  .ai-tab {
    padding: 10px 16px 12px;
    font-size: 0.9rem;
  }
  .ai-chat-log {
    height: 320px;
    padding: 14px;
  }
  .ai-msg {
    max-width: 88%;
  }
  .ai-row {
    flex-direction: column;
  }
  .ai-row .btn {
    width: 100%;
  }
}
