/* Icons */
img.icon,
.icon img,
.top-left img,
.top-icons img,
.server-tools img,
.mobile-menu-btn img {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.message-icons img {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.channel-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.server-invite img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.message-plus img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.server-search img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

/* Server icon */
.server-icon {
  text-decoration: none;
}

.server-icon.home img {
  width: 26px;
  height: 18px;
  object-fit: contain;
  border-radius: 0;
}

.server-icon.add-server img,
.server-icon.explore img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 0;
}

/* Active server */
.server-icon.active {
  background: #5865f2;
  border-radius: 16px;
}

.server-icon.active .pill {
  height: 40px;
  opacity: 1;
}

/* Channel sidebar */
.channel-list {
  width: 240px;
  background: #2b2d31;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

/* Server name */
.server-name {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 15px;
  color: white;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 1.5px 0 rgba(0, 0, 0, .05);
  cursor: pointer;
  background: #2b2d31;
  flex-shrink: 0;
}

.server-name:hover {
  background: #35373c;
}

.server-arrow {
  margin-left: auto;
  font-size: 14px;
  color: #949ba4;
}

.server-invite {
  margin-left: 8px;
  color: #949ba4;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.server-invite:hover {
  color: #dbdee1;
}

.server-invite svg,
.server-invite img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* Channel list */
.channels {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 0;
}

/* Channel item */
.channel {
  height: 34px;
  padding: 0 8px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #949ba4;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.channel:hover {
  background: #35373c;
  color: #dbdee1;
}

.channel.active {
  background: #404249;
  color: white;
}

/* Channel icon */
.channel-icon {
  width: 20px;
  height: 20px;
  color: #80848e;
  flex-shrink: 0;
}

.channel:hover .channel-icon,
.channel.active .channel-icon {
  color: #ffffff;
}

.hash {
  color: #80848e;
  font-size: 20px;
  font-weight: 600;
  width: 18px;
  text-align: center;
}

.channel.active .hash {
  color: #fff;
}

.channel-add {
  margin-left: auto;
  color: #b5bac1;
  font-size: 20px;
  line-height: 1;
}

/* Channel line */
.channel-line {
  height: 1px;
  margin: 7px 8px;
  background: #3f4147;
}

/* Categories */
.category {
  margin-top: 16px;
  margin-bottom: 3px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #949ba4;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.category-arrow {
  font-size: 12px;
}

/* User bar */
.server-user {
  height: 52px;
  padding: 0 8px;
  background: #232428;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.server-user .avatar-wrap {
  flex-shrink: 0;
}

.user-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-text .name {
  color: white;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-text .subtext {
  color: #b5bac1;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* User icons */
.user-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  color: #b5bac1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
}

.user-icon:hover {
  background: #35373c;
  color: #dbdee1;
}

.user-icon svg,
.user-icon img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
}

.server-user .user-icon.muted,
.server-user .user-icon.deafened {
  background: #3b242a;
  color: #f23f43;
}

.server-user .user-icon.muted:hover,
.server-user .user-icon.deafened:hover {
  background: #472b32;
  color: #f23f43;
}

/* Chat area */
.server-chat {
  flex: 1;
  min-width: 0;
  background: #313338;
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Chat header */
.server-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .24);
  background: #313338;
  flex-shrink: 0;
  z-index: 2;
}

.header-hash {
  color: #80848e;
  font-size: 24px;
  font-weight: 500;
}

.channel-name {
  color: white;
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Header icons */
.server-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #b5bac1;
}

.tool-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tool-icon:hover {
  color: #dbdee1;
}

.tool-icon svg,
.tool-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.help {
  width: 20px;
  height: 20px;
  background: #b5bac1;
  color: #313338;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.help:hover {
  background: #dbdee1;
}

/* Search bar */
.server-search {
  width: 180px;
  height: 28px;
  padding: 0 8px;
  background: #1e1f22;
  display: flex;
  align-items: center;
  border-radius: 4px;
  gap: 6px;
}

.server-search input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-size: 13px;
  font-family: inherit;
}

.server-search input::placeholder {
  color: #949ba4;
}

.server-search svg,
.server-search img {
  width: 16px;
  height: 16px;
  color: #949ba4;
  flex-shrink: 0;
  object-fit: contain;
}

/* Chat messages */
.server-body {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #1a1b1e transparent;
}

.server-body::-webkit-scrollbar {
  width: 8px;
}

.server-body::-webkit-scrollbar-thumb {
  background: #1a1b1e;
  border-radius: 4px;
}

.server-body::-webkit-scrollbar-track {
  background: transparent;
}

/* Welcome message */
.welcome {
  margin-top: 0;
}

.big-hash {
  width: 68px;
  height: 68px;
  margin-bottom: 12px;
  background: #41434a;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 500;
}

.welcome h1 {
  margin: 0 0 6px;
  color: white;
  font-size: 30px;
  font-weight: 700;
  word-break: break-word;
}

.welcome p {
  margin: 0;
  color: #b5bac1;
  font-size: 14px;
}

/* Message bar */
.message-row {
  height: 44px;
  min-height: 44px;
  margin: 0 16px 16px;
  padding: 0 16px;
  background: #383a40;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.message-plus {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  color: #b5bac1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.message-plus:hover {
  color: #dbdee1;
}

.message-plus img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.message-row input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-size: 15px;
  font-family: inherit;
}

.message-row input::placeholder {
  color: #6d6f78;
}

/* Message icons */
.message-icons {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #b5bac1;
}

.message-icon {
  display: flex;
  cursor: pointer;
}

.message-icon:hover {
  color: #dbdee1;
}

.message-icon svg,
.message-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.gif {
  padding: 2px 4px;
  background: #b5bac1;
  color: #383a40;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.gif:hover {
  background: #fff;
}

.apps {
  width: 20px;
  height: 20px;
  border: 2px solid #b5bac1;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.apps:hover {
  border-color: #fff;
  color: #fff;
}

.message-send {
  background: none;
  border: none;
  color: #5865f2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.message-send:hover {
  color: #4752c4;
}

.message-send svg,
.message-send img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* Message list */
.cc-list {
  flex-shrink: 0;
  margin-top: 16px;
}

/* Message */
.cc-msg {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 4px 8px;
  margin-top: 6px;
  border-radius: 4px;
}

.cc-msg:hover {
  background: rgba(2, 2, 2, 0.1);
}

.cc-msg-main {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* Message hover actions */
.cc-actions {
  display: none;
  position: absolute;
  top: -14px;
  right: 16px;
  background: #313338;
  border: 1px solid #232428;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 5;
}

.cc-msg:hover .cc-actions {
  display: flex;
}

.cc-action-btn {
  background: none;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: #b5bac1;
}

.cc-action-btn:hover {
  background: #35373c;
  color: #dbdee1;
}

.cc-action-btn img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

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

/* Profile picture */
.cc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Name and time */
.cc-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.cc-author {
  color: white;
  font-size: 16px;
  font-weight: 500;
}

.cc-time {
  color: #949ba4;
  font-size: 12px;
}

/* Message text */
.cc-text {
  margin: 2px 0 0;
  color: #dbdee1;
  font-size: 16px;
  line-height: 1.375;
  word-break: break-word;
}

/* Replied message */
.cc-reply {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #b5bac1;
  margin-bottom: 4px;
  position: relative;
  padding-left: 48px;
}

.cc-reply::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 9px;
  width: 20px;
  height: 10px;
  border-left: 2px solid #4e5058;
  border-top: 2px solid #4e5058;
  border-top-left-radius: 6px;
}

.cc-reply-author {
  font-weight: 600;
  color: #dbdee1;
  cursor: pointer;
}

.cc-reply-author:hover {
  text-decoration: underline;
}

.cc-reply-text {
  color: #949ba4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 450px;
}

/* Reactions */
.cc-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.cc-reaction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: #2b2d31;
  border: 1px solid #3f4147;
  border-radius: 8px;
  color: #b5bac1;
  font-size: 14px;
  cursor: pointer;
}

.cc-reaction:hover {
  background: #35373c;
  border-color: #5865f2;
}

.cc-reaction.selected {
  background: #3c4270;
  border-color: #5865f2;
  color: #c9cdfb;
}

.cc-reaction-count {
  font-size: 13px;
  font-weight: 600;
}

.cc-reaction:disabled {
  cursor: default;
  opacity: 0.8;
}

.cc-add-reaction {
  padding: 3px 8px;
  background: #2b2d31;
  border: 1px solid #3f4147;
  border-radius: 8px;
  color: #b5bac1;
  font-size: 14px;
  cursor: pointer;
}

.cc-add-reaction:hover {
  background: #35373c;
  border-color: #5865f2;
  color: white;
}

/* Reply preview */
#reply-preview {
  margin: 0 16px;
}

.reply-preview-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #2b2d31;
  border-radius: 8px 8px 0 0;
  color: #b5bac1;
  font-size: 13px;
  border-bottom: 1px solid #232428;
}

.reply-preview-content span b {
  color: white;
}

.reply-cancel-btn {
  background: none;
  border: none;
  color: #b5bac1;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.reply-cancel-btn:hover {
  color: white;
  background: #35373c;
}

.message-row.with-reply {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Emoji popover */
.emoji-pop {
  position: fixed;
  z-index: 300;
  background: #2b2d31;
  border: 1px solid #1e1f22;
  border-radius: 8px;
  padding: 8px;
  display: none;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.emoji-pop.open {
  display: grid;
}

.emoji-pop button {
  background: none;
  border: none;
  font-size: 20px;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-pop button:hover {
  background: #35373c;
}

/* Typing indicator */
.typing {
  color: #949ba4;
  font-size: 13px;
  font-style: italic;
  margin: 6px 16px 14px;
}

/* Toast notification */
.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translate(-50%, 16px);
  background: #111214;
  color: #f2f3f5;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Channel permissions */
.permission-button {
  margin-left: 8px;
  padding: 4px 7px;
  background: none;
  border: none;
  border-radius: 4px;
  color: #b5bac1;
  font-size: 18px;
  cursor: pointer;
}

.permission-button:hover {
  background: #404249;
  color: white;
}

.permission-panel {
  display: none;
  position: absolute;
  top: 55px;
  right: 16px;
  z-index: 10;
  width: 230px;
  padding: 16px;
  background: #232428;
  border: 1px solid #3f4147;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  color: white;
}

.permission-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.permission-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: #dbdee1;
  font-size: 13px;
}

.permission-panel input {
  accent-color: #5865f2;
}

.permission-panel button {
  margin-top: 8px;
  padding: 6px 12px;
  background: #5865f2;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
}

.permission-panel button:hover {
  background: #4752c4;
}

/* No permission message */
.no-permission {
  display: none;
  margin: 0 16px 16px;
  padding: 14px;
  background: #383a40;
  border-radius: 8px;
  color: #b5bac1;
  text-align: center;
  font-size: 14px;
}

/* Small screens */
@media (max-width: 480px) {
  .cc-avatar {
    width: 32px;
    height: 32px;
  }

  .cc-msg {
    gap: 10px;
  }

  .cc-author,
  .cc-text {
    font-size: 15px;
  }
}

.desktop-only {
  display: flex;
}

/* Mobile buttons */
.mobile-menu-btn,
.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: #949ba4;
  cursor: pointer;
}

/* Tablet screen */
@media (max-width: 1024px) {
  .server-rail {
    width: 64px;
  }

  .channel-list {
    width: 200px;
  }

  .server-tools .tool-icon:nth-child(1),
  .server-tools .tool-icon:nth-child(3),
  .server-tools .help {
    display: none;
  }

  .server-search input {
    width: 100px;
  }
}

/* Mobile screen */
@media (max-width: 768px) {
  .mobile-top-bar {
    display: flex;
  }

  .mobile-menu-btn {
    display: flex;
    padding: 4px;
    margin-right: 4px;
    border-radius: 4px;
  }

  .mobile-menu-btn:hover {
    background: #35373c;
  }

  .mobile-menu-btn svg,
  .mobile-menu-btn img {
    width: 20px;
    height: 20px;
    object-fit: contain;
  }

  .sidebar-close-btn {
    display: flex;
    font-size: 20px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
  }

  .sidebar-close-btn:hover {
    background: #35373c;
  }

  /* Hide sidebars */
  .server-rail,
  .channel-list {
    display: none;
  }

  .server-chat {
    width: 100%;
    flex: 1;
    height: 100%;
    height: 100dvh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Show sidebar */
  .app.show-sidebar .server-rail {
    display: flex;
    width: 72px;
    flex-shrink: 0;
  }

  .app.show-sidebar .channel-list {
    display: flex;
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .app.show-sidebar .server-chat {
    display: none;
  }

  .server-header {
    height: 48px;
    min-height: 48px;
    padding: 0 10px;
    gap: 8px;
    flex-shrink: 0;
  }

  .channel-name {
    max-width: 200px;
    font-size: 16px;
  }

  /* Hide desktop tools */
  .server-tools .tool-icon[title="Threads"],
  .server-tools .tool-icon[title="Notifications"],
  .server-tools .tool-icon[title="Pinned Messages"],
  .server-tools .server-search,
  .server-tools .help {
    display: none !important;
  }

  /* Show member list */
  .server-tools .tool-icon[title="Member List"] {
    display: flex !important;
    color: #dbdee1;
  }

  .desktop-only {
    display: none !important;
  }

  .server-body {
    padding: 16px 12px;
    flex: 1 1 0;
    min-height: 0;
  }

  .big-hash {
    width: 52px;
    height: 52px;
    font-size: 34px;
    margin-bottom: 8px;
  }

  .welcome h1 {
    font-size: 22px;
  }

  /* Mobile message bar */
  .message-row {
    margin: 0 8px 8px;
    padding: 0 10px;
    gap: 8px;
    height: 44px;
    min-height: 44px;
    flex-shrink: 0;
  }

  .message-icons {
    gap: 8px;
  }

  #reply-preview {
    margin: 0 8px;
  }

  .permission-panel {
    right: 8px;
    width: 220px;
  }

  .no-permission {
    margin: 0 8px 8px;
  }
}

/* Small mobile screen */
@media (max-width: 480px) {
  .server-search {
    display: none;
  }

  .channel-name {
    max-width: 170px;
  }

  .message-icons {
    gap: 6px;
  }

  .message-row input {
    font-size: 14px;
  }
}