/* ==========================================================================
   FINKU GEN-Z — AI CHAT PAGE STYLES (ai-chat.css)
   Styling khusus halaman AXIOM Intelligence (AI Chat)
   ========================================================================== */

/* --------------------------------------------------------------------------
   CANVAS AREA — Full-bleed gradient background
   -------------------------------------------------------------------------- */
#view-aichat {
  background: var(--gradient-bg), var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Subtle radial glow di sudut kiri atas */
#view-aichat::before {
  content: '';
  position: absolute;
  top: -120px;
  left: -80px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Subtle radial glow di kanan bawah */
#view-aichat::after {
  content: '';
  position: absolute;
  bottom: -100px;
  right: -60px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Panel konten di atas overlay */
#ai-chat-panel {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   MESSAGES CONTAINER — Scrollbar tersembunyi agar bersih
   -------------------------------------------------------------------------- */
#ai-chat-messages {
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;   /* IE/Edge */
}
#ai-chat-messages::-webkit-scrollbar {
  display: none;               /* Chrome/Safari */
}

/* --------------------------------------------------------------------------
   PESAN USER & AI — Hover effect subtle
   -------------------------------------------------------------------------- */
.chat-msg-user,
.chat-msg-ai {
  transition: opacity 0.2s ease;
  animation: fadeIn 0.25s ease-out forwards;
}

/* --------------------------------------------------------------------------
   QUICK PROMPT PILLS — Hover state via CSS (fallback dari inline JS handler)
   -------------------------------------------------------------------------- */
.chat-quick-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-pill);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}
.chat-quick-btn:hover {
  background: var(--accent-blue-glow, rgba(56, 189, 248, 0.15));
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* --------------------------------------------------------------------------
   TEXTAREA AUTO-RESIZE PLACEHOLDER
   -------------------------------------------------------------------------- */
#ai-chat-input::placeholder {
  color: var(--text-muted);
  font-size: 15px;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   LOADING DOTS ANIMATION — Pemikiran AI
   -------------------------------------------------------------------------- */
.chat-loading-dots {
  display: inline-block;
  min-width: 32px;
  opacity: 0.8;
}
.chat-loading-dots::after {
  content: '';
  animation: chatDots 1.2s steps(1, end) infinite;
}
@keyframes chatDots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* --------------------------------------------------------------------------
   LIGHT MODE OVERRIDES
   -------------------------------------------------------------------------- */
body.light-mode #view-aichat {
  background: var(--gradient-bg), var(--bg-primary);
}
body.light-mode .chat-quick-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-secondary);
}
body.light-mode .chat-quick-btn:hover {
  color: var(--accent-blue);
}
body.light-mode #ai-chat-composer {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 8px 28px rgba(15, 15, 26, 0.08) !important;
}

/* --------------------------------------------------------------------------
   MOBILE ADJUSTMENTS
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  #ai-chat-messages {
    padding: 24px 5% !important;
    gap: 20px !important;
  }
  #ai-chat-panel > div:last-child {
    padding-left: 5% !important;
    padding-right: 5% !important;
  }
}

/* Hide FAB in AI Chat */
body:has(#view-aichat.active) .fab-quick-add { display: none !important; }

/* --------------------------------------------------------------------------
   PDF PREVIEW MODAL (v111) — per-page cards + auto table detection
   -------------------------------------------------------------------------- */
#ai-chat-pdf-preview-pages {
  overflow-y: auto;
  max-height: 55vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.pdf-preview-page-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
  overflow: hidden;
}

.pdf-preview-page-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-glass-hover);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.pdf-preview-page-meta {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.pdf-preview-page-body {
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  word-break: break-word;
}

.pdf-preview-table-wrap {
  overflow-x: auto;
  padding: 4px 10px 10px;
}

.pdf-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.pdf-preview-table th {
  text-align: right;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.pdf-preview-table th:first-child,
.pdf-preview-table td:first-child {
  text-align: left;
}

.pdf-preview-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-align: right;
}

.pdf-preview-table td:first-child {
  color: var(--text-primary);
}

.pdf-preview-cut-marker {
  margin: 0 14px 12px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #ef4444;
  font-size: 12.5px;
  font-weight: 600;
}
