/* Asisten ATLAS — widget chat atlasacademy.pro
   Tanpa dependensi. Palet mengikuti situs: #0b0f19, #1e3a8a, #dc2626. */

.atlas-ai-fab,
.atlas-ai-panel,
.atlas-ai-panel * {
  box-sizing: border-box;
}

.atlas-ai-fab {
  /* landing.blade.php punya aturan body.page-landing > * { position:relative }.
     !important menjaga tombol tetap mengambang di kanan bawah. */
  position: fixed !important;
  top: auto !important;
  left: auto !important;
  right: 24px;
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  z-index: 1004 !important;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: #0b0f19;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 22px rgba(11, 15, 25, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.atlas-ai-fab:hover {
  transform: scale(1.06);
  background: #1e3a8a;
  box-shadow: 0 6px 28px rgba(30, 58, 138, 0.55);
}

.atlas-ai-fab:focus-visible {
  outline: 3px solid #dc2626;
  outline-offset: 3px;
}

.atlas-ai-fab svg {
  width: 28px;
  height: 28px;
  display: block;
}

.atlas-ai-fab[data-open="1"] {
  background: #dc2626;
}

.atlas-ai-panel {
  position: fixed !important;
  top: auto !important;
  right: 24px;
  bottom: 96px;
  z-index: 1005 !important;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 190px));
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(11, 15, 25, 0.35);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: #0f172a;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.atlas-ai-panel[data-open="1"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.atlas-ai-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #0b0f19;
  color: #f1f5f9;
}

.atlas-ai-head-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  flex: 0 0 auto;
}

.atlas-ai-head-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.atlas-ai-head-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: -2px;
}

.atlas-ai-head-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.atlas-ai-icon-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.atlas-ai-icon-btn:hover {
  background: rgba(248, 250, 252, 0.12);
  color: #ffffff;
}

.atlas-ai-icon-btn svg {
  width: 16px;
  height: 16px;
}

.atlas-ai-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.atlas-ai-msg {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  animation: atlas-ai-in 0.16s ease-out;
}

@keyframes atlas-ai-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.atlas-ai-msg--bot {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.atlas-ai-msg--user {
  align-self: flex-end;
  background: #1e3a8a;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.atlas-ai-msg a {
  color: #1e3a8a;
  font-weight: 600;
}

.atlas-ai-msg--user a {
  color: #ffffff;
}

.atlas-ai-dots {
  display: inline-flex;
  gap: 4px;
  padding: 4px 2px;
}

.atlas-ai-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: atlas-ai-blip 1.1s infinite ease-in-out;
}

.atlas-ai-dots span:nth-child(2) { animation-delay: 0.15s; }
.atlas-ai-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes atlas-ai-blip {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.atlas-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}

.atlas-ai-chip {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
}

.atlas-ai-chip:hover {
  border-color: #1e3a8a;
  background: #eff6ff;
}

.atlas-ai-foot {
  flex: 0 0 auto;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 8px 10px 10px;
}

.atlas-ai-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.atlas-ai-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 9px 11px;
  font: inherit;
  color: #0f172a;
  background: #f8fafc;
  max-height: 96px;
  min-height: 40px;
  outline: none;
}

.atlas-ai-input:focus {
  border-color: #1e3a8a;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

.atlas-ai-send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: #dc2626;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.atlas-ai-send:hover { background: #b91c1c; }
.atlas-ai-send:disabled { background: #cbd5e1; cursor: not-allowed; }
.atlas-ai-send svg { width: 18px; height: 18px; }

.atlas-ai-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
}

/* Tombol serah-terima — hanya dirender bila asisten menyerahkan pertanyaan. */
.atlas-ai-handoff {
  display: inline-block;
  margin-top: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #15803d;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.atlas-ai-handoff:hover { background: #166534; }

@media (max-width: 768px) {
  .atlas-ai-fab {
    right: 16px;
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
    width: 52px;
    height: 52px;
  }

  .atlas-ai-fab svg { width: 26px; height: 26px; }

  .atlas-ai-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: 0;
  }

  .atlas-ai-msg { max-width: 90%; }
}

@media (prefers-reduced-motion: reduce) {
  .atlas-ai-fab,
  .atlas-ai-panel,
  .atlas-ai-msg {
    transition: none;
    animation: none;
  }
}
