/**
 * Syncle AI Rich Cards CSS
 * 채팅 내 인라인 프로덕트 캐러셀 + 비교 테이블 + 조건 배지 스타일
 */

/* ==================== 캐러셀 래퍼 ==================== */

.rich-cards-carousel-wrapper {
  position: relative;
  margin: 12px 0;
  overflow: visible;
}

.rich-cards-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 2px 8px;
}

.rich-cards-carousel::-webkit-scrollbar {
  display: none;
}

/* ==================== 캐러셀 네비게이션 버튼 ==================== */

.carousel-scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s ease;
  color: #333;
}

.carousel-scroll-btn:hover {
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

.carousel-left {
  left: -12px;
}

.carousel-right {
  right: -12px;
}

/* ==================== 리치 카드 ==================== */

.rich-product-card {
  flex: 0 0 220px;
  scroll-snap-align: start;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.rich-product-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* 카드 이미지 영역 */
.rich-card-image {
  position: relative;
  width: 100%;
  height: 120px;
  background: linear-gradient(135deg, #f0f2f5 0%, #e8eaed 100%);
  overflow: hidden;
}

.rich-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rich-card-image.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
}

.rich-card-image.no-image::after {
  content: '\f1ad';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 28px;
  color: #bbb;
}

/* AI 배지 */
.rich-card-ai-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

/* 매칭 점수 배지 */
.match-score-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

/* 카드 본문 */
.rich-card-body {
  padding: 10px 12px;
}

/* 카테고리 + 인원수 + 임대타입 한 줄 */
.rich-card-meta-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.rich-card-category {
  font-size: 11px;
  color: #6366f1;
  font-weight: 600;
  display: inline-block;
}

/* 인원수, 임대타입 칩 */
.rich-card-info-chip {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  line-height: 1.4;
}

.capacity-chip {
  color: #d97706;
  background: rgba(245, 158, 11, 0.1);
}

.rental-type-chip {
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
}

/* 검색 결과 개수 표시 */
.rich-cards-count {
  font-size: 12px;
  color: #6366f1;
  font-weight: 600;
  padding: 4px 0 8px;
}

.rich-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rich-card-price {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 4px;
}

.rich-card-location {
  font-size: 11px;
  color: #888;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* 추천 이유 태그 */
.rich-card-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.reason-tag {
  font-size: 10px;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* 카드 액션 버튼 */
.rich-card-actions {
  display: flex;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.rich-card-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: #888;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rich-card-action-btn:hover {
  color: #333;
  background: rgba(0, 0, 0, 0.03);
}

.rich-card-action-btn.bookmark-btn.bookmarked {
  color: #ef4444;
}

.rich-card-action-btn.bookmark-btn.bookmarked svg {
  fill: #ef4444;
}

.rich-card-action-btn + .rich-card-action-btn {
  border-left: 1px solid rgba(0, 0, 0, 0.05);
}

/* ==================== 비교 테이블 ==================== */

.comparison-table-wrapper {
  margin: 12px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.comparison-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.comparison-table th,
.comparison-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.comparison-table thead th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

.compare-header {
  min-width: 120px;
}

.compare-category {
  display: block;
  font-size: 10px;
  color: #6366f1;
  font-weight: 600;
  margin-bottom: 2px;
}

.compare-title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.3;
}

.compare-label {
  text-align: left !important;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
  min-width: 80px;
  background: #fafafa;
}

.compare-actions td {
  padding: 10px 12px;
}

.compare-detail-link {
  display: inline-block;
  padding: 4px 10px;
  background: #6366f1;
  color: #fff !important;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.compare-detail-link:hover {
  background: #4f46e5;
}

/* ==================== 조건 배지 (이해한 조건) ==================== */

.understood-conditions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(99, 102, 241, 0.04);
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: 10px;
  margin-bottom: 8px;
}

.conditions-label {
  font-size: 11px;
  color: #888;
  font-weight: 500;
  margin-right: 4px;
}

.condition-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: #333;
  background: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-weight: 500;
}

.condition-chip[data-type="location"] {
  border-color: rgba(59, 130, 246, 0.2);
  background: rgba(59, 130, 246, 0.05);
}

.condition-chip[data-type="category"] {
  border-color: rgba(99, 102, 241, 0.2);
  background: rgba(99, 102, 241, 0.05);
}

.condition-chip[data-type="price"] {
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.05);
}

.condition-chip[data-type="capacity"] {
  border-color: rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.05);
}

/* ==================== 스트리밍 커서 ==================== */

.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #6366f1;
  margin-left: 2px;
  animation: blink-cursor 0.8s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.streaming-message .message-content {
  min-height: 24px;
}

/* ==================== 반응형 ==================== */

@media (max-width: 767px) {
  .rich-product-card {
    flex: 0 0 180px;
  }

  .rich-card-image {
    height: 100px;
  }

  .rich-card-body {
    padding: 8px 10px;
  }

  .rich-card-title {
    font-size: 12px;
  }

  .carousel-scroll-btn {
    display: none !important;
  }

  .comparison-table {
    font-size: 11px;
  }

  .compare-header {
    min-width: 100px;
  }
}
