/* ═══════════════════════════════════════════════════════════
   AI Product Comparator – style.css  v3.1
   Aesthetic: Clean editorial / 화이트 베이스 / 고가독성
   Font: Pretendard (Korean) + DM Sans (영문 헤더)
═══════════════════════════════════════════════════════════ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;600;700;800&display=swap');

/* ── 토큰 ── */
:root {
  --c-bg:        #f7f8fa;
  --c-white:     #ffffff;
  --c-border:    #e4e7ec;
  --c-border2:   #d0d5dd;
  --c-text:      #111827;
  --c-sub:       #6b7280;
  --c-muted:     #9ca3af;

  --c-a:         #2563eb;          /* 상품 A – 블루 */
  --c-a-soft:    #eff6ff;
  --c-a-mid:     #bfdbfe;
  --c-b:         #dc2626;          /* 상품 B – 레드 */
  --c-b-soft:    #fef2f2;
  --c-b-mid:     #fecaca;
  --c-win:       #16a34a;          /* 승자 */
  --c-win-soft:  #f0fdf4;
  --c-win-badge: #dcfce7;

  --c-accent:    #7c3aed;          /* 포인트 – 퍼플 */
  --c-tie:       #f59e0b;

  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   18px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:      0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg:   0 12px 40px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);

  --font-body:   'Pretendard', -apple-system, sans-serif;
  --font-head:   'DM Sans', 'Pretendard', sans-serif;
}

/* ── 래퍼 ── */
.aipc-app {
  font-family: var(--font-body);
  color: var(--c-text);
  background: var(--c-bg);
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 0 64px;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════
   HERO – 깔끔한 화이트 헤더
══════════════════════════════════════ */
.aipc-hero {
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  padding: 36px 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aipc-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--c-accent);
  background: #f5f3ff;
  border: 1px solid #e9d5ff;
  border-radius: 100px;
  padding: 4px 12px;
  width: fit-content;
}
.aipc-hero-badge::before { content: '✦'; font-size: 9px; }

.aipc-hero-title {
  font-family: var(--font-head);
  font-size: clamp(22px, 3.5vw, 34px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.5px;
  color: var(--c-text);
  margin: 0;
  padding: 0;
  border: none;          /* 일부 테마 h2 border 초기화 */
}

/* ══════════════════════════════════════
   상품 헤더 카드 (2열)
══════════════════════════════════════ */
.aipc-product-headers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--c-border);
  margin-bottom: 0;
}

.aipc-product-header {
  background: var(--c-white);
  padding: 24px 32px;
  position: relative;
}
.aipc-product-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.aipc-product-header-a::before { background: var(--c-a); }
.aipc-product-header-b::before { background: var(--c-b); }

.aipc-product-header h2 {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.3;
}
.aipc-product-header-a h2 { color: var(--c-a); }
.aipc-product-header-b h2 { color: var(--c-b); }

.aipc-product-tagline {
  font-size: 13px;
  color: var(--c-sub);
  line-height: 1.5;
}

/* ══════════════════════════════════════
   비교 테이블 섹션
══════════════════════════════════════ */
.aipc-result {
  background: var(--c-white);
  border-top: 1px solid var(--c-border);
}

.aipc-table-section {
  border-bottom: 1px solid var(--c-border);
}
.aipc-table-section:last-of-type { border-bottom: none; }

.aipc-table-section-title {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--c-muted);
  padding: 18px 32px 12px;
  border-bottom: 1px solid var(--c-border);
  background: #fafbfc;
  display: flex;
  align-items: center;
  gap: 8px;
}
.aipc-table-section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--c-accent);
  border-radius: 2px;
}

/* 테이블 */
.aipc-compare-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.aipc-compare-table thead th {
  padding: 11px 24px 11px 32px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: left;
  background: #f9fafb;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-sub);
}
.aipc-compare-table thead th:first-child { width: 160px; color: var(--c-muted); }
.aipc-compare-table thead th:nth-child(2) { color: var(--c-a); }
.aipc-compare-table thead th:nth-child(3) { color: var(--c-b); }

/* 행 */
.aipc-compare-table tbody tr {
  border-bottom: 1px solid var(--c-border);
  transition: background .12s;
}
.aipc-compare-table tbody tr:last-child { border-bottom: none; }
.aipc-compare-table tbody tr:hover { background: #fafbfc; }

/* 승자 행 */
.aipc-row-win-a { background: var(--c-a-soft) !important; }
.aipc-row-win-a:hover { background: #dbeafe !important; }
.aipc-row-win-b { background: var(--c-b-soft) !important; }
.aipc-row-win-b:hover { background: #fee2e2 !important; }

/* 셀 */
.aipc-compare-table td {
  padding: 14px 24px 14px 32px;
  font-size: 14px;
  vertical-align: middle;
  line-height: 1.5;
}
.aipc-compare-table td:first-child {
  font-size: 13px;
  color: var(--c-sub);
  font-weight: 500;
  width: 160px;
}
.aipc-compare-table td:nth-child(2),
.aipc-compare-table td:nth-child(3) {
  font-weight: 500;
  color: var(--c-text);
}

/* WIN 배지 */
.aipc-win-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 100px;
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}
.aipc-win-a-badge {
  background: var(--c-a);
  color: #fff;
}
.aipc-win-b-badge {
  background: var(--c-b);
  color: #fff;
}

/* 비교 노트 */
.aipc-compare-note {
  font-size: 12px;
  color: var(--c-sub);
  margin-top: 3px;
  font-weight: 400;
}

/* ══════════════════════════════════════
   요약 – 강점 카드
══════════════════════════════════════ */
.aipc-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--c-border);
  border-top: 1px solid var(--c-border);
}

.aipc-summary-strengths {
  background: var(--c-white);
  padding: 28px 32px;
}
.aipc-summary-strengths h4 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.aipc-summary-strengths h4::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.aipc-summary-strengths-a h4 { color: var(--c-a); }
.aipc-summary-strengths-a h4::before { background: var(--c-a); }
.aipc-summary-strengths-b h4 { color: var(--c-b); }
.aipc-summary-strengths-b h4::before { background: var(--c-b); }

.aipc-summary-strengths ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.aipc-summary-strengths ul li {
  font-size: 13.5px;
  color: var(--c-text);
  line-height: 1.5;
  padding-left: 18px;
  position: relative;
}
.aipc-summary-strengths ul li::before {
  content: '✓';
  position: absolute;
  left: 0;
  font-size: 12px;
  font-weight: 700;
}
.aipc-summary-strengths-a ul li::before { color: var(--c-a); }
.aipc-summary-strengths-b ul li::before { color: var(--c-b); }

/* ══════════════════════════════════════
   AI 추천
══════════════════════════════════════ */
.aipc-recommendation {
  background: var(--c-white);
  border-top: 1px solid var(--c-border);
  padding: 28px 32px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.aipc-recommendation-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.aipc-recommendation-body { flex: 1; }
.aipc-recommendation h4 {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--c-accent);
  margin: 0 0 8px;
}
.aipc-recommendation p {
  font-size: 14px;
  line-height: 1.75;
  color: var(--c-text);
  margin: 0;
}

/* ══════════════════════════════════════
   반응형 — 태블릿
══════════════════════════════════════ */
@media (max-width: 860px) {
  .aipc-compare-table td:first-child { width: 120px; }
  .aipc-summary-strengths { padding: 20px 24px; }
}

/* ══════════════════════════════════════
   모바일 — 카드 스택형 (680px 이하)
   구조: 항목명 → A행 → B행 으로 세로 쌓기
══════════════════════════════════════ */
@media (max-width: 680px) {

  /* ── 히어로 ── */
  .aipc-hero { padding: 22px 16px 18px; }
  .aipc-hero-title { font-size: 20px; letter-spacing: -0.3px; }

  /* ── 상품 헤더: 좌우 유지 (이름 비교용) ── */
  .aipc-product-headers { grid-template-columns: 1fr 1fr; gap: 1px; }
  .aipc-product-header  { padding: 14px 16px; }
  .aipc-product-header h2 { font-size: 14px; line-height: 1.3; }
  .aipc-product-tagline   { font-size: 11px; }

  /* ── 섹션 타이틀 ── */
  .aipc-table-section-title { padding: 13px 16px 11px; font-size: 11.5px; letter-spacing: 1px; color: var(--c-sub); }

  /* ══════════════════════════════════════
     테이블 → 카드 스택 변환
     각 <tr>이 하나의 비교 카드가 됨
     ┌──────────────────────┐
     │  항목명              │  ← 회색 라벨
     ├──────────────────────┤
     │ 🔵 A  값  [WIN]      │  ← A 행
     ├──────────────────────┤
     │ 🔴 B  값             │  ← B 행
     └──────────────────────┘
  ══════════════════════════════════════ */
  .aipc-compare-table          { display: block; margin-top: 12px; }  /* 섹션 타이틀과 첫 카드 사이 간격 */
  .aipc-compare-table thead    { display: none; }   /* 열 헤더 숨김 */
  .aipc-compare-table tbody    { display: block; }

  /* tr = 카드 1장 (margin 가운데 값 = 좌우 여백) */
  .aipc-compare-table tbody tr {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    margin: 0 8px 10px;
    overflow: hidden;
    background: var(--c-white);
    box-shadow: var(--shadow-sm);
  }
  /* 호버·WIN 행 오버라이드 초기화 */
  .aipc-compare-table tbody tr:hover { background: var(--c-white); }
  .aipc-row-win-a,
  .aipc-row-win-b { background: var(--c-white) !important; }

  /* ── 항목명 셀 (td:first-child) ── */
  .aipc-compare-table td:first-child {
    width: 100%;
    background: #eef0f3;
    border-bottom: 1px solid var(--c-border);
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    letter-spacing: 0.2px;
    order: 0;
  }

  /* ── A 값 셀 (td:nth-child(2)) ── */
  /* flex column → 칩(::before)이 값 위 별도 줄에 놓임 */
  .aipc-compare-table td:nth-child(2) {
    order: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 13px 16px;
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.55;
    color: var(--c-text);
    border-bottom: 1px solid var(--c-border);
    position: relative;
    background: var(--c-white);
  }
  /* A 라벨 — 전체 상품명, 자체 줄, 길면 줄바꿈 */
  .aipc-compare-table td:nth-child(2)::before {
    content: attr(data-label-a);
    display: inline-block;
    max-width: 100%;
    font-size: 11px;
    font-weight: 800;
    color: var(--c-a);
    background: var(--c-a-soft);
    border: 1px solid var(--c-a-mid);
    border-radius: 4px;
    padding: 2px 7px;
    letter-spacing: 0.3px;
    line-height: 1.35;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }
  /* WIN인 경우 A셀 배경 */
  .aipc-row-win-a td:nth-child(2) {
    background: var(--c-a-soft) !important;
  }

  /* ── B 값 셀 (td:nth-child(3)) ── */
  .aipc-compare-table td:nth-child(3) {
    order: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 13px 16px;
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.55;
    color: var(--c-text);
    background: var(--c-white);
  }
  /* B 라벨 — 전체 상품명, 자체 줄, 길면 줄바꿈 */
  .aipc-compare-table td:nth-child(3)::before {
    content: attr(data-label-b);
    display: inline-block;
    max-width: 100%;
    font-size: 11px;
    font-weight: 800;
    color: var(--c-b);
    background: var(--c-b-soft);
    border: 1px solid var(--c-b-mid);
    border-radius: 4px;
    padding: 2px 7px;
    letter-spacing: 0.3px;
    line-height: 1.35;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }
  /* WIN인 경우 B셀 배경 */
  .aipc-row-win-b td:nth-child(3) {
    background: var(--c-b-soft) !important;
  }

  /* ── 비교 노트는 B셀 안에서 들여쓰기 ── */
  .aipc-compare-note {
    display: block;
    font-size: 12.5px;
    color: var(--c-sub);
    font-weight: 400;
    line-height: 1.5;
    margin-top: 5px;
    padding-left: 2px;
  }

  /* ── WIN 배지 ── */
  .aipc-win-badge { font-size: 10px; padding: 2px 7px; margin-left: 6px; }

  /* ── 카드 사이 섹션 여백 ── */
  .aipc-table-section { padding-bottom: 6px; }

  /* ── 요약 강점 ── */
  .aipc-summary          { grid-template-columns: 1fr; }
  .aipc-summary-strengths { padding: 18px 16px; }
  .aipc-summary-strengths h4     { font-size: 13px; }
  .aipc-summary-strengths ul li  { font-size: 13px; }

  /* ── AI 추천 ── */
  .aipc-recommendation { padding: 18px 16px; flex-direction: column; gap: 10px; }
  .aipc-recommendation-icon { width: 36px; height: 36px; font-size: 16px; border-radius: 8px; }
  .aipc-recommendation p { font-size: 13px; line-height: 1.7; }
}
