/* Cô Tư (widget chung AICA-G) - tinh chỉnh RIÊNG cho AI Đi Chợ, không sửa widget chung.
   Mặc định: 1 nút tròn nhỏ nằm TRÊN thanh menu dưới; không bong bóng chào tự bật.
   Biến --aidicho-cotu-bottom do cotu-overrides.js tính (trên thanh menu / thanh nút cố định dưới + vùng an toàn). */
:root {
  --aidicho-cotu-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* Không tự hiện bong bóng "Hỏi Cô Tư 👋" */
#aicag-widget #aicag-tooltip { display: none !important; }

/* Nút tròn nhỏ (không đặt display ở #aicag-btn: widget tự ẩn/hiện nó khi mở/đóng chat) */
#aicag-widget #aicag-btn {
  left: auto !important;
  right: calc(12px + env(safe-area-inset-right, 0px)) !important;
  bottom: var(--aidicho-cotu-bottom) !important;
  gap: 0 !important;
}
#aicag-widget #aicag-avatar-btn {
  width: 52px !important;
  height: 52px !important;
  border-radius: 50% !important;
  border: 2px solid var(--aicag-primary, #22c55e) !important;
  background: #fff !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3) !important;
  animation: none !important;
}
#aicag-widget #aicag-avatar-btn img { object-position: top center !important; }
#aicag-widget #aicag-pulse-ring { display: none !important; }
#aicag-widget #aicag-online-dot { width: 11px !important; height: 11px !important; bottom: 1px !important; right: 1px !important; }

/* Khung chat: luôn nằm TRÊN thanh menu dưới, không che thanh menu */
#aicag-widget #aicag-panel {
  left: auto !important;
  right: calc(12px + env(safe-area-inset-right, 0px)) !important;
  bottom: var(--aidicho-cotu-bottom) !important;
}
@media (max-width: 768px) {
  #aicag-widget #aicag-panel {
    left: calc(8px + env(safe-area-inset-left, 0px)) !important;
    right: calc(8px + env(safe-area-inset-right, 0px)) !important;
    width: auto !important;
    max-width: none !important;
    height: calc(100vh - var(--aidicho-cotu-bottom) - env(safe-area-inset-top, 0px) - 16px) !important;
    height: calc(100dvh - var(--aidicho-cotu-bottom) - env(safe-area-inset-top, 0px) - 16px) !important;
    max-height: 640px !important;
  }
}

/* Nút "−" nhỏ để thu gọn hẳn nút tròn vào mép màn hình */
#aidicho-cotu-hide {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 15px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  z-index: 2;
}
#aidicho-cotu-hide::before { content: ''; position: absolute; inset: -10px; } /* vùng chạm rộng hơn */

/* Mép tab khi đã thu gọn */
#aidicho-cotu-tab { display: none; }
html.aidicho-cotu-min #aicag-widget #aicag-avatar-btn,
html.aidicho-cotu-min #aidicho-cotu-hide { display: none !important; }
html.aidicho-cotu-min #aicag-widget #aicag-btn { right: 0 !important; }
html.aidicho-cotu-min #aidicho-cotu-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 23px 0 0 23px;
  background: var(--aicag-primary, #22c55e);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}
