/**
 * TIME-AI-NB — Chatbox CSS v12
 * v12: Footer → Topbar (icons góc trên phải), bỏ cbx-footer/cbx-trada/cbx-upgrade
 * v10 fixes:
 *   1. Font 11px → 13px (đọc rõ hơn, đặc biệt mobile)
 *   2. Gray text #64748b → #475569 (đậm hơn, dễ đọc)
 *   3. Thêm .cbx-badge-check, .cbx-mua-le-btn, .cbx-error-text
 *   4. Responsive cải thiện
 */

.cbx-page {
  display: flex; flex-direction: column; height: 88vh; min-height: 520px;
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #fff; color: #0f172a;
  border-radius: 12px; border: 1px solid #e2e8f0;
  overflow: hidden; position: relative;
}

/* ─── Messages area ──────────────────────────── */
.cbx-msgs-area { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.cbx-msgs-area::-webkit-scrollbar { width: 3px; }
.cbx-msgs-area::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
.cbx-msgs-area::-webkit-scrollbar-track { background: transparent; }
.cbx-msgs-area { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.12) transparent; }

/* ─── Welcome ────────────────────────────────── */
.cbx-welcome {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 18px 16px 16px; max-width: 800px; margin: 0 auto;
}
.cbx-hero-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.cbx-hero-icon { font-size: 34px; line-height: 1; }
.cbx-hero-text { font-size: 22px; font-weight: 800; color: #0f172a; }
.cbx-subtext { font-size: 14px; color: #475569; line-height: 1.6; margin-bottom: 26px; }
.cbx-subtext strong { font-weight: 700; color: #0f172a; }

/* ─── Plan cards ─────────────────────────────── */
.cbx-plan-grid { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
.cbx-card {
  flex: 1 1 220px; max-width: 250px; padding: 14px 12px 12px;
  border-radius: 14px; border: 1.5px solid #e2e8f0; text-align: left; position: relative;
  display: flex; flex-direction: column;
}
.cbx-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  padding: 4px 16px; border-radius: 999px; color: #fff; font-size: 13px; font-weight: 700;
}
.cbx-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cbx-card-name { font-size: 15px; font-weight: 800; line-height: 1.2; }
.cbx-price-row { display: flex; align-items: baseline; gap: 2px; }
.cbx-card-price { font-size: 16px; font-weight: 800; color: #0f172a; }
.cbx-card-period { font-size: 12px; color: #475569; }
.cbx-tagline { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 5px; }
.cbx-divider { height: 1px; background: #e2e8f0; margin: 0 0 5px; opacity: 0.5; }
.cbx-feats { display: flex; flex-direction: column; gap: 1px; margin-bottom: 8px; flex: 1; }
.cbx-feat { font-size: 13px; color: #334155; line-height: 1.45; display: flex; align-items: flex-start; gap: 4px; }
.cbx-card-btn {
  width: 100%; padding: 8px 0; border-radius: 9px;
  font-family: 'Be Vietnam Pro', sans-serif; font-size: 13px; font-weight: 700;
  cursor: pointer; border: 1.5px dashed; margin-top: auto;
}

/* ─── Chat thread ────────────────────────────── */
.cbx-thread { max-width: 720px; margin: 0 auto; padding: 8px 24px; }
.cbx-user-row { padding: 18px 0; border-bottom: 1px solid #f1f5f9; }
.cbx-asst-row { padding: 18px 0; border-bottom: 1px solid #f1f5f9; }
.cbx-row-inner { display: flex; align-items: flex-start; gap: 12px; }
.cbx-user-icon {
  width: 28px; height: 28px; border-radius: 50%; background: #0284C7; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
.cbx-user-text { font-size: 15px; line-height: 1.75; color: #0f172a; font-weight: 500; flex: 1; word-wrap: break-word; }
.cbx-asst-icon {
  width: 28px; height: 28px; border-radius: 50%; background: #FFF3E0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; margin-top: 2px;
}
.cbx-asst-text { font-size: 15px; line-height: 1.85; color: #1e293b; flex: 1; word-wrap: break-word; white-space: pre-wrap; }
.cbx-error-text { color: #c62828; }

/* ─── Badge check ────────────────────────────── */
.cbx-badge-check {
  font-size: 12px; color: #16A34A; font-weight: 600;
  padding: 2px 0 0 40px;
}

/* ─── Mua lẻ prompt ──────────────────────────── */
.cbx-mua-le-row { padding: 8px 0 12px 40px; }
.cbx-mua-le-btn {
  font-family: 'Be Vietnam Pro', sans-serif; font-size: 13px; font-weight: 700;
  color: #E65100; background: #FFF3E0;
  border: 1.5px dashed #F57C00; border-radius: 9px;
  padding: 8px 20px; cursor: pointer;
}
.cbx-mua-le-btn:active { opacity: 0.7; }

/* ─── Banner HDSD (chưa login) ────────────────── */
.cbx-banner-hdsd {
  display: block; width: 100%; margin-top: 16px; padding: 14px 20px;
  background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
  border: 1.5px dashed #F57C00; border-radius: 12px;
  text-align: center; text-decoration: none; color: #E65100;
  font-size: 15px; line-height: 1.5;
}
.cbx-banner-hdsd strong { font-weight: 800; font-size: 16px; }
.cbx-banner-hdsd:hover { background: linear-gradient(135deg, #FFE0B2 0%, #FFCC80 100%); }

/* ─── Guest mode ─────────────────────────────── */
.cbx-guest .cbx-msgs-area { display: flex; align-items: center; justify-content: center; }

/* ─── Topbar (logged in) — icons góc trên phải ── */
.cbx-topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px 6px; flex-shrink: 0;
}
.cbx-topbar-left { display: flex; align-items: center; gap: 8px; }
.cbx-topbar-right { display: flex; align-items: center; gap: 12px; }
.cbx-icon-btn { display: inline-flex; align-items: center; line-height: 1; }
.cbx-icon-btn:hover { opacity: 0.7; }
.cbx-plan-badge { font-size: 24px; line-height: 1; }

/* ─── Loading dots ───────────────────────────── */
.cbx-dots { display: inline-flex; gap: 5px; padding: 4px 0; }
.cbx-dot { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: cbxBounce 1.2s infinite; }
.cbx-dot:nth-child(2) { animation-delay: 0.15s; }
.cbx-dot:nth-child(3) { animation-delay: 0.3s; }
.cbx-cursor { display: inline-block; width: 2px; height: 16px; background: #0284C7; margin-left: 2px; vertical-align: text-bottom; animation: cbxBlink .8s infinite; }

/* ─── Input area ─────────────────────────────── */
.cbx-input-area { flex-shrink: 0; padding: 8px 20px 12px; }
.cbx-input-box { max-width: 720px; margin: 0 auto; position: relative; }
.cbx-input-box textarea {
  width: 100%; min-height: 76px; max-height: 240px; padding: 12px 88px 12px 16px;
  border: 1px solid #e2e8f0; border-radius: 16px;
  font-family: 'Be Vietnam Pro', -apple-system, sans-serif;
  font-size: 15px; line-height: 1.5; resize: none; outline: none;
  background: #fff; color: #0f172a;
  scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.12) transparent;
}
.cbx-input-box textarea::-webkit-scrollbar { width: 3px; }
.cbx-input-box textarea::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
.cbx-input-box textarea:focus { border-color: #0284C7; }
.cbx-send-btn {
  width: 34px; height: 34px;
  border-radius: 9px; border: none; background: #0284C7; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.cbx-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.cbx-btn-group { position: absolute; right: 16px; bottom: 12px; display: flex; gap: 6px; align-items: center; }
.cbx-rocket-btn {
  width: 28px; height: 28px; border-radius: 7px;
  border: 1.5px dashed #E65100; background: #FFF3E0; color: #E65100;
  font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cbx-rocket-btn:active { opacity: 0.7; }

/* ─── Remain info ───────────────────────────── */
.cbx-remain { font-size: 13px; color: #475569; }

/* ─── Toast ───────────────────────────────────── */
.cbx-toast {
  position: absolute; bottom: 72px; left: 50%; transform: translateX(-50%);
  padding: 8px 18px; background: #1e293b; color: #fff; border-radius: 10px;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  animation: cbxToastIn .25s ease-out; z-index: 10;
}

/* ─── Animations ──────────────────────────────── */
@keyframes cbxBounce { 0%,60%,100% { transform: translateY(0); opacity: .3; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes cbxBlink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes cbxToastIn { from { transform: translateX(-50%) translateY(10px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }

/* ─── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  .cbx-page { height: calc(100vh - 60px); border-radius: 0; border: none; }
  .cbx-plan-grid { flex-direction: column; align-items: center; }
  .cbx-card { max-width: 100%; }
  .cbx-thread { padding: 8px 16px; }
}
