/* ===========================================================
   Learn With Rinkesh — Chat widget styles
   =========================================================== */

#chatFloatBtn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sky, #2F80C9);
  color: #fff;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(47,128,201,0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: chatFloat 3s ease-in-out infinite;
}
#chatFloatBtn:hover {
  transform: scale(1.15);
  box-shadow: 0 10px 26px rgba(47,128,201,0.45);
  animation-play-state: paused;
}
@keyframes chatFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ---------- Disclaimer ---------- */
.chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,35,33,0.6);
  align-items: center;
  justify-content: center;
  z-index: 1000001;
  padding: 20px;
}
.chat-overlay.open { display: flex; }

.chat-disclaimer-box {
  background: #fff;
  border-radius: var(--radius);
  border-top: 5px solid var(--sky, #2F80C9);
  max-width: 420px;
  width: 100%;
  padding: 28px;
  animation: fbPop 0.35s cubic-bezier(.34,1.56,.64,1);
}
.chat-disclaimer-box h3 { font-size: 18px; margin: 0 0 10px; }
.chat-disclaimer-box p { font-size: 14px; color: var(--ink-soft); margin: 0 0 12px; line-height: 1.5; }
.chat-disclaimer-box ul { font-size: 13px; color: var(--ink); padding-left: 20px; margin: 0 0 18px; line-height: 1.6; }

/* ---------- Chat window ---------- */
.chat-window {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 340px;
  height: 480px;
  min-width: 300px;
  min-height: 320px;
  max-width: 96vw;
  max-height: 92vh;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--grid-line);
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
  z-index: 1000000;
  flex-direction: column;
  overflow: auto;
  resize: both;
}
.chat-window.open { display: flex; animation: fbPop 0.3s cubic-bezier(.34,1.56,.64,1); }

.chat-window.maximized {
  top: 40px;
  left: 10%;
  bottom: auto;
  right: auto;
  width: 80%;
  height: calc(100vh - 80px);
  min-width: 340px;
  min-height: 360px;
  max-width: 96vw;
  max-height: 92vh;
  resize: both;
  overflow: auto;
}

@media (max-width: 900px) {
  .chat-window.maximized { left: 20px; width: calc(100% - 40px); }
}

.chat-header {
  position: relative;
  background: var(--chat-theme, var(--sky, #2F80C9));
  background-image: linear-gradient(135deg, rgba(255,255,255,0.16), rgba(0,0,0,0.14));
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: grab;
  user-select: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-header-icon { font-size: 16px; }
.chat-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7CEBA6;
  animation: chatLivePulse 2s ease-in-out infinite;
}
@keyframes chatLivePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124,235,166,0.55); }
  50% { box-shadow: 0 0 0 5px rgba(124,235,166,0); }
}
.chat-header-actions { display: flex; align-items: center; }
.chat-header button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  margin-left: 5px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.chat-header button:hover { background: rgba(255,255,255,0.35); transform: translateY(-1px); }

.chat-settings-panel {
  display: none;
  padding: 14px;
  background: #F9F8F3;
  border-bottom: 1px solid var(--grid-line);
}
.chat-settings-panel.open { display: block; }
.chat-settings-panel label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 4px;
  margin-top: 8px;
}
.chat-settings-panel input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  font-size: 13px;
}
.chat-checkbox-row { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-top: 10px; }
.chat-checkbox-row input { width: auto; }

.chat-compose-warning {
  font-size: 11px;
  color: #B3261E;
  background: #FBE6E2;
  padding: 6px 12px;
  border-top: 1px solid var(--grid-line);
}

.chat-reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #F0F5F1;
  border-top: 1px solid var(--grid-line);
  border-left: 3px solid var(--excel-green);
}
.chat-reply-preview-content { flex: 1; min-width: 0; }
.chat-reply-preview-name { font-size: 11px; font-weight: 700; color: var(--excel-green-deep); }
.chat-reply-preview-text { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-reply-preview button { background: none; border: none; cursor: pointer; color: var(--ink-soft); font-size: 14px; padding: 2px 6px; }
.chat-reply-preview button:hover { color: var(--ink); }

.chat-quoted-block {
  font-size: 11px;
  background: rgba(0,0,0,0.05);
  border-left: 3px solid var(--excel-green);
  border-radius: 4px;
  padding: 4px 8px;
  margin-top: 3px;
  margin-bottom: 2px;
  cursor: pointer;
}
.chat-msg-own .chat-quoted-block { background: rgba(255,255,255,0.25); border-left-color: #fff; }

.chat-case-study-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--excel-green-deep);
  background: #D9EFDD;
  border-radius: 12px;
  padding: 4px 10px;
  margin-top: 3px;
  text-decoration: none;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease;
}
.chat-case-study-chip:hover { background: #C3E5C9; }
.chat-msg-own .chat-case-study-chip { background: rgba(255,255,255,0.3); color: #fff; }
.chat-msg-own .chat-case-study-chip:hover { background: rgba(255,255,255,0.45); }
.chat-quoted-block .qname { font-weight: 700; color: var(--excel-green-deep); }
.chat-msg-own .chat-quoted-block .qname { color: #fff; }
.chat-quoted-block .qtext { color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 220px; }
.chat-msg-own .chat-quoted-block .qtext { color: rgba(255,255,255,0.85); }

.chat-reply-icon { }

.chat-banned-notice {
  font-size: 12px;
  font-weight: 700;
  color: #8A2A22;
  background: #FBE6E2;
  padding: 10px 14px;
  border-bottom: 1px solid var(--grid-line);
  line-height: 1.4;
}

.chat-report-panel {
  display: none;
  padding: 14px;
  background: #FBF3F1;
  border-top: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
  max-height: 260px;
  overflow-y: auto;
}
.chat-report-panel.open { display: block; }
.chat-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.chat-report-target {
  font-size: 11px;
  color: var(--ink-soft);
  margin: 0 0 10px;
  font-family: 'IBM Plex Mono', monospace;
}
.chat-report-panel label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 4px;
  margin-top: 8px;
}
.chat-report-panel select,
.chat-report-panel textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

.chat-theme-swatches { display: flex; gap: 8px; margin-top: 6px; }
.chat-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease;
}
.chat-swatch:hover { transform: scale(1.15); }
.chat-swatch.selected { border-color: var(--ink); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--paper);
}
.chat-loading { text-align: center; color: var(--ink-soft); font-size: 12px; padding: 20px; }

.chat-msg { margin-bottom: 12px; }
.chat-msg-name { font-size: 11px; font-weight: 700; color: var(--excel-green-deep); font-family: 'IBM Plex Mono', monospace; }
.chat-real-name { font-weight: 400; color: var(--ink-soft); font-style: italic; }
.chat-msg-own .chat-real-name { color: rgba(255,255,255,0.75); }
.chat-msg-time { font-weight: 400; color: var(--ink-soft); margin-left: 4px; }
.chat-msg-text { font-size: 13px; color: var(--ink); background: #fff; padding: 8px 10px; border-radius: 8px; margin-top: 3px; display: inline-block; max-width: 100%; word-wrap: break-word; }

.chat-msg-own { display: flex; flex-direction: column; align-items: flex-end; }
.chat-msg-own .chat-msg-text { background: var(--chat-theme, var(--sky, #2F80C9)); color: #fff; }
.chat-msg-own .chat-msg-image { margin-left: auto; }
.chat-msg-own .chat-reaction-row { flex-direction: row-reverse; }

.chat-edited-tag { font-size: 10px; color: var(--ink-soft); font-weight: 400; margin-left: 4px; }

.chat-msg-edit-box { margin-top: 4px; }
.chat-msg-edit-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid var(--grid-line);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
.chat-msg-edit-actions { display: flex; gap: 6px; margin-top: 4px; }
.chat-msg-image { display: block; max-width: 180px; border-radius: 8px; margin-top: 5px; }

.chat-date-divider {
  display: flex;
  justify-content: center;
  margin: 14px 0 10px;
}
.chat-date-divider span {
  background: rgba(0,0,0,0.08);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  padding: 4px 12px;
  border-radius: 12px;
}

.chat-report-icon {
  background: rgba(0,0,0,0.05);
  border: none;
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  padding: 3px 8px;
  margin-left: 4px;
  border-radius: 12px;
  vertical-align: middle;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.chat-msg-own .chat-report-icon { background: rgba(255,255,255,0.2); }
.chat-msg:hover .chat-report-icon { opacity: 0.9; }
.chat-report-icon:hover { opacity: 1; background: rgba(0,0,0,0.12); }
.chat-msg-own .chat-report-icon:hover { background: rgba(255,255,255,0.35); }

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--grid-line);
  background: #fff;
}
.chat-attach-btn {
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
}
.chat-input-row input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--grid-line);
  border-radius: 16px;
  font-size: 13px;
}
#chatSendBtn {
  background: var(--chat-theme, var(--sky, #2F80C9));
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}

#chatSaveSettingsBtn {
  background: var(--chat-theme, var(--sky, #2F80C9)) !important;
  border-color: var(--chat-theme, var(--sky, #2F80C9)) !important;
}

.chat-image-preview-row {
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--grid-line);
  background: #F9F8F3;
}
.chat-image-preview-row img { height: 40px; border-radius: 6px; }
#chatRemoveImageBtn { background: none; border: none; font-size: 16px; color: var(--ink-soft); cursor: pointer; }

/* ---------- Emoji picker (composing) ---------- */
.chat-emoji-panel {
  display: none;
  border-top: 1px solid var(--grid-line);
  background: #F9F8F3;
  max-height: 150px;
}
.chat-emoji-panel.open { display: block; }
.chat-emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px;
  max-height: 150px;
  overflow-y: auto;
}
.chat-emoji-option {
  font-size: 18px;
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.chat-emoji-option:hover { background: #fff; transform: scale(1.2); }

/* ---------- Message reactions ---------- */
.chat-reaction-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  min-height: 18px;
}
.chat-reaction-counts { display: flex; gap: 4px; flex-wrap: wrap; }
.chat-reaction-pill {
  background: #fff;
  border: 1px solid var(--grid-line);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
}
.chat-react-picker {
  display: none;
  gap: 4px;
}
.chat-msg:hover .chat-react-picker { display: flex; }
.chat-react-option {
  cursor: pointer;
  font-size: 13px;
  opacity: 0.6;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.chat-react-option:hover { opacity: 1; transform: scale(1.3); }

@media (max-width: 480px) {
  .chat-window { width: calc(100vw - 32px); right: 16px; }
}
