/* ──────────────────────────────────────────────
   Sommelier Chat Widget — Three Pillars Wine
   ────────────────────────────────────────────── */

/* Floating Action Button */
.sommelier-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #d41132 0%, #8b0a22 100%);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  box-shadow:
    0 4px 20px rgba(212, 17, 50, 0.4),
    0 0 0 0 rgba(212, 17, 50, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sommelier-pulse 3s ease-in-out infinite;
}

.sommelier-fab:hover {
  transform: scale(1.08);
  box-shadow:
    0 6px 28px rgba(212, 17, 50, 0.5),
    0 0 0 0 rgba(212, 17, 50, 0);
}

.sommelier-fab.open {
  animation: none;
  transform: rotate(0deg);
}

@keyframes sommelier-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(212, 17, 50, 0.4), 0 0 0 0 rgba(212, 17, 50, 0.3); }
  50% { box-shadow: 0 4px 20px rgba(212, 17, 50, 0.4), 0 0 0 12px rgba(212, 17, 50, 0); }
}

/* Chat Window */
.sommelier-chat {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9999;
  width: 400px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 140px);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(16, 16, 24, 0.97);
  border: 1px solid rgba(212, 17, 50, 0.2);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  font-family: 'Manrope', system-ui, sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sommelier-chat.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.sommelier-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(212, 17, 50, 0.15) 0%, rgba(139, 10, 34, 0.1) 100%);
  border-bottom: 1px solid rgba(212, 17, 50, 0.15);
  flex-shrink: 0;
}

.sommelier-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #d41132, #8b0a22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.sommelier-chat-info {
  flex: 1;
  min-width: 0;
}

.sommelier-chat-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8e4e0;
  letter-spacing: -0.01em;
}

.sommelier-chat-status {
  font-size: 0.7rem;
  color: #22c55e;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sommelier-chat-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sommelier-chat-close {
  background: none;
  border: none;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: all 0.2s;
  line-height: 1;
}

.sommelier-chat-close:hover {
  color: #e8e4e0;
  background: rgba(255, 255, 255, 0.06);
}

/* Messages Area */
.sommelier-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 17, 50, 0.3) transparent;
}

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

.sommelier-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(212, 17, 50, 0.3);
  border-radius: 4px;
}

/* Message Bubbles */
.sommelier-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
  animation: msgSlide 0.3s ease-out;
  word-wrap: break-word;
}

@keyframes msgSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sommelier-msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  color: #e8e4e0;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sommelier-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #d41132, #a10d28);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.sommelier-msg.bot strong {
  color: #d41132;
  font-weight: 600;
}

.sommelier-msg.bot em {
  color: #8a8580;
}

/* Typing Indicator */
.sommelier-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}

.sommelier-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(212, 17, 50, 0.5);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.sommelier-typing span:nth-child(2) { animation-delay: 0.15s; }
.sommelier-typing span:nth-child(3) { animation-delay: 0.3s; }

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

/* Quick Actions */
.sommelier-quick-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 16px 8px;
  flex-shrink: 0;
}

.sommelier-quick-btn {
  background: rgba(212, 17, 50, 0.08);
  border: 1px solid rgba(212, 17, 50, 0.2);
  color: #d41132;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.sommelier-quick-btn:hover {
  background: rgba(212, 17, 50, 0.15);
  border-color: rgba(212, 17, 50, 0.4);
  transform: translateY(-1px);
}

/* Input Area */
.sommelier-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 10, 15, 0.6);
  flex-shrink: 0;
}

.sommelier-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  color: #e8e4e0;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
}

.sommelier-chat-input::placeholder {
  color: #555;
}

.sommelier-chat-input:focus {
  border-color: rgba(212, 17, 50, 0.4);
}

.sommelier-chat-send {
  background: linear-gradient(135deg, #d41132, #8b0a22);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.sommelier-chat-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(212, 17, 50, 0.3);
}

.sommelier-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Markdown in bot messages */
.sommelier-msg.bot p { margin: 4px 0; }
.sommelier-msg.bot ul, .sommelier-msg.bot ol { padding-left: 18px; margin: 6px 0; }
.sommelier-msg.bot li { margin: 3px 0; }
.sommelier-msg.bot code {
  background: rgba(212, 17, 50, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82em;
}

/* Welcome message styling */
.sommelier-welcome {
  text-align: center;
  padding: 20px 16px 8px;
  flex-shrink: 0;
}

.sommelier-welcome-emoji {
  font-size: 36px;
  margin-bottom: 8px;
}

.sommelier-welcome-title {
  font-size: 1rem;
  font-weight: 700;
  color: #e8e4e0;
  margin-bottom: 4px;
}

.sommelier-welcome-sub {
  font-size: 0.78rem;
  color: #666;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 480px) {
  .sommelier-chat {
    width: calc(100vw - 16px);
    right: 8px;
    bottom: 80px;
    height: calc(100vh - 100px);
    border-radius: 16px;
  }
  .sommelier-fab {
    bottom: 16px;
    right: 16px;
  }
}
