/* Pazloman AI chat page (docs/AI_ASSISTANT.md). Only what no theme class covers (D41):
   the ready-made question "pills" (D58) and the "Thinking…" line, as on Scorpion's assistant,
   in the theme's accent colours (#ff8001, its hover #cd6700). */
/* "Live" badge by the assistant's name (D61), as Scorpion's socket status */
.ai-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  padding: 3px 10px;
  border: 1px solid #dfe4eb;
  border-radius: 999px;
  background: #fff;
  color: #9aa1ab;
  font-size: 12px;
  font-weight: normal;
  line-height: 1.3;
  vertical-align: middle;
}

.ai-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.ai-status--live {
  color: #5cb85c;
}

.ai-status--live .ai-status__dot {
  box-shadow: 0 0 8px currentColor;
  animation: ai-status-pulse 1.6s ease-in-out infinite;
}

.ai-status--offline {
  color: #d9534f;
}

@keyframes ai-status-pulse {
  50% { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-status--live .ai-status__dot {
    animation: none;
  }
}

/* Compact product cards in the chat (D65): photo left, name, rating, price, Buy always visible.
   Two or three in a row on wide screens, one per row on phones. */
.ai-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  margin: 12px 0 4px;
}

.ai-card {
  display: flex;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid #dfe4eb;
  border-radius: 4px;
  background: #fff;
}

.ai-card__photo {
  display: block;
  flex: 0 0 90px;
  width: 90px;
}

.ai-card__photo .product-photo__item {
  position: relative;
  display: block;
  width: 90px;
  height: 90px;
}

.ai-card__photo .product-photo__img {
  max-width: 100%;
  max-height: 100%;
}

.ai-card__body {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.ai-card__title {
  padding-top: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ai-card__rating {
  margin-top: 4px;
  font-size: 12px;
}

.ai-card__price {
  margin-top: 6px;
}

.ai-card__price .product-price,
.ai-card__price .product-price__item {
  margin: 0;
  padding-bottom: 0;
}

/* The theme's photo labels (Акція, Хіт, -10%) are sized for the big catalogue card */
.ai-card .product-photo__labels {
  transform: scale(.6);
  transform-origin: top left;
}

.ai-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.ai-card__actions .product-cut__action-item {
  margin: 0;
  padding: 0;
}

/* The theme's buy block keeps 10px margins for the catalogue panel */
.ai-card__actions .product-buy,
.ai-card__actions .product-buy__available,
.ai-card__actions .product-buy__buttons {
  margin: 0;
}

@media (max-width: 480px) {
  .ai-cards {
    grid-template-columns: 1fr;
  }
}

/* Header: Chat history and New chat as theme buttons (btn btn-default), with a count badge */
.ai-header-nav {
  display: inline-flex;
  gap: 8px;
  margin-left: 16px;
}

/* the theme puts "/" before a header nav of links; these are buttons */
.ai-header-nav:before {
  display: none;
}

.ai-header-btn {
  padding: 5px 12px;
  font-size: 13px;
}

.ai-header-btn__count {
  display: inline-block;
  min-width: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 9px;
  background: #487ebb;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

/* Chat history: one row per chat, title left, date right, delete at the end */
.ai-history {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  border: 1px solid #dfe4eb;
  border-radius: 4px;
}

.ai-history__item {
  display: flex;
  align-items: center;
  border-top: 1px solid #dfe4eb;
}

.ai-history__item:first-child {
  border-top: 0;
}

.ai-history__item:hover,
.ai-history__item--active {
  background: #f2f6f9;
}

.ai-history__item--active .ai-history__open {
  box-shadow: inset 3px 0 0 #ff8001;
}

.ai-history__open {
  display: flex;
  flex: 1 1 auto;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  padding: 9px 12px;
  color: #487ebb;
  text-decoration: none;
}

.ai-history__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ai-history__date {
  flex: 0 0 auto;
  color: #9aa1ab;
  font-size: 12px;
}

.ai-history__delete {
  flex: 0 0 auto;
  margin-right: 6px;
  padding: 2px 8px;
  border: 0;
  background: none;
  color: #9aa1ab;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.ai-history__delete:hover,
.ai-history__delete--confirm {
  color: #d9534f;
}

.ai-history__delete--confirm {
  font-size: 12px;
}

.ai-history__empty {
  padding: 9px 12px;
  color: #9aa1ab;
}

@media (max-width: 640px) {
  .ai-header-nav {
    display: flex;
    margin: 8px 0 0;
  }

  .ai-history__open {
    flex-direction: column;
    gap: 2px;
  }
}

/* Space between the conversation ("Thinking…", notices) and the message box */
.ai-chat__form {
  margin-top: 16px;
}

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.ai-suggestion {
  padding: 7px 16px;
  border: 1px solid #ff8001;
  border-radius: 999px;
  background: #fff;
  color: #cd6700;
  font-size: 14px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}

.ai-suggestion:hover,
.ai-suggestion:focus {
  background: #ff8001;
  color: #fff;
  outline: none;
}

.ai-suggestion:disabled {
  opacity: .5;
  cursor: default;
}

.ai-thinking {
  display: inline-block;
}

.ai-thinking__mark {
  display: inline-block;
  vertical-align: -3px;
  margin-right: 4px;
  color: #ff8001;
  animation: ai-thinking-spark 1.6s ease-in-out infinite;
}

.ai-thinking__dots span {
  animation: ai-thinking-dot 1.2s ease-in-out infinite;
}

.ai-thinking__dots span:nth-child(2) {
  animation-delay: .2s;
}

.ai-thinking__dots span:nth-child(3) {
  animation-delay: .4s;
}

@keyframes ai-thinking-spark {
  0%, 100% { transform: scale(.85) rotate(0deg); opacity: .6; }
  50% { transform: scale(1.15) rotate(90deg); opacity: 1; }
}

@keyframes ai-thinking-dot {
  0%, 80%, 100% { opacity: .2; }
  40% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-thinking__mark,
  .ai-thinking__dots span {
    animation: none;
  }
}
