#ai-assistant-chat {
    background: #fff;
    border-radius: 8px;
    overflow-y: auto;
    min-height: 75vh;
     
    margin-bottom: 80px;
    font-family: 'Helvetica', sans-serif !important;   
    font-size: 14px !important;   
    line-height: 1.5;
}
.empty-msg {
    margin-top: 10px;
}
.msg {
    display: flex;
    margin: 10px 0;
}
.user-msg {
    justify-content: flex-end;
}
.user-msg .bubble {
    background: #ededed;
    border-radius: 16px 16px 0 16px;
    padding: 10px 14px;
}
.bot-msg {
    display: block;
    /*justify-content: flex-start;*/
}
.bot-msg .bubble {
    /*background: #f4f4f5;*/
    color: #222;
    border-radius: 16px 16px 16px 0;
        padding: 14px 0;
}
.error-msg .bubble {
    background: #ffe6e6;
    color: #d9534f;
    border-radius: 16px;
}
.bubble {
     
    /*max-width: 75%;*/
    word-wrap: break-word;
}

/* typing animation */
.typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 2px;
    background: #999;
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}
.typing span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes blink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

@media (max-width: 1199px) {
  #ai-assistant-form, .ai-note  {
    left: 0px;
  }
}
@media (min-width: 1200px) {
  #ai-assistant-form, .ai-note  {
    left: 256px;
  }
}
/* form */
#ai-assistant-form {    
    gap: 0;
    position: fixed;
    bottom: 30px;
    right: 0;
    z-index: 10;
    max-width: 800px;
    margin: auto;   
}
.ai-note {
    height: 30px;
    position: fixed;
    bottom: 0;
    right: 0;
    background: white;
    z-index: 1;
    margin: auto;
    text-align: center;   /* căn giữa chữ */
    font-size: 12px;      /* chữ nhỏ gọn */
    color: #666;          /* màu xám nhẹ */  
    display: flex;        /* dùng flexbox */
    align-items: center;  /* căn giữa theo chiều dọc */
    justify-content: center; /* căn giữa theo chiều ngang */    
}

.ai-input-wrapper {
  position: relative;
  display: flex;
}

#ai-assistant-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
  min-height: 42px;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.5;
  resize: none;
}


#ai-assistant-input:focus {
  outline: none;              /* bỏ outline mặc định */
  box-shadow: none;           /* bỏ hiệu ứng shadow */
  border-color: #ccc;         /* giữ màu border như khi bình thường */
}

.ai-input-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;              /* dính hẳn vào đáy của textarea */
  display: flex;
  gap: 6px;
}

.ai-input-actions button {
background: #4a7d9100;
    color: #000000;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.ai-input-actions button:hover {
    background: #ddd;
}


.msg.user-msg .bubble-img {
  background: transparent !important;
  padding: 2px !important;
  box-shadow: none;
}

.msg.user-msg .bubble-file {
  background: #f5f5f5;
  color: #333;
  padding: 6px 10px;
  border-radius: 6px;
}

.preview-only {
  opacity: 0.7;
}

.ai-sessions-box a,
.ai-sessions-box button {
  font-weight: normal !important;
  color: #333 !important;
  font-size: 12px !important;
}

.ai-sessions-box a:hover,
.ai-sessions-box button:hover {
  color: #000 !important;
}

 

.ai-new-chat-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 0;
    color: #444;
    cursor: pointer;
    margin: 15px 0 0 0;
}

.ai-new-chat-btn:hover {
  color: #000;
  font-weight: bold;
}

.ai-sessions-list {
  list-style: disc;
  padding-left: 18px;
  margin: 0;
  font-size: 13px;
  color: #555;
}




.ai-sessions-list li {
  margin: 7px !important;
  padding: 0;
}

.ai-sessions-list .ai-session-link {
  display: block;
  width: 100%;             /* full ngang khối li */
  max-width: 170px;        /* cắt text */
  padding: 4px 8px;        /* giảm padding */
  line-height: 1.2;        /* chiều cao text gọn hơn */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 4px;
}

.ai-sessions-list .ai-session-link.active {
  background: #dfdfdf;
  font-weight: bold;
}

.ai-session-item {
  position: relative;
}

.ai-session-options {
  display: none;
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-weight: bold;
  color: #888;
  padding: 2px 6px;
  border-radius: 4px;
}

.ai-session-item:hover .ai-session-options {
  display: inline-block;
}

.ai-session-options:hover {
  background: #eee;
}

.ai-session-popup {
  position: absolute;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10000;
  width: 140px;
}

.ai-session-popup .popup-item {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}

.ai-session-popup .popup-item:hover {
  background: #f5f5f5;
}

.inline-rename-input {
  width: 90%;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  padding: 2px 4px;
}

.ai-session-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.ai-session-modal {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  width: 300px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  text-align: center;
}

.ai-session-modal h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.ai-session-modal .rename-input {
  width: 100%;
  padding: 6px;
  font-size: 14px;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.ai-session-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ai-session-modal button {
  padding: 5px 12px;
  font-size: 13px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.ai-session-modal .rename-save {
  background: #4a7d91;
  color: #fff;
}

.ai-session-modal .rename-cancel {
  background: #6b6b6b;
}
.ai-session-modal .rename-save:hover {
  background: #005f8a;
}
.ai-session-modal .rename-cancel:hover {
  background: #2d2d2d;
}



 

#ai-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;

  position: relative;   /* thay absolute → relative (hoặc bỏ hẳn) */
  margin-bottom: 8px;   /* cách textarea một khoảng */
  max-width: 100%;
}

#ai-file-preview .preview-item {
  display: inline-block;
}

#ai-file-preview .preview-inner {
  display: inline-block;
  position: relative; /* để nút ✕ bám */
}

#ai-file-preview img {
  max-width: 180px;
  height: 100px;
  border-radius: 6px;
  border: 1px solid #ccc;
  display: block;
}

#ai-file-preview .remove-file {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #000000;
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    font-size: 14px;
    cursor: pointer;
    line-height: 18px;
    text-align: center;
    padding: 0;
    margin: 0;
}

#ai-assistant-chat .chat-offset {
  height: 50vh;   /* chừa ra đúng 70% màn hình */
}

.ai-masonry-grid {
  column-count: 4;
  column-gap: 15px;
  margin-top: 20px;
}

.ai-masonry-grid .product-card {
  display: inline-block;
  width: 100%;
  margin-bottom: 15px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.ai-masonry-grid .product-info {
  padding: 10px;
  font-size: 14px;
}

.ai-masonry-grid .product-title {
  margin-bottom: 5px;
  display: block;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;  
}

.ai-masonry-grid .info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-masonry-grid .formats {
  color: #4a7d91;
  font-size: 12px;
  text-transform: capitalize;
}

.ai-masonry-grid .product-price {
  color: #4a7d91;
  font-size: 12px;
}

.bubble-text {
    white-space: normal;  /* giữ xuống dòng */
    line-height: 2;
}

.bubble-masonry {
  white-space: normal;  /* để Masonry layout không bị phá */
  line-height: normal;
}

.bubble-text ul {
  list-style: none;       /* bỏ chấm đầu dòng */
  padding-left: 0;        /* bỏ thụt vào */
  margin: 0;              /* bỏ khoảng cách mặc định */
}

.bubble-text li {
  margin: 4px 0;          /* thu hẹp khoảng cách giữa các dòng */
  padding-left: 0;        /* bỏ thụt trái */
}

.bubble-text p {
  display: inline;   /* hoặc inline-block */
  margin: 0;
}
.bubble-text p + p::before {
  content: "\A";     /* xuống dòng */
  white-space: pre;
}

.bubble.bubble-text table th,
.bubble.bubble-text table td {
  text-align: left;
}


.build-product-masonry-grid {
  column-width: 180px;
  column-gap: 10px;
}

.build-product-masonry-card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
margin-bottom: 15px;  
}

.build-product-masonry-thumb {
  width: 100%;
  height: auto;
  border-radius: 6px 6px 0 0;
}

.build-product-masonry-info {
  padding: 6px;
}

.build-product-masonry-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-top: 4px;
}

.build-product-masonry-formats {
  color: #777;
}

.build-product-masonry-price {
  color: green;
  font-weight: bold;
}

.ai-fade-in {
  opacity: 0;
  transform: translateY(5px);
  animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-file-slider {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 5px 0;
  max-width: 100%;
}

.ai-file-slider::-webkit-scrollbar {
  height: 6px;
}
.ai-file-slider::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.ai-label, .agent-label {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #666;
}

.ai-label::first-letter,
.agent-label::first-letter {
    text-transform: uppercase;
}