/* Pet Cưng Store — giao diện AI Assistant. Chỉ áp dụng bên trong .lb-ai */
.lb-ai {
  --pet-green: #7B8B4A;
  --pet-green-hover: #68783B;
  --pet-brown: #57321E;
  --pet-orange: #DD784B;
  --pet-cream: #FAF4EC;
  --pet-beige: #EEDCC8;
  --pet-border: #E9DED3;
  --pet-muted: #78695C;
  display: grid;
  grid-template-columns: minmax(285px, 33%) minmax(0, 1fr);
  gap: 22px;
  width: min(100%, 1200px);
  margin: 28px auto 56px;
  padding: 0 16px;
  color: var(--pet-brown);
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
.lb-ai, .lb-ai * { box-sizing: border-box; }
.lb-ai-profile, .lb-ai-chat {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--pet-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(87,50,30,.06);
}
.lb-ai-profile { padding: 26px; background: #FFFDF9; }
.lb-ai h2 { margin: 0 0 8px; color: var(--pet-brown); font-size: 21px; font-weight: 750; line-height: 1.4; }
.lb-ai-profile > p { margin: 0 0 24px; color: var(--pet-muted); font-size: 13px; }
.lb-ai label { display: block; margin: 0 0 16px; color: var(--pet-brown); font-size: 13px; font-weight: 650; }
.lb-ai select, .lb-ai input, .lb-ai textarea {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 7px 0 0;
  padding: 11px 13px;
  border: 1px solid var(--pet-border);
  border-radius: 9px;
  background: #fff;
  color: var(--pet-brown);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: none;
}
.lb-ai :is(input,select,textarea)::placeholder { color: #A1958B; opacity: 1; }
.lb-ai :is(input,select,textarea):focus {
  outline: 2px solid rgba(123,139,74,.3);
  outline-offset: 1px;
  border-color: var(--pet-green);
}
.lb-ai textarea { resize: vertical; }
.lb-ai button {
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  background: var(--pet-green);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
  transition: background-color .18s ease, transform .18s ease;
}
.lb-ai button:hover { background: var(--pet-green-hover); color: #fff; }
.lb-ai button:focus-visible, .lb-ai a:focus-visible { outline: 2px solid var(--pet-orange); outline-offset: 3px; }
.lb-ai button:disabled { opacity: .65; cursor: wait; }
.lb-ai-form > button { display: block; width: 100%; min-height: 46px; margin-top: 6px; }
.lb-ai-age-feedback { margin: -9px 0 16px; color: var(--pet-muted); font-size: 12px; line-height: 1.5; }
.lb-ai-age-ok { color: var(--pet-green-hover); }
.lb-ai-age-warning { color: #AF592F; }
.lb-ai-age-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.lb-ai-age-choices button { padding: 7px 11px; background: var(--pet-cream); border: 1px solid var(--pet-border); color: var(--pet-brown); font-size: 12px; }
.lb-ai-age-choices button:hover { background: var(--pet-beige); color: var(--pet-brown); }

/* Khu vực hội thoại */
.lb-ai-chat { display: flex; flex-direction: column; min-height: 650px; }
.lb-ai-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 21px;
  background: var(--pet-cream);
  border-bottom: 1px solid var(--pet-border);
}
.lb-ai-chat-head h2 { margin: 0; font-size: 18px; }
.lb-ai-chat-head small { color: var(--pet-muted); font-size: 12px; }
.lb-ai-avatar { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; border: 1px solid #E4D0B8; border-radius: 50%; background: #FFF3DF; font-size: 26px; }
.lb-ai-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 13px;
  min-height: 420px;
  max-height: 570px;
  overflow-y: auto;
  padding: 22px;
  background: #FFFCF8;
}
.lb-ai-message {
  max-width: min(87%, 560px);
  padding: 12px 15px;
  border-radius: 14px;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.7;
  white-space: normal;
}
.lb-ai-message strong { font-weight: 700; }
.lb-ai-message br + br { line-height: 1.25; }
.lb-ai-bot { align-self: flex-start; border: 1px solid var(--pet-border); border-bottom-left-radius: 4px; background: #FFF; color: var(--pet-brown); }
.lb-ai-user { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--pet-green); color: #fff; }
.lb-ai-chat-form { display: flex; gap: 10px; padding: 15px; border-top: 1px solid var(--pet-border); background: #fff; }
.lb-ai-chat-form input { flex: 1; margin: 0; }
.lb-ai-chat-form button { flex: 0 0 auto; min-width: 76px; white-space: nowrap; }
.lb-ai-retry { margin-top: 10px; padding: 7px 12px !important; font-size: 12px !important; }

/* Gợi ý sản phẩm từ WooCommerce */
.lb-ai-products { display: grid; grid-template-columns: repeat(auto-fit,minmax(195px,1fr)); gap: 11px; margin-top: 14px; }
.lb-ai-product-card { display: flex; gap: 10px; min-width: 0; padding: 11px; border: 1px solid var(--pet-border); border-radius: 10px; background: #fff; color: var(--pet-brown); }
.lb-ai-product-card img { flex: 0 0 74px; width: 74px; height: 74px; object-fit: contain; border-radius: 7px; background: #fff; }
.lb-ai-product-info { flex: 1; min-width: 0; }
.lb-ai-product-info > a:first-child { display: block; color: var(--pet-brown); font-weight: 700; text-decoration: none; line-height: 1.4; }
.lb-ai-product-info > a:first-child:hover { color: var(--pet-orange); }
.lb-ai-product-price { margin: 6px 0; color: var(--pet-orange); font-weight: 750; }
.lb-ai-product-info small { display: block; margin: 0 0 7px; color: var(--pet-muted); font-size: 11px; }
.lb-ai .lb-ai-product-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 3px 4px 2px 0;
  padding: 6px 9px;
  border: 1px solid var(--pet-border);
  border-radius: 6px;
  background: var(--pet-cream);
  color: var(--pet-brown) !important;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.lb-ai .lb-ai-product-link:is(button) { border-color: var(--pet-green); background: var(--pet-green); color: #fff !important; font-family: inherit; line-height: inherit; }
.lb-ai .lb-ai-product-link:hover { background: var(--pet-beige); color: var(--pet-brown) !important; }
.lb-ai .lb-ai-product-link:is(button):hover { background: var(--pet-green-hover); color: #fff !important; }
.lb-ai .lb-ai-product-link:disabled { opacity: .65; cursor: wait; }
.lb-ai-cart-feedback { margin-top: 5px; color: var(--pet-green-hover); font-size: 12px; }

@media (max-width: 800px) {
  .lb-ai { grid-template-columns: 1fr; gap: 15px; margin: 18px auto 40px; padding: 0 12px; }
  .lb-ai-profile { padding: 20px; }
  .lb-ai-chat { min-height: 530px; }
  .lb-ai-messages { min-height: 330px; max-height: 470px; padding: 16px; }
}
@media (max-width: 480px) {
  .lb-ai-chat-head { padding: 14px; }
  .lb-ai-chat-form { gap: 7px; padding: 11px; }
  .lb-ai-chat-form button { min-width: 60px; padding: 10px; }
  .lb-ai-message { max-width: 95%; }
  .lb-ai-products { grid-template-columns: 1fr; }
}
