*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #fff;
  color: #1a1a1a;
  font-family: Arial, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Root container ── */
#chat-root {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
}

/* ── Header ── */
#chat-header {
  background: #f36f21;
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

#chat-title {
  font-size: 14px;
  font-weight: bold;
  margin: 0;
  color: white;
}

.header-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

#btn-new-chat {
  background: none;
  border: 1px solid white;
  border-radius: 10px;
  padding: 8px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  font-family: inherit;
}
#btn-new-chat:hover { background: rgba(255,255,255,0.15); }

#btn-fullscreen {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

/* ── Chat messages area ── */
#chat {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
  margin-top: 16px;
}

#chat::-webkit-scrollbar { width: 6px; }
#chat::-webkit-scrollbar-track { background: transparent; }
#chat::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* ── Timestamp label ── */
.msg-label {
  font-size: 14px;
  color: #777;
  font-weight: normal;
  margin-bottom: 2px;
}
.msg-label.user { align-self: flex-end; }
.msg-label.ai   { align-self: flex-start; }

/* ── Message bubble wrapper ── */
.msg-wrap {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* ── Bubble ── */
.bubble-outer {
  background: #dae1e7;
  border-radius: 14px;
  max-width: 100%;
  font-size: 14px;
  font-weight: normal;
  flex-shrink: 0;
}
.bubble-outer.user {
  align-self: flex-end;
  margin-left: auto;
  margin-right: 0;
}
.bubble-outer.ai {
  align-self: flex-start;
  margin-left: 0;
  margin-right: auto;
}

.bubble-inner {
  color: #000;
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  white-space: pre-wrap;
  word-break: break-word;
  font-weight: 500;
  font-size: 15px;
  font-family: Arial, sans-serif;
}

/* ── Loading / shimmer ── */
.loading-message {
  position: relative;
  color: #000;
  display: inline-block;
  font-style: italic;
  opacity: 0.8;
}
.loading-message::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 25%,
    rgba(255,255,255,0.7) 50%,
    transparent 75%
  );
  background-size: 200% 100%;
  animation: shimmerText 2s linear infinite;
  pointer-events: none;
}
@keyframes shimmerText {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Product carousel container ── */
.carousel-container {
  margin-top: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
  position: relative;
  overflow-x: hidden;
  overflow-y: visible;
  max-width: 100%;
  flex-shrink: 0;
}

.carousel-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding: 0 24px;
  scroll-snap-type: x mandatory;
  max-width: 100%;
  scrollbar-width: none;
  min-height: 435px;
  align-items: flex-start;
}
.carousel-track::-webkit-scrollbar { display: none; }

/* ── Arrow buttons ── */
.arrow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #f36f21;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.arrow-btn.left  { left: 4px; }
.arrow-btn.right { right: 4px; }
.arrow-btn.hidden { display: none; }

/* ── Compare row ── */
.compare-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.compare-trigger-btn {
  padding: 6px 12px;
  border-radius: 20px;
  border: none;
  background: #f36f21;
  font-size: 12px;
  cursor: pointer;
  color: white;
  font-family: inherit;
}

/* ── Product card ── */
.productCard {
  min-width: 230px;
  max-width: 230px;
  min-height: 435px;
  max-height: 435px;
  flex-shrink: 0;
  background: #f9f9f9;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  border: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scroll-snap-align: start;
  position: relative;
}

@media (max-width: 420px) {
  .productCard { min-width: 340px !important; }
}
@media (min-width: 420px) and (max-width: 576px) {
  .productCard { min-width: 245px !important; }
}
@media (min-width: 576px) and (max-width: 760px) {
  .productCard { min-width: 260px !important; }
}
@media (min-width: 772px) and (max-width: 992px) {
  .productCard { min-width: 280px !important; }
}
@media (min-width: 992px) and (max-width: 1200px) {
  .productCard { max-width: 250px !important; }
}

/* ── Card: see-reviews badge ── */
.card-reviews-badge {
  position: absolute;
  top: 13px;
  left: 13px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  z-index: 2;
  cursor: pointer;
}
.card-reviews-star {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  animation: pulseRotateBounce 2.5s infinite;
}
.card-reviews-text {
  font-size: 10px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
}
@keyframes pulseRotateBounce {
  0%   { transform: scale(1) rotate(0deg) translateY(0); }
  30%  { transform: scale(1.1) rotate(-6deg) translateY(-2px); }
  60%  { transform: scale(1.1) rotate(6deg) translateY(-2px); }
  100% { transform: scale(1) rotate(0deg) translateY(0); }
}

/* ── Card: image ── */
.card-image {
  width: 100%;
  height: 140px;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 10px;
  background: #fff;
  flex-shrink: 0;
  margin-top: 30px;
}
.card-image-placeholder {
  width: 100%;
  height: 140px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 10px;
  margin-top: 30px;
  border-radius: 6px;
}

/* ── Card: name ── */
.card-name {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  line-height: 1.4;
  word-break: break-word;
  color: black;
}

/* ── Card: price ── */
.card-price {
  color: #f36f21;
  font-weight: bold;
  font-size: 12px;
  min-height: 10px;
  flex-shrink: 0;
}

/* ── Card: buttons area ── */
.card-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.card-btn-view {
  background: #f36f21;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  width: 100%;
  font-size: 12px;
  font-family: inherit;
  text-decoration: none;
  display: block;
  text-align: center;
}
.card-btn-view:hover { background: #e65a0f; }

.card-btn-cart {
  display: block;
  background: #f36f21;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  font-size: 12px;
  width: 100%;
  text-align: center;
}
.card-btn-cart:hover { background: #e65a0f; }

.card-btn-panel {
  display: block;
  background: #6c757d;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  font-weight: bold;
  font-size: 12px;
  width: 100%;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
}

.card-btn-compare {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  width: 100%;
  font-family: inherit;
  transition: all 0.15s;
}
.card-btn-compare.selected {
  background: #f36f21;
  color: #fff;
  border-color: #f36f21;
}

/* ── Comparison table wrapper ── */
.comparison-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid #e0e0e0;
  background: #fff;
}

/* ── Review card ── */
.review-card {
  margin-top: 12px;
  max-width: 320px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #eee;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.review-product-label {
  font-size: 12px;
  text-transform: uppercase;
  color: #f36f21;
  margin-bottom: 6px;
}
.review-avatar-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.review-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f36f21;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  margin-right: 8px;
  flex-shrink: 0;
}
.review-author-name {
  font-weight: 700;
  font-size: 14px;
}
.review-greeting {
  font-size: 12px;
  color: #555;
  background: #f7f7f7;
  padding: 6px 10px;
  border-radius: 16px;
  display: inline-block;
  margin-bottom: 10px;
}
.review-body {
  border-radius: 10px;
  border: 1px solid #f1f1f1;
  padding: 10px 12px;
  background: #fff;
  margin-bottom: 10px;
}
.review-rating-row {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}
.review-star { color: #f36f21; margin-right: 6px; }
.review-summary {
  font-size: 12px;
  color: #444;
  margin-bottom: 8px;
}
.review-link {
  flex: 1;
  background: #f36f21;
  color: #fff;
  padding: 8px 10px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
  text-align: center;
  display: block;
}
.review-link:hover { background: #e65a0f; }

/* ── Input form ── */
#input-form {
  display: flex;
  padding: 12px;
  border-top: 1px solid #ddd;
  background: #fff;
  align-items: center;
  flex-shrink: 0;
}

#input {
  flex: 1;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid #ccc;
  resize: none;
  font-size: 14px;
  margin-right: 8px;
  font-family: inherit;
  color: black;
  outline: none;
  line-height: 1.4;
  max-height: 120px;
  overflow-y: auto;
}
#input:focus { border-color: #f36f21; }

#send {
  padding: 8px 12px;
  border-radius: 50%;
  background: #ccc;
  color: #fff;
  border: none;
  cursor: not-allowed;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  transition: background 0.15s;
}
#send:not(:disabled) {
  background: #f36f21;
  cursor: pointer;
}
#send:not(:disabled):hover { background: #e65a0f; }

/* ── Footer ── */
#chat-footer {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  padding: 8px;
  flex-shrink: 0;
}

/* ── Welcome message ── */
.welcome-msg {
  color: #555;
  font-size: 14px;
  text-align: center;
  padding: 20px;
}
