/* --------------------------------------------------
   RESET & THEME
-------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-main: #020617;              /* background utama */
  --bg-panel: rgba(15, 23, 42, 0.96);
  --bg-panel-soft: rgba(15, 23, 42, 0.9);
  --bg-chip: rgba(17, 24, 39, 0.95);
  --bg-input: rgba(6, 11, 25, 0.98);

  --border-soft: rgba(148, 163, 184, 0.45);
  --border-strong: rgba(129, 140, 248, 0.9);

  --text-main: #e5e7eb;
  --text-soft: #9ca3af;
  --text-muted: #6b7280;

  --accent-blue: #38bdf8;
  --accent-indigo: #6366f1;
  --accent-green: #22c55e;

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 999px;

  --shadow-deep: 0 22px 60px rgba(0, 0, 0, 0.75);
  --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.9);
  --transition-fast: 0.16s ease-out;
  --transition-med: 0.22s ease-out;
}

html, body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, #1d283a 0, transparent 55%),
    radial-gradient(circle at 100% 0%, #0f172a 0, transparent 55%),
    radial-gradient(circle at 50% 100%, #020617 0, #020617 60%);
  color: var(--text-main);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 10px;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------
   APP LAYOUT
-------------------------------------------------- */
.app {
  width: 100%;
  max-width: 1220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  background: radial-gradient(circle at 20% 0%, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow:
    var(--shadow-deep),
    0 0 0 1px rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(20px);
}

/* HP: sidebar disembunyikan, fokus ke chat */
@media (max-width: 768px) {
  body {
    padding: 6px;
  }

  .app {
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .sidebar {
    display: none;
  }
}

/* --------------------------------------------------
   SIDEBAR
-------------------------------------------------- */
.sidebar {
  padding: 18px 18px 16px;
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.18), transparent 45%),
    radial-gradient(circle at 100% 0, rgba(88, 28, 135, 0.25), transparent 45%),
    var(--bg-panel);
  border-right: 1px solid rgba(30, 64, 175, 0.5);
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

/* garis neon dekor */
.sidebar::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 0 0, rgba(59, 130, 246, 0.1), transparent 55%),
    radial-gradient(circle at 100% 50%, rgba(129, 140, 248, 0.08), transparent 60%);
  opacity: 0.8;
  pointer-events: none;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 18px;
  background:
    conic-gradient(from 210deg,
      #38bdf8,
      #6366f1,
      #22c55e,
      #06b6d4,
      #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  color: #020617;
  box-shadow:
    0 0 25px rgba(56, 189, 248, 0.9),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.brand-text p {
  font-size: 12px;
  color: var(--text-soft);
}

/* Section label */
.sidebar-section {
  position: relative;
  z-index: 1;
}

.section-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Info platform card */
.profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(31, 41, 55, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.55);
  box-shadow: var(--shadow-soft);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, #fbbf24, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #0b1120;
}

.profile-name {
  font-size: 14px;
  font-weight: 600;
}

.profile-role {
  font-size: 12px;
  color: var(--text-soft);
}

/* Mode konsultasi / quick actions */
.pill-btn {
  width: 100%;
  text-align: left;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 9px 13px;
  font-size: 12px;
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.18), transparent 65%),
              rgba(15, 23, 42, 0.95);
  color: var(--text-main);
  cursor: pointer;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition:
    background var(--transition-med),
    transform var(--transition-fast),
    box-shadow var(--transition-med),
    border-color var(--transition-med);
}

.pill-btn:hover {
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.35), transparent 60%),
    rgba(15, 23, 42, 0.98);
  border-color: rgba(129, 140, 248, 0.95);
  box-shadow: 0 0 22px rgba(59, 130, 246, 0.7);
  transform: translateY(-1px);
}

.pill-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.6);
}

/* Rekomendasi penggunaan */
.shortcuts ul {
  list-style: none;
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* --------------------------------------------------
   MAIN CHAT AREA
-------------------------------------------------- */
.chat {
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
}

/* Header */
.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.85);
  margin-bottom: 12px;
}

.chat-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.chat-header p {
  font-size: 13px;
  color: var(--text-soft);
  max-width: 440px;
}

/* Status pill */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(34, 197, 94, 0.7);
  background: radial-gradient(circle at 0 0, rgba(34, 197, 94, 0.3), transparent 70%);
  color: #bbf7d0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.3);
}

/* --------------------------------------------------
   CHAT BODY + BUBBLES
-------------------------------------------------- */
.chat-body {
  flex: 1;
  padding: 6px 2px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

/* scrollbar tipis */
.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.85);
  border-radius: 999px;
}

.bubble-row {
  display: flex;
  justify-content: flex-start;
}

.bubble-row-user {
  justify-content: flex-end;
}

.bubble {
  max-width: 80%;
  padding: 10px 13px 7px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.95);
}

/* AI bubble */
.bubble-ai {
  background: linear-gradient(135deg, #0f172a, #1d4ed8);
  border: 1px solid rgba(129, 140, 248, 0.8);
  border-bottom-left-radius: 6px;
}

/* User bubble */
.bubble-user {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #022c22;
  border-bottom-right-radius: 6px;
}

/* Meta text */
.bubble-meta {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.78;
}


/* Typing indicator (3 titik jalan) */
.typing-indicator {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    margin-top: 4px;
}

.typing-indicator span {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    animation: typingBounce 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

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


/* --------------------------------------------------
   INPUT AREA (PAKAI STRUKTUR index.html YANG SEKARANG)
-------------------------------------------------- */
.chat-input {
  margin-top: 10px;
}

.input-wrapper {
  background: var(--bg-input);
  border-radius: 18px;
  border: 1px solid rgba(75, 85, 99, 0.9);
  padding: 9px 10px 7px;
  box-shadow:
    0 16px 35px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Textarea */
textarea#message {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.45;
  max-height: 120px;
  padding: 4px 2px 0;
  caret-color: var(--accent-green);
  -webkit-appearance: none;
  appearance: none;
}

textarea#message::placeholder {
  color: var(--text-muted);
}

/* Bagian bawah: chips + tombol kirim */
.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: none;
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  font-size: 11px;
  background: var(--bg-chip);
  color: var(--text-main);
  border: 1px solid rgba(55, 65, 81, 0.9);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.chip:hover {
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.35), rgba(17, 24, 39, 0.98));
  border-color: var(--border-strong);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.7);
  transform: translateY(-1px);
}

.chip:active {
  transform: translateY(1px);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.65);
}

/* Tombol Kirim */
.send-btn {
  border-radius: var(--radius-pill);
  border: none;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-green), #4ade80);
  color: #022c22;
  box-shadow:
    0 0 18px rgba(34, 197, 94, 0.75),
    0 0 0 1px rgba(21, 128, 61, 0.9);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    filter var(--transition-fast);
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

.send-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

.send-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

/* --------------------------------------------------
   RESPONSIVE DETAIL
-------------------------------------------------- */
@media (max-width: 480px) {
  .chat {
    padding: 14px 10px;
  }

  .chat-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .bubble {
    max-width: 88%;
  }

  .input-wrapper {
    padding: 8px 9px 7px;
  }

  .send-btn {
    padding: 7px 14px;
    font-size: 12px;
  }
}
/* ===== FIX SCROLL TIDAK BISA NAIK TURUN ===== */

html, body {
  height: auto !important;
  overflow-y: auto !important;
}

.app {
  height: auto !important;
  max-height: none !important;
}

.chat-body {
  overflow-y: auto !important;
  max-height: calc(100vh - 240px) !important;
  padding-bottom: 20px;
}

/* Pill active highlight */
.pill-btn.pill-active {
  box-shadow: 0 6px 30px rgba(99, 102, 241, 0.35), 0 0 18px rgba(59,130,246,0.25);
  border-color: rgba(129,140,248,0.95);
  transform: translateY(-2px);
}

/* ==== STATUS PILL ANIMATED ==== */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.8);
  background: radial-gradient(circle at 0 0, rgba(34, 197, 94, 0.32), transparent 70%),
              linear-gradient(135deg, #022c22, #064e3b);
  color: #bbf7d0;
  box-shadow:
    0 0 18px rgba(34, 197, 94, 0.7),
    0 0 0 1px rgba(6, 78, 59, 0.9);
  animation: statusGlow 4s ease-in-out infinite alternate;
}

.status-dot {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow:
    0 0 12px rgba(34, 197, 94, 0.9),
    0 0 0 4px rgba(34, 197, 94, 0.3);
  animation: dotCore 1.8s ease-in-out infinite;
}

/* Ring yang melebar keluar */
.status-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid rgba(34, 197, 94, 0.55);
  animation: dotPulseRing 1.8s ease-out infinite;
}

/* Animasi glow pill */
@keyframes statusGlow {
  0% {
    box-shadow:
      0 0 12px rgba(34, 197, 94, 0.6),
      0 0 0 1px rgba(6, 78, 59, 0.9);
    transform: translateY(0);
  }
  50% {
    box-shadow:
      0 0 22px rgba(34, 197, 94, 0.9),
      0 0 0 1px rgba(6, 95, 70, 1);
    transform: translateY(-1px);
  }
  100% {
    box-shadow:
      0 0 14px rgba(34, 197, 94, 0.7),
      0 0 0 1px rgba(6, 78, 59, 0.9);
    transform: translateY(0);
  }
}

/* Animasi titik hijau di dalam */
@keyframes dotCore {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Ring yang keluar pelan-pelan */
@keyframes dotPulseRing {
  0% {
    transform: scale(0.2);
    opacity: 0.9;
  }
  70% {
    transform: scale(2.1);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

/* ==== HEADER KONSULTASI JADI KAYAK CARD ==== */

.chat-header {
  position: relative;
  margin-bottom: 16px;
  padding: 16px 14px 14px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.22), transparent 60%),
    radial-gradient(circle at 100% 0, rgba(129, 140, 248, 0.18), transparent 60%),
    rgba(15, 23, 42, 0.98);
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.95),
    0 0 0 1px rgba(15, 23, 42, 0.9);
  border-bottom: none !important;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* garis glow tipis di bawah judul */
.chat-header::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 8px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(96, 165, 250, 0.8),
    rgba(52, 211, 153, 0.8),
    transparent);
  opacity: 0.7;
}

/* Judul */
.chat-header h2 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

/* Subteks */
.chat-header p {
  font-size: 13px;
  color: #9ca3af;
  max-width: 460px;
}

.typing-dots::after {
  content: '...';
  display: inline-block;
  overflow: hidden;
  width: 0;
  vertical-align: bottom;
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0%   { width: 0; }
  33%  { width: 0.4em; }
  66%  { width: 0.8em; }
  100% { width: 1.2em; }
}