/* ===========================
   ASK TUTOR BUTTON
=========================== */
#jcb-ask-tutor-btn {
  margin-left: 12px;
  padding: 7px 16px;
  border-radius: 9px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #ffffff !important;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
  transition: background .2s ease, box-shadow .2s ease, transform .15s ease;
}

#jcb-ask-tutor-btn:hover,
#jcb-ask-tutor-btn:focus {
  color: #ffffff !important;
  background: linear-gradient(135deg, #1e40af, #0ea5e9);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

/* ===========================
   MODAL BASE
=========================== */
#jcb-tutor-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont;
}

#jcb-tutor-modal.open {
  display: block;
}

/* ===========================
   BACKDROP
=========================== */
.jcb-tutor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

/* ===========================
   MODAL BOX
=========================== */
.jcb-tutor-box {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 360px;
  height: 520px;
  background: #ffffff;
  border-radius: 9px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: jcb-fade-in .2s ease;
}

@keyframes jcb-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===========================
   HEADER
=========================== */
.jcb-tutor-header {
  padding: 12px 14px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.jcb-tutor-header span {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .2px;
}

.jcb-tutor-header button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #ffffff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .2s ease;
}

.jcb-tutor-header button:hover {
  background: rgba(255,255,255,0.25);
}

#jcb-tutor-close {
  font-size: 18px;
  line-height: 1;
}

/* ===========================
   MESSAGES AREA
=========================== */
.jcb-tutor-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  background: #f9fafb;
}

/* USER MESSAGE */
.jcb-msg.user {
  margin-left: auto;
  margin-bottom: 10px;
  max-width: 78%;
  background: #2563eb;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 9px 9px 3px 9px;
  font-size: 13px;
  line-height: 1.4;
}

/* AI MESSAGE */
.jcb-msg.ai {
  margin-right: auto;
  margin-bottom: 10px;
  max-width: 85%;
  background: #ffffff;
  color: #0f172a;
  padding: 10px 12px;
  border-radius: 9px 9px 9px 3px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.jcb-msg.loading {
  opacity: .6;
  font-style: italic;
}

.jcb-msg.error {
  background: #fee2e2;
  color: #991b1b;
}

/* ===========================
   INPUT AREA
=========================== */
.jcb-tutor-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

#jcb-tutor-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid #e5e7eb;
  font-size: 13px;
  outline: none;
}

#jcb-tutor-input:focus {
  border-color: #2563eb;
}

/* SEND BUTTON */
#jcb-tutor-send {
  padding: 8px 14px;
  border-radius: 9px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s ease;
}

#jcb-tutor-send:hover {
  opacity: .9;
}

/* ===========================
   MOBILE
=========================== */
@media (max-width: 480px) {
  .jcb-tutor-box {
    left: 12px;
    right: 12px;
    width: auto;
    height: 80vh;
  }
}
