/* ===== Live Chat Widget Styles ===== */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Chat bubble button */
.chat-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--green, #4a7c2a);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(74,124,42,.35);
  transition: transform .2s, box-shadow .2s;
  position: relative;
}
.chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(74,124,42,.45);
}
.chat-bubble svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chat-bubble .chat-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: .8; }
}
.chat-bubble.hidden { display: none; }

/* Chat window */
.chat-window {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e0d8;
  animation: slideUp .3s ease;
  transform-origin: bottom right;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-window.minimized { display: none; }

/* Chat header */
.chat-header {
  background: var(--green, #4a7c2a);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.chat-header-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Playfair Display', serif;
}
.chat-header-info span {
  font-size: 11px;
  opacity: .85;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat-status-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
}
.chat-header-actions {
  display: flex;
  gap: 4px;
}
.chat-header-actions button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background .15s;
  opacity: .85;
}
.chat-header-actions button:hover {
  background: rgba(255,255,255,.15);
  opacity: 1;
}

/* Chat messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #fafaf7;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  animation: msgIn .2s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-message.agent {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5e0d8;
  border-bottom-left-radius: 4px;
  color: #1f2a1a;
}
.chat-message.visitor {
  align-self: flex-end;
  background: var(--green, #4a7c2a);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-message.system {
  align-self: center;
  background: none;
  color: #9ca3af;
  font-size: 12px;
  padding: 4px 8px;
  font-style: italic;
}
.chat-typing {
  align-self: flex-start;
  padding: 10px 14px;
  display: flex;
  gap: 4px;
}
.chat-typing span {
  width: 7px;
  height: 7px;
  background: #c4bfb5;
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .2s; }
.chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Chat input */
.chat-input-area {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e5e0d8;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.chat-input-area input {
  flex: 1;
  border: 1.5px solid #d8d4cb;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  color: #1f2a1a;
  transition: border-color .15s;
}
.chat-input-area input:focus {
  border-color: var(--green, #4a7c2a);
}
.chat-input-area input::placeholder {
  color: #b0aca5;
}
.chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--green, #4a7c2a);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
}
.chat-send-btn:hover {
  background: var(--green-dark, #3a6320);
  transform: scale(1.05);
}
.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Name prompt overlay */
.chat-name-prompt {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  z-index: 2;
  border-radius: 16px;
}
.chat-name-prompt h4 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  margin: 0;
  color: #1f2a1a;
}
.chat-name-prompt p {
  color: #6b7280;
  font-size: 13px;
  margin: 0;
  text-align: center;
}
.chat-name-prompt input {
  width: 100%;
  max-width: 260px;
  padding: 10px 16px;
  border: 1.5px solid #d8d4cb;
  border-radius: 999px;
  font-size: 14px;
  font-family: inherit;
  text-align: center;
  outline: none;
}
.chat-name-prompt input:focus {
  border-color: var(--green);
}
.chat-name-prompt button {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 10px 32px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* Responsive */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 12px;
    right: 12px;
  }
  .chat-window {
    width: calc(100vw - 24px);
    height: calc(100vh - 100px);
    bottom: 70px;
    right: 0;
    border-radius: 12px;
  }
  .chat-bubble {
    width: 52px;
    height: 52px;
  }
}
