/* ===============================================
   CHAT BOT CSS - ORGANIZED & OPTIMIZED
   =============================================== */

/* ───────── GLOBAL RESET ───────── */
html, body {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
  box-sizing: border-box !important;
  background: transparent !important;
  border: none !important;
  overflow: hidden !important;
}

body {
  display: flex !important;
  flex-direction: column;
  justify-content: stretch;
  align-items: stretch;
  min-width: 0 !important;
  min-height: 0 !important;
}

:root { 
  box-shadow: none !important;
  overflow: hidden !important;
}

/* ───────── CONTAINER STRUCTURE ───────── */
.cb-bot-outer {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
}

#chat-bot {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  background: #fff !important;
  display: flex;
  flex-direction: column;
  opacity: 1;
  border: none !important;
  box-sizing: border-box !important;
}

#chat-bot.hidden { 
  display: none !important; 
}

/* ───────── HEADER SECTION ───────── */
.cb-head {
  /* Layout */
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 54px;
  
  /* Dimensions */
  min-height: 54px;
  max-height: 54px;
  height: 54px;
  padding: 17px 18px 15px 20px;
  
  /* Styling */
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.02em;
  border-radius: 0 !important;
  
  /* Behavior */
  cursor: pointer;
  user-select: none;
  box-shadow: none;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.cb-head-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.cb-clear,
.cb-close {
  cursor: pointer;
  font-size: 19px;
  padding: 0 5px;
  opacity: 0.85;
  user-select: none;
  margin-left: 8px;
  border-radius: 5px;
}

/* ───────── BODY & MESSAGES SECTION ───────── */
.cb-body {
  /* Layout */
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  
  /* Styling */
  background: #fff;
  border-radius: 0 !important;
  box-shadow: 0 2px 9px rgba(20,40,34,0.07);
  border-top: 1px solid #eef4f1;
  
  /* Behavior */
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.cb-msgs {
  /* Layout */
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  
  /* Spacing */
  padding: 16px 18px 0px 16px;
  
  /* Styling */
  font-size: 15px;
  white-space: pre-line;
  background: #fcfefd;
  
  /* Behavior */
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box !important;
}

/* ───────── MESSAGE BUBBLES ───────── */
.cb-msgs .bubble {
  /* Layout */
  display: block;
  max-width: 78%;
  
  /* Spacing */
  padding: 11px 17px;
  margin: 4px 0 10px 0;
  
  /* Styling */
  font-size: 15px;
  line-height: 1.6;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  
  /* Text handling */
  word-break: break-word;
  word-wrap: break-word;
  overflow-wrap: break-word;
  
  /* Behavior */
  box-sizing: border-box !important;
}

.cb-msgs .bubble.left {
  background: #eef5ff;
  color: #222;
  align-self: flex-start;
  margin-right: 18%;
  border-bottom-left-radius: 6px;
  border-top-left-radius: 12px;
}

.cb-msgs .bubble.right {
  background: #fbe7a2;
  color: #3a2d07;
  align-self: flex-end;
  margin-left: 18%;
  border-bottom-right-radius: 6px;
  border-top-right-radius: 12px;
}

/* ───────── AVATAR MESSAGE WRAPPER ───────── */
.msg-avatar-wrap {
  display: flex !important;
  align-items: flex-start !important;
  margin: 4px 0 10px 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.msg-avatar-wrap .bubble {
  margin: 0 !important;
  max-width: calc(78% - 38px) !important;
}

.cb-avatar-msg {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* ───────── INPUT SECTION ───────── */
.cb-inputbar {
  /* Layout */
  display: flex;
  flex: 0 0 56px;
  
  /* Dimensions */
  min-height: 56px;
  max-height: 56px;
  height: 56px;
  padding: 8px 9px 8px 12px;
  margin: 0 !important;
  
  /* Styling */
  border-top: 1px solid #e7f8f1;
  background: #fafcfa;
  
  /* Behavior */
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.cb-input {
  /* Layout */
  flex: 1;
  
  /* Spacing */
  padding: 12px 10px 11px 12px;
  margin-right: 9px;
  
  /* Styling */
  border: none;
  background: #f7fcfa;
  font-size: 15px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(160,200,185,0.04);
  
  /* Behavior */
  transition: border .14s, box-shadow .15s;
  outline: none;
  box-sizing: border-box !important;
  overflow: hidden !important;
  resize: none !important;
}

.cb-send {
  /* Layout */
  flex: 0 0 auto;
  min-height: 40px;
  
  /* Spacing */
  padding: 0 20px;
  
  /* Styling */
  color: #fff;
  border: none;
  border-radius: 7px;
  background: #1abc9c;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 2px 7px rgba(27,188,156,0.09);
  
  /* Behavior */
  cursor: pointer;
  transition: background .13s, box-shadow .14s, transform .13s;
  outline: none;
  box-sizing: border-box !important;
}

.cb-send:hover, 
.cb-send:focus {
  background: #179b7f;
  box-shadow: 0 5px 18px rgba(27,188,156,0.14);
}

.cb-send:active {
  background: #139c7b;
  transform: scale(0.97);
}

/* ===============================================
   MOBILE RESPONSIVE STYLES
   =============================================== */
@media (max-width: 600px) {
  
  /* ───────── MOBILE CONTAINER ───────── */
  #chat-bot {
    border-radius: 12px !important;
  }
  
  /* ───────── MOBILE HEADER ───────── */
  .cb-head {
    /* Adjust dimensions for mobile */
    min-height: 56px !important;
    max-height: 56px !important;
    height: 56px !important;
    flex: 0 0 56px !important;
    
    /* Adjust spacing and typography */
    padding: 14px 18px !important;
    font-size: 16px !important;
    border-radius: 12px 12px 0 0 !important;
  }
  
  .cb-clear,
  .cb-close {
    font-size: 18px !important;
    padding: 4px 8px !important;
  }
  
  /* ───────── MOBILE BODY ───────── */
  .cb-body {
    border-radius: 0 0 12px 12px !important;
  }
  
  .cb-msgs {
    padding: 12px 16px 0px 16px !important;
  }
  
  /* ───────── MOBILE BUBBLES ───────── */
  .cb-msgs .bubble {
    max-width: 85% !important;
    padding: 11px 14px !important;
    margin: 4px 0 8px 0 !important;
  }
  
  .cb-msgs .bubble.left,
  .cb-msgs .bubble.right {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  
  /* ───────── MOBILE INPUT ───────── */
  .cb-inputbar {
    padding: 8px 12px !important;
  }
  
  .cb-input {
    font-size: 16px !important;
    padding: 12px 14px !important;
    margin-right: 8px !important;
    height: 40px !important;
  }
  
  .cb-send {
    font-size: 15px !important;
    padding: 0 18px !important;
    min-height: 40px !important;
    height: 40px !important;
  }
}