/* ============================================================
   Assistant AI — Styles
   ============================================================ */

/* FAB Button */
.assistant-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 9990;
  width: 56px; height: 56px; border-radius: 50%;
  background: #4CAF50; color: #fff; border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(76,175,80,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; transition: all .3s;
}
.assistant-fab:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(76,175,80,.5); }
.assistant-fab.active { background: #388E3C; transform: rotate(90deg); }

/* Chat Panel */
.assistant-panel {
  position: fixed; bottom: 92px; right: 24px; z-index: 9991;
  width: 380px; max-width: calc(100vw - 48px);
  height: 500px; max-height: calc(100vh - 140px);
  background: #fff; border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: assistant-slide-in .25s ease;
}

/* Header */
.assistant-header {
  background: #4CAF50; color: #fff; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.assistant-header__title {
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.assistant-header__title .mdi { font-size: 20px; }
.assistant-header__close {
  background: none; border: none; color: #fff; cursor: pointer;
  font-size: 20px; opacity: .8; transition: opacity .2s;
  padding: 4px;
}
.assistant-header__close:hover { opacity: 1; }

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

.assistant-msg {
  display: flex; gap: 8px; max-width: 90%;
}
.assistant-msg--bot { align-self: flex-start; }
.assistant-msg--user { align-self: flex-end; flex-direction: row-reverse; }

.assistant-msg__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #E8F5E9; color: #4CAF50;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.assistant-msg__bubble {
  padding: 10px 14px; border-radius: 12px;
  font-size: 13px; line-height: 1.5;
}
.assistant-msg--bot .assistant-msg__bubble {
  background: #f5f5f5; color: #333;
  border-bottom-left-radius: 4px;
}
.assistant-msg--user .assistant-msg__bubble {
  background: #4CAF50; color: #fff;
  border-bottom-right-radius: 4px;
}
.assistant-msg__bubble a { color: inherit; font-weight: 700; text-decoration: underline; }
.assistant-msg--bot .assistant-msg__bubble a { color: #2E7D32; }

/* Bubble inner HTML formatting */
.assistant-msg__bubble ul,
.assistant-msg__bubble ol {
  margin: 6px 0 6px 18px; padding: 0;
}
.assistant-msg__bubble li { margin-bottom: 3px; }
.assistant-msg__bubble code {
  background: rgba(0,0,0,.07); padding: 1px 5px; border-radius: 3px;
  font-size: 12px; font-family: 'Roboto Mono', monospace;
}
.assistant-msg__bubble table {
  margin: 8px 0; width: 100%;
}

/* Warning box for safety-critical info */
.assistant-warning {
  background: #FFF3E0; border: 2px solid #E65100; border-radius: 8px;
  padding: 8px 12px; margin-bottom: 10px;
  color: #BF360C; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; gap: 6px;
}
.assistant-warning::before {
  content: "\26A0\FE0F";
  font-size: 16px;
}

/* Typing indicator — three bouncing dots */
.typing-dots {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 0;
}
.typing-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #9E9E9E; display: inline-block;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Suggestions */
.assistant-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0;
}
.assistant-suggestion {
  font-size: 12px; padding: 6px 12px; border-radius: 16px;
  background: #E8F5E9; color: #2E7D32; border: 1px solid #C8E6C9;
  cursor: pointer; transition: all .2s;
  font-family: 'Roboto', sans-serif;
}
.assistant-suggestion:hover { background: #C8E6C9; }

/* Input */
.assistant-input-row {
  display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid #e0e0e0; flex-shrink: 0;
  background: #fff;
}
.assistant-input {
  flex: 1; border: 1px solid #e0e0e0; border-radius: 20px;
  padding: 8px 16px; font-size: 13px; outline: none;
  font-family: 'Roboto', sans-serif; transition: border-color .2s;
}
.assistant-input:focus { border-color: #4CAF50; }
.assistant-send {
  width: 36px; height: 36px; border-radius: 50%;
  background: #4CAF50; color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; transition: background .2s; flex-shrink: 0;
}
.assistant-send:hover { background: #388E3C; }

/* Animation */
@keyframes assistant-slide-in {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* === DARK MODE === */
[data-theme="dark"] .assistant-panel { background: #16213e; box-shadow: 0 8px 32px rgba(0,0,0,.4); }
[data-theme="dark"] .assistant-messages { color: #e0e0e0; }
[data-theme="dark"] .assistant-msg--bot .assistant-msg__bubble { background: #1c2a4a; color: #e0e0e0; }
[data-theme="dark"] .assistant-msg--bot .assistant-msg__bubble a { color: #66BB6A; }
[data-theme="dark"] .assistant-msg--bot .assistant-msg__bubble code { background: rgba(255,255,255,.1); color: #81C784; }
[data-theme="dark"] .assistant-msg__avatar { background: #1c3a2e; }
[data-theme="dark"] .assistant-suggestion { background: #1c3a2e; color: #66BB6A; border-color: #2a4a3a; }
[data-theme="dark"] .assistant-suggestion:hover { background: #2a4a3a; }
[data-theme="dark"] .assistant-input-row { background: #16213e; border-color: #2a2a4a; }
[data-theme="dark"] .assistant-input { background: #1c2a4a; border-color: #2a2a4a; color: #e0e0e0; }
[data-theme="dark"] .assistant-warning { background: #3E2723; border-color: #FF6F00; color: #FFAB40; }
[data-theme="dark"] .typing-dot { background: #66BB6A; }
