/* ============================================================
   HOCO AI Chatbot — Scoped Styles
   ============================================================ */

.hoco-chatbot *,
.hoco-chatbot *::before,
.hoco-chatbot *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --hc-color: #0a66ff;
  --hc-color-dark: #0850d0;
  --hc-radius: 16px;
  --hc-shadow: 0 8px 40px rgba(0,0,0,.22);
  --hc-bg: #ffffff;
  --hc-msg-bg: #f0f4ff;
  --hc-user-bg: var(--hc-color);
  --hc-text: #1a1a2e;
  --hc-z: 99999;
}

.chatbot-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--hc-color);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(10,102,255,.45);
  z-index: var(--hc-z);
  transition: transform .2s ease;
}

.chatbot-toggle:hover { transform: scale(1.08); }

.chatbot-window {
  position: fixed;
  bottom: 85px;
  right: 20px;
  width: 360px;
  height: 600px;
  background: var(--hc-bg);
  border-radius: var(--hc-radius);
  box-shadow: var(--hc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--hc-z);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hoco-chatbot.is-open .chatbot-window {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.chatbot-header {
  padding: 12px 16px;
  background: var(--hc-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hc-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.2);
}

.hc-header-avatar-placeholder {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

.chatbot-header-name { 
  font-weight: 700; 
  font-size: 14px; 
  line-height: 1.2;
}

.chatbot-header-sub { 
  font-size: 11px; 
  opacity: 0.8;
}

.chatbot-close-icon {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  opacity: 0.8;
}

.chatbot-close-icon:hover {
  opacity: 1;
}

.hc-typing {
  font-style: italic;
  display: flex;
  gap: 4px;
}

.hc-typing span {
  width: 6px;
  height: 6px;
  background: #aaa;
  border-radius: 50%;
  animation: hc-bounce 1s infinite;
}

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

@keyframes hc-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fcfcfc;
}

.hc-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
}

.hc-msg--bot {
  align-self: flex-start;
  background: var(--hc-msg-bg);
  color: var(--hc-text);
  border-bottom-left-radius: 2px;
}

.hc-msg--user {
  align-self: flex-end;
  background: var(--hc-user-bg);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chatbot-input-bar {
  padding: 12px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
}

.chatbot-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

.chatbot-send-btn {
  background: var(--hc-color);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
}

.hc-area-selection {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}

.hc-area-btn {
  background: #fff;
  border: 1px solid var(--hc-color);
  color: var(--hc-color);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: all 0.2s;
}

.hc-area-btn:hover {
  background: var(--hc-color);
  color: #fff;
}

@media (max-width: 480px) {
  .chatbot-window {
    width: 300px; /* Specific width instead of full width */
    max-width: calc(100% - 30px);
    right: 15px;
    bottom: 80px;
    height: 450px; /* Fixed small height or proportional */
    max-height: 70vh;
    border-radius: 12px; /* Standard rounded corners */
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  }
  
  .chatbot-messages {
      padding: 10px;
  }

  .hc-msg {
      font-size: 13px; /* Standard readable size */
      max-width: 85%;
  }

  .hc-area-btn {
      padding: 10px;
      font-size: 13px;
  }

  .chatbot-toggle {
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
  }
}
