/* Asisten AI chat widget (views/ai/widget.php). Colours follow the theme's --warna-kampus when the theme has one;
   the fallback is a dark blue that keeps white text above 7:1. Everything is scoped under .aicw so theme styles
   and this file stay apart. */
.aicw {
  --aicw-warna: var(--warna-kampus, #1d4f6e);
  --aicw-di-atas: var(--warna-kampus-di-atas, #ffffff);
  --aicw-teks: #1f2328;
  --aicw-redup: #57606a;
  --aicw-latar: #ffffff;
  --aicw-garis: #d0d7de;
  --aicw-bot: #f3f5f7;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1050;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--aicw-teks);
}
.aicw *, .aicw *::before, .aicw *::after { box-sizing: border-box; }
.aicw-buka {
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 22px;
  background: var(--aicw-warna);
  color: var(--aicw-di-atas);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.aicw-buka[aria-expanded="true"] { display: none; }
.aicw-panel {
  display: flex;
  flex-direction: column;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 32px);
  background: var(--aicw-latar);
  border: 1px solid var(--aicw-garis);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
  overflow: hidden;
}
.aicw-panel[hidden] { display: none; }
.aicw-kepala {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  background: var(--aicw-warna);
  color: var(--aicw-di-atas);
}
.aicw-judul { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; color: inherit; overflow-wrap: anywhere; }
.aicw-tutup {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}
.aicw-log { flex: 1; overflow-y: auto; padding: 12px 16px; }
.aicw-pesan { margin: 0 0 10px; padding: 8px 12px; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.aicw-pesan-bot { background: var(--aicw-bot); margin-right: 24px; }
.aicw-pesan-anda { background: transparent; border: 1px solid var(--aicw-garis); margin-left: 24px; }
.aicw-pesan-galat { background: #fff1f0; color: #8a1c13; border: 1px solid #f3b3ad; }
.aicw-pesan-tunggu { color: var(--aicw-redup); font-style: italic; }
.aicw-form { display: flex; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--aicw-garis); }
.aicw-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 8px 10px;
  border: 1px solid #8c959f;
  border-radius: 6px;
  font: inherit;
  font-size: 16px;
  color: var(--aicw-teks);
  background: #ffffff;
  resize: none;
}
.aicw-kirim {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--aicw-warna);
  color: var(--aicw-di-atas);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.aicw-kirim[disabled] { opacity: .6; cursor: wait; }
.aicw-catatan { margin: 0; padding: 0 16px 10px; font-size: 12px; color: var(--aicw-redup); }
.aicw button:focus-visible, .aicw-input:focus-visible { outline: 3px solid #0969da; outline-offset: 2px; }
.aicw-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 480px) {
  .aicw { left: 16px; right: 16px; bottom: 16px; display: flex; justify-content: flex-end; }
  .aicw-panel { width: 100%; max-width: none; height: calc(100vh - 32px); height: calc(100dvh - 32px); }
}
@media print { .aicw { display: none; } }
