/* =============================================
   Wingate School — Chat Widget Styles
   ============================================= */

#wg-chat-wrap {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#wg-chat-window {
  width: 360px;
  max-height: 520px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#wg-chat-window.wg-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

#wg-chat-wrap {
  display: none;
}
#wg-chat-wrap:has(.wg-open) {
  display: block;
}

/* Header */
#wg-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--primary);
  color: var(--white);
}

#wg-chat-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

#wg-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 3s;
}

#wg-chat-close:hover {
  color: var(--white);
}

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

.wg-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.wg-msg--user {
  background: #1a3a5c;
  color: var(--white);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.wg-msg--bot {
  background: var(--white);
  color: #222;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

.wg-msg--bot a {
  color: var(--primary);
  text-decoration: underline;
}

.wg-msg--bot em {
  color: #999;
  font-style: italic;
}

/* Input area */
#wg-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: var(--white);
}

#wg-chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

#wg-chat-input:focus {
  border-color: var(--primary);
}

#wg-chat-send {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
  white-space: nowrap;
}

#wg-chat-send:hover {
  background: var(--primary-hover);
}

#wg-chat-send:disabled,
#wg-chat-input:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Scrollbar */
#wg-chat-messages::-webkit-scrollbar {
  width: 4px;
}
#wg-chat-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

/* Typing dots animation */
.wg-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
}

.wg-typing-dots span {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9bb0c5;
    animation: wg-dot-bounce 1.2s infinite ease-in-out;
}

.wg-typing-dots span:nth-child(1) { animation-delay: 0s; }
.wg-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.wg-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wg-dot-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%            { transform: translateY(-5px); opacity: 1; }
}

@media (max-width: 480px) {
  #wg-chat-wrap {
    bottom: 0;
    right: 0;
    left: 0;
    padding: 0 var(--gutter);
  }

  #wg-chat-window {
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 75vh;
    height: 50vh;
  }

  #wg-chat-messages {
    flex: 1;
    min-height: 0;
  }

  #wg-chat-input {
    font-size: 16px;
  }
}