/* Plaswill Indicators — IA Conversacional Assistant Stylesheet */

/* Header Trigger Button */
.btn-ia-assistant {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, rgba(255, 242, 18, 0.15) 0%, rgba(9, 80, 106, 0.4) 100%);
  border: 1px solid #FFF212;
  color: #FFF212;
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px rgba(255, 242, 18, 0.12);
  user-select: none;
}

.btn-ia-assistant:hover {
  background: #FFF212;
  color: #080C14;
  box-shadow: 0 0 18px rgba(255, 242, 18, 0.35);
  transform: translateY(-1px);
}

.btn-ia-assistant .ia-icon-sparkle {
  animation: ia-sparkle-pulse 2.2s infinite ease-in-out;
}

@keyframes ia-sparkle-pulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15) rotate(5deg); }
}

.ia-btn-label-mobile {
  display: none;
}

/* Off-Canvas Backdrop */
.ia-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease-in-out;
}

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

/* Off-Canvas Drawer Container */
.ia-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: calc(100vw - 32px);
  height: 100vh;
  background-color: #0A0F1A;
  border-left: 1px solid #1F2D44;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.75);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: text;
}

.ia-drawer.open {
  transform: translateX(0);
}

/* Drawer Header */
.ia-header {
  padding: 14px 18px;
  background: #0E1626;
  border-bottom: 1px solid #1F2D44;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.ia-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ia-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 242, 18, 0.12);
  border: 1px solid #FFF212;
  color: #FFF212;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ia-title-box {
  display: flex;
  flex-direction: column;
}

.ia-main-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #F8FAFC;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ia-live-pill {
  font-size: 0.65rem;
  font-weight: 700;
  color: #10B981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 6px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ia-sub-title {
  font-size: 0.72rem;
  color: #94A3B8;
  margin-top: 1px;
}

.ia-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ia-btn-icon {
  background: transparent;
  border: 1px solid transparent;
  color: #94A3B8;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ia-btn-icon:hover {
  background: #18253E;
  border-color: #2B3D5C;
  color: #F8FAFC;
}

/* Chat Body */
.ia-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.ia-body::-webkit-scrollbar {
  width: 5px;
}
.ia-body::-webkit-scrollbar-track {
  background: transparent;
}
.ia-body::-webkit-scrollbar-thumb {
  background: #1F2D44;
  border-radius: 3px;
}
.ia-body::-webkit-scrollbar-thumb:hover {
  background: #2B3D5C;
}

/* Welcome Card */
.ia-welcome-card {
  background: #0E1626;
  border: 1px solid #1F2D44;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ia-welcome-text {
  font-size: 0.82rem;
  color: #CBD5E1;
  line-height: 1.5;
}

.ia-welcome-text strong {
  color: #FFF212;
}

.ia-chips-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.ia-chips-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ia-suggestion-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #1F2D44;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.78rem;
  color: #E2E8F0;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ia-suggestion-chip:hover {
  background: rgba(255, 242, 18, 0.08);
  border-color: #FFF212;
  color: #FFF212;
  transform: translateX(2px);
}

.ia-suggestion-chip::after {
  content: "→";
  opacity: 0.5;
  transition: transform 0.2s;
}

.ia-suggestion-chip:hover::after {
  opacity: 1;
  transform: translateX(3px);
}

/* Message Rows */
.ia-msg-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}

.ia-msg-row.user {
  align-items: flex-end;
}

.ia-msg-row.assistant {
  align-items: flex-start;
}

.ia-msg-author {
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748B;
  padding: 0 4px;
}

/* Speech Bubbles */
.ia-bubble {
  padding: 12px 16px;
  line-height: 1.55;
  font-size: 0.86rem;
  word-break: break-word;
}

.ia-bubble.user {
  background: #FFF212;
  color: #080C14;
  font-weight: 500;
  border-radius: 16px 16px 3px 16px;
  max-width: 85%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.ia-bubble.assistant {
  background: #131D31;
  border: 1px solid #1F2D44;
  color: #F8FAFC;
  border-radius: 16px 16px 16px 3px;
  max-width: 95%;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* Markdown Formatting inside Assistant Bubble */
.ia-bubble.assistant h1,
.ia-bubble.assistant h2,
.ia-bubble.assistant h3,
.ia-bubble.assistant h4 {
  color: #FFF212;
  margin: 12px 0 6px 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}

.ia-bubble.assistant h1:first-child,
.ia-bubble.assistant h2:first-child,
.ia-bubble.assistant h3:first-child {
  margin-top: 0;
}

.ia-bubble.assistant p {
  margin: 6px 0;
}

.ia-bubble.assistant ul,
.ia-bubble.assistant ol {
  margin: 6px 0 8px 18px;
  padding: 0;
}

.ia-bubble.assistant li {
  margin-bottom: 4px;
}

.ia-bubble.assistant strong {
  color: #FFF212;
  font-weight: 700;
}

.ia-bubble.assistant hr {
  border: none;
  border-top: 1px solid #1F2D44;
  margin: 10px 0;
}

/* Tables inside bubbles */
.ia-bubble.assistant table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.78rem;
  background: #0E1626;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #1F2D44;
}

.ia-bubble.assistant th,
.ia-bubble.assistant td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid #1F2D44;
}

.ia-bubble.assistant th {
  background: #18253E;
  color: #FFF212;
  font-weight: 700;
}

.ia-bubble.assistant tr:last-child td {
  border-bottom: none;
}

/* Chart Container inside Assistant Bubble */
.ia-chart-container {
  width: 100%;
  height: 220px;
  margin: 12px 0 8px 0;
  background: #080C14;
  border: 1px solid #1F2D44;
  border-radius: 8px;
  overflow: hidden;
}

/* Deep-Link Dashboard Action Button */
.ia-dashboard-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background: rgba(255, 242, 18, 0.1);
  border: 1px solid #FFF212;
  color: #FFF212;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.ia-dashboard-link-btn:hover {
  background: #FFF212;
  color: #080C14;
  box-shadow: 0 0 14px rgba(255, 242, 18, 0.3);
  transform: translateY(-1px);
}

/* Tools telemetry pill */
.ia-tools-telemetry {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.68rem;
  color: #64748B;
}

.ia-tools-telemetry span.tool-tag {
  background: #0E1626;
  border: 1px solid #1F2D44;
  padding: 1px 5px;
  border-radius: 4px;
  color: #94A3B8;
  font-family: monospace;
}

/* Typing / Loading indicator */
.ia-typing-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #131D31;
  border: 1px solid #1F2D44;
  border-radius: 16px 16px 16px 3px;
  max-width: 220px;
}

.ia-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ia-typing-dot {
  width: 7px;
  height: 7px;
  background: #FFF212;
  border-radius: 50%;
  animation: ia-dot-bounce 1.3s infinite ease-in-out;
}

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

@keyframes ia-dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

.ia-typing-label {
  font-size: 0.74rem;
  color: #94A3B8;
}

/* Drawer Footer / Input Area */
.ia-footer {
  padding: 12px 16px;
  background: #0E1626;
  border-top: 1px solid #1F2D44;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.ia-textarea {
  flex: 1;
  background: #080C14;
  border: 1px solid #1F2D44;
  border-radius: 8px;
  padding: 10px 12px;
  color: #F8FAFC;
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.4;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  outline: none;
  transition: border-color 0.2s ease;
}

.ia-textarea:focus {
  border-color: #FFF212;
  box-shadow: 0 0 8px rgba(255, 242, 18, 0.15);
}

.ia-textarea::placeholder {
  color: #64748B;
}

.ia-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #FFF212;
  border: none;
  color: #080C14;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.ia-send-btn:hover:not(:disabled) {
  background: #FFE600;
  transform: scale(1.05);
}

.ia-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}


/* Mobile Responsive Drawer (<= 600px) */
@media (max-width: 600px) {
  .ia-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    border-left: none !important;
    box-shadow: none !important;
  }

  .ia-header {
    padding: 10px 14px !important;
  }

  .ia-body {
    padding: 12px 14px !important;
    gap: 12px !important;
  }

  .ia-bubble.user,
  .ia-bubble.assistant {
    max-width: 96% !important;
    font-size: 0.84rem !important;
    padding: 10px 14px !important;
  }

  .ia-footer {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) 12px !important;
  }

  .ia-textarea {
    font-size: 16px !important; /* Prevents iOS auto-zoom */
  }

  .ia-btn-icon,
  .ia-send-btn {
    min-width: 42px !important;
    min-height: 42px !important;
  }
}
