/* ============================================
   FINANCEAI — AI ASSISTANT STYLES
   ============================================ */

/* ---- PANEL ---- */
.ai-panel {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: 380px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0,0,0,0.25);
}

.ai-panel.open {
  transform: none;
}

.ai-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.ai-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ---- HEADER ---- */
.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ai-title { display: flex; align-items: center; gap: 12px; }

.ai-avatar {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-mid);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  position: relative;
}

.ai-avatar::after {
  content: '';
  position: absolute;
  bottom: -2px; right: -2px;
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.ai-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.ai-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.ai-close {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
.ai-close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ---- MESSAGES ---- */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.ai-msg { display: flex; flex-direction: column; gap: 4px; }

.ai-msg.user { align-items: flex-end; }
.ai-msg.assistant { align-items: flex-start; }

.msg-bubble {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.55;
  word-break: break-word;
}

.ai-msg.user .msg-bubble {
  background: var(--accent);
  color: #0c1a0c;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.ai-msg.assistant .msg-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 0 4px;
}

/* ---- TYPING INDICATOR ---- */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 13px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.typing-dot {
  width: 6px; height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}

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

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

/* ---- QUICK ACTIONS ---- */
.quick-actions {
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.quick-btn {
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.quick-btn:hover {
  border-color: var(--accent-mid);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ---- INPUT AREA ---- */
.ai-input-area {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.ai-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.84rem;
  line-height: 1.4;
  outline: none;
  resize: none;
  max-height: 120px;
  transition: border-color 0.2s ease;
  font-family: var(--font-body);
}

.ai-input:focus { border-color: var(--accent); }
.ai-input::placeholder { color: var(--text-muted); }

.ai-send {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: #0c1a0c;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.ai-send:hover { opacity: 0.85; transform: scale(1.04); }
.ai-send:active { transform: scale(0.96); }

/* ---- EXPENSE CARD IN CHAT ---- */
.ai-expense-card {
  background: var(--bg-surface);
  border: 1px solid var(--accent-mid);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 4px;
  max-width: 88%;
}

.ai-expense-card-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
}

.ai-expense-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}

.ai-expense-field:last-child { border-bottom: none; }
.ai-expense-field-label { color: var(--text-muted); }
.ai-expense-field-value { font-weight: 600; color: var(--text-primary); }

.ai-expense-actions {
  display: flex; gap: 8px; margin-top: 12px;
}

.ai-btn-confirm {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  background: var(--accent);
  color: #0c1a0c;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  transition: opacity 0.2s;
  cursor: pointer;
  border: none;
}
.ai-btn-confirm:hover { opacity: 0.85; }

.ai-btn-cancel {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}
.ai-btn-cancel:hover { border-color: var(--danger); color: var(--danger); }

/* ---- RESPONSIVE ---- */
@media (max-width: 480px) {
  .ai-panel { width: 100%; }
}
