:root {
  --bg1: #000000;
  --bg2: #0a0e14;
  --card: rgba(255, 255, 255, 0.03);
  --muted: #8aa0aa;
  --accent: #3ee8c8;
  --accent-2: #60a5fa;
  --glass: rgba(255, 255, 255, 0.02);
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --sidebar-width: 380px;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
body {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial;
  background: #000000;
  color: #e6eef6;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.55;
}
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}
/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg2);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}
.sidebar-search {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.sidebar-search input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  color: #ffffff;
  font-size: 0.9rem;
}
.threads-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.thread-item {
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.thread-item:hover {
  background: rgba(255, 255, 255, 0.03);
}
.thread-item.active {
  background: rgba(62, 232, 200, 0.1);
  border-right: 3px solid var(--accent);
}
.thread-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}
.thread-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #04263a;
  font-size: 1.1rem;
}
.thread-avatar-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.thread-info {
  flex: 1;
  min-width: 0;
}
.thread-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-preview {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.thread-time {
  font-size: 0.75rem;
  color: var(--muted);
}
.thread-unread {
  background: var(--accent);
  color: #04263a;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* Main Chat Area */
.main-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg1);
  height: 100vh;
}
.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.01);
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #04263a;
  position: relative;
  flex-shrink: 0;
}
.chat-header-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.chat-header-title {
  font-weight: 600;
  font-size: 1rem;
}
.chat-header-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.message {
  display: flex;
  gap: 10px;
  max-width: 70%;
  animation: fadeIn 0.3s;
}
.message.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.message-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}
.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #04263a;
  font-size: 0.85rem;
}
.message-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.message-content {
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.message.own .message-content {
  background: linear-gradient(
    135deg,
    rgba(62, 232, 200, 0.2),
    rgba(96, 165, 250, 0.2)
  );
  border-color: rgba(62, 232, 200, 0.3);
}
.message-sender {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--accent);
}
.message-text {
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.message-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  justify-content: flex-start;
}
.message.own .message-footer {
  justify-content: flex-end;
}
.message-time {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: left;
}
.message.own .message-time {
  text-align: right;
}
.message-status {
  font-size: 0.7rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.message-status.sent {
  color: var(--muted);
  opacity: 0.7;
}
.message-status.delivered {
  color: var(--muted);
  opacity: 0.9;
}
.message-status.seen {
  color: #60a5fa;
  opacity: 1;
}
.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.01);
}
.chat-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  color: #ffffff;
  font-size: 0.95rem;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  font-family: inherit;
}
.chat-input:focus {
  outline: 2px solid rgba(96, 165, 250, 0.14);
  border-color: rgba(96, 165, 250, 0.28);
}
.chat-send-btn {
  padding: 12px 24px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #051017;
  border: 0;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s,
    opacity 0.2s;
}
.chat-send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  opacity: 0.9;
}
.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Empty State */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}
.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state-text {
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.empty-state-subtext {
  font-size: 0.9rem;
  color: var(--muted);
}
/* Dialog/Modal Styles */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.dialog-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.dialog {
  background: var(--bg2);
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s;
}
.dialog-overlay.active .dialog {
  transform: scale(1);
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dialog-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}
.dialog-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s;
}
.dialog-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}
.dialog-body {
  margin-bottom: 20px;
}
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #ffffff;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  color: #ffffff;
  font-size: 0.95rem;
  font-family: inherit;
}
.form-textarea {
  min-height: 80px;
  resize: vertical;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: 2px solid rgba(96, 165, 250, 0.14);
  border-color: rgba(96, 165, 250, 0.28);
}
.form-help {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}
.member-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.member-tag {
  background: rgba(62, 232, 200, 0.1);
  border: 1px solid rgba(62, 232, 200, 0.3);
  border-radius: 8px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.member-tag-remove {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}
.user-search-container {
  position: relative;
}
.user-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.user-search-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s;
}
.user-search-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.user-search-item:last-child {
  border-bottom: none;
}
.user-search-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}
.user-search-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #04263a;
  font-size: 0.9rem;
}
.user-search-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.user-search-info {
  flex: 1;
  min-width: 0;
}
.user-search-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-search-username {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dialog-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  border: 0;
  font-size: 0.9rem;
  transition:
    transform 0.2s,
    opacity 0.2s;
}
.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #051017;
}
.btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--accent);
}
.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  opacity: 0.9;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Settings Panel */
.settings-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.settings-panel.active {
  opacity: 1;
  pointer-events: all;
}
.settings-content {
  background: var(--bg2);
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: 8px;
}
.status-indicator.connected {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.status-indicator.disconnected {
  background: var(--error);
  box-shadow: 0 0 8px var(--error);
}
.status-indicator.connecting {
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}
.btn-icon {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--accent);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.05);
}
.typing-indicator {
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

/* Thread Type Filter */
.thread-type-filter {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 8px;
}
.filter-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}
.filter-btn.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #051017;
  border-color: transparent;
}

/* Pinned Users Section */
.pinned-users-section {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.pinned-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pinned-user-item {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}
.pinned-user-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.pinned-user-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}
.pinned-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #04263a;
  font-size: 0.85rem;
}
.pinned-user-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.pinned-user-info {
  flex: 1;
  min-width: 0;
}
.pinned-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pinned-user-username {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pinned-user-unpin-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.2s;
  opacity: 0;
}
.pinned-user-item:hover .pinned-user-unpin-btn {
  opacity: 1;
}
.pinned-user-unpin-btn:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Pinned Threads Section */
.pinned-threads-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.pinned-threads-section .section-title {
  padding: 8px 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Thread Pin Button */
.thread-pin-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
  opacity: 0;
  transition: all 0.2s;
  border-radius: 4px;
}
.thread-item:hover .thread-pin-btn {
  opacity: 1;
}
.thread-pin-btn:hover {
  color: var(--accent);
  background: rgba(62, 232, 200, 0.1);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn:hover {
  color: #ffffff;
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Info Section */
.info-section {
  margin-bottom: 20px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.info-row:last-child {
  border-bottom: none;
}
.info-label {
  font-weight: 600;
  color: var(--muted);
}
.info-value {
  color: #ffffff;
}

/* Thread Actions */
.thread-actions {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Search Filter Bar */
.search-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.search-filter-bar .form-input {
  flex: 1;
}

/* Members List */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 400px;
  overflow-y: auto;
}
.member-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.member-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}
.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #04263a;
  font-size: 0.9rem;
}
.member-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.member-info {
  flex: 1;
  min-width: 0;
}
.member-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}
.member-username {
  font-size: 0.8rem;
  color: var(--muted);
}
.member-role {
  padding: 4px 12px;
  background: rgba(62, 232, 200, 0.1);
  border: 1px solid rgba(62, 232, 200, 0.3);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}
.member-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.btn-icon-small {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon-small:hover {
  background: rgba(62, 232, 200, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.btn-icon-small.btn-danger {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-icon-small.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
}
.member-banned {
  opacity: 0.6;
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.2);
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  max-height: 400px;
  overflow-y: auto;
}
.media-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.2s, border-color 0.2s;
}
.media-item:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}
.media-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-thumb-video,
.media-thumb-audio,
.media-thumb-file {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(62, 232, 200, 0.1);
}
.media-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  padding: 8px;
  font-size: 0.7rem;
  color: #ffffff;
}
.media-type {
  font-weight: 600;
  margin-bottom: 2px;
}
.media-date {
  color: rgba(255, 255, 255, 0.7);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Context Menu */
.context-menu {
  position: fixed;
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 4px;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  min-width: 180px;
}
.menu-item {
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.2s;
  color: #ffffff;
}
.menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

/* Button Danger */
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-chat {
    width: 100%;
  }
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
    </style>
