/* ===== Virtual Assistant Widget ===== */

.assistant-fab {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-main);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 255, 65, 0.4);
  z-index: 9999;
  animation: float 3s ease-in-out infinite;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.assistant-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(0, 255, 65, 0.5);
}

.assistant-fab svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  transition: transform var(--transition);
}

.assistant-fab.open svg {
  transform: rotate(45deg);
}

/* ===== Chat Panel ===== */

.assistant-panel {
  position: fixed;
  bottom: 96px;
  inset-inline-end: 24px;
  width: 380px;
  max-height: 520px;
  background: var(--bg-dark);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 143, 17, 0.15);
  display: none;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
}

.assistant-panel.open {
  display: flex;
}

/* Panel header */
.assistant-header {
  padding: 16px 20px;
  background: var(--gradient-main);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.assistant-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.assistant-header-info h4 {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
}

.assistant-header-info p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
}

/* Quick actions */
.assistant-quick-actions {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-subtle);
}

.quick-action-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.quick-action-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  color: var(--text-primary);
}

/* Messages area */
.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 300px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.6;
  word-wrap: break-word;
}

.chat-msg.bot {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-start-start-radius: 4px;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--gradient-main);
  color: #fff;
  border-end-end-radius: 4px;
}

.chat-msg.typing {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}

.chat-msg.typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-dot 1.4s ease-in-out infinite;
}

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

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

/* Input area */
.assistant-input {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.assistant-input input {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

.assistant-input input:focus {
  border-color: var(--accent-purple);
}

.assistant-input input::placeholder {
  color: var(--text-muted);
}

.assistant-send-btn,
.assistant-mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.assistant-send-btn {
  background: var(--gradient-main);
  color: #fff;
}

.assistant-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 12px rgba(0, 255, 65, 0.3);
}

.assistant-send-btn svg,
.assistant-mic-btn svg {
  width: 18px;
  height: 18px;
}

.assistant-mic-btn {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.assistant-mic-btn:hover {
  border-color: var(--border-accent);
  color: var(--accent-blue);
}

.assistant-mic-btn.connecting {
  background: var(--accent-blue, #3B82F6);
  color: #fff;
  border-color: transparent;
  animation: pulse-dot 1s ease-in-out infinite;
}

.assistant-mic-btn.active {
  background: #EF4444;
  color: #fff;
  border-color: transparent;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .assistant-panel {
    width: calc(100% - 32px);
    inset-inline-end: 16px;
    bottom: 88px;
    max-height: calc(100dvh - 120px);
  }

  .assistant-fab {
    bottom: 16px;
    inset-inline-end: 16px;
    width: 54px;
    height: 54px;
  }

  .assistant-messages {
    max-height: 40dvh;
  }

  .assistant-send-btn,
  .assistant-mic-btn {
    width: 44px;
    height: 44px;
  }

  .assistant-input input {
    font-size: 16px; /* Prevent iOS zoom on focus */
  }

  .quick-action-btn {
    padding: 8px 16px;
    min-height: 36px;
  }
}

@media (max-width: 480px) {
  .assistant-panel {
    width: calc(100% - 16px);
    inset-inline-end: 8px;
  }

  .assistant-header {
    padding: 12px 16px;
  }
}
