/* ===== 공통 컴포넌트 (레벨 2) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
  gap: 8px;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-bg-light);
  color: var(--color-text-light);
}

.btn-dark {
  background: var(--color-text-dark);
  color: #fff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.icon-btn:hover {
  color: var(--color-primary);
}

.text-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  transition: color 0.2s;
}

.text-btn:hover {
  color: var(--color-primary);
}

/* ===== 폼 요소 (레벨 2) ===== */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text-dark);
}

.form-group .sub-label {
  font-size: 11px;
  color: var(--color-text-light);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--color-primary);
}

.form-input.sm {
  padding: 9px;
  font-size: 13px;
  border-radius: 8px;
}

.form-select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 12px;
  background: var(--color-bg);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.form-range {
  width: 100%;
  cursor: pointer;
  accent-color: var(--color-primary);
  height: 5px;
}

/* ===== 모달 (레벨 3) ===== */
.modal-box {
  background: #fff;
  border-radius: 24px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.modal-lg {
  max-width: 800px;
}

.modal-header {
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--color-text-dark);
}

.modal-body {
  padding: 32px;
  overflow-y: auto;
}

.action-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.action-row.right {
  justify-content: flex-end;
}

/* ===== 랜딩 뷰 보완 (레벨 4) ===== */
.welcome-section {
  margin-bottom: 20px;
}

.trending-list {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--color-text-light);
  font-size: 14px;
}

/* ===== 필터 패널 (레벨 4) ===== */
.filter-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.separator {
  color: var(--color-border);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 8px 0;
}

.check-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text-dark);
  font-weight: 600;
  background: var(--color-bg);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  transition: all 0.2s;
}

.check-btn:hover {
  background: var(--color-bg-light);
}

.filter-footer {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
  margin-top: 10px;
}

.slider-group {
  flex: 1;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  color: var(--color-text-light);
  font-weight: 600;
}

/* 문의게시판 아코디언 */
.inquiry-item {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s;
}

.inquiry-item.is-ad-inquiry {
  border-color: rgba(249, 115, 22, 0.24);
  background: linear-gradient(180deg, #fffaf5 0%, #ffffff 65%);
}

.inquiry-item.is-new-inquiry {
  border-color: rgba(37, 99, 235, 0.35);
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 70%);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12), 0 12px 28px rgba(37, 99, 235, 0.08);
  animation: thisoneNewInquiryPulse 1.8s ease-out 1;
}

@keyframes thisoneNewInquiryPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.28), 0 14px 34px rgba(37, 99, 235, 0.12);
  }

  100% {
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12), 0 12px 28px rgba(37, 99, 235, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .inquiry-item.is-new-inquiry {
    animation: none;
  }
}

.inq-header {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
}

.inq-header:hover {
  background: var(--color-bg-light);
}

.inq-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inq-badge {
  width: 28px;
  height: 28px;
  background: #eff6ff;
  color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
}

.inq-info {
  display: flex;
  flex-direction: column;
}

.inq-title {
  font-weight: 700;
  color: var(--color-text-dark);
  font-size: 14px;
}


.inq-badge-ad {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
  vertical-align: middle;
}

.inq-meta {
  font-size: 11px;
  color: var(--color-text-light);
  margin-top: 2px;
}

.inq-content-area {
  display: none;
  padding: 20px;
  background: var(--color-bg-light);
  border-top: 1px solid var(--color-border);
}

.inq-content-area.show {
  display: block !important;
}

.inq-body {
  text-align: left;
  white-space: normal;
  font-size: clamp(13px, 2.4vw, 14px);
  line-height: 1.75;
  word-break: keep-all;
  overflow-wrap: anywhere;
  color: var(--color-text, #334155);
  margin-bottom: 16px;
}

.inq-body-paragraph {
  margin: 0 0 10px;
}

.inq-body-paragraph:last-child {
  margin-bottom: 0;
}

/* ===== AI 검색 결과 (추가) ===== */
/* 중복 규칙 제거됨: #msgContainer 및 .ai-result는 상단 레벨 4 섹션에서 정의됨 */


.pick-list {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2vw, 16px);
  width: 100%;
}

.pick-row-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.pick-row {
  display: flex;
  gap: clamp(8px, 2vw, 16px);
  padding: clamp(10px, 1.5vw, 16px);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: all 0.2s;
  align-items: stretch;
}

.pick-row:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.row-thumb {
  flex-shrink: 0;
  width: clamp(80px, 15vw, 120px);
  height: clamp(80px, 15vw, 120px);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.row-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 4px;
}

.row-header {
  width: 100%;
}

.row-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row-title {
  font-size: clamp(0.9rem, 1.2vw, 1.05rem);
  font-weight: 800;
  color: var(--color-text-dark);
  margin: 0;
  line-height: 1.3;
}

.row-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.row-badge-item {
  font-size: clamp(9px, 1vw, 11px);
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.row-positive-signal-badge {
  display: inline-flex;
  align-items: center;
  gap: clamp(2px, 0.5vw, 4px);
  padding: clamp(2px, 0.5vw, 3px) clamp(6px, 1vw, 8px);
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: clamp(10px, 1vw, 11px);
  font-weight: 700;
  line-height: 1.35;
}

.row-review-signal-badge,
.badge-review-signal {
  display: inline-flex;
  align-items: center;
  gap: clamp(2px, 0.5vw, 4px);
  padding: clamp(2px, 0.5vw, 3px) clamp(6px, 1vw, 8px);
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  white-space: nowrap;
  line-height: 1.35;
}

.row-label-badge { background: #eff6ff; color: #2563eb; }
.badge-value { background: #f0fdf4; color: #16a34a; border: 1px solid #dcfce7; }
.badge-trust { background: #fff7ed; color: #ea580c; border: 1px solid #ffedd5; }
.badge-thisone { background: #fef2f2; color: #dc2626; border: 1px solid #fee2e2; }
.badge-default { background: #f1f5f9; color: #64748b; }

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: clamp(11px, 1vw, 12px);
  color: var(--color-text-light);
}

.row-store-name { font-weight: 700; color: #475569; }

.row-price-area {
  flex-shrink: 0;
  width: clamp(100px, 17vw, 150px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(6px, 1vw, 10px);
  text-align: right;
}

.row-price {
  font-size: clamp(1.1rem, 1.5vw, 1.4rem);
  font-weight: 900;
  color: #ef4444;
  letter-spacing: -0.5px;
}

.row-price-rental {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: clamp(5px, 0.9vw, 8px);
}

.row-price-main {
  display: block;
}

.row-price-sub {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: clamp(1px, 0.4vw, 3px);
  font-size: clamp(10px, 1vw, 12px);
  font-weight: 700;
  color: #64748b;
  letter-spacing: -0.02em;
  line-height: 1.32;
}

.row-contract-line {
  display: block;
  max-width: min(100%, 12em);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.row-cta {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--color-primary);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}


.result-inquiry-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: clamp(12px, 2.4vw, 20px);
}

.result-inquiry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(100%, 18rem);
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: var(--color-primary);
  border-radius: 999px;
  padding: clamp(10px, 2vw, 14px) clamp(14px, 3vw, 22px);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}

.result-inquiry-btn:hover {
  border-color: var(--color-primary);
  background: #dbeafe;
}


.status-line {
  width: 100%;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 12px);
  position: relative;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: clamp(8px, 1.2vw, 12px) clamp(12px, 1.8vw, 16px);
  color: #334155;
  font-size: clamp(12px, 1.1vw, 14px);
}

.thinking-icon {
  color: var(--color-primary);
  font-weight: 800;
  flex-shrink: 0;
  animation: thinkingPulse 1.4s ease-in-out infinite;
}

.status-text {
  flex: 1;
  min-width: 0;
}

.status-line::after {
  content: "";
  position: absolute;
  left: -38%;
  bottom: 0;
  width: 38%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0), rgba(59, 130, 246, 0.85), rgba(59, 130, 246, 0));
  animation: thinkingProgressFlow 1.6s ease-in-out infinite;
}

.fallback-inline-btn {
  border: 1px solid rgba(59, 130, 246, 0.4);
  background: #fff;
  color: var(--color-primary);
  border-radius: 999px;
  font-size: clamp(11px, 1vw, 12px);
  font-weight: 700;
  padding: clamp(4px, 0.9vw, 8px) clamp(8px, 1.2vw, 12px);
  white-space: nowrap;
  cursor: pointer;
}

.fold-box {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  padding: 10px 14px;
}

.fold-box > summary {
  cursor: pointer;
  font-size: clamp(12px, 1.1vw, 13px);
  font-weight: 800;
  color: #64748b;
}

.fold-content {
  margin-top: 10px;
  font-size: clamp(12px, 1.05vw, 13px);
  color: #475569;
  line-height: 1.5;
}

/* 제외 상품 리스트 */
.reject-card {
  background: #f8fafc;
  border-radius: 16px;
  padding: 16px 20px;
  margin-top: 16px;
  border: 1px solid #f1f5f9;
}

.reject-title {
  font-weight: 800;
  color: #64748b;
  font-size: 13px;
  margin-bottom: 12px;
}

.reject-item {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #94a3b8;
}

/* 반응형 (모바일) - clamp 사용으로 대부분의 하드코딩 제거 */
@media (max-width: 640px) {
  body.search-mode .landing-view {
    width: 100%;
    position: sticky;
    top: var(--header-height);
    z-index: 10;
    background: #fff;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .search-wrap {
    width: 95% !important; /* 모바일에서 가로폭 확보 */
    margin: 0 auto;
  }

  body:not(.search-mode):not(.ai-tool-mode) .search-box {
    overflow: hidden;
  }

  body:not(.search-mode):not(.ai-tool-mode) .search-box .input-row {
    min-width: 0;
    gap: clamp(0.375rem, 1.8vw, 0.5rem);
  }

  body:not(.search-mode):not(.ai-tool-mode) .search-box .msg-input {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }

  body:not(.search-mode):not(.ai-tool-mode) .search-box .footer-right {
    flex: 0 1 auto;
    min-width: 0;
    gap: clamp(0.125rem, 1vw, 0.3125rem);
  }

  body:not(.search-mode):not(.ai-tool-mode) .search-box .footer-right > * {
    flex: 0 0 auto;
  }

  .pick-list {
    gap: clamp(6px, 1.8vw, 10px);
  }

  .pick-row {
    gap: clamp(6px, 1.8vw, 10px);
    padding: clamp(8px, 2vw, 10px);
    border-radius: 10px;
  }

  .row-thumb {
    width: clamp(72px, 21vw, 84px);
    height: clamp(72px, 21vw, 84px);
    border-radius: 6px;
  }

  .row-info {
    gap: clamp(2px, 0.9vw, 4px);
    padding: 0;
  }

  .row-title-line {
    gap: clamp(4px, 1vw, 6px);
  }

  .row-title {
    white-space: normal; /* 모바일에서 제품명 줄바꿈 허용 */
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .row-badges {
    gap: clamp(3px, 0.8vw, 4px);
  }

  .row-badge-item {
    padding: 1px 5px;
    line-height: 1.2;
  }

  .row-meta {
    gap: clamp(4px, 1vw, 6px);
    line-height: 1.22;
  }

  .row-description,
  .row-facts {
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .row-price-area {
    width: clamp(88px, 24vw, 102px);
    gap: clamp(4px, 1vw, 6px);
  }

  .row-price {
    line-height: 1.1;
  }

  .row-price-sub {
    gap: 1px;
    line-height: 1.2;
  }

  .row-cta {
    padding: 4px 8px;
    line-height: 1.2;
  }
}

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

@keyframes thinkingPulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes thinkingProgressFlow {
  0% { left: -38%; }
  100% { left: 100%; }
}



/* Legacy progress UI hard-disable */
.live-response,
#liveResponse,
.typing,
.typing-text,
.thinking,
.thinking-card,
.progress-text {
  display: none !important;
}

/* ===== Error states ===== */
.error-state {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.6vw, 12px);
  color: #475569;
  background: #f8fafc;
  border: 1px solid #dbeafe;
  border-radius: clamp(12px, 2vw, 18px);
  padding: clamp(12px, 2.5vw, 20px);
  font-size: clamp(13px, 1.6vw, 16px);
  line-height: 1.45;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.06);
}

.result-error-state {
  width: 100%;
}

.error-state-center {
  min-height: clamp(140px, 24vw, 240px);
  justify-content: center;
  text-align: center;
}

.error-state-inline {
  justify-content: flex-start;
}

.search-error-state {
  width: min(95%, 900px);
  margin: clamp(8px, 1.8vw, 14px) auto 0;
}

.error-state-icon {
  width: clamp(22px, 4vw, 30px);
  height: clamp(22px, 4vw, 30px);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  background: #2563eb;
  font-size: clamp(11px, 1.5vw, 14px);
  font-weight: 800;
}

.error-state-message {
  font-weight: 700;
  word-break: keep-all;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.error-state-aiDelay {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.error-state-apiFail,
.error-state-noResults {
  background: #f8fafc;
}

.error-state-imageFail {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.notice-stack {
  position: fixed;
  left: 50%;
  bottom: clamp(16px, 4vw, 32px);
  transform: translateX(-50%);
  width: min(92%, 520px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vw, 12px);
  z-index: var(--z-toast, 9999);
  pointer-events: none;
}

.notice-toast {
  width: 100%;
  padding: clamp(10px, 2vw, 14px) clamp(12px, 2.5vw, 18px);
  border-radius: clamp(10px, 2vw, 14px);
  color: #334155;
  background: #fff;
  border: 1px solid #dbeafe;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  font-size: clamp(12px, 1.4vw, 14px);
  font-weight: 700;
}

.notice-success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.notice-warning { border-color: #fed7aa; background: #fff7ed; color: #9a3412; }

@media (max-width: 640px) {
  .error-state {
    align-items: flex-start;
  }

  .error-state-center {
    min-height: clamp(120px, 42vw, 180px);
  }
}

