/*
// PORT-RBW-v1.0.0 (widget di-port dari project chatbot sebelumnya, paritas widget v1.5.7)*
 * RBW AI Assistant - widget.css
 * Styling widget chat + video launcher.
 * Semua class pakai prefix "rbw-" supaya tidak bentrok dengan tema WordPress.
 *
 * v1.1: ukuran frame video desktop 120x180 (rasio 2:3, bisa dioverride lewat
 *       CSS custom properties dari widget.js jika diubah di admin),
 *       mobile 100x160 via media query.
 */

/* ===== Container ===== */
#rbw-ai-widget {
  position: fixed;
  bottom: 70px;
  left: 10px;
  z-index: 99999;
  font-family: 'Segoe UI', Arial, sans-serif;
}

/* ===== Launcher: video frame ===== */
#rbw-video-launcher {
  cursor: pointer;
  text-align: center;
  user-select: none;
  transition: transform 0.2s ease;
}
#rbw-video-launcher:hover { transform: scale(1.05); }

#rbw-video-frame {
  position: relative;
  width: var(--rbw-frame-w, 120px);   /* desktop 120px */
  height: var(--rbw-frame-h, 180px);  /* desktop 180px — rasio 2:3 */
  overflow: hidden;
  border-radius: 14px;
  background: transparent; /* video transparan (webm) tampil bersih; fallback mp4 juga tetap ok */
  box-shadow: none;
}

#rbw-video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;  /* video sudah di-crop 2:3 via ffmpeg; tidak perlu zoom */
  transform: scale(1.0);
  display: block;
  pointer-events: none;
}

#rbw-launcher-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  /*background: rgba(24, 78, 119, 0.85); /* hijau tua semi transparan — sesuaikan warna tema RBW */
  background-color: #C46204;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  padding: 0px 0;
  text-align: center;
  border-radius: 0 0 14px 14px;
}

/* ===== Launcher: tombol biasa (jika tidak pakai video) ===== */
#rbw-launcher-btn {
  /*ackground: linear-gradient(135deg, #1a6ea8, #0f4a75); /* hijau tua — sesuaikan tema */
  background-color: #C46204;
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* ===== Launcher: ukuran mobile ===== */
@media (max-width: 768px) {
  #rbw-video-frame {
    width: 100px;   /* mobile 100px */
    height: 160px;  /* mobile 160px */
  }
  #rbw-launcher-label {
    font-size: 12px;
    padding: 4px 0;
  }
  #rbw-chat-box {
  width: 290px !important;
  height: 480px !important;
  }
}

/* ===== Chat box ===== */
#rbw-chat-box {
  display: none; /* WAJIB — tersembunyi sampai launcher diklik */
  width: 360px;
  max-width: calc(100vw - 20px);
  height: 450px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25);
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 10px;
}

.rbw-chat-header {
  /*background: linear-gradient(135deg, #1a6ea8, #0f4a75); */
  background-color: #C46204;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rbw-chat-title {
  font-weight: bold;
  font-size: 15px;
}

.rbw-chat-subtitle {
  font-size: 11px;
  opacity: 0.85;
}

#rbw-chat-close {
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}
#rbw-chat-close:hover { opacity: 1; }

/* ===== Chat logs ===== */
#rbw-chat-logs {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #f4f7f9;
  font-size: 14px;
  line-height: 1.5;
}

.rbw-msg-user,
.rbw-msg-bot {
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 85%;
  word-wrap: break-word;
}

.rbw-msg-user {
  /*background: #1a6ea8; */
  background-color: #C46204;
  color: #fff;
  margin-left: auto;
  text-align: left;
}

.rbw-msg-bot {
  background: #ffffff;
  border: 1px solid #dfe6ea;
  margin-right: auto;
}

.rbw-msg-bot a {
  color: #0f4a75;
  font-weight: 600;
  text-decoration: underline;
}

.rbw-msg-img img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 6px;
  cursor: pointer;
}

.rbw-loading {
  font-style: italic;
  opacity: 0.7;
}

.rbw-error {
  background: #fdecea;
  border-color: #f5c6cb;
  color: #a94442;
}

/* ===== Input area ===== */
.rbw-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #e5eaee;
}

#rbw-user-input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #ccd6dd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
}
#rbw-user-input:focus { border-color: #1a6ea8; }

#rbw-send-btn {
  /*background: #1a6ea8; */
  background-color: #C46204;
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
}
#rbw-send-btn:disabled { opacity: 0.6; cursor: wait; }

/* ===== v1.4 VOICE: mic & speaker buttons ===== */
#rbw-mic-btn {
  background: #f4f7f9;
  border: 1px solid #ccd6dd;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s ease;
}
#rbw-mic-btn:hover { background: #e5eaee; }
#rbw-mic-btn.rbw-mic-active {
  background: #c0392b;
  border-color: #c0392b;
  animation: rbw-pulse 1.2s infinite;
}
@keyframes rbw-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
}
#rbw-speak-toggle {
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  margin-right: 10px;
}
#rbw-speak-toggle:hover { opacity: 1; }
.rbw-speak-btn {
  display: inline-block;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.55;
  margin-left: 8px;
  vertical-align: middle;
  transition: opacity 0.15s ease;
}
.rbw-speak-btn:hover { opacity: 1; }

/* ===== v1.5: input area 2 baris + lang selector ===== */
.rbw-chat-input-area {
  flex-direction: column;
  gap: 8px;
}

.rbw-input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.rbw-input-actions #rbw-send-btn {
  margin-left: auto;
  min-width: 84px;
  flex: 0 0 auto;
}

#rbw-lang-select {
  background: #f4f7f9;
  border: 1px solid #ccd6dd;
  border-radius: 18px;
  font-size: 12px;
  color: #0f4a75;
  padding: 6px 4px;
  max-width: 130px;
  cursor: pointer;
  outline: none;
  flex: 0 1 auto;
}
#rbw-lang-select:focus { border-color: #1a6ea8; }

@media (max-width: 768px) {
  #rbw-lang-select {
    font-size: 11px;
    max-width: 110px;
    padding: 5px 2px;
  }
  .rbw-input-actions #rbw-send-btn {
    min-width: 72px;
    padding: 9px 12px;
  }
}
