/* ICPC Chatbot Widget */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&family=Heebo:wght@400;500;700&display=swap');

#icpc-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1a2b4a;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#icpc-chat-toggle {
  animation: icpc-glow 3s ease-in-out infinite;
}

#icpc-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  animation: none;
}

@keyframes icpc-glow {
  0%, 100% { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); transform: scale(1); }
  50% { box-shadow: 0 4px 28px rgba(26, 43, 74, 0.55), 0 0 20px rgba(26, 43, 74, 0.35); transform: scale(1.06); }
}

/* Attention prompt bubble */
#icpc-chat-prompt {
  position: fixed;
  bottom: 88px;
  right: 24px;
  background: #1a2b4a;
  color: #fff;
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.4;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  z-index: 99997;
  max-width: 240px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

#icpc-chat-prompt.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#icpc-chat-prompt::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 22px;
  width: 12px;
  height: 12px;
  background: #1a2b4a;
  transform: rotate(45deg);
}

#icpc-chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

#icpc-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 360px;
  height: 520px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#icpc-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
#icpc-chat-header {
  background: #1a2b4a;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#icpc-chat-header img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: #fff;
  object-fit: contain;
}

#icpc-chat-header .icpc-chat-title {
  font-family: 'Heebo', Arial, sans-serif;
  font-weight: 700;
  font-size: 15px;
  flex: 1;
}

#icpc-chat-new {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.15s, border-color 0.15s;
}

#icpc-chat-new:hover {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.8);
}

#icpc-chat-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
  opacity: 0.8;
  transition: opacity 0.15s;
}

#icpc-chat-close:hover {
  opacity: 1;
}

/* Privacy notice */
#icpc-chat-privacy {
  background: #f0f8ff;
  padding: 8px 14px;
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 11px;
  color: #555;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

/* Messages area */
#icpc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.icpc-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
}

.icpc-msg.assistant {
  align-self: flex-start;
  background: #f3f3f3;
  color: #333;
  border-bottom-left-radius: 4px;
}

.icpc-msg.user {
  align-self: flex-end;
  background: #1a2b4a;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.icpc-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
  align-self: flex-start;
}

.icpc-typing span {
  width: 7px;
  height: 7px;
  background: #bbb;
  border-radius: 50%;
  animation: icpc-pulse 1.4s infinite ease-in-out;
}

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

@keyframes icpc-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input area */
#icpc-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e8e8e8;
  flex-shrink: 0;
  background: #fafafa;
}

#icpc-chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 9px 14px;
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 13.5px;
  outline: none;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
}

#icpc-chat-input:focus {
  border-color: #1a2b4a;
}

#icpc-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1a2b4a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

#icpc-chat-send:hover {
  background: #0f1d33;
}

#icpc-chat-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

#icpc-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Mobile responsive */
@media (max-width: 480px) {
  #icpc-chat-panel {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  #icpc-chat-toggle {
    bottom: 16px;
    right: 16px;
  }

  #icpc-chat-prompt {
    bottom: 80px;
    right: 16px;
    max-width: 200px;
  }
}
