/* ============================================
   Wilcoe Chat Widget
   ============================================ */

/* --- Chat Bubble (FAB) --- */
.chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #f7931e;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(247, 147, 30, 0.4);
  transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
}

.chat-fab:hover {
  background: #e5830f;
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(247, 147, 30, 0.5);
}

.chat-fab.is--open {
  background: #023377;
  box-shadow: 0 4px 20px rgba(2, 51, 119, 0.4);
}

.chat-fab.is--open:hover {
  background: #012169;
}

.chat-fab__icon,
.chat-fab__close {
  width: 28px;
  height: 28px;
  transition: opacity 0.2s, transform 0.2s;
  position: absolute;
}

.chat-fab__icon {
  opacity: 1;
  transform: scale(1);
}

.chat-fab.is--open .chat-fab__icon {
  opacity: 0;
  transform: scale(0.5);
}

.chat-fab__close {
  opacity: 0;
  transform: scale(0.5);
}

.chat-fab.is--open .chat-fab__close {
  opacity: 1;
  transform: scale(1);
}

/* --- Chat Window --- */
.chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9999;
  width: 400px;
  max-height: 560px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.chat-window.is--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* --- Header --- */
.chat-header {
  background: #023377;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header__avatar {
  width: 36px;
  height: 36px;
  background: #f7931e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.chat-header__info {
  flex: 1;
}

.chat-header__name {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.chat-header__status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

/* --- Messages Area --- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 360px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #d2d2d7;
  border-radius: 4px;
}

/* --- Message Bubbles --- */
.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
}

.chat-msg--bot {
  align-self: flex-start;
  background: #f5f5f7;
  color: #1d1d1f;
  border-bottom-left-radius: 4px;
}

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

.chat-msg a {
  color: #f7931e;
  text-decoration: underline;
  font-weight: 500;
}

.chat-msg--user a {
  color: #ffc170;
}

/* Typing indicator */
.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  background: #f5f5f7;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.chat-typing__dot {
  width: 7px;
  height: 7px;
  background: #86868b;
  border-radius: 50%;
  animation: chatBounce 1.2s infinite;
}

.chat-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* --- Lead Capture --- */
.chat-lead {
  padding: 16px;
  background: #f5f5f7;
  border-radius: 12px;
  margin: 4px 0;
  align-self: flex-start;
  max-width: 90%;
}

.chat-lead__label {
  font-size: 13px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 8px;
}

.chat-lead__input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  background: #fff;
  color: #1d1d1f;
  outline: none;
  margin-bottom: 8px;
  font-family: inherit;
  box-sizing: border-box;
}

.chat-lead__input:focus {
  border-color: #023377;
}

.chat-lead__btn {
  display: inline-block;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 100px;
  background: #f7931e;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-lead__btn:hover {
  background: #e5830f;
}

.chat-lead__skip {
  display: inline-block;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: #86868b;
  cursor: pointer;
  margin-left: 6px;
  transition: color 0.2s;
}

.chat-lead__skip:hover {
  color: #1d1d1f;
}

/* --- Input Area --- */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e8e8ed;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #d2d2d7;
  border-radius: 20px;
  background: #fff;
  color: #1d1d1f;
  outline: none;
  resize: none;
  font-family: inherit;
  max-height: 80px;
  line-height: 1.4;
}

.chat-input:focus {
  border-color: #023377;
}

.chat-input::placeholder {
  color: #86868b;
}

.chat-send {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: #f7931e;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.chat-send:hover {
  background: #e5830f;
}

.chat-send:disabled {
  background: #d2d2d7;
  cursor: not-allowed;
}

/* --- Quick Replies --- */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  align-self: flex-start;
  max-width: 90%;
}

.chat-quick-reply {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #d2d2d7;
  border-radius: 100px;
  background: #fff;
  color: #1d1d1f;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.chat-quick-reply:hover {
  border-color: #f7931e;
  background: rgba(247, 147, 30, 0.06);
}

/* --- Mobile --- */
@media (max-width: 480px) {
  .chat-window {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }

  .chat-fab {
    bottom: 20px;
    right: 20px;
    width: 54px;
    height: 54px;
  }

  .chat-messages {
    max-height: none;
    flex: 1;
  }
}
