/* Constrained poll result container */
.discord-poll-result-message {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #f6f6fa;
  border: 1px solid #e3e5e8;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: 0 1px 4px rgba(88,101,242,0.04);
  max-width: 520px;         /* wider container so bar and meta fit comfortably */
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  position: relative;       /* for timestamp */
}

[data-theme="dark"] .discord-poll-result-message {
  background: #232428;
  border-color: #36393f;
}


[data-theme="dark"] .discord-poll-result-message {
  background: #232428;
  border-color: #36393f;
}

.discord-poll-result-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Header */
.discord-poll-result-header {
  font-size: 1rem;
  font-weight: 600;
  color: #5865f2;
  margin-bottom: 0.25rem;
}
[data-theme="dark"] .discord-poll-result-header {
  color: #8ea1e1;
}

/* Winner Row */
.discord-poll-result-winner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-start;
  font-size: 1rem;
  font-weight: 700;
  color: #23272a;
  /* allow the bar/meta to wrap when space is tight */
  flex-wrap: wrap;
}

[data-theme="dark"] .discord-poll-result-winner {
  color: #fff;
}

.discord-poll-result-emoji {
  font-size: 1.25rem;
}
.discord-poll-result-check {
  color: #43b581;
}

/* Poll Bar */
.discord-poll-result-bar {
  /* make the bar flexible so it can shrink/grow depending on container */
  flex: 1 1 260px;        /* preferred 260px but allow shrinking */
  min-width: 0;          /* allow shrink on very small screens */
  height: 34px;          /* slightly taller to match Discord feel */
  border-radius: 6px;
  background: rgba(0,0,0,0.12);
  overflow: hidden;
}

[data-theme="dark"] .discord-poll-result-bar {
  background: rgba(255,255,255,0.04);
}

.discord-poll-result-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(88,101,242,1) 0%, rgba(99,114,255,1) 100%);
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  font-size: 0.95rem;
  color: #fff;
  font-weight: 600;
  transition: width 0.35s ease;
}

.discord-poll-result-fill-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  /* allow answer text to ellipsize when space is limited */
  min-width: 0;
}

.discord-poll-result-answer {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  max-width: 100%;
}

/* Votes */
.discord-poll-result-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.88rem;
  color: #8b8f99;
  margin-left: 0.5rem;
  /* allow meta to shrink so it doesn't force the bar to overflow */
  flex-shrink: 1;
  min-width: 0;
}

/* On narrow containers allow meta to sit below the bar to avoid overflow */
@media (max-width: 440px) {
  .discord-poll-result-winner {
    gap: 0.5rem;
  }
  .discord-poll-result-bar {
    flex-basis: 100%;
    width: 100%;
  }
  .discord-poll-result-meta {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
  }
  .discord-poll-result-percent {
    margin-right: 0.5rem;
  }
}
[data-theme="dark"] .discord-poll-result-meta {
  color: #b5bac1;
}
.discord-poll-result-votes {
  opacity: 0.9;
}

.discord-poll-result-percent,
.discord-poll-result-votes {
  white-space: nowrap; /* keep percent and votes compact */
  font-weight: 700;
}

/* When the timestamp appears in the poll result, ensure it doesn't overlap the content */
.discord-poll-result-message > .discord-timestamp {
  margin-left: 0.5rem;
  flex-shrink: 0;
}

@media (max-width: 440px) {
  /* Move timestamp to its own row on very small screens */
  .discord-poll-result-message > .discord-timestamp {
    width: 100%;
    margin-left: 0;
    margin-top: 0.25rem;
    justify-self: flex-end;
  }
}

/* View Poll Button */
.discord-poll-result-view-btn {
  align-self: flex-start;
  margin: 0.25rem 0.5rem 0;
  background: #5865f2;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.discord-poll-result-view-btn:hover {
  background: #4752c4;
}


/* Discord Logs Archive Styles */

.discord-logs-container {
  width: 100%;
  max-width: 100%;
}

/* Main layout: sidebar + content side by side */
.discord-main-layout {
  display: flex;
  gap: 1.5rem;
  min-height: 500px;
  align-items: stretch;
}

/* Content area (messages) */
.discord-content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Server/Channel Header */
.discord-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.12) 0%, rgba(88, 101, 242, 0.04) 100%);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(88, 101, 242, 0.2);
}

[data-theme="dark"] .discord-header {
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.15) 0%, rgba(88, 101, 242, 0.05) 100%);
  border-color: rgba(88, 101, 242, 0.25);
}

.discord-server-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
}

.discord-header-info {
  flex: 1;
  min-width: 0;
}

.discord-server-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
  line-height: 1.3;
}

[data-theme="dark"] .discord-server-name {
  color: #fff;
}

.discord-channel-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 1rem; /* slightly larger */
  color: var(--text-color, #2e3338);
  margin-top: 0.15rem;
  flex: 1;
  min-width: 0;
  font-weight: 700; /* stronger, similar to Discord header */
  letter-spacing: -0.01em;
}

/* Mobile: wrap channel name and topic */
@media (max-width: 768px) {
  .discord-header {
    overflow: hidden;
  }
  
  .discord-header-info {
    overflow: hidden;
    max-width: calc(100% - 60px);
  }
  
  .discord-channel-name {
    flex-wrap: wrap;
    overflow: hidden;
    max-width: 100%;
  }
  
  .discord-topic-divider {
    display: none;
  }
  
  .discord-channel-topic {
    flex-basis: 100%;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
}

[data-theme="dark"] .discord-channel-name {
  color: #f2f3f5;
}

.discord-channel-name svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  flex-shrink: 0;
}

.discord-topic-divider {
  margin: 0 0.5rem;
  color: #80848e;
  opacity: 0.5;
}

.discord-channel-topic {
  font-size: 0.8rem;
  color: #80848e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.discord-channel-topic:hover {
  color: #5c5e66;
}

.discord-channel-topic.expanded {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.4;
}

[data-theme="dark"] .discord-channel-topic {
  color: #949ba4;
}

[data-theme="dark"] .discord-channel-topic:hover {
  color: #b5bac1;
}

.discord-message-count {
  font-size: 0.75rem;
  color: #80848e;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="dark"] .discord-message-count {
  background: rgba(255, 255, 255, 0.08);
  color: #949ba4;
}

/* Channel Selector */
.discord-channel-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.discord-channel-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  font-size: 0.875rem;
  color: #4f545c;
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-theme="dark"] .discord-channel-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: #b5bac1;
}

.discord-channel-btn:hover {
  background: rgba(88, 101, 242, 0.1);
  border-color: rgba(88, 101, 242, 0.3);
  color: #5865f2;
}

.discord-channel-btn.active {
  background: rgba(88, 101, 242, 0.15);
  border-color: rgba(88, 101, 242, 0.4);
  color: #5865f2;
}

[data-theme="dark"] .discord-channel-btn:hover,
[data-theme="dark"] .discord-channel-btn.active {
  background: rgba(88, 101, 242, 0.2);
  border-color: rgba(88, 101, 242, 0.4);
  color: #8b9dff;
}

.discord-channel-btn svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}

.discord-channel-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Messages Container */
.discord-messages {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: calc(100vh - 300px);
  min-height: 400px;
}

/* Message Group (same author within time window) */
.discord-message-group {
  padding: 0.5rem 0;
}

.discord-message-group:hover {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .discord-message-group:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Single Message */
.discord-message {
  display: flex;
  gap: 1rem;
  padding: 0.125rem 0.5rem;
  position: relative;
  transition: background-color 0.3s ease;
}

/* Message highlight for deep-linking */
.discord-message-highlight {
  background-color: rgba(88, 101, 242, 0.25) !important;
  box-shadow: 
    inset 4px 0 0 0 #5865f2,
    0 0 20px rgba(88, 101, 242, 0.3);
  animation: message-highlight-pulse 0.5s ease-in-out 3, message-highlight-fade 3s ease-out 1.5s forwards;
  border-radius: 4px;
  position: relative;
}

@keyframes message-highlight-pulse {
  0%, 100% {
    background-color: rgba(88, 101, 242, 0.25);
    box-shadow: 
      inset 4px 0 0 0 #5865f2,
      0 0 20px rgba(88, 101, 242, 0.3);
  }
  50% {
    background-color: rgba(88, 101, 242, 0.4);
    box-shadow: 
      inset 4px 0 0 0 #5865f2,
      0 0 30px rgba(88, 101, 242, 0.5);
  }
}

@keyframes message-highlight-fade {
  0% {
    background-color: rgba(88, 101, 242, 0.25);
    box-shadow: 
      inset 4px 0 0 0 #5865f2,
      0 0 20px rgba(88, 101, 242, 0.3);
  }
  100% {
    background-color: transparent;
    box-shadow: 
      inset 4px 0 0 0 transparent,
      0 0 0 transparent;
  }
}

[data-theme="dark"] .discord-message-highlight {
  background-color: rgba(88, 101, 242, 0.3) !important;
  box-shadow: 
    inset 4px 0 0 0 #5865f2,
    0 0 25px rgba(88, 101, 242, 0.4);
  animation: message-highlight-pulse-dark 0.5s ease-in-out 3, message-highlight-fade-dark 3s ease-out 1.5s forwards;
}

@keyframes message-highlight-pulse-dark {
  0%, 100% {
    background-color: rgba(88, 101, 242, 0.3);
    box-shadow: 
      inset 4px 0 0 0 #5865f2,
      0 0 25px rgba(88, 101, 242, 0.4);
  }
  50% {
    background-color: rgba(88, 101, 242, 0.5);
    box-shadow: 
      inset 4px 0 0 0 #7289da,
      0 0 40px rgba(88, 101, 242, 0.6);
  }
}

@keyframes message-highlight-fade-dark {
  0% {
    background-color: rgba(88, 101, 242, 0.3);
    box-shadow: 
      inset 4px 0 0 0 #5865f2,
      0 0 25px rgba(88, 101, 242, 0.4);
  }
  100% {
    background-color: transparent;
    box-shadow: 
      inset 4px 0 0 0 transparent,
      0 0 0 transparent;
  }
}

.discord-message.first-in-group {
  padding-top: 0.5rem;
  margin-top: 1rem;
}

.discord-message.first-in-group::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .discord-message.first-in-group::before {
  background: rgba(255, 255, 255, 0.06);
}

.discord-message:first-child.first-in-group {
  margin-top: 0;
}

.discord-message:first-child.first-in-group::before {
  display: none;
}

/* Avatar */
.discord-avatar-wrapper {
  width: 40px;
  flex-shrink: 0;
  padding-top: 2px;
}

.discord-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.discord-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5865f2 0%, #7289da 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
}

/* Timestamp placeholder for continuation messages */
.discord-timestamp-gutter {
  width: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}

.discord-hover-timestamp {
  font-size: 0.65rem;
  color: #80848e;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.discord-message:hover .discord-hover-timestamp {
  opacity: 1;
}

/* Message Content */
.discord-message-content {
  flex: 1;
  min-width: 0;
}

.discord-message-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.discord-username {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #1a1a1a;
  cursor: pointer;
}

.discord-username:hover {
  text-decoration: underline;
}

[data-theme="dark"] .discord-username {
  color: #f2f3f5;
}

/* Role colors */
.discord-username.role-admin { color: #e74c3c; }
.discord-username.role-mod { color: #3498db; }
.discord-username.role-vip { color: #9b59b6; }
.discord-username.role-member { color: #2ecc71; }

[data-theme="dark"] .discord-username.role-admin { color: #ff6b6b; }
[data-theme="dark"] .discord-username.role-mod { color: #5dade2; }
[data-theme="dark"] .discord-username.role-vip { color: #bb8fce; }
[data-theme="dark"] .discord-username.role-member { color: #58d68d; }

.discord-bot-tag {
  font-size: 0.625rem;
  font-weight: 600;
  background: #5865f2;
  color: #fff;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.discord-server-tag {
  font-size: 0.625rem;
  font-weight: 600;
  background: #3ba55c;
  color: #fff;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .discord-server-tag {
  background: #2d7d46;
}

.discord-archive-tag {
  font-size: 0.625rem;
  font-weight: 600;
  background: #9b59b6;
  color: #fff;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: help;
}

[data-theme="dark"] .discord-archive-tag {
  background: #8e44ad;
}

.discord-timestamp {
  font-size: 0.75rem;
  color: #80848e;
}

[data-theme="dark"] .discord-timestamp {
  color: #949ba4;
}

/* Jump to message button (shown in search results) */
.discord-jump-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  margin-left: 0.5rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: #5865f2;
  background: rgba(88, 101, 242, 0.1);
  border: 1px solid rgba(88, 101, 242, 0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.discord-jump-btn:hover {
  background: rgba(88, 101, 242, 0.2);
  border-color: rgba(88, 101, 242, 0.5);
}

.discord-jump-btn svg {
  flex-shrink: 0;
}

[data-theme="dark"] .discord-jump-btn {
  background: rgba(88, 101, 242, 0.15);
  border-color: rgba(88, 101, 242, 0.4);
  color: #8b9dff;
}

[data-theme="dark"] .discord-jump-btn:hover {
  background: rgba(88, 101, 242, 0.25);
  border-color: rgba(88, 101, 242, 0.6);
}

.discord-text {
  font-size: 0.9375rem;
  line-height: 1.375;
  color: #2e3338;
  word-wrap: break-word;
}

[data-theme="dark"] .discord-text {
  color: #dcddde;
}

/* Inline formatting */
.discord-text code {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

[data-theme="dark"] .discord-text code {
  background: rgba(255, 255, 255, 0.08);
}

.discord-text a {
  color: #00aff4;
  text-decoration: none;
}

.discord-text a:hover {
  text-decoration: underline;
}

/* Mentions */
.discord-mention {
  background: rgba(88, 101, 242, 0.15);
  color: #5865f2;
  padding: 0 0.2rem;
  border-radius: 3px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.discord-mention:hover {
  background: rgba(88, 101, 242, 0.25);
}

[data-theme="dark"] .discord-mention {
  background: rgba(88, 101, 242, 0.3);
  color: #c9cdfb;
}

/* Clickable channel links */
.discord-channel-link {
  cursor: pointer;
  text-decoration: none;
}

.discord-channel-link:hover {
  text-decoration: underline;
}

/* Headings (# ## ### in Discord) */
.discord-heading {
  display: block;
  font-weight: 700;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.discord-heading-1 {
  font-size: 1.5rem;
}

.discord-heading-2 {
  font-size: 1.25rem;
}

.discord-heading-3 {
  font-size: 1.1rem;
}

/* Subtext / Small text (-# in Discord) */
.discord-subtext {
  display: block;
  font-size: 0.75rem;
  color: #72767d;
  margin-top: 0.25rem;
  line-height: 1.4;
}

[data-theme="dark"] .discord-subtext {
  color: #a3a6aa;
}

/* List items */
.discord-list-item {
  display: block;
  padding-left: 1rem;
  line-height: 1.5;
}

/* Timestamps */
.discord-timestamp {
  background: rgba(88, 101, 242, 0.1);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.875em;
  cursor: default;
}

[data-theme="dark"] .discord-timestamp {
  background: rgba(88, 101, 242, 0.15);
}

/* Slash commands */
.discord-slash-command {
  background: rgba(88, 101, 242, 0.15);
  color: #5865f2;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-weight: 500;
}

/* @everyone and @here */
.discord-mention-everyone {
  background: rgba(250, 168, 26, 0.15);
  color: #faa81a;
}

[data-theme="dark"] .discord-mention-everyone {
  background: rgba(250, 168, 26, 0.2);
}

/* Emoji */
.discord-emoji {
  width: 1.375em;
  height: 1.375em;
  vertical-align: -0.3em;
  object-fit: contain;
}

.discord-emoji.large {
  width: 3rem;
  height: 3rem;
}

/* Stickers */
.discord-stickers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.discord-sticker {
  display: inline-block;
}

.discord-sticker-image {
  width: 160px;
  height: 160px;
  object-fit: contain;
  border-radius: 4px;
}

.discord-sticker-lottie {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.discord-sticker-lottie svg {
  width: 100%;
  height: 100%;
}

.discord-sticker-placeholder {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88, 101, 242, 0.1);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-muted, #72767d);
}

[data-theme="dark"] .discord-sticker-placeholder {
  background: rgba(88, 101, 242, 0.15);
  color: #b9bbbe;
}

/* Polls */
.discord-poll {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  max-width: 400px;
}

[data-theme="dark"] .discord-poll {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.discord-poll.finalized {
  opacity: 0.85;
}

.discord-poll-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.discord-poll-emoji {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.discord-poll-question {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-color, #2e3338);
  flex: 1;
}

[data-theme="dark"] .discord-poll-question {
  color: #f2f3f5;
}

.discord-poll-multiselect {
  font-size: 0.7rem;
  color: var(--text-muted, #72767d);
  background: rgba(88, 101, 242, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.discord-poll-answers {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.discord-poll-answer {
  position: relative;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
  overflow: hidden;
  min-height: 32px;
}

[data-theme="dark"] .discord-poll-answer {
  background: rgba(255, 255, 255, 0.03);
}

.discord-poll-answer-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(88, 101, 242, 0.25);
  border-radius: 6px;
  transition: width 0.3s ease;
}

[data-theme="dark"] .discord-poll-answer-bar {
  background: rgba(88, 101, 242, 0.35);
}

.discord-poll-answer-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  z-index: 1;
}

.discord-poll-answer-emoji {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.discord-poll-answer-text {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-color, #2e3338);
}

[data-theme="dark"] .discord-poll-answer-text {
  color: #dcddde;
}

.discord-poll-answer-votes {
  font-size: 0.75rem;
  color: var(--text-muted, #72767d);
  white-space: nowrap;
}

.discord-poll-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.75rem;
  color: var(--text-muted, #72767d);
}

[data-theme="dark"] .discord-poll-footer {
  border-top-color: rgba(255, 255, 255, 0.06);
}

.discord-poll-status {
  color: #ed4245;
}

.discord-poll-expiry {
  color: #5865f2;
}

/* Poll voters */
.discord-poll-voters {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.5rem;
  flex-wrap: wrap;
}

.discord-poll-voter {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(88, 101, 242, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #5865f2;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.discord-poll-voter img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Improved voter visuals */
.discord-poll-voters { padding: 0.25rem 0.5rem 0.5rem 0.5rem; gap: 0.35rem }
.discord-poll-voter { width: 26px; height: 26px; font-size:0.75rem; border-radius:50%; border:1px solid rgba(0,0,0,0.08); box-shadow:0 1px 0 rgba(255,255,255,0.03) inset; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.discord-poll-voter:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(3,8,23,0.2); z-index: 4 }
.discord-poll-voter span { display:flex; align-items:center; justify-content:center }
.discord-poll-voters-more { margin-left: 0.5rem; font-size:0.8rem }

/* Modal styling for voters */
.discord-modal-overlay { position: fixed; inset: 0; background: rgba(2,6,23,0.55); display:flex; align-items:center; justify-content:center; z-index:1005; padding:1.25rem }
.discord-modal { width: min(680px, 95%); background: var(--card-bg, #ffffff); border-radius: 12px; box-shadow: 0 20px 60px rgba(2,6,23,0.6); overflow: hidden; color: var(--text-color, #222); }
.discord-modal-header { display:flex; align-items:center; justify-content:space-between; padding:0.75rem 1rem; border-bottom: 1px solid rgba(0,0,0,0.06) }
.discord-modal-title { font-weight:600; font-size:1rem }
.discord-modal-close { background:none; border: none; font-size:1.05rem; cursor:pointer; padding:0.35rem 0.5rem }
.discord-modal-body { padding:0.5rem 0.75rem 1rem; max-height: 56vh; overflow:auto }
.discord-modal-voters-list { display:flex; flex-direction:column; gap:0.5rem; padding:0.25rem }
.discord-modal-voter { display:flex; gap:0.75rem; align-items:center; padding:0.5rem;border-radius:8px; transition: background 0.12s }
.discord-modal-voter:hover { background: rgba(88,101,242,0.04) }
.discord-modal-voter-avatar { width:44px; height:44px; border-radius:50%; overflow:hidden; display:flex;align-items:center;justify-content:center;background: rgba(88,101,242,0.08); color: #5865f2; border:1px solid rgba(0,0,0,0.06)}
.discord-modal-voter-avatar img{width:100%;height:100%;object-fit:cover}
.discord-modal-voter-info { display:flex; flex-direction:column }
.discord-modal-voter-name { font-weight:600 }
.discord-modal-voter-username { font-size:0.85rem;color:var(--text-muted,#777) }
.discord-modal-empty { padding:1rem; color:var(--text-muted,#777); text-align:center }

[data-theme="dark"] .discord-modal { background: #17181a; color:#fff }
[data-theme="dark"] .discord-modal-header { border-bottom-color: rgba(255,255,255,0.04) }
[data-theme="dark"] .discord-modal-voter:hover { background: rgba(255,255,255,0.02) }
[data-theme="dark"] .discord-modal-voter-username { color: #b5bac1 }

.discord-poll-voters-more {
  font-size: 0.65rem;
  color: var(--text-muted, #72767d);
  margin-left: 0.25rem;
}

/* Attachments */
.discord-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.discord-attachment-image-wrapper {
  max-width: 400px;
}

.discord-attachment-image {
  max-width: 400px;
  max-height: 300px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s ease;
  display: block;
}

.discord-attachment-image:hover {
  opacity: 0.9;
}

/* Video attachments */
.discord-attachment-video-wrapper {
  max-width: 500px;
}

.discord-attachment-video {
  max-width: 100%;
  max-height: 350px;
  border-radius: 8px;
  background: #000;
}

/* Audio attachments */
.discord-attachment-audio-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
}

.discord-attachment-audio {
  width: 100%;
  height: 32px;
  border-radius: 4px;
}

.discord-attachment-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  max-width: 400px;
}

[data-theme="dark"] .discord-attachment-file {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.discord-attachment-icon {
  width: 36px;
  height: 36px;
  color: #5865f2;
  flex-shrink: 0;
}

.discord-attachment-info {
  flex: 1;
  min-width: 0;
}

.discord-attachment-name {
  font-size: 0.875rem;
  color: #00aff4;
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discord-attachment-name:hover {
  text-decoration: underline;
}

.discord-attachment-size {
  font-size: 0.75rem;
  color: #80848e;
  margin-top: 0.1rem;
}

/* Embeds */
.discord-embed {
  border-left: 4px solid #5865f2;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
  max-width: 500px;
}

[data-theme="dark"] .discord-embed {
  background: rgba(0, 0, 0, 0.2);
}

.discord-embed-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.discord-embed-author-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.discord-embed-author-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #2e3338;
}

[data-theme="dark"] .discord-embed-author-name {
  color: #dcddde;
}

.discord-embed-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2e3338;
  margin-bottom: 0.5rem;
}

[data-theme="dark"] .discord-embed-title {
  color: #f2f3f5;
}

/* Only style as link when it's an actual anchor */
a.discord-embed-title {
  color: #00aff4;
  text-decoration: none;
}

a.discord-embed-title:hover {
  text-decoration: underline;
}

.discord-embed-description {
  font-size: 0.875rem;
  color: #4f545c;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

[data-theme="dark"] .discord-embed-description {
  color: #b5bac1;
}

/* Embed fields */
.discord-embed-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.discord-embed-field {
  grid-column: span 3;
}

.discord-embed-field.inline {
  grid-column: span 1;
}

.discord-embed-field-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #2e3338;
  margin-bottom: 0.125rem;
}

[data-theme="dark"] .discord-embed-field-name {
  color: #f2f3f5;
}

.discord-embed-field-value {
  font-size: 0.875rem;
  color: #4f545c;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

[data-theme="dark"] .discord-embed-field-value {
  color: #b5bac1;
}

.discord-embed-footer-separator {
  color: #80848e;
}

/* Embed content wrapper for thumbnail layout */
.discord-embed-content-wrapper {
  display: flex;
  gap: 1rem;
}

.discord-embed-content {
  flex: 1;
  min-width: 0;
}

.discord-embed-thumbnail {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 4px;
  object-fit: cover;
}

.discord-embed-image {
  margin-top: 0.75rem;
  max-width: 100%;
  max-height: 300px;
  border-radius: 4px;
  object-fit: contain;
}

.discord-embed-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #80848e;
}

.discord-embed-footer-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

/* Embed provider (site name) */
.discord-embed-provider {
  font-size: 0.75rem;
  font-weight: 500;
  color: #80848e;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}

[data-theme="dark"] .discord-embed-provider {
  color: #949ba4;
}

/* Loading state for embeds */
.discord-embed-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .discord-embed-loading {
  background: rgba(255, 255, 255, 0.02);
}

/* Video embeds */
.discord-embed-video {
  max-width: 520px;
}

.discord-embed-video-container {
  margin-top: 0.75rem;
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  border-radius: 4px;
  overflow: hidden;
  background: #000;
}

.discord-embed-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.discord-embed-video-player {
  max-width: 100%;
  max-height: 350px;
  border-radius: 4px;
  background: #000;
}

.discord-embed-video-iframe {
  width: 400px;
  max-width: 100%;
  height: 225px;
  border: none;
  border-radius: 4px;
}

/* YouTube thumbnail click-to-play */
.discord-embed-video-thumbnail-link {
  display: block;
  text-decoration: none;
  margin-top: 0.75rem;
}

.discord-embed-video-thumbnail {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  border-radius: 4px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.discord-embed-video-thumbnail:hover {
  opacity: 0.9;
}

.discord-embed-video-thumbnail-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discord-embed-video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.discord-embed-video-thumbnail:hover .discord-embed-video-play-overlay {
  transform: translate(-50%, -50%) scale(1.1);
}

.discord-embed-video-play-icon {
  width: 100%;
  height: 100%;
}

/* Reactions */
.discord-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.discord-reaction {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  color: #4f545c;
  cursor: pointer;
  transition: all 0.1s ease;
}

[data-theme="dark"] .discord-reaction {
  background: rgba(255, 255, 255, 0.06);
  color: #b5bac1;
}

.discord-reaction:hover {
  border-color: rgba(88, 101, 242, 0.4);
  background: rgba(88, 101, 242, 0.1);
}

.discord-reaction.reacted {
  border-color: rgba(88, 101, 242, 0.5);
  background: rgba(88, 101, 242, 0.15);
  color: #5865f2;
}

.discord-reaction-emoji {
  width: 1rem;
  height: 1rem;
}

/* Reply thread line */
.discord-reply-context {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0 0.25rem 3.5rem;
  font-size: 0.8125rem;
  color: #80848e;
  position: relative;
  margin-left: 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.1s ease;
}

.discord-reply-context:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .discord-reply-context:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.discord-reply-context::before {
  content: '';
  width: 33px;
  height: 13px;
  border-left: 2px solid #4f545c;
  border-top: 2px solid #4f545c;
  border-radius: 8px 0 0 0;
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

[data-theme="dark"] .discord-reply-context::before {
  border-color: #5c5f66;
}

.discord-reply-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.discord-reply-username {
  font-weight: 600;
  color: #5c5f66;
  cursor: pointer;
}

.discord-reply-username:hover {
  color: #2e3338;
}

[data-theme="dark"] .discord-reply-username {
  color: #b5bac1;
}

[data-theme="dark"] .discord-reply-username:hover {
  color: #fff;
}

.discord-reply-content {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Search/Filter */
.discord-search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  position: relative;
}

.discord-search-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  color: #2e3338;
  transition: all 0.15s ease;
}

[data-theme="dark"] .discord-search-input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  color: #dcddde;
}

.discord-search-input:focus {
  outline: none;
  border-color: rgba(88, 101, 242, 0.5);
  background: rgba(88, 101, 242, 0.05);
}

.discord-search-input::placeholder {
  color: #80848e;
}

.discord-search-loading {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
}

/* Search info banner */
.discord-search-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(88, 101, 242, 0.1);
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #5865f2;
}

[data-theme="dark"] .discord-search-info {
  background: rgba(88, 101, 242, 0.15);
}

.discord-search-clear {
  background: none;
  border: none;
  color: #5865f2;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.discord-search-clear:hover {
  background: rgba(88, 101, 242, 0.15);
}

/* Date divider */
.discord-date-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
}

.discord-date-divider::before,
.discord-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .discord-date-divider::before,
[data-theme="dark"] .discord-date-divider::after {
  background: rgba(255, 255, 255, 0.08);
}

.discord-date-divider span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #80848e;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Loading state */
.discord-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 1rem;
}

.discord-loading-text {
  font-size: 0.9rem;
  color: #80848e;
}

/* Empty state */
.discord-empty {
  text-align: center;
  padding: 3rem;
  color: #80848e;
}

.discord-empty svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.discord-empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #4f545c;
  margin-bottom: 0.5rem;
}

[data-theme="dark"] .discord-empty-title {
  color: #b5bac1;
}

.discord-empty-description {
  font-size: 0.875rem;
}

/* Havoc bot disclaimer */
.discord-havoc-disclaimer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin: 1rem 1rem 0.5rem;
  background: rgba(250, 168, 26, 0.1);
  border: 1px solid rgba(250, 168, 26, 0.3);
  border-radius: 6px;
  color: #b5851b;
  font-size: 0.8125rem;
}

.discord-havoc-disclaimer svg {
  flex-shrink: 0;
  color: #faa81a;
}

[data-theme="dark"] .discord-havoc-disclaimer {
  background: rgba(250, 168, 26, 0.15);
  border-color: rgba(250, 168, 26, 0.4);
  color: #f0c674;
}

[data-theme="dark"] .discord-havoc-disclaimer svg {
  color: #faa81a;
}

/* Pagination / Load more */
.discord-load-more {
  display: flex;
  justify-content: center;
  padding: 1.5rem;
}

.discord-loading-more {
  display: flex;
  justify-content: center;
  padding: 0.75rem;
}

.discord-load-more-btn {
  background: rgba(88, 101, 242, 0.1);
  border: 1px solid rgba(88, 101, 242, 0.3);
  color: #5865f2;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.discord-load-more-btn:hover {
  background: rgba(88, 101, 242, 0.2);
  border-color: rgba(88, 101, 242, 0.5);
}

[data-theme="dark"] .discord-load-more-btn {
  background: rgba(88, 101, 242, 0.15);
  color: #8b9dff;
}

[data-theme="dark"] .discord-load-more-btn:hover {
  background: rgba(88, 101, 242, 0.25);
}

/* Code blocks */
.discord-code-block {
  background: #2b2d31;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  padding: 0.5rem;
  margin: 0.25rem 0;
  overflow: auto;
  max-height: 400px;
  max-width: 100%;
  overscroll-behavior: contain;
  /* prefer modern developer-friendly monospace fonts, avoid ligatures for ASCII art */
  font-family: ui-monospace, "JetBrains Mono", "Fira Code", "Roboto Mono", "Consolas", "Monaco", "Courier New", monospace;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  font-size: 0.92rem; /* readable size for ASCII art */
  line-height: 1.125;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  tab-size: 4;
  -moz-tab-size: 4;
  letter-spacing: 0;
}

/* Scrollbar styling for code blocks */
.discord-code-block::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.discord-code-block::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.discord-code-block::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.discord-code-block::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.discord-code-block::-webkit-scrollbar-corner {
  background: transparent;
}

[data-theme="light"] .discord-code-block::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .discord-code-block::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .discord-code-block::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.discord-code-block code {
  background: none;
  padding: 0;
  color: #b5bac1;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  tab-size: 4; /* consistent tab rendering */
  -moz-tab-size: 4;
}

[data-theme="light"] .discord-code-block {
  background: #f2f3f5;
}

[data-theme="light"] .discord-code-block code {
  color: #2e3338;
}

/* Blockquotes */
.discord-blockquote {
  border-left: 4px solid #4e5058;
  padding-left: 0.75rem;
  margin: 0.25rem 0;
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #b5bac1;
}

[data-theme="light"] .discord-blockquote {
  border-left-color: #c4c9ce;
  color: #4e5058;
}

/* Spoilers */
.discord-spoiler {
  background: #1e1f22;
  color: transparent;
  border-radius: 3px;
  padding: 0 0.2rem;
  cursor: pointer;
  transition: all 0.1s ease;
}

.discord-spoiler:hover,
.discord-spoiler.revealed {
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
}

[data-theme="light"] .discord-spoiler {
  background: #b9bbbe;
}

[data-theme="light"] .discord-spoiler:hover,
[data-theme="light"] .discord-spoiler.revealed {
  background: rgba(0, 0, 0, 0.1);
}

/* Links in text */
.discord-link {
  color: #00aff4;
  text-decoration: none;
}

.discord-link:hover {
  text-decoration: underline;
}

/* System messages (join, boost, etc.) */
.discord-system-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  color: #80848e;
  font-size: 0.9rem;
}

.discord-system-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.discord-system-icon svg {
  width: 100%;
  height: 100%;
}

.discord-system-content {
  flex: 1;
}

.discord-system-content .discord-username {
  color: #00aff4;
  font-weight: 600;
}

.discord-system-unknown {
  font-style: italic;
  opacity: 0.7;
}

[data-theme="dark"] .discord-system-message {
  color: #949ba4;
}

/* Responsive */
@media (max-width: 640px) {
  .discord-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .discord-message {
    gap: 0.75rem;
  }

  .discord-avatar-wrapper,
  .discord-timestamp-gutter {
    width: 32px;
  }

  .discord-avatar,
  .discord-avatar-placeholder {
    width: 32px;
    height: 32px;
  }

  .discord-attachment-image,
  .discord-attachment-image-wrapper {
    max-width: 100%;
  }

  .discord-attachment-video-wrapper {
    max-width: 100%;
  }

  .discord-embed {
    max-width: 100%;
  }

  .discord-embed-video-container {
    padding-bottom: 56.25%;
  }
}

/* ============================================================================
   Sidebar with Guild and Channel Selection
   ============================================================================ */

.discord-sidebar {
  display: flex;
  flex-direction: row;
  gap: 0;
  width: 260px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  overflow: hidden;
  align-self: stretch;
  max-height: calc(100vh - 200px);
}

.discord-sidebar-channels {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

[data-theme="dark"] .discord-sidebar {
  background: rgba(255, 255, 255, 0.02);
}

/* Guild List (server icons) - compact vertical strip */
.discord-guild-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.35rem;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
  flex-shrink: 0;
}

[data-theme="dark"] .discord-guild-list {
  border-right-color: rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.discord-guild-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  overflow: hidden;
  flex-shrink: 0;
}

[data-theme="dark"] .discord-guild-btn {
  background: rgba(255, 255, 255, 0.08);
}

.discord-guild-btn:hover {
  border-radius: 35%;
  background: rgba(88, 101, 242, 0.25);
}

.discord-guild-btn.active {
  border-radius: 35%;
  background: #5865f2;
}

.discord-guild-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discord-guild-initial {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4f545c;
}

[data-theme="dark"] .discord-guild-initial {
  color: #b5bac1;
}

.discord-guild-btn.active .discord-guild-initial {
  color: #fff;
}

/* Channel List Header */
.discord-channel-list-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #5c5f66;
  padding: 0.5rem 0.5rem 0.75rem;
}

[data-theme="dark"] .discord-channel-list-header {
  color: #949ba4;
}

/* Channel list in sidebar mode */
.discord-sidebar .discord-channel-list {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.25rem;
  margin-bottom: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Category headers in sidebar */
.discord-category-header {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.4rem 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #6d6f78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

[data-theme="dark"] .discord-category-header {
  color: #8e9297;
}

.discord-category-header svg {
  opacity: 0.7;
}

.discord-sidebar .discord-channel-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  border: none;
  background: transparent;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}

.discord-sidebar .discord-channel-btn svg {
  flex-shrink: 0;
}

.discord-sidebar .discord-channel-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discord-sidebar .discord-channel-btn.has-category {
  padding-left: 1rem;
}

.discord-sidebar .discord-channel-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .discord-sidebar .discord-channel-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.discord-sidebar .discord-channel-btn.active {
  background: rgba(88, 101, 242, 0.15);
  color: #5865f2;
}

[data-theme="dark"] .discord-sidebar .discord-channel-btn.active {
  background: rgba(88, 101, 242, 0.2);
  color: #8b9dff;
}

/* Thread button styling - indented under parent channel */
.discord-sidebar .discord-thread-btn {
  padding-left: 2rem;
  font-size: 0.8rem;
  opacity: 0.85;
}

.discord-sidebar .discord-thread-btn svg {
  width: 14px;
  height: 14px;
}

/* ============================================================================
   Load More Button
   ============================================================================ */

.discord-load-more {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0;
  margin-top: 1rem;
}

.discord-load-more-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(88, 101, 242, 0.1);
  border: 1px solid rgba(88, 101, 242, 0.3);
  border-radius: 8px;
  color: #5865f2;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.discord-load-more-btn:hover:not(:disabled) {
  background: rgba(88, 101, 242, 0.2);
  border-color: rgba(88, 101, 242, 0.5);
}

.discord-load-more-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

[data-theme="dark"] .discord-load-more-btn {
  background: rgba(88, 101, 242, 0.15);
  border-color: rgba(88, 101, 242, 0.4);
  color: #8b9dff;
}

[data-theme="dark"] .discord-load-more-btn:hover:not(:disabled) {
  background: rgba(88, 101, 242, 0.25);
  border-color: rgba(88, 101, 242, 0.6);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .discord-main-layout {
    flex-direction: column;
  }

  .discord-sidebar {
    width: 100%;
    max-height: 250px;
    flex-direction: column;
  }

  .discord-guild-list {
    flex-direction: row;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    border-right: none;
    padding: 0.35rem;
    background: transparent;
  }

  [data-theme="dark"] .discord-guild-list {
    border-bottom-color: rgba(255, 255, 255, 0.08);
    background: transparent;
  }

  .discord-sidebar-channels {
    flex: 1;
    overflow-y: auto;
  }

  .discord-sidebar .discord-channel-list {
    flex: 1;
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }

  .discord-sidebar .discord-channel-btn {
    width: auto;
  }

  .discord-messages {
    max-height: calc(100vh - 400px);
  }
}

/* Image Modal */
.discord-image-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 2rem;
  cursor: pointer;
}

.discord-image-modal {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  cursor: default;
}

.discord-image-modal-img {
  max-width: 100%;
  max-height: calc(90vh - 4rem);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.discord-image-modal-close {
  position: absolute;
  top: -2.5rem;
  right: -0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: background 0.2s;
}

.discord-image-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.discord-image-modal-link {
  color: #00aff4;
  font-size: 0.875rem;
  text-decoration: none;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  transition: background 0.2s;
}

.discord-image-modal-link:hover {
  background: rgba(255, 255, 255, 0.2);
  text-decoration: none;
}

/* ============================================
   Reaction Users Popup
   ============================================ */

.discord-reaction-popup {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  min-width: 200px;
  max-width: 280px;
  max-height: 300px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .discord-reaction-popup {
  background: #2f3136;
}

.discord-reaction-popup-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

[data-theme="dark"] .discord-reaction-popup-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.discord-reaction-popup-emoji {
  width: 24px;
  height: 24px;
  font-size: 1.25rem;
}

.discord-reaction-popup-count {
  color: #80848e;
  font-size: 0.875rem;
  font-weight: 400;
}

.discord-reaction-popup-users {
  padding: 0.5rem;
  overflow-y: auto;
  max-height: 220px;
}

.discord-reaction-popup-loading {
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.discord-reaction-popup-empty {
  text-align: center;
  padding: 1rem;
  color: #80848e;
  font-size: 0.875rem;
}

.discord-reaction-popup-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
}

.discord-reaction-popup-user:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .discord-reaction-popup-user:hover {
  background: rgba(255, 255, 255, 0.04);
}

.discord-reaction-popup-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.discord-reaction-popup-name {
  font-size: 0.875rem;
  color: #2e3338;
}

[data-theme="dark"] .discord-reaction-popup-name {
  color: #dcddde;
}

/* ============================================
   Header Actions (copy link, member toggle)
   ============================================ */

.discord-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.discord-copy-link-btn,
.discord-jump-first-btn,
.discord-member-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  background: rgba(0, 0, 0, 0.06);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #5c5f66;
  transition: all 0.15s ease;
}

[data-theme="dark"] .discord-copy-link-btn,
[data-theme="dark"] .discord-jump-first-btn,
[data-theme="dark"] .discord-member-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #b5bac1;
}

.discord-copy-link-btn:hover,
.discord-jump-first-btn:hover,
.discord-member-toggle-btn:hover {
  background: rgba(88, 101, 242, 0.15);
  color: #5865f2;
}

.discord-jump-first-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.discord-copy-link-btn.copied {
  background: rgba(35, 165, 90, 0.2);
  color: #23a55a;
}

.discord-member-toggle-btn.active {
  background: rgba(88, 101, 242, 0.2);
  color: #5865f2;
}

.discord-member-count {
  font-size: 0.7rem;
  font-weight: 500;
}

/* ============================================
   Member List Panel
   ============================================ */

.discord-member-list {
  width: 220px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 12px;
  padding: 0.75rem;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .discord-member-list {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
}

.discord-member-list-loading {
  display: flex;
  justify-content: center;
  padding: 2rem;
}

.discord-member-list-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #80848e;
  font-size: 0.85rem;
}

.discord-member-group {
  margin-bottom: 1rem;
}

.discord-member-group:last-child {
  margin-bottom: 0;
}

.discord-member-group-header {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.5rem 0.5rem 0.25rem;
  color: #80848e;
}

.discord-member-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: default;
  transition: background 0.15s ease;
}

.discord-member-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .discord-member-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.discord-member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.discord-member-avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #5865f2;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.discord-member-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: #2e3338;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .discord-member-name {
  color: #dbdee1;
}

.discord-member-item .discord-bot-tag {
  font-size: 0.6rem;
  padding: 0.1rem 0.25rem;
  flex-shrink: 0;
}

/* ============================================
   Context Menu (right-click on messages)
   ============================================ */

.discord-context-menu {
  position: fixed;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 1002;
  min-width: 180px;
  padding: 0.375rem;
  overflow: hidden;
}

[data-theme="dark"] .discord-context-menu {
  background: #111214;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.discord-context-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #2e3338;
  font-size: 0.875rem;
  text-align: left;
  transition: background 0.1s ease;
}

[data-theme="dark"] .discord-context-menu-item {
  color: #dbdee1;
}

.discord-context-menu-item:hover {
  background: #5865f2;
  color: #fff;
}

.discord-context-menu-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.discord-context-menu-item:hover svg {
  opacity: 1;
}

