/* ============================================================
   ROJAK AI — CONSOLIDATED STYLESHEET
   Semua styling widget Rojak AI ada di file ini.
   Di-link dari index.html <head>.
   ============================================================ */

/* ============================================================
   1. FLOATING ACTION BUTTON (FAB)
============================================================ */

.rojak-ai-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9997;
  height: 46px;
  padding: 0 18px 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-bright, #2a2b2c);
  border-radius: 999px;
  background: var(--panel, #111213);
  color: var(--text, #f0f0ee);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.005em;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  transition: transform 180ms cubic-bezier(.16,1,.3,1),
              background 180ms ease,
              border-color 180ms ease,
              box-shadow 220ms ease,
              opacity 200ms ease;
}

.rojak-ai-fab:hover {
  background: var(--panel-2, #161718);
  border-color: #3a3b3c;
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}

.rojak-ai-fab:active { transform: translateY(0) scale(.98); }

.rojak-ai-fab-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background: var(--accent, #e45632);
  color: #fff;
  transition: transform 340ms cubic-bezier(.34, 1.56, .64, 1);
}

.rojak-ai-fab:hover .rojak-ai-fab-icon {
  transform: rotate(15deg) scale(1.05);
}

.rojak-ai-fab-icon svg {
  width: 15px !important;
  height: 15px !important;
  max-width: 15px !important;
  max-height: 15px !important;
  display: block !important;
}

.rojak-ai-fab-dot {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green, #6bb87c);
  box-shadow:
    0 0 0 2.5px var(--panel, #111213),
    0 0 0 3.5px rgba(107, 184, 124, .25);
  animation: rojakAiDotPulse 2.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes rojakAiDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .6; transform: scale(.9); }
}

.rojak-ai-fab.rojak-ai-fab-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(.95);
}

/* ============================================================
   2. PANEL
============================================================ */

.rojak-ai-panel {
  position: fixed;
  z-index: 9998;
  right: 16px;
  bottom: 16px;
  width: min(430px, calc(100vw - 28px));
  height: min(680px, calc(100vh - 28px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #292b29;
  border-radius: 10px;
  background: #111210;
  box-shadow: 0 20px 55px rgba(0,0,0,.58), 0 2px 8px rgba(0,0,0,.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(.98);
  transform-origin: bottom right;
  transition: opacity 220ms cubic-bezier(.16,1,.3,1),
              transform 320ms cubic-bezier(.16,1,.3,1),
              visibility 220ms ease;
}

.rojak-ai-panel.rojak-ai-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ============================================================
   3. HEADER
============================================================ */

.rojak-ai-header {
  flex: 0 0 auto;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid #242623;
  background: #151614;
}

.rojak-ai-header-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.rojak-ai-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid #6f3426;
  border-radius: 8px;
  background: #1d1613;
  color: #e45632;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -.02em;
  transition: transform 340ms cubic-bezier(.34, 1.56, .64, 1),
              box-shadow 340ms ease;
}

.rojak-ai-avatar:hover {
  transform: scale(1.08) rotate(-4deg);
  box-shadow: 0 0 0 3px rgba(228, 86, 50, .15);
}

.rojak-ai-title { min-width: 0; }

.rojak-ai-title-name {
  color: var(--text, #f0f0ee);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.2;
}

.rojak-ai-title-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: #777a74;
  font-size: 10px;
  line-height: 1.2;
}

.rojak-ai-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green, #6bb87c);
  box-shadow: 0 0 0 2px rgba(107,184,124,.10);
}

.rojak-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.rojak-ai-icon-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #292b29;
  border-radius: 7px;
  background: #151614;
  color: #8b8e88;
  font-family: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: transform 240ms cubic-bezier(.34, 1.56, .64, 1),
              border-color .16s ease,
              background .16s ease,
              color .16s ease;
}

.rojak-ai-icon-button:hover {
  border-color: #3a3c39;
  background: #1b1d1a;
  color: #e6e7e3;
  transform: translateY(-1px);
}

.rojak-ai-icon-button:active {
  transform: translateY(0) scale(.94);
}

.rojak-ai-icon-button svg {
  width: 13px !important;
  height: 13px !important;
  max-width: 13px !important;
  max-height: 13px !important;
  display: block !important;
}

/* ============================================================
   4. BODY
============================================================ */

.rojak-ai-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 16px 10px;
  background: #0e0f0e;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #292b29 transparent;
  -webkit-overflow-scrolling: touch;
}

.rojak-ai-body::-webkit-scrollbar { width: 6px; }
.rojak-ai-body::-webkit-scrollbar-thumb {
  background: #2a2b2c;
  border-radius: 99px;
}

/* ============================================================
   5. MESSAGES
============================================================ */

.rojak-ai-msg {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.rojak-ai-msg-user { align-items: flex-end; }
.rojak-ai-msg-bot  { align-items: flex-start; }

.rojak-ai-bubble {
  max-width: min(86%, 365px);
  padding: 11px 14px;
  border: 1px solid #272925;
  border-radius: 9px;
  background: #171916;
  color: #e2e4df;
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: -.004em;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  overflow: hidden;
  transition: border-color 240ms ease,
              transform 320ms cubic-bezier(.16, 1, .3, 1);
}

.rojak-ai-msg-user .rojak-ai-bubble {
  border-color: #633122;
  background: #211714;
  border-bottom-right-radius: 3px;
  color: #e2e4df;
}

.rojak-ai-msg-user .rojak-ai-bubble:hover {
  transform: translateX(-2px);
}

.rojak-ai-msg-bot .rojak-ai-bubble {
  border-bottom-left-radius: 3px;
  max-width: 100%;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
}

.rojak-ai-msg-bot .rojak-ai-bubble:hover {
  transform: translateX(2px);
}

.rojak-ai-time {
  margin-top: 5px;
  padding: 0 3px;
  color: #555852;
  font-size: 9px;
  letter-spacing: .01em;
}

/* ============================================================
   6. TYPING INDICATOR
============================================================ */

.rojak-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #272925;
  border-radius: 9px;
  border-bottom-left-radius: 3px;
  background: #171916;
  animation: rojakAiTypingIn 380ms cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes rojakAiTypingIn {
  from { opacity: 0; transform: translateX(-14px) scale(.94); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

.rojak-ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8b8e88;
  animation: rojakAiTypingBounce 1.4s ease-in-out infinite;
}

.rojak-ai-typing span:nth-child(2) { animation-delay: .18s; }
.rojak-ai-typing span:nth-child(3) { animation-delay: .36s; }

@keyframes rojakAiTypingBounce {
  0%, 60%, 100% {
    transform: translateY(0) scale(1);
    opacity: .45;
    background: #8b8e88;
  }
  30% {
    transform: translateY(-5px) scale(1.15);
    opacity: 1;
    background: #e45632;
  }
}

/* ============================================================
   7. QUICK SUGGESTIONS
============================================================ */

.rojak-ai-suggest {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 4px 0 18px;
  padding-top: 10px;
  animation: rojakAiSuggestIn 520ms cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: 180ms;
}

@keyframes rojakAiSuggestIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rojak-ai-suggest::before {
  content: "Saran cepat";
  display: block;
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: #686b65;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  animation: rojakAiSuggestLabelIn 480ms cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: 260ms;
}

@keyframes rojakAiSuggestLabelIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.rojak-ai-chip {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #292b29;
  border-radius: 7px;
  background: #121311;
  color: #c4c6c0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  letter-spacing: -.005em;
  cursor: pointer;
  animation: rojakAiChipIn 460ms cubic-bezier(.34, 1.56, .64, 1) both;
  transition: border-color 180ms ease,
              background 180ms ease,
              color 180ms ease,
              transform 240ms cubic-bezier(.34, 1.56, .64, 1),
              box-shadow 240ms ease;
}

.rojak-ai-chip:nth-child(2) { animation-delay: 320ms; }
.rojak-ai-chip:nth-child(3) { animation-delay: 380ms; }
.rojak-ai-chip:nth-child(4) { animation-delay: 440ms; }
.rojak-ai-chip:nth-child(5) { animation-delay: 500ms; }

@keyframes rojakAiChipIn {
  0%   { opacity: 0; transform: translateY(10px) scale(.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.rojak-ai-chip:hover {
  border-color: #633122;
  background: #1a1614;
  color: #f0f0ee;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .28);
}

.rojak-ai-chip:active {
  transform: translateY(0) scale(.97);
}

@media (min-width: 480px) {
  .rojak-ai-suggest {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================
   8. TYPEWRITER CURSOR
============================================================ */

.rojak-ai-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  background: #e45632;
  animation: rojakAiCursorBlink 640ms steps(1) infinite;
}

@keyframes rojakAiCursorBlink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ============================================================
   9. BUBBLE CONTENT (markdown render)
============================================================ */

.rojak-ai-bubble-inner {
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

.rojak-ai-bubble-inner p { margin: 0 0 6px; }
.rojak-ai-bubble-inner p:last-child { margin-bottom: 0; }

.rojak-ai-bubble-inner code {
  padding: 1px 4px;
  border-radius: 3px;
  background: #0b0c0a;
  color: #f0a48a;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.rojak-ai-bubble-inner pre {
  margin: 6px 0 2px;
  padding: 8px 9px;
  border-radius: 5px;
  background: #0b0c0a;
  border: 1px solid #222320;
  overflow-x: hidden;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-all;
}

.rojak-ai-bubble-inner pre code {
  background: transparent;
  color: #d9e0cf;
  padding: 0;
  font-size: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================================
   10. FOOTER / INPUT
============================================================ */

.rojak-ai-footer {
  flex: 0 0 auto;
  padding: 10px 12px 11px;
  border-top: 1px solid #242623;
  background: #121311;
}

.rojak-ai-input-row {
  box-sizing: border-box;
  display: flex;
  align-items: flex-end;
  gap: 9px;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 5px 5px 5px 13px;
  border: 1px solid #30322f !important;
  border-radius: 9px;
  background: #0b0c0b;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color 240ms ease,
              background 240ms ease,
              box-shadow 300ms ease;
}

.rojak-ai-input-row:hover,
.rojak-ai-input-row:focus,
.rojak-ai-input-row:focus-within,
.rojak-ai-input-row:focus-visible,
.rojak-ai-input-row:active {
  border: 1px solid #464944 !important;
  background: #0d0e0d !important;
  outline: none !important;
  box-shadow: none !important;
}

.rojak-ai-input-row:focus-within {
  box-shadow: 0 0 0 3px rgba(228, 86, 50, .08) !important;
}

.rojak-ai-textarea {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 34px;
  max-height: 108px;
  margin: 0;
  padding: 7px 0;
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0 !important;
  outline: none !important;
  background: transparent !important;
  color: #e5e7e2;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: -.005em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  resize: none;
  -webkit-appearance: none;
  appearance: none;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  caret-color: #e45632;
  vertical-align: middle;
  box-shadow: none !important;
}

.rojak-ai-textarea:focus,
.rojak-ai-textarea:focus-visible,
.rojak-ai-textarea:hover,
.rojak-ai-textarea:active {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.rojak-ai-textarea::placeholder {
  color: #555852;
  line-height: 1.45;
}

.rojak-ai-textarea::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.rojak-ai-send {
  box-sizing: border-box;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  margin-bottom: 2px;
  border: 1px solid #c84c2f;
  border-radius: 7px;
  background: #d95735;
  color: #fff;
  cursor: pointer;
  transition: transform 240ms cubic-bezier(.34, 1.56, .64, 1),
              background 180ms ease,
              border-color 180ms ease,
              box-shadow 240ms ease;
}

.rojak-ai-send:hover {
  background: #e3603b;
  border-color: #e3603b;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(228, 86, 50, .35);
}

.rojak-ai-send:hover svg {
  animation: rojakAiPlaneFly 620ms cubic-bezier(.16, 1, .3, 1);
}

@keyframes rojakAiPlaneFly {
  0%   { transform: translate(0, 0) rotate(0deg); }
  45%  { transform: translate(8px, -8px) rotate(-8deg); opacity: 0; }
  46%  { transform: translate(-10px, 10px) rotate(0deg); opacity: 0; }
  100% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
}

.rojak-ai-send:active {
  transform: translateY(0) scale(.92);
}

.rojak-ai-send:disabled {
  opacity: .45;
  cursor: not-allowed;
  animation: rojakAiSendPulse 1.4s ease-in-out infinite;
}

@keyframes rojakAiSendPulse {
  0%, 100% { opacity: .55; }
  50%      { opacity: .35; }
}

.rojak-ai-send svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  display: block !important;
}

.rojak-ai-hint {
  margin-top: 7px;
  font-size: 9px;
  line-height: 1.4;
  color: #4f524d;
  text-align: center;
  letter-spacing: .01em;
}

/* ============================================================
   11. BODY NO-SCROLL
============================================================ */

body.rojak-ai-no-scroll { overflow: hidden; }

/* ============================================================
   12. RESPONSIVE — MOBILE FULLSCREEN
============================================================ */

@media (max-width: 600px) {
  .rojak-ai-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-shadow: none;
    transform-origin: bottom center;
  }

  .rojak-ai-fab {
    right: 12px;
    bottom: 12px;
    height: 44px;
    padding: 0 16px 0 7px;
    font-size: 12.5px;
  }

  .rojak-ai-fab-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .rojak-ai-header {
    height: 60px;
    padding: 0 12px 0 15px;
  }

  .rojak-ai-body {
    padding: 17px 14px 9px;
  }

  .rojak-ai-bubble {
    max-width: 91%;
    font-size: 13.5px;
    line-height: 1.58;
  }

  .rojak-ai-footer {
    padding: 9px 10px 10px;
  }

  .rojak-ai-input-row {
    border-radius: 9px;
  }

  .rojak-ai-chip {
    font-size: 12px;
  }
}

/* ============================================================
   13. FULL ANIMATION PACK
============================================================ */

/* FAB entrance */
.rojak-ai-fab {
  animation: rdkAiFabIn 640ms cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: 800ms;
}

@keyframes rdkAiFabIn {
  0%   { opacity: 0; transform: translateY(24px) scale(.88); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* FAB dot glow */
.rojak-ai-fab-dot {
  animation: rojakAiDotPulse 2.2s ease-in-out infinite,
             rdkAiDotGlow 3s ease-in-out infinite;
}

@keyframes rdkAiDotGlow {
  0%, 100% {
    box-shadow:
      0 0 0 2.5px var(--panel, #111213),
      0 0 0 3.5px rgba(107, 184, 124, .25),
      0 0 12px rgba(107, 184, 124, .35);
  }
  50% {
    box-shadow:
      0 0 0 2.5px var(--panel, #111213),
      0 0 0 3.5px rgba(107, 184, 124, .25),
      0 0 18px rgba(107, 184, 124, .55);
  }
}

/* Panel entrance spring */
.rojak-ai-panel.rojak-ai-open {
  animation: rdkAiPanelIn 520ms cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes rdkAiPanelIn {
  0%   { opacity: 0; transform: translateY(28px) scale(.94); }
  60%  { opacity: 1; transform: translateY(-3px) scale(1.005); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Avatar entrance */
.rojak-ai-avatar {
  animation: rdkAiAvatarIn 480ms cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: 120ms;
}

@keyframes rdkAiAvatarIn {
  from { opacity: 0; transform: scale(.75) rotate(-12deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

/* Status dot pulse */
.rojak-ai-status-dot {
  animation: rdkAiStatusPulse 2.4s ease-in-out infinite;
}

@keyframes rdkAiStatusPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px rgba(107, 184, 124, .10); }
  50%      { transform: scale(1.25); box-shadow: 0 0 0 4px rgba(107, 184, 124, .18); }
}

/* Reset icon spin on hover */
#rojakAiReset:hover svg {
  animation: rdkAiResetSpin 720ms cubic-bezier(.16, 1, .3, 1);
}

@keyframes rdkAiResetSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Message entrance */
.rojak-ai-msg-user {
  animation: rdkAiMsgInUser 420ms cubic-bezier(.16, 1, .3, 1) both;
}

.rojak-ai-msg-bot {
  animation: rdkAiMsgInBot 420ms cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes rdkAiMsgInUser {
  0%   { opacity: 0; transform: translateX(24px) translateY(6px) scale(.96); }
  100% { opacity: 1; transform: translateX(0) translateY(0) scale(1); }
}

@keyframes rdkAiMsgInBot {
  0%   { opacity: 0; transform: translateX(-24px) translateY(6px) scale(.96); }
  100% { opacity: 1; transform: translateX(0) translateY(0) scale(1); }
}

/* Panel close transition */
.rojak-ai-panel:not(.rojak-ai-open) {
  transition:
    opacity 200ms ease,
    transform 260ms cubic-bezier(.7, 0, .84, 0),
    visibility 200ms ease;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .rojak-ai-fab,
  .rojak-ai-fab-dot,
  .rojak-ai-panel.rojak-ai-open,
  .rojak-ai-avatar,
  .rojak-ai-status-dot,
  .rojak-ai-msg-user,
  .rojak-ai-msg-bot,
  .rojak-ai-suggest,
  .rojak-ai-chip,
  .rojak-ai-typing,
  .rojak-ai-typing span,
  .rojak-ai-send,
  .rojak-ai-send svg {
    animation: none !important;
    transition: none !important;
  }
}