/* ===================================================================
   LIA EMS -- ai.css
   AI Components: Panels, Suggestions, Chat, Floating Button, etc.
   =================================================================== */

/* -- AI PANEL -- */
.ai-panel {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
  border: 1px solid var(--ai-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}

.ai-panel::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(167, 139, 250, .15) 0%, transparent 70%);
}

.ai-panel-title {
  font-size: 11px;
  font-weight: 800;
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-panel-body {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.6;
}

/* -- AI CHIPS -- */
.ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(139, 92, 246, .2);
  border: 1px solid rgba(139, 92, 246, .3);
  color: #c4b5fd;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  margin: 2px;
}

.ai-chip:hover {
  background: rgba(139, 92, 246, .35);
  transform: translateY(-1px);
}

.ai-chip-selected {
  background: rgba(139, 92, 246, .4);
  border-color: #a78bfa;
  color: #fff;
}

/* -- AI SUGGESTION CARD -- */
.ai-suggest {
  background: linear-gradient(135deg, var(--ai-lt), rgba(139, 92, 246, .04));
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 8px;
  position: relative;
  cursor: pointer;
  transition: all .15s;
}

.ai-suggest:hover {
  border-color: #8b5cf6;
  box-shadow: var(--sh-ai);
}

.ai-suggest::before {
  content: '\2728';
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 14px;
  opacity: .6;
}

.ai-suggest-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ai);
  margin-bottom: 3px;
}

.ai-suggest-body {
  font-size: 11px;
  color: var(--tx2);
  line-height: 1.5;
}

.ai-suggest-meta {
  font-size: 9.5px;
  color: var(--tx4);
  margin-top: 4px;
}

.ai-suggest-acts {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}

/* -- AI INPUT FIELD -- */
.ai-input-wrap {
  position: relative;
}

.ai-input-wrap .fi {
  padding-right: 70px;
  border-color: var(--ai-border);
  background: var(--ai-lt);
}

.ai-input-wrap .fi:focus {
  border-color: var(--ai);
  box-shadow: 0 0 0 2px var(--ai-glow);
}

.ai-ask-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ai);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
}

.ai-ask-btn:hover {
  background: var(--ai2);
}

/* -- AI THINKING INDICATOR -- */
.ai-thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--ai-lt);
  border: 1px solid var(--ai-border);
  border-radius: 8px;
  font-size: 11px;
  color: var(--ai);
  margin-bottom: 8px;
}

.ai-dots {
  display: flex;
  gap: 3px;
}

.ai-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ai);
  animation: aiDot 1.2s ease infinite;
}

.ai-dot:nth-child(2) {
  animation-delay: .2s;
}

.ai-dot:nth-child(3) {
  animation-delay: .4s;
}

@keyframes aiDot {
  0%, 60%, 100% {
    transform: scale(1);
    opacity: .4;
  }
  30% {
    transform: scale(1.4);
    opacity: 1;
  }
}

/* -- AI RESULT BOX -- */
.ai-result {
  background: linear-gradient(135deg, var(--ai-lt) 0%, rgba(255, 255, 255, .8) 100%);
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  animation: aiReveal .3s ease;
}

@keyframes aiReveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ai-result-hd {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.ai-result-icon {
  width: 22px;
  height: 22px;
  background: var(--ai);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.ai-result-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--ai);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.ai-result-body {
  font-size: 12px;
  color: var(--tx2);
  line-height: 1.65;
}

/* -- AI FIELD BADGE -- */
.ai-field-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--ai-p);
  border: 1px solid var(--ai-border);
  color: var(--ai);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
  transition: all .12s;
  margin-left: 4px;
  vertical-align: middle;
}

.ai-field-badge:hover {
  background: rgba(109, 40, 217, .2);
}

/* -- AI SIDEBAR CARD -- */
.ai-sidebar-card {
  background: linear-gradient(135deg, #1e1b4b, #2e1065);
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  padding: 12px;
  color: #e2e8f0;
}

.ai-sidebar-title {
  font-size: 10px;
  font-weight: 800;
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ai-insight-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.ai-insight-row:last-child {
  border-bottom: none;
}

.ai-insight-icon {
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-insight-text {
  font-size: 11px;
  line-height: 1.5;
  color: #cbd5e1;
}

.ai-insight-em {
  color: #a78bfa;
  font-weight: 700;
}

/* -- AI RISK STRIP -- */
.ai-risk-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  background: linear-gradient(135deg, rgba(220, 38, 38, .08), rgba(109, 40, 217, .06));
  border: 1px solid rgba(220, 38, 38, .2);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .12s;
}

.ai-risk-strip:hover {
  box-shadow: 0 3px 12px rgba(220, 38, 38, .15);
}

.ai-risk-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--red);
  flex: 1;
}

.ai-risk-action {
  font-size: 10px;
  font-weight: 700;
  color: var(--ai);
  background: var(--ai-p);
  border: 1px solid var(--ai-border);
  border-radius: 5px;
  padding: 2px 8px;
  flex-shrink: 0;
}

/* -- AI FLOATING ASSISTANT BUTTON -- */
.ai-float {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 999;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--ai), #8B5CF6);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(109, 40, 217, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all .2s;
  animation: aiFloat 3s ease infinite;
}

.ai-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(109, 40, 217, .55);
}

@keyframes aiFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* -- AI CHAT PANEL -- */
.ai-chat-panel {
  position: fixed;
  bottom: 80px;
  right: 22px;
  width: 340px;
  max-height: 500px;
  background: var(--white);
  border: 1px solid var(--ai-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(109, 40, 217, .2);
  z-index: 998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp .2s ease;
}

.ai-chat-panel.open {
  display: flex;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ai-chat-hd {
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--ai), #8B5CF6);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ai-chat-title {
  font-size: 13px;
  font-weight: 800;
  flex: 1;
}

.ai-chat-close {
  background: rgba(255, 255, 255, .2);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* -- AI CHAT MESSAGES -- */
.ai-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-chat-msgs::-webkit-scrollbar {
  width: 3px;
}

.ai-chat-msgs::-webkit-scrollbar-thumb {
  background: var(--bd2);
  border-radius: 2px;
}

.ai-msg {
  max-width: 85%;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 11.5px;
  line-height: 1.55;
}

.ai-msg.bot {
  background: var(--ai-lt);
  border: 1px solid var(--ai-border);
  color: var(--tx);
  align-self: flex-start;
  border-radius: 3px 10px 10px 10px;
}

.ai-msg.user {
  background: var(--blue);
  color: #fff;
  align-self: flex-end;
  border-radius: 10px 3px 10px 10px;
}

/* -- AI CHAT INPUT -- */
.ai-chat-inp {
  padding: 10px 12px;
  border-top: 1px solid var(--bd);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ai-chat-inp input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--ai-border);
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  background: var(--ai-lt);
}

.ai-chat-inp input:focus {
  border-color: var(--ai);
  box-shadow: 0 0 0 2px var(--ai-glow);
}

.ai-chat-inp button {
  background: var(--ai);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  transition: all .12s;
}

.ai-chat-inp button:hover {
  background: var(--ai2);
}

/* -- AI QUICK PROMPTS -- */
.ai-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 12px 8px;
}

.ai-qp {
  font-size: 10.5px;
  padding: 3px 9px;
  background: var(--surf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  cursor: pointer;
  color: var(--tx3);
  transition: all .12s;
}

.ai-qp:hover {
  background: var(--ai-lt);
  border-color: var(--ai-border);
  color: var(--ai);
}
