/* ═══════════════════════════════════════════════════════════
   Product Compare — Floating Bar + Modal
   ═══════════════════════════════════════════════════════════ */

/* ── Floating Bar ── */
.pc-bar {
  position: fixed; bottom: -80px; left: 50%; transform: translateX(-50%);
  z-index: 900; transition: bottom .3s ease;
}
.pc-bar-show { bottom: 20px; }
.pc-bar-inner {
  display: flex; align-items: center; gap: 10px;
  background: var(--card, #fff); border-radius: 24px; padding: 8px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15); border: 1px solid var(--border, #e2e8f0);
}
.pc-bar-items { display: flex; gap: 6px; }
.pc-bar-chip {
  display: flex; align-items: center; gap: 4px;
  background: var(--primary-light, #dbeafe); border-radius: 14px; padding: 4px 8px;
  font-size: 12px; max-width: 140px;
}
.pc-bar-thumb { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; }
.pc-bar-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-bar-chip-x {
  border: none; background: none; cursor: pointer; font-size: 14px;
  color: var(--text2, #64748b); padding: 0 2px; line-height: 1;
}
.pc-bar-chip-x:hover { color: #dc2626; }
.pc-bar-btn {
  background: var(--primary, #2563eb); color: #fff; border: none;
  border-radius: 16px; padding: 8px 18px; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.pc-bar-btn:hover { opacity: .9; }
.pc-bar-clear {
  border: none; background: none; font-size: 18px; cursor: pointer;
  color: var(--text2, #64748b); padding: 0 4px;
}
.pc-bar-clear:hover { color: #dc2626; }

/* ── Modal ── */
.pc-modal {
  position: fixed; inset: 0; z-index: 1100;
  display: none; align-items: flex-end; justify-content: center;
}
.pc-modal-show { display: flex; }
.pc-modal-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.5);
  animation: pcFadeIn .2s ease;
}
.pc-modal-content {
  position: relative; z-index: 1;
  width: 100%; max-width: 800px; max-height: 85vh;
  background: var(--card, #fff); border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column;
  animation: pcSlideUp .3s ease;
}
@keyframes pcFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pcSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.pc-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border, #e2e8f0);
}
.pc-modal-header h2 { font-size: 18px; font-weight: 700; }
.pc-modal-close {
  border: none; background: none; font-size: 24px; cursor: pointer;
  color: var(--text2, #64748b); padding: 0 4px;
}
.pc-modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }

/* ── Comparison Layout ── */
.pc-products {
  display: grid; gap: 12px; margin-bottom: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border, #e2e8f0);
}
.pc-product-head { text-align: center; }
.pc-head-img { width: 80px; height: 80px; object-fit: cover; border-radius: 10px; margin-bottom: 6px; }
.pc-head-placeholder {
  width: 80px; height: 80px; margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg, #f8fafc); border-radius: 10px; font-size: 28px;
}
.pc-head-name { font-size: 13px; font-weight: 600; line-height: 1.3; margin-bottom: 2px; }
.pc-head-price { font-size: 14px; font-weight: 700; color: var(--primary, #2563eb); }

.pc-matrix { margin-bottom: 16px; }
.pc-row {
  display: grid; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border, #f1f5f9); font-size: 13px;
}
.pc-row:last-child { border-bottom: none; }
.pc-label { color: var(--text2, #64748b); font-weight: 500; }
.pc-val { font-weight: 600; color: var(--text, #1e293b); }

/* ── AI Section ── */
.pc-ai-section {
  background: var(--bg, #f8fafc); border-radius: 12px; padding: 14px 16px;
  margin-bottom: 12px;
}
.pc-ai-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.pc-ai-section p { font-size: 13px; line-height: 1.6; color: var(--text2, #475569); }
.pc-ai-recommend { background: rgba(37,99,235,.06); }
.pc-ai-recommend h3 { color: var(--primary, #2563eb); }

/* ── Loading / Error ── */
.pc-loading { text-align: center; padding: 40px; color: var(--text2); font-size: 14px; }
.pc-error { text-align: center; padding: 40px; color: #dc2626; font-size: 14px; }

/* ── Toast ── */
.pc-toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 20px;
  font-size: 13px; opacity: 0; transition: opacity .3s, transform .3s; z-index: 1200;
  pointer-events: none;
}
.pc-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Compare Button on Card ── */
.mpc-compare-btn.pc-selected { background: var(--primary, #2563eb); color: #fff; }

/* ── Mobile ── */
@media (max-width: 600px) {
  .pc-modal-content { max-width: 100%; border-radius: 16px 16px 0 0; }
  .pc-bar-chip-name { max-width: 60px; }
  .pc-products, .pc-row { gap: 8px; }
  .pc-label { font-size: 11px; }
  .pc-head-img, .pc-head-placeholder { width: 56px; height: 56px; }
}
