/* === CHAT TOGGLE BUTTON === */
body.theme-icr .chat-toggle{
  position: fixed;
  right: 1rem;
  bottom: 0 !important;
  top: auto !important;

  margin-bottom: 1rem;
  padding-bottom: env(safe-area-inset-bottom);

  z-index: 1021;
  width: 52px;
  height: 52px;

  background: rgba(0,0,0,.82);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;

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

  cursor: pointer;

  box-shadow: 
    0 10px 22px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.06);

  transition: all .18s ease;
}

/* hover */
body.theme-icr .chat-toggle:hover{
  transform: translateY(-3px);

  background: rgba(0,0,0,.95);
  border-color: rgba(212,175,55,.35);

  box-shadow:
    0 14px 28px rgba(0,0,0,.45),
    0 0 0 4px rgba(255,255,255,.08);
}

/* active */
body.theme-icr .chat-toggle:active{
  transform: translateY(0);
  box-shadow:
    0 4px 10px rgba(0,0,0,.55) inset;
}

/* icon */
body.theme-icr .chat-toggle-icon{
  width: 26px;
  height: 26px;
  color: var(--icr-gold);
}

@media (max-width: 576px){
  body.theme-icr .chat-toggle{
    right: .75rem !important;
    bottom: 0 !important;
    margin-bottom: 1rem;
  }
}

/* === CHAT WIDGET === */
body.theme-icr #chat-container{
  position: static !important;
  right: 1rem !important;
  bottom: 0 !important; 
  top: auto !important;
  left: auto !important;

  z-index: 1020;
  padding: 0 !important;
  display: none; 
}

/* Ensure the chat card has a consistent width */
body.theme-icr #chat-container .col-md-8,
body.theme-icr #chat-container .col-lg-6,
body.theme-icr #chat-container .col-xl-4{
  width: 360px;
  max-width: calc(100vw - 2rem);
}


@media (max-width: 576px){
  body.theme-icr #chat-container{
    right: .75rem !important;
    left: .75rem !important;
    bottom: 0 0 72px 0 !important;
  }

  body.theme-icr #chat-container .col-md-8,
  body.theme-icr #chat-container .col-lg-6,
  body.theme-icr #chat-container .col-xl-4{
    width: 100%;
    max-width: 100%;
  }
}


/* === CARD === */
body.theme-icr .chat-card{
  position: fixed;

  right: 1rem;
  bottom: 0;

  margin-bottom: 1rem; /* jarak dari bawah */

  width: 320px;
  height: 600px;
  max-height: calc(100vh - 110px);

  display: flex;
  flex-direction: column;

  z-index: 1040;
}

body.theme-icr .chat-card{
  bottom: env(safe-area-inset-bottom);
  margin-bottom: 1rem;
}


/* === HEADER === */
body.theme-icr .chat-header{
  background: rgba(0,0,0,.92) !important;
  border-bottom: 1px solid rgba(255,255,255,.15);
  color: #ffffff;
}

body.theme-icr .chat-header .fw-bold{
  margin: 0;
  color: #ffffff;
  
  text-shadow: 0 0 6px rgba(0,0,0,.4);

  letter-spacing: .2px;
}

/* Close button */
body.theme-icr .chat-close{
  color: rgba(255,255,255,.55);
  cursor: pointer;

  padding: .25rem .35rem;
  border-radius: .45rem;

  transition: background .15s ease, color .15s ease, transform .15s ease;
}

body.theme-icr .chat-close:hover{
  background: rgba(255,255,255,.08);
  color: var(--icr-gold);
}


/* ===== CHAT CARD LAYOUT ===== */
body.theme-icr #chat1{
  display: flex;
  flex-direction: column;
  height: 600px;
  max-height: calc(100vh - 110px);
}

body.theme-icr #chat1 .card-body{
  flex: 1 1 auto;
  min-height: 0;

  display: flex;
  flex-direction: column;

  padding: 1rem;
  background: rgba(12,12,12,.96);
  color: rgba(255,255,255,.88);
}

/* ===== MESSAGE HISTORY ===== */
body.theme-icr .messageHistory{
  flex: 1 1 auto;
  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;

  display: flex;
  flex-direction: column;
  gap: .75rem;

  padding: .75rem;
  margin-bottom: .5rem;

  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.04);
  border-radius: .85rem;
}

/* ===== FORM AREA ===== */
body.theme-icr #chat1 .form-outline{
  flex-shrink: 0;
  margin-top: auto;
  padding-top: .5rem;

  background: rgba(12,12,12,.96);
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ===== INPUT GROUP ===== */
body.theme-icr #chat1 .input-group{
  display: flex;
  align-items: stretch;
  width: 100%;

  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  overflow: hidden;

  box-shadow:
    0 4px 12px rgba(0,0,0,.28),
    inset 0 1px 0 rgba(255,255,255,.03);
}

/* ===== INPUT ===== */
body.theme-icr #chat1 input#message.form-control{
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;

  background: rgba(20,20,20,1) !important;
  color: #ffffff !important;

  border: none !important;
  border-radius: 0 !important;

  padding: 0 .9rem !important;
  margin: 0 !important;

  box-shadow: none !important;
  outline: none !important;
}

body.theme-icr #chat1 input#message.form-control::placeholder{
  color: rgba(255,255,255,.45) !important;
  font-style: italic;
}

body.theme-icr #chat1 input#message.form-control:focus{
  background: rgba(26,26,26,1) !important;
  color: #ffffff !important;
  box-shadow: none !important;
  outline: none !important;
}

/* ===== SEND BUTTON ===== */
body.theme-icr #chat1 .btn-chat-send{
  min-width: 88px;
  min-height: 44px;

  border: none !important;
  border-radius: 0 !important;

  background: linear-gradient(
    180deg,
    rgba(212,175,55,1),
    rgba(184,148,34,1)
  ) !important;

  color: #000 !important;
  font-weight: 600;
  padding: 0 1rem !important;
  margin: 0 !important;

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

  box-shadow: none !important;
  outline: none !important;
  white-space: nowrap;
}

body.theme-icr #chat1 .btn-chat-send:hover{
  background: linear-gradient(
    180deg,
    rgba(224,190,78,1),
    rgba(196,160,46,1)
  ) !important;
}

body.theme-icr #chat1 .btn-chat-send:active{
  transform: translateY(1px);
}

/* ===== CLOSE BUTTON ===== */
body.theme-icr .chat-close{
  color: rgba(255,255,255,.55);
  cursor: pointer;

  padding: .25rem .35rem;
  border-radius: .45rem;

  transition: background .15s ease, color .15s ease, transform .15s ease;
}

body.theme-icr .chat-close:hover{
  background: rgba(255,255,255,.08);
  color: var(--icr-gold);
  transform: scale(1.05);
}

/* === SCROLLBAR (webkit) === */
body.theme-icr .messageHistory::-webkit-scrollbar{ 
  width: 8px; 
}

/* track */
body.theme-icr .messageHistory::-webkit-scrollbar-track{
  background: transparent;
}

/* thumb */
body.theme-icr .messageHistory::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.18);
  border-radius: 999px;
  transition: background .2s ease;
}

body.theme-icr .messageHistory::-webkit-scrollbar-thumb:hover{
  background: rgba(255,255,255,.32);
  /* background: rgba(212,175,55,.45); */
}


/* === CHAT ROWS === */
body.theme-icr .chat-row{
  display: flex;
  align-items: flex-start;
}

body.theme-icr .chat-user{ justify-content: flex-end; }
body.theme-icr .chat-ai{ justify-content: flex-start; }

/* === AVATAR === */
body.theme-icr .chat_pp{
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;

  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.25);

  box-shadow: 0 4px 10px rgba(0,0,0,.25);
}

/* === CHAT BUBBLES === */
body.theme-icr .chat-bubble{
  max-width: 75%;
  padding: .65rem .85rem;
  border-radius: 16px;

  font-size: .85rem;
  line-height: 1.45;

  word-wrap: break-word;

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

  box-shadow: 0 6px 14px rgba(0,0,0,.28);

  transition: transform .15s ease, box-shadow .15s ease;
}

/* subtle hover */
body.theme-icr .chat-bubble:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0,0,0,.35);
}


/* === USER BUBBLE === */
body.theme-icr .bubble-user{
  background: linear-gradient(
    180deg,
    rgba(212,175,55,1),
    rgba(184,148,34,1)
  );

  border-color: rgba(212,175,55,.6);
  color: #000;

  margin-right: .75rem;
}

/* === AI BUBBLE === */
body.theme-icr .bubble-ai{
  background: rgba(255,255,255,.06);

  border-color: rgba(255,255,255,.10);
  color: rgba(255,255,255,.88);

  margin-left: .75rem;

  backdrop-filter: blur(4px);
}

/* === TEXT === */
body.theme-icr .chat-text{
  margin: 0;
  color: inherit;
}

/* Loading state */
body.theme-icr #sendMessage.is-loading{
  opacity: .65;
  pointer-events: none;
  filter: grayscale(.08);
}


body.theme-icr #chat1 .form-outline,
body.theme-icr #chat1 .input-group,
body.theme-icr #chat1 form{
  width: 100%;
  margin-left: 0 !important;
  margin-right: 0 !important;
}