/* ==========================================================================
   Multi-Message Selection, Batch Forwarding & Floating Action Bar Styles
   (消息多选、批量转发与底部悬浮操作栏样式)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Multi-Select Activation on Chat Window & Message Rows
   -------------------------------------------------------------------------- */
.chat-window.selection-mode-active {
  user-select: none;
}

/* Checkbox beside message bubble */
.msg-select-checkbox {
  display: none;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: auto 4px auto 0;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  transition: transform 0.15s ease;
}

.msg-row.me .msg-select-checkbox {
  margin: auto 0 auto 4px;
}

.selection-mode-active .msg-select-checkbox {
  display: inline-flex;
  animation: checkFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes checkFadeIn {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.msg-checkbox-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-dim, #64748b);
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.msg-select-checkbox:hover .msg-checkbox-circle {
  border-color: var(--primary, #3b82f6);
  transform: scale(1.08);
}

.msg-checkbox-circle svg {
  opacity: 0;
  transform: scale(0.4);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: #ffffff;
}

/* Checked State */
.msg-row.selected .msg-checkbox-circle {
  background: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.msg-row.selected .msg-checkbox-circle svg {
  opacity: 1;
  transform: scale(1);
}

/* Row & Bubble styling during selection mode */
.selection-mode-active .msg-row {
  cursor: pointer;
  max-width: 88%;
  border-radius: 12px;
  padding: 4px 8px;
  margin: 2px 0;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.selection-mode-active .msg-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.selection-mode-active .msg-row.selected {
  background: rgba(59, 130, 246, 0.14);
}

.selection-mode-active .msg-row.selected .msg-bubble {
  box-shadow: 0 0 0 2px var(--primary, #3b82f6), 0 4px 14px rgba(59, 130, 246, 0.25);
}

/* Hide hover actions while in selection mode to avoid visual conflict */
.selection-mode-active .msg-hover-actions {
  display: none !important;
}

/* Header Trigger Button Active State */
#btn-toggle-multiselect.active {
  background: rgba(59, 130, 246, 0.2);
  color: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
}

/* --------------------------------------------------------------------------
   2. Bottom Floating Action Bar (底部悬浮操作栏)
   -------------------------------------------------------------------------- */
.message-select-bar {
  position: absolute;
  bottom: 16px;
  left: 20px;
  right: 20px;
  max-width: 680px;
  margin: 0 auto;
  background: rgba(30, 41, 59, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.25);
  z-index: 50;
  animation: selectBarSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes selectBarSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.msg-select-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.msg-select-bar-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.msg-select-bar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main, #f8fafc);
}

.btn-select-cancel:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-select-toggle {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-select-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.msg-select-count-info {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-select-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--primary, #3b82f6);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.msg-select-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.msg-select-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

.msg-select-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-action-copy {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main, #f8fafc);
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-action-copy:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-action-forward {
  background: var(--primary, #3b82f6);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.btn-action-forward:not(:disabled):hover {
  background: var(--primary-hover, #2563eb);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   3. Batch Forward Modal (批量转发弹窗)
   -------------------------------------------------------------------------- */
.forward-modal-card {
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
}

.forward-modal .modal-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-color, #334155);
}

.forward-modal-subtitle {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  margin-top: 4px;
}

.forward-modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  flex: 1;
}

/* Search Box */
.forward-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-dim, #64748b);
  transition: border-color 0.2s ease;
}

.forward-search-box:focus-within {
  border-color: var(--primary, #3b82f6);
  color: var(--primary, #3b82f6);
}

.forward-search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main, #f8fafc);
  font-size: 13px;
}

.forward-search-box input::placeholder {
  color: var(--text-dim, #64748b);
}

/* Filter Tabs */
.forward-filter-tabs {
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.4);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #334155);
}

.forward-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.forward-tab-btn.active {
  background: var(--bg-card, #1e293b);
  color: var(--text-main, #f8fafc);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Target List */
.forward-target-list {
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.forward-target-list::-webkit-scrollbar {
  width: 5px;
}

.forward-target-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Target Item */
.forward-target-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  user-select: none;
}

.forward-target-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.forward-target-item.selected {
  background: rgba(59, 130, 246, 0.12);
}

.forward-target-chk {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--text-dim, #64748b);
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.forward-target-chk svg {
  opacity: 0;
  transform: scale(0.4);
  transition: all 0.15s ease;
  color: #ffffff;
}

.forward-target-item.selected .forward-target-chk {
  background: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
}

.forward-target-item.selected .forward-target-chk svg {
  opacity: 1;
  transform: scale(1);
}

.forward-target-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  flex-shrink: 0;
}

.forward-target-info {
  flex: 1;
  min-width: 0;
}

.forward-target-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forward-target-sub {
  font-size: 12px;
  color: var(--text-dim, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forward-target-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted, #94a3b8);
  flex-shrink: 0;
}

.forward-target-badge.group {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.forward-empty-tip {
  text-align: center;
  color: var(--text-dim, #64748b);
  padding: 30px 10px;
  font-size: 13px;
}

/* Modal Footer */
.forward-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color, #334155);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.forward-selected-targets-hint {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
}

.forward-footer-actions {
  display: flex;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   4. Global Toast Notification (批量复制与转发提示)
   -------------------------------------------------------------------------- */
.message-select-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.message-select-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.message-select-toast-icon {
  display: inline-flex;
  color: var(--success, #10b981);
}

/* --------------------------------------------------------------------------
   5. Mobile Responsiveness
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .message-select-bar {
    left: 8px;
    right: 8px;
    bottom: 12px;
    padding: 8px 12px;
    gap: 8px;
  }

  .msg-select-bar-btn span,
  .msg-select-action-btn span {
    font-size: 12px;
  }

  .btn-select-cancel span {
    display: none;
  }

  .msg-select-count-info {
    font-size: 12px;
  }

  .msg-select-action-btn {
    padding: 6px 12px;
  }
}
