/* Chat Workspace (Clean Feishu Web Polish) */
.chat-main {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-subtle);
  position: relative;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 8px;
}
.chat-empty-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 10px rgba(31, 35, 41, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  margin-bottom: 4px;
}
.chat-empty-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-secondary);
}
.chat-empty-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-header {
  height: var(--header-h);
  padding: 0 22px;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 0 rgba(31, 35, 41, 0.025);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  background: #fff;
  z-index: 2;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.chat-header-title-wrap {
  min-width: 0;
}
.chat-header-title {
  font-size: 15.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.chat-header-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-header-online {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #009a29;
  font-weight: 500;
}
.chat-header-online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* In-chat Search Bar */
.chat-search-bar {
  padding: 10px 22px;
  border-bottom: 1px solid var(--border-light);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-search-results {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-search-hit {
  padding: 8px 11px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

/* Message Timeline */
.msg-timeline {
  flex: 1;
  overflow-y: auto;
  padding: 18px 26px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  background: var(--bg-subtle);
}

.load-more-wrap {
  text-align: center;
  padding: 4px 0 12px;
}

.time-divider {
  text-align: center;
  margin: 10px 0 6px;
}
.time-divider span {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(31, 35, 41, 0.05);
  color: var(--text-muted);
  font-size: 11px;
}

.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  position: relative;
  transition: background 0.12s;
}
.msg-row:hover {
  background: rgba(31, 35, 41, 0.025);
}
.msg-row.own {
  flex-direction: row-reverse;
}

.msg-body-col {
  max-width: min(68%, 620px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
}
.msg-row.own .msg-body-col {
  align-items: flex-end;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 12px;
}
.msg-row.own .msg-meta {
  flex-direction: row-reverse;
}
.msg-sender-name {
  font-weight: 500;
  color: var(--text-secondary);
}
.msg-time {
  font-size: 11px;
  color: var(--text-muted);
}

.msg-bubble-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.msg-row.own .msg-bubble-wrap {
  align-items: flex-end;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 4px 14px 14px 14px;
  background: #fff;
  border: 1px solid #eaedf1;
  box-shadow: 0 1px 2px rgba(31, 35, 41, 0.04);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.58;
  word-break: break-word;
  max-width: 100%;
}
.msg-text {
  white-space: pre-wrap;
}
.msg-row.own .msg-bubble {
  border-radius: 14px 4px 14px 14px;
  background: #dbe8ff;
  border-color: #c8dcff;
  box-shadow: 0 1px 2px rgba(51, 112, 255, 0.06);
}
.msg-bubble.revoked {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text-muted);
  font-style: italic;
  font-size: 12px;
  padding: 4px 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.msg-reedit-btn {
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  color: var(--brand);
  padding: 1px 4px;
  border-radius: 4px;
}
.msg-reedit-btn:hover {
  background: var(--brand-soft);
  text-decoration: underline;
}
.msg-bubble.image-bubble {
  padding: 3px;
  background: #fff;
  border-color: #eaedf1;
}
.msg-row.own .msg-bubble.image-bubble {
  background: #fff;
  border-color: #d6e2ff;
}
.msg-bubble.voice-msg-bubble {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Feishu-style Voice Message Bubble */
.voice-bubble {
  --voice-progress: 0%;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 114px;
  max-width: 240px;
  height: 42px;
  padding: 0 14px;
  border-radius: 4px 14px 14px 14px;
  background: #fff;
  border: 1px solid #eaedf1;
  box-shadow: 0 1px 2px rgba(31, 35, 41, 0.04);
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transition: filter 0.12s;
}
.msg-row.own .voice-bubble {
  border-radius: 14px 4px 14px 14px;
  background: #dbe8ff;
  border-color: #c8dcff;
  flex-direction: row-reverse;
}
.voice-bubble:hover {
  filter: brightness(0.97);
}
.voice-bubble::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--voice-progress);
  background: rgba(51, 112, 255, 0.14);
  pointer-events: none;
  transition: width 0.15s linear;
}
.msg-row.own .voice-bubble::before {
  left: auto;
  right: 0;
  background: rgba(51, 112, 255, 0.18);
}

.voice-bubble-main {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.msg-row.own .voice-bubble-main {
  flex-direction: row-reverse;
}
.voice-wave-svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
  flex-shrink: 0;
}
.msg-row.own .voice-wave-svg {
  transform: scaleX(-1);
}
.voice-bubble.playing .voice-arc-1 { animation: voiceArc 1.05s infinite 0s; }
.voice-bubble.playing .voice-arc-2 { animation: voiceArc 1.05s infinite 0.18s; }
.voice-bubble.playing .voice-arc-3 { animation: voiceArc 1.05s infinite 0.36s; }

@keyframes voiceArc {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

.voice-dur {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.voice-play-hint {
  position: relative;
  z-index: 1;
  font-size: 11px;
  color: var(--text-muted);
}

/* Composer Inline Voice Recording Bar */
.composer-voice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  min-height: 60px;
  background: #fff7f7;
  border-radius: 0 0 10px 10px;
}
.voice-rec-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.voice-rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
  animation: recPulse 1s infinite;
}
@keyframes recPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}
.voice-rec-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
  white-space: nowrap;
}
.voice-rec-viz {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 4px;
}
.voice-rec-viz span {
  width: 3px;
  height: 5px;
  border-radius: 2px;
  background: var(--danger);
  opacity: 0.78;
  transition: height 0.08s ease-out;
}
.voice-rec-timer {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.voice-rec-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.msg-reply-box {
  margin-bottom: 6px;
  padding: 5px 9px;
  border-left: 3px solid var(--brand);
  background: rgba(31, 35, 41, 0.05);
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-image-thumb {
  display: block;
  max-width: 280px;
  max-height: 260px;
  min-width: 90px;
  min-height: 60px;
  object-fit: cover;
  border-radius: 8px;
  cursor: zoom-in;
  border: 1px solid var(--border-light);
  background: var(--bg-hover);
  transition: transform 0.15s, box-shadow 0.15s;
}
.msg-image-thumb:hover {
  box-shadow: var(--shadow-sm);
}

/* Feishu Hover Floating Action Bar */
.msg-hover-actions {
  display: none;
  position: absolute;
  top: -16px;
  right: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(31, 35, 41, 0.08);
  padding: 3px;
  gap: 2px;
  z-index: 10;
}
.msg-row.own .msg-hover-actions {
  right: auto;
  left: 12px;
}
.msg-row:hover .msg-hover-actions {
  display: flex;
}
.msg-act-btn {
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.msg-act-btn:hover {
  background: var(--bg-hover);
  color: var(--brand);
}
.msg-act-btn.danger:hover {
  color: var(--danger);
}

/* Composer (Floating Clean Feishu Card) */
.composer-wrap {
  background: var(--bg-subtle);
  padding: 4px 22px 16px;
  flex-shrink: 0;
}

.composer-disabled-banner {
  padding: 13px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px dashed var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

.composer-reply-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.composer-vis-btn {
  position: relative;
}
.composer-vis-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.composer-box {
  border: 1px solid #dfe2e8;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(31, 35, 41, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 2px 12px rgba(51, 112, 255, 0.10);
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px 5px;
  border-bottom: 1px solid #f0f1f4;
  position: relative;
}
.composer-tools-left {
  display: flex;
  align-items: center;
  gap: 4px;
}
.composer-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.emoji-popover {
  position: absolute;
  bottom: 40px;
  left: 8px;
  width: 280px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  z-index: 30;
}
.emoji-btn {
  font-size: 18px;
  height: 30px;
  border-radius: 6px;
}
.emoji-btn:hover {
  background: var(--bg-hover);
}

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 12px 10px;
}
.composer-input-row #btn-send-msg {
  height: 34px;
  padding: 0 18px;
  border-radius: 8px;
  flex-shrink: 0;
}
.composer-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 150px;
  line-height: 1.5;
  font-size: 14px;
}

/* Drag-and-drop overlay */
.drop-overlay {
  position: absolute;
  inset: 12px;
  background: rgba(235, 241, 255, 0.92);
  border: 2px dashed var(--brand);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--brand);
  font-size: 16px;
  font-weight: 600;
  z-index: 50;
  pointer-events: none;
}

/* Right Drawer */
.chat-drawer {
  width: var(--drawer-w);
  height: 100%;
  border-left: 1px solid var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.drawer-header {
  height: var(--header-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  padding: 0 12px;
}
.drawer-tab {
  flex: 1;
  padding: 10px 6px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
}
.drawer-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 500;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

.drawer-section {
  margin-bottom: 18px;
}
.drawer-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.drawer-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.drawer-setting-row > div:first-child {
  min-width: 0;
  flex: 1;
}

.drawer-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
}
.drawer-member-item:hover {
  background: var(--bg-hover);
}
.drawer-member-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.drawer-album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.drawer-album-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
  border: 1px solid var(--border-light);
}

/* Fullscreen Lightbox */
#lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 24, 0.88);
  z-index: 9800;
  display: flex;
  flex-direction: column;
}
.lightbox-topbar {
  height: 54px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}
.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
}
.lightbox-img {
  max-width: 92vw;
  max-height: 82vh;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease-out;
}
.lightbox-actions {
  display: flex;
  gap: 8px;
}
.lightbox-btn {
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
}
.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
