/* ==========================================================================
   PUBLIC FORUM & CHAT - MODERN STYLESHEET (DARK & LIGHT THEME)
   ========================================================================== */

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-bubble: #1e293b;
  --bg-bubble-self: #4338ca;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #e0e7ff;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --success: #10b981;
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e2e8f0;
  --bg-bubble: #ffffff;
  --bg-bubble-self: #4f46e5;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --border-color: rgba(0, 0, 0, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  display: flex;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.5;
}

/* ================= APP CONTAINER ================= */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
}

/* ================= SIDEBAR ================= */
.sidebar {
  width: 290px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.logo-icon {
  font-size: 24px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.logo-text h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo-text p {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-section-title {
  padding: 16px 16px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-add-room {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-add-room:hover {
  background: var(--bg-tertiary);
}

.rooms-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.room-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  gap: 12px;
  position: relative;
}

.room-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

.room-item.active {
  background: rgba(99, 102, 241, 0.18);
  color: var(--accent);
  font-weight: 600;
}

.room-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.room-item-icon {
  font-size: 18px;
}

.room-item-info {
  flex: 1;
  min-width: 0;
}

.room-item-name {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-item-desc {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-item-badge {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.btn-room-gear {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.15s ease;
}
.room-item:hover .btn-room-gear {
  opacity: 1;
}
.btn-room-gear:hover {
  color: var(--text-main);
  background: var(--bg-tertiary);
  transform: scale(1.1);
}

.btn-action.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}

/* User Profile Badge (Bottom of Sidebar) */
.user-profile-bar {
  padding: 12px 14px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  flex: 1;
  min-width: 0;
  color: var(--text-main);
  padding: 4px;
  border-radius: var(--radius-md);
  transition: background 0.15s;
}
.user-profile-btn:hover {
  background: var(--bg-tertiary);
}

.user-avatar-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.user-details {
  flex: 1;
  min-width: 0;
}
.user-name-display {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-status-text {
  font-size: 11px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 5px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

/* ================= MAIN CHAT AREA ================= */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  min-width: 0;
  position: relative;
}

/* Header */
.chat-header {
  height: 64px;
  padding: 0 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  gap: 14px;
}

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

.btn-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

.header-room-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.header-room-title h2 {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-room-badge {
  font-size: 11px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-action {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn-action:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-action.highlight {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}
.btn-action.highlight:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border-radius: var(--radius-md);
}

/* Ethics & Rules Banner */
.ethics-banner {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  padding: 8px 20px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ethics-banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ethics-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}
.ethics-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
}

/* ================= CHAT MESSAGES FEED ================= */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-empty-state {
  margin: auto;
  text-align: center;
  max-width: 380px;
  padding: 40px 20px;
}
.empty-state-icon {
  font-size: 50px;
  margin-bottom: 14px;
  display: inline-block;
}
.chat-empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
}
.chat-empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* Single Message Item */
.message-card {
  display: flex;
  gap: 12px;
  max-width: 85%;
  align-self: flex-start;
  position: relative;
  transition: background 0.15s;
}
.message-card.is-self {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.message-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  max-width: 100%;
}

.message-card.is-self .message-body {
  align-items: flex-end;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.message-card.is-self .message-header {
  flex-direction: row-reverse;
}

.message-sender {
  font-weight: 700;
  color: var(--text-main);
}
.bot-badge {
  background: #4f46e5;
  color: #fff;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: bold;
}
.message-time {
  color: var(--text-dim);
  font-size: 10px;
}

/* Message Content Bubble (Menyesuaikan kapasitas kalimat secara presisi) */
.message-bubble {
  background: var(--bg-bubble);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 14px;
  border-top-left-radius: 2px;
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  position: relative;
  box-shadow: var(--shadow-sm);
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  height: auto;
  min-height: unset;
}
.message-card.is-self .message-bubble {
  background: var(--bg-bubble-self);
  color: #ffffff;
  border: none;
  border-top-left-radius: 14px;
  border-top-right-radius: 2px;
}

.censored-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  background: var(--warning-bg);
  color: var(--warning);
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 6px;
  font-weight: 600;
  width: fit-content;
}

.judol-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  background: var(--danger-bg);
  color: #f87171;
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 6px;
  font-weight: 600;
  width: fit-content;
}

/* Reply Reference */
.reply-reference {
  background: rgba(0, 0, 0, 0.15);
  border-left: 3px solid var(--accent);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sticker Display in Bubble */
.sticker-bubble {
  padding: 4px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.sticker-image-wrap {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}
.sticker-image-wrap:hover {
  transform: scale(1.08);
}
.sticker-image-wrap svg,
.sticker-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sticker-title-tag {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 4px;
}

/* Message Actions & Reactions */
.message-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.message-card.is-self .message-footer {
  justify-content: flex-end;
}

.reaction-chip {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.reaction-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--text-main);
}
.reaction-chip.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: bold;
}

.btn-msg-reply, .btn-msg-react {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.message-card:hover .btn-msg-reply,
.message-card:hover .btn-msg-react {
  opacity: 1;
}
.btn-msg-reply:hover, .btn-msg-react:hover {
  color: var(--text-main);
  background: var(--bg-tertiary);
}

/* ================= CHAT INPUT DOCK ================= */
.chat-dock {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 12px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 15;
}

/* Live Bad Word Warning Alert */
.live-ethics-alert {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  display: none;
  align-items: center;
  gap: 8px;
  animation: slideDown 0.2s ease;
}
.live-ethics-alert.visible {
  display: flex;
}

/* Quoted Reply Banner */
.reply-preview-dock {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.reply-preview-dock.visible {
  display: flex;
}
.reply-cancel-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
}

/* Main Input Bar */
.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 8px 6px 14px;
  transition: border-color 0.15s;
}
.input-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.chat-textarea {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  max-height: 120px;
  min-height: 24px;
  outline: none;
  line-height: 1.4;
  padding: 6px 0;
}
.chat-textarea::placeholder {
  color: var(--text-dim);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-dock-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.15s;
}
.btn-dock-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
}
.btn-dock-icon.active {
  background: var(--accent);
  color: #fff;
}

.btn-send-message {
  background: var(--accent);
  color: #fff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}
.btn-send-message:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

/* ================= STICKER DRAWER ================= */
.sticker-drawer {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  max-height: 320px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.sticker-drawer.open {
  display: flex;
}

.sticker-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  overflow-x: auto;
}
.sticker-tab-btn {
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
  border-bottom: 2px solid transparent;
}
.sticker-tab-btn:hover {
  color: var(--text-main);
}
.sticker-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg-secondary);
}

.sticker-grid-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
}

.sticker-item-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sticker-item-btn:hover {
  transform: translateY(-3px) scale(1.05);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  background: rgba(99, 102, 241, 0.1);
}
.sticker-preview {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sticker-preview svg, .sticker-preview img {
  width: 100%;
  height: 100%;
}
.sticker-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Custom Sticker Input */
.custom-sticker-box {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.custom-sticker-input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}
.custom-sticker-input:focus {
  border-color: var(--accent);
}

/* ================= MODALS ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.open {
  display: flex;
}

.modal-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.modal-close-btn:hover {
  color: var(--text-main);
  background: var(--bg-tertiary);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 75vh;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.form-input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.avatar-option-btn {
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  font-size: 24px;
  height: 48px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.avatar-option-btn:hover {
  transform: scale(1.1);
  background: rgba(99, 102, 241, 0.2);
}
.avatar-option-btn.selected {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.25);
}

/* Share URL Card */
.share-link-box {
  display: flex;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  align-items: center;
}
.share-url-text {
  flex: 1;
  font-size: 13px;
  color: var(--accent-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: monospace;
}

.qr-code-wrap {
  margin: 10px auto;
  text-align: center;
  padding: 16px;
  background: #ffffff;
  border-radius: var(--radius-md);
  display: inline-block;
  box-shadow: var(--shadow-sm);
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  cursor: pointer;
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-lg);
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Quick Reaction Picker Popup */
.quick-react-popup {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 4px 8px;
  display: flex;
  gap: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 30;
  animation: fadeIn 0.15s ease;
}
.quick-react-popup button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 4px;
  transition: transform 0.15s;
}
.quick-react-popup button:hover {
  transform: scale(1.3);
}

/* Keyframes */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ================= IMAGE MESSAGE & UPLOAD STYLES ================= */
/* Image Upload Preview Dock */
.image-preview-dock {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: none;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.2s ease;
}
.image-preview-dock.visible {
  display: flex;
}
.image-preview-thumb-wrap {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
  background: #000;
}
.image-preview-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-preview-cancel-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-preview-cancel-btn:hover {
  background: var(--danger);
}
.image-preview-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.image-preview-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.image-preview-size {
  font-size: 11px;
  color: var(--text-dim);
}

/* Chat Image Bubble */
.message-image-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.message-image-wrap {
  max-width: 320px;
  max-height: 260px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.message-image-wrap:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.message-image-wrap img {
  width: 100%;
  height: 100%;
  max-height: 260px;
  object-fit: cover;
  display: block;
}

/* Modal Lightbox */
.modal-lightbox {
  padding: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
}
.lightbox-dialog {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: scaleIn 0.2s ease;
}
.lightbox-close-btn {
  position: absolute;
  top: -44px;
  right: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox-close-btn:hover {
  background: var(--danger);
}
.lightbox-image-box {
  max-width: 85vw;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.lightbox-image-box img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 12px;
}
.lightbox-footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}
.lightbox-caption {
  font-size: 13px;
  color: #e2e8f0;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ================= MOBILE RESPONSIVE ================= */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 10px 0 25px rgba(0, 0, 0, 0.5);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .btn-menu-toggle {
    display: block;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 19;
    display: none;
  }
  .sidebar-backdrop.active {
    display: block;
  }
  .chat-header {
    padding: 0 12px;
  }
  .header-actions .btn-action span {
    display: none;
  }
  .message-card {
    max-width: 92%;
  }
}
