/* ── Alex Chat Widget ────────────────────────────────────── */
#alex-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #14b8a6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(16,185,129,0.35);
  cursor: pointer;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
  color: white;
  font-size: 24px;
}
#alex-chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(16,185,129,0.5);
}
#alex-chat-fab .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid white;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* Panel */
#alex-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9998;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 520px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  animation: chat-slide-up 0.3s ease-out;
}
#alex-chat-panel.open {
  display: flex;
}
@keyframes chat-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.alex-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(30,41,59,0.6);
}
.alex-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #14b8a6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.alex-header-info {
  flex: 1;
}
.alex-header-name {
  color: white;
  font-weight: 600;
  font-size: 14px;
}
.alex-header-status {
  color: #10b981;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.alex-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}
.alex-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  transition: color 0.2s;
}
.alex-close:hover {
  color: white;
}

/* Messages */
.alex-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
}
.alex-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #e2e8f0;
  animation: msg-pop 0.3s ease-out;
}
@keyframes msg-pop {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.alex-msg.bot {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.2);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.alex-msg.user {
  background: rgba(20,184,166,0.2);
  border: 1px solid rgba(20,184,166,0.25);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.alex-msg .sender {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 3px;
  color: #64748b;
}
.alex-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}
.alex-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.alex-typing span:nth-child(2) { animation-delay: 0.2s; }
.alex-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Input bar */
.alex-input-bar {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(30,41,59,0.4);
}
.alex-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 14px;
  color: white;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.alex-input:focus {
  border-color: rgba(16,185,129,0.5);
}
.alex-input::placeholder {
  color: #64748b;
}
.alex-voice-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #10b981, #14b8a6);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}
.alex-voice-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(16,185,129,0.4);
}
.alex-voice-btn.active {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  animation: voice-pulse 2s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
}

/* Voice mode overlay */
.alex-voice-overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  gap: 16px;
  flex: 1;
}
.alex-voice-overlay.active {
  display: flex;
}
.alex-voice-wave {
  display: flex;
  gap: 3px;
  height: 48px;
  align-items: center;
}
.alex-voice-wave div {
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(to top, #10b981, #14b8a6);
}
.alex-voice-status {
  color: #94a3b8;
  font-size: 13px;
  text-align: center;
}

.alex-messages::-webkit-scrollbar { width: 4px; }
.alex-messages::-webkit-scrollbar-track { background: transparent; }
.alex-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

/* Tooltip on FAB */
#alex-chat-fab::after {
  content: 'Chat with Alex';
  position: absolute;
  right: 72px;
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: white;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#alex-chat-fab:hover::after {
  opacity: 1;
}
