.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}

.chat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #00E676, #00B0FF);
  border: none;
  border-radius: 50px;
  color: #000;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,230,118,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(0,230,118,0.4);
}

.chat-icon { font-size: 1.2rem; }

.chat-panel {
  position: absolute;
  bottom: 60px;
  right: 0;
  width: 380px;
  max-height: 500px;
  background: #12121a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-weight: 600;
}

.chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1.3rem;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--accent, #00E676);
  color: #000;
  border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
  border-bottom-left-radius: 4px;
}

.chat-typing {
  align-self: flex-start;
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
  padding: 4px 0;
}

.chat-input-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent, #00E676);
}

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent, #00E676);
  border: none;
  color: #000;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 500px) {
  .chat-panel {
    width: calc(100vw - 32px);
    right: -8px;
  }
}

/* ─── Light theme ─── */
[data-theme="light"] .chat-panel {
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
}

[data-theme="light"] .chat-header {
  background: var(--surface2);
  border-bottom-color: var(--border);
}
[data-theme="light"] .chat-close { color: var(--text3); }

[data-theme="light"] .chat-msg.assistant {
  background: var(--surface2);
  color: var(--text);
}

[data-theme="light"] .chat-typing { color: var(--text3); }

[data-theme="light"] .chat-input-form { border-top-color: var(--border); }
[data-theme="light"] .chat-input {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}
