/* CC Chatbot Colegio — blue palette */

#cc-chatbot-container {
  --cc-primary:       #1565C0;
  --cc-primary-light: #42A5F5;
  --cc-primary-dark:  #0D47A1;
  --cc-chip-border:   #1976D2;
  --cc-chip-hover:    #1565C0;
  --cc-user-bubble:   #1976D2;
  --cc-bot-bubble:    #ffffff;
  --cc-bg:            #f0f4ff;
  --cc-shadow:        0 8px 32px rgba(21, 101, 192, 0.25);
  --cc-radius:        18px;

  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
}

/* ── Floating action button ── */

#cc-chatbot-fab {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

#cc-chatbot-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: var(--cc-shadow);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

#cc-chatbot-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(21, 101, 192, 0.35);
}

#cc-chatbot-btn img {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: block;
}

#cc-chatbot-label {
  background: #fff;
  color: var(--cc-primary);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(21, 101, 192, 0.18);
  white-space: nowrap;
  animation: cc-label-appear 0.4s ease 0.6s both, cc-label-fade 0.5s ease 5s forwards;
  pointer-events: none;
}

@keyframes cc-label-appear {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes cc-label-fade {
  from { opacity: 1; }
  to   { opacity: 0; pointer-events: none; }
}

/* ── Chat window ── */

#cc-chatbot-window {
  position: absolute;
  bottom: 84px;
  right: 0;
  width: 320px;
  height: 490px;
  max-height: 80vh;
  background: var(--cc-bg);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;

  opacity: 0;
  transform: scale(0.92) translateY(10px);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#cc-chatbot-window.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

/* ── Header ── */

#cc-chatbot-header {
  background: var(--cc-primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  flex-shrink: 0;
}

#cc-chatbot-header img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
}

#cc-chatbot-header span {
  flex: 1;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
}

#cc-chatbot-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  border-radius: 50%;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

#cc-chatbot-close:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

/* ── Messages ── */

#cc-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

#cc-chatbot-messages::-webkit-scrollbar {
  width: 4px;
}
#cc-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(21, 101, 192, 0.2);
  border-radius: 2px;
}

.cc-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.cc-bubble-row.bot {
  justify-content: flex-start;
}

.cc-bubble-row.user {
  justify-content: flex-end;
}

.cc-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cc-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.cc-bubble-row.bot .cc-bubble {
  background: var(--cc-bot-bubble);
  color: #1a1a2e;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.cc-bubble-row.user .cc-bubble {
  background: var(--cc-user-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ── Typing indicator ── */

.cc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--cc-bot-bubble);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  width: fit-content;
}

.cc-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cc-primary-light);
  display: block;
  animation: cc-bounce 1.2s infinite ease-in-out;
}

.cc-typing span:nth-child(2) { animation-delay: 0.2s; }
.cc-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cc-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Actions (chips) ── */

#cc-chatbot-actions {
  padding: 10px 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-top: 1px solid rgba(21, 101, 192, 0.1);
  background: #fff;
  flex-shrink: 0;
  max-height: 180px;
  overflow-y: auto;
}

#cc-chatbot-actions::-webkit-scrollbar {
  width: 4px;
}
#cc-chatbot-actions::-webkit-scrollbar-thumb {
  background: rgba(21, 101, 192, 0.2);
  border-radius: 2px;
}

.cc-chip {
  background: #fff;
  color: var(--cc-chip-border);
  border: 1.5px solid var(--cc-chip-border);
  border-radius: 20px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  line-height: 1.3;
  text-align: left;
}

.cc-chip:hover {
  background: var(--cc-chip-hover);
  color: #fff;
  transform: translateY(-1px);
}

.cc-chip.back {
  border-color: transparent;
  color: var(--cc-primary);
  background: rgba(21, 101, 192, 0.07);
  font-size: 12px;
}

.cc-chip.back:hover {
  background: rgba(21, 101, 192, 0.15);
  color: var(--cc-primary-dark);
}

/* ── Responsive ── */

@media (max-width: 480px) {
  #cc-chatbot-container {
    bottom: 16px;
    right: 16px;
  }

  #cc-chatbot-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
    right: 0;
  }
}
