/* ============================================================
   CHATBOT CSS - COMBINED FORM + CHAT
   Unique class names (.tx-cb-*), Design tokens, Dark theme
   NO IFRAME - Include only
   ============================================================ */

/* ── DESIGN TOKENS ── */
:root {

  /* =========================
     TREXA DARK BACKGROUNDS
  ========================== */

  --bg:        #0B1323;
  --surface:   #101A2F;
  --surface2:  #16233D;
  --surface3:  #1D2D4D;

  /* =========================
     BORDERS
  ========================== */

  --border:    rgba(230, 242, 250, 0.08);
  --border2:   rgba(230, 242, 250, 0.14);

  /* =========================
     BRAND COLORS
  ========================== */

  /* Primary TREXA */
  --accent:    #00BFA5;

  /* Secondary Navy */
  --accent2:   #123056;

  /* User Bubble */
  --user-bubble:
      linear-gradient(
          135deg,
          #00BFA5,
          #123056
      );
  --green-primary:linear-gradient(135deg, #0B1323, #00BFA5)!important;
  /* Bot Bubble */
  --bot-bubble: #16233D;

  /* =========================
     TEXT
  ========================== */

  --text:        #F4F8FC;

  --text-muted:  #A8B3C7;

  --text-dim:    #6B7280;

  /* =========================
     STATUS
  ========================== */

  --green: #00BFA5;

  /* CTA / Highlight */
  --warning: #FFB020;

  /* =========================
     SHAPE
  ========================== */

  --radius:    18px;
  --radius-sm: 10px;

  /* =========================
     SHADOWS
  ========================== */

  --shadow-sm:
      0 1px 2px rgba(0, 0, 0, 0.18);

  --shadow-md:
      0 4px 12px rgba(0, 0, 0, 0.24);

  --shadow-lg:
      0 12px 32px rgba(0, 0, 0, 0.35);
}

/* ============================================================
   TRIGGER BUTTON - Floating on page
   ============================================================ */

.tx-cb-trigger {
  position: fixed;
  bottom: 50px;
  right: 24px;
  z-index: 999;
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg,var(--bs-warning),var(--bs-orange));
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--bs-dark);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.25s ease;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.tx-cb-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 25px rgba(var(--bs-warning-rgb), .35);
}

.tx-cb-trigger:active {
  transform: scale(0.95);
}

.tx-cb-trigger.active {
  display: none;
}

.tx-cb-trigger-content {
  display: flex; align-items: center; gap: 6px;
}

.tx-cb-trigger-icon {
  width: 22px;
  height: 22px;

  object-fit: cover;
  border-radius: 50%;

  background: #ffffff;

  padding: 2px;

  border: 1px solid rgba(255,255,255,.4);

  box-shadow:
    0 0 10px rgba(var(--bs-warning-rgb), .45),
    0 0 20px rgba(var(--bs-warning-rgb), .18);
}
/* ============================================================
   MODAL - Overlay & container
   ============================================================ */

.tx-cb-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 998;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 0.3s ease;
}

.tx-cb-modal.active {
  background: rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.tx-cb-popup-container {
  width: 420px;
  height: 600px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  margin: 24px;
  margin-bottom: 80px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.tx-cb-modal.active .tx-cb-popup-container {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── HEADER ── */
.tx-cb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tx-cb-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.tx-cb-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tx-cb-header-info {
  flex: 1;
  min-width: 0;
}

.tx-cb-header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.tx-cb-header-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.tx-cb-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  animation: txCbBlink 2s infinite;
  flex-shrink: 0;
}

@keyframes txCbBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.tx-cb-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
  padding: 0;
}

.tx-cb-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.tx-cb-close-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* ============================================================
   CONTENT AREA - Form + Chat
   TREXA GUIDELINES VERSION
   ============================================================ */

.tx-cb-content-area{
  flex:1;
  overflow:hidden;
  display:flex;
  flex-direction:column;

  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,.02),
      rgba(255,255,255,.01)
    );
}

/* ── FORM SECTION ── */

.tx-cb-form-section{
  flex:1;
  overflow-y:auto;
  padding:24px;
  display:flex;
  flex-direction:column;
}

.tx-cb-form-wrapper{
  flex:1;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.tx-cb-form-title{
  font-size:18px;
  font-weight:600;

  color:var(--text);

  margin-bottom:8px;
}

.tx-cb-form-subtitle{
  font-size:13px;

  color:var(--text-muted);

  margin-bottom:24px;

  line-height:1.5;
}

.tx-cb-form{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.tx-cb-form-group{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.tx-cb-form-group label{
  font-size:12px;
  font-weight:600;

  color:var(--text);

  text-transform:uppercase;

  letter-spacing:.05em;
}

/* ── INPUT ── */

.tx-cb-form-input{
  padding:10px 14px;

  background:var(--surface2);

  border:
    1px solid rgba(0,191,165,.10);

  border-radius:10px;

  font-family:'Plus Jakarta Sans',sans-serif;

  font-size:13px;

  color:var(--text);

  outline:none;

  transition:all .2s;

  box-shadow:
    inset 0 1px 2px rgba(255,255,255,.02);
}

.tx-cb-form-input::placeholder{
  color:var(--text-dim);
}

.tx-cb-form-input:focus{
  border-color:
    rgba(0,191,165,.45);

  box-shadow:
    0 0 0 3px rgba(0,191,165,.10);
}

/* ── SUBMIT BUTTON ── */

.tx-cb-form-submit{
  padding:11px 16px;

  background:
    linear-gradient(
      135deg,
      var(--bs-warning),
      var(--bs-orange)
    );

  border:none;

  border-radius:10px;

  color:var(--bs-dark);

  font-size:13px;
  font-weight:700;

  cursor:pointer;

  font-family:'Plus Jakarta Sans',sans-serif;

  transition:all .2s;

  margin-top:8px;

  box-shadow:
    0 4px 12px rgba(255,176,32,.24);
}

.tx-cb-form-submit:hover{
  transform:translateY(-1px);

  box-shadow:
    0 6px 16px rgba(255,176,32,.34);
}

.tx-cb-form-submit:active{
  transform:translateY(0);
}

/* ── CHAT SECTION ── */

.tx-cb-chat-section{
  flex:1;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.tx-cb-chat-wrapper{
  flex:1;

  display:flex;
  flex-direction:column;

  overflow:hidden;

  justify-content:space-between;

  min-height:0;
}

/* ── MESSAGES ── */

.tx-cb-messages{
  flex:1;

  min-height:0;

  overflow-y:auto;

  padding:20px 18px;

  display:flex;
  flex-direction:column;

  gap:14px;
}

.tx-cb-messages::-webkit-scrollbar{
  width:4px;
}

.tx-cb-messages::-webkit-scrollbar-track{
  background:transparent;
}

.tx-cb-messages::-webkit-scrollbar-thumb{
  background:
    rgba(0,191,165,.18);

  border-radius:2px;
}

.tx-cb-date{
  text-align:center;

  font-size:11px;

  color:var(--text-dim);

  margin-bottom:4px;
}

/* ── MESSAGE ── */

.tx-cb-msg{
  display:flex;
  align-items:flex-end;

  gap:8px;

  animation:
    txCbFadeSlide .22s ease both;
}

.tx-cb-msg.user{
  flex-direction:row-reverse;
}

@keyframes txCbFadeSlide{

  from{
    opacity:0;
    transform:translateY(8px);
  }

  to{
    opacity:1;
    transform:translateY(0);
  }
}

/* ── AVATAR ── */

.tx-cb-msg-avatar{
  width:28px;
  height:28px;

  border-radius:9px;

  background:#ffffff;

  display:flex;
  align-items:center;
  justify-content:center;

  font-size:14px;

  flex-shrink:0;

  border:
    1px solid rgba(0,191,165,.08);
}

.tx-cb-msg.user .tx-cb-msg-avatar{
  display:none;
}

/* ── BUBBLE ── */

.tx-cb-bubble{
  max-width:82%;

  padding:11px 15px;

  border-radius:var(--radius);

  font-size:14px;

  line-height:1.65;

  word-break:break-word;
}

/* USER */

.tx-cb-msg.user .tx-cb-bubble{
  background:
    linear-gradient(
      135deg,
      var(--bs-primary),
      var(--bs-secondary)
    );

  color:#fff;

  border-bottom-right-radius:4px;

  box-shadow:
    0 8px 20px rgba(0,191,165,.14);
}

/* BOT */

.tx-cb-msg.bot .tx-cb-bubble{
  background:var(--bot-bubble);

  color:var(--text);

  border:
    1px solid rgba(0,191,165,.08);

  border-bottom-left-radius:4px;
}

/* ── MARKDOWN ── */

.tx-cb-md-body{
  font-size:13px;
  line-height:1.8;

  color:var(--text-muted);
}

.tx-cb-md-body .tx-cb-md-h1{
  font-size:15px;
  font-weight:600;

  color:var(--text);

  margin:0 0 12px;

  padding-bottom:8px;

  border-bottom:
    1px solid rgba(0,191,165,.08);
}

.tx-cb-md-body .tx-cb-md-h2{
  font-size:11px;
  font-weight:600;

  color:var(--bs-primary);

  text-transform:uppercase;

  letter-spacing:.08em;

  margin:16px 0 8px;

  display:flex;
  align-items:center;

  gap:6px;
}

.tx-cb-md-body .tx-cb-md-h2::before{
  content:'';

  display:block;

  width:3px;
  height:12px;

  border-radius:2px;

  background:var(--bs-primary);

  flex-shrink:0;
}

.tx-cb-md-body .tx-cb-md-h3{
  font-size:13px;
  font-weight:600;

  color:var(--text);

  margin:12px 0 6px;
}

.tx-cb-md-body .tx-cb-md-p{
  margin:0 0 8px;

  color:var(--text-muted);
}

.tx-cb-md-body .tx-cb-md-p:last-child{
  margin-bottom:0;
}

/* ── LIST ── */

.tx-cb-md-body .tx-cb-md-ul,
.tx-cb-md-body .tx-cb-md-ol{
  list-style:none;

  margin:4px 0 10px;

  padding:0;
}

.tx-cb-md-body .tx-cb-md-ul li{
  display:flex;
  align-items:flex-start;

  gap:8px;

  font-size:13px;

  color:var(--text-muted);

  padding:3px 0;
}

.tx-cb-md-body .tx-cb-md-ul li::before{
  content:'';

  width:5px;
  height:5px;

  border-radius:50%;

  background:var(--bs-primary);

  flex-shrink:0;

  margin-top:7px;
}

/* ── INLINE CODE ── */

.tx-cb-md-body code{
  font-family:monospace;

  font-size:12px;

  background:
    rgba(0,191,165,.08);

  border:
    1px solid rgba(0,191,165,.14);

  border-radius:4px;

  padding:1px 6px;

  color:var(--bs-primary);
}

/* ── SOURCE BADGE ── */

.tx-cb-source-badge{
  display:inline-block;

  font-size:10px;

  padding:2px 7px;

  border-radius:20px;

  border:
    1px solid rgba(0,191,165,.10);

  color:var(--text-dim);

  background:var(--surface3);

  margin-top:6px;
}

/* ── TYPING ── */

.tx-cb-typing-dots{
  display:flex;

  gap:5px;

  padding:14px 16px;
}

.tx-cb-typing-dots span{
  width:7px;
  height:7px;

  border-radius:50%;

  background:var(--bs-primary);

  opacity:.4;

  animation:
    txCbBounce 1.2s infinite;
}

.tx-cb-typing-dots span:nth-child(2){
  animation-delay:.2s;
}

.tx-cb-typing-dots span:nth-child(3){
  animation-delay:.4s;
}

@keyframes txCbBounce{

  0%,80%,100%{
    transform:translateY(0);
    opacity:.4;
  }

  40%{
    transform:translateY(-6px);
    opacity:1;
  }
}

/* ── QUICK REPLIES ── */

.tx-cb-quick-replies{
  padding:12px 18px 0;

  flex-shrink:0;
}

.tx-cb-quick-label{
  font-size:10px;
  font-weight:600;

  color:var(--text-dim);

  text-transform:uppercase;

  letter-spacing:.08em;

  margin-bottom:8px;
}

.tx-cb-quick-list{
  display:flex;
  flex-wrap:wrap;

  gap:7px;
}

.tx-cb-quick-btn{
  font-family:'Plus Jakarta Sans',sans-serif;

  font-size:12px;
  font-weight:500;

  color:var(--bs-primary);

  background:
    rgba(0,191,165,.08);

  border:
    1px solid rgba(0,191,165,.18);

  border-radius:20px;

  padding:6px 13px;

  cursor:pointer;

  transition:all .18s ease;

  white-space:nowrap;
}

.tx-cb-quick-btn:hover{
  background:
    linear-gradient(
      135deg,
      var(--bs-primary),
      var(--bs-secondary)
    );

  border-color:transparent;

  color:#fff;

  transform:translateY(-1px);

  box-shadow:
    0 6px 16px rgba(0,191,165,.16);
}

.tx-cb-quick-btn:active{
  transform:translateY(0);
}

/* ── INPUT ── */

.tx-cb-input-wrap{
  padding:12px 18px 18px;

  flex-shrink:0;
}

.tx-cb-input{
  display:flex;
  align-items:center;

  gap:8px;

  background:var(--surface2);

  border:
    1px solid rgba(0,191,165,.10);

  border-radius:14px;

  padding:8px 8px 8px 16px;

  transition:border-color .2s;
}

.tx-cb-input:focus-within{
  border-color:
    rgba(0,191,165,.45);

  box-shadow:
    0 0 0 3px rgba(0,191,165,.10);
}

.tx-cb-input input{
  flex:1;

  border:none;

  background:transparent;

  font-family:'Plus Jakarta Sans',sans-serif;

  font-size:14px;

  color:var(--text);

  outline:none;
}

.tx-cb-input input::placeholder{
  color:var(--text-dim);
}

/* ── SEND BUTTON ── */

.tx-cb-send-btn{
  width:36px;
  height:36px;

  border-radius:10px;

  background:
    linear-gradient(
      135deg,
      var(--bs-warning),
      var(--bs-orange)
    );

  border:none;

  cursor:pointer;

  display:flex;
  align-items:center;
  justify-content:center;

  transition:all .18s;

  flex-shrink:0;

  box-shadow:
    0 4px 12px rgba(255,176,32,.24);

  padding:0;
}

.tx-cb-send-btn:hover{
  transform:scale(1.05);

  box-shadow:
    0 6px 16px rgba(255,176,32,.34);
}

.tx-cb-send-btn:active{
  transform:scale(.96);
}

.tx-cb-send-btn:disabled{
  opacity:.5;
  cursor:not-allowed;

  transform:none;
}

.tx-cb-send-btn svg{
  fill:var(--bs-dark);

  width:16px;
  height:16px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 620px) {
  .tx-cb-popup-container {
    width: 100%;
    height: 70vh;
    margin: 0;
    margin-bottom: 0;
    border-radius: 16px 16px 0 0;
  }

  .tx-cb-messages {
    padding: 16px 14px;
  }

  .tx-cb-quick-replies {
    padding: 10px 14px 0;
  }

  .tx-cb-input-wrap {
    padding: 10px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .tx-cb-bubble {
    max-width: 88%;
  }

  .tx-cb-form-section {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .tx-cb-trigger {
    bottom: 115px; right: 16px;
    padding: 10px 14px;
    font-size: 13px; gap: 6px;
  }

  .tx-cb-trigger-icon {
    width: 18px; height: 18px;
  }

  .tx-cb-popup-container {
    margin: 12px;
    width: calc(100% - 24px);
  }
}
