/* Community Page Styles */

.community-container {
  padding: 24px 20px 120px;
  min-height: calc(100vh - 90px);
  background: linear-gradient(180deg, #f5f7ff 0%, #eef3ff 100%);
}

.community-card {
  max-width: 1080px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 24px 48px rgba(15, 42, 92, 0.12);
}

.community-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

/* Floating Action Button */
.friends-fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1000;
}

.friends-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.friends-fab:active {
  transform: scale(0.95);
}

body.dark-theme .friends-fab {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

body.parchment-theme .friends-fab {
  background: linear-gradient(135deg, #8b7355 0%, #6b5344 100%);
  box-shadow: 0 4px 12px rgba(139, 115, 85, 0.4);
}

/* Friends Section Styling */
.friends-page-search {
  margin-bottom: 20px;
  padding: 0 20px;
}

.friends-page-search input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.2s ease;
}

.friends-page-search input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.friends-page-list {
  margin-bottom: 30px;
  padding: 0 20px;
}

.friends-page-empty {
  text-align: center;
  color: #64748b;
  padding: 40px 20px;
}

.friends-page-add-section {
  border-top: 2px solid #e5e7eb;
  padding: 20px;
  margin-top: 20px;
}

.friends-page-add-section h3 {
  margin: 0 0 15px;
  font-size: 18px;
  color: #1f2937;
}

.friends-page-add-search input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.2s ease;
  margin-bottom: 15px;
}

.friends-page-add-search input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.friends-page-add-results {
  max-height: 400px;
  overflow-y: auto;
}

.friend-result-add-btn {
  padding: 8px 16px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

.friend-result-add-btn:hover {
  background: #2563eb;
}

.friend-dm-btn {
  padding: 8px 12px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

.friend-dm-btn:hover {
  background: #2563eb;
}

/* Dark Theme */
body.dark-theme .friends-page-search input,
body.dark-theme .friends-page-add-search input {
  background: #2d2d2d;
  border-color: #3d3d3d;
  color: #e8e8e8;
}

body.dark-theme .friends-page-search input:focus,
body.dark-theme .friends-page-add-search input:focus {
  border-color: #3b82f6;
}

body.dark-theme .friends-page-empty {
  color: #9ca3af;
}

body.dark-theme .friends-page-add-section h3 {
  color: #ffffff;
}

body.dark-theme .friends-page-add-section {
  border-color: #3d3d3d;
}

body.dark-theme .friend-result-add-btn,
body.dark-theme .friend-dm-btn {
  background: #3b82f6;
}

body.dark-theme .friend-result-add-btn:hover,
body.dark-theme .friend-dm-btn:hover {
  background: #2563eb;
}

/* Dark Mode - DM Section */
body.dark-theme .dm-users {
  background: #1e293b;
  border-color: #374151;
}

body.dark-theme .dm-users h3 {
  color: #f1f5f9;
}

body.dark-theme .dm-search input {
  background: #374151;
  border-color: #4b5563;
  color: #f1f5f9;
}

body.dark-theme .dm-search input:focus {
  outline: none;
  border-color: #3b82f6;
}

body.dark-theme .online-user {
  background: #374151;
  border-color: #4b5563;
}

body.dark-theme .online-user:hover {
  background: #4b5563;
}

body.dark-theme .user-name {
  color: #f1f5f9;
}

body.dark-theme .dm-create-btn {
  background: #374151;
  border-color: #3b82f6;
  color: #3b82f6;
}

body.dark-theme .dm-create-btn:hover {
  background: #3b82f6;
  color: white;
}

body.dark-theme .dm-chat {
  background: #1e293b;
  border-color: #374151;
}

body.dark-theme .dm-placeholder {
  color: #9ca3af;
}

body.dark-theme .dm-chat-area {
  background: #1e293b;
}

body.dark-theme .dm-chat-header {
  background: #1e293b;
  border-color: #374151;
}

body.dark-theme .dm-chat-header h3 {
  color: #f1f5f9;
}

/* Dark Mode - Groups Section */
body.dark-theme .groups-list {
  background: #1e293b;
  border-color: #374151;
}

body.dark-theme .groups-list h3 {
  color: #f1f5f9;
}

body.dark-theme .groups-chat {
  background: #1e293b;
  border-color: #374151;
}

body.dark-theme .groups-placeholder {
  color: #9ca3af;
}

body.dark-theme .groups-chat-area {
  background: #1e293b;
}

body.dark-theme .groups-chat-header {
  background: #1e293b;
  border-color: #374151;
}

body.dark-theme .groups-chat-header h3 {
  color: #f1f5f9;
}

body.dark-theme .create-group-form {
  background: #1e293b;
  border-color: #374151;
}

body.dark-theme .create-group-form h3 {
  color: #f1f5f9;
}

body.dark-theme .form-field label {
  color: #e2e8f0;
}

body.dark-theme .form-field input,
body.dark-theme .form-field textarea {
  background: #374151;
  border-color: #4b5563;
  color: #f1f5f9;
}

body.dark-theme .form-field input:focus,
body.dark-theme .form-field textarea:focus {
  outline: none;
  border-color: #3b82f6;
}

/* Dark Mode - Search Results */
body.dark-theme .search-result-item {
  background: #374151;
  border-color: #4b5563;
}

body.dark-theme .search-result-item:hover {
  background: #4b5563;
}

body.dark-theme .search-result-item .user-assembly {
  color: #9ca3af;
}

body.dark-theme .search-hint,
body.dark-theme .search-loading,
body.dark-theme .search-empty,
body.dark-theme .search-error {
  color: #9ca3af;
}

/* Dark Mode - Friend Search Results */
body.dark-theme .friend-result-item {
  background: #374151;
}

body.dark-theme .friend-result-item:hover {
  background: #4b5563;
}

body.dark-theme .friend-result-name {
  color: #f1f5f9;
}

body.dark-theme .friend-result-assembly {
  color: #9ca3af;
}

body.dark-theme .friend-search-hint {
  color: #9ca3af;
}

body.dark-theme .friend-search-box input {
  background: #374151;
  border-color: #4b5563;
  color: #f1f5f9;
}

body.dark-theme .friend-search-box input:focus {
  outline: none;
  border-color: #3b82f6;
}

/* Dark Mode - Friend Cards */
body.dark-theme .friend-card {
  background: #374151;
  border-color: #4b5563;
}

body.dark-theme .friend-card:hover {
  background: #4b5563;
  border-color: #3b82f6;
}

body.dark-theme .friend-name {
  color: #f1f5f9;
}

body.dark-theme .friend-assembly {
  color: #9ca3af;
}

/* Parchment Theme */
body.parchment-theme .friends-page-search input,
body.parchment-theme .friends-page-add-search input {
  background: #f0e6d0;
  border-color: #d4c4a8;
  color: #3d2914;
}

body.parchment-theme .friends-page-search input:focus,
body.parchment-theme .friends-page-add-search input:focus {
  border-color: #8b7355;
}

body.parchment-theme .friends-page-empty {
  color: #6b5344;
}

body.parchment-theme .friends-page-add-section h3 {
  color: #3d2914;
}

body.parchment-theme .friends-page-add-section {
  border-color: #d4c4a8;
}

body.parchment-theme .friend-result-add-btn,
body.parchment-theme .friend-dm-btn {
  background: #8b7355;
}

body.parchment-theme .friend-result-add-btn:hover,
body.parchment-theme .friend-dm-btn:hover {
  background: #6b5344;
}

.community-title {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0.02em;
  color: #10263e;
}

.community-subtitle {
  margin: 8px 0 0;
  color: #4f5e7a;
  font-size: 15px;
  line-height: 1.7;
}

.community-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.community-action-btn {
  padding: 14px 22px;
  border-radius: 999px;
  border: none;
  background: #2563eb;
  color: white;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.18);
}

.community-action-btn:hover {
  background: #1d4ed8;
}

.community-create-form {
  background: #f8fbff;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 24px;
  padding: 22px;
  margin-bottom: 20px;
}

.hidden {
  display: none;
}

.community-field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.community-field label {
  color: #34436d;
  font-size: 14px;
  font-weight: 700;
}

.community-field input,
.community-field textarea {
  width: 100%;
  border: 1px solid rgba(56, 83, 151, 0.18);
  border-radius: 18px;
  padding: 14px 16px;
  background: #ffffff;
  color: #1f2f4d;
  font-size: 15px;
  resize: vertical;
}

.community-submit-btn {
  padding: 14px 22px;
  border-radius: 999px;
  border: none;
  background: #1e40af;
  color: white;
  font-size: 15px;
  cursor: pointer;
}

.community-status {
  margin-bottom: 18px;
  color: #152238;
  font-size: 15px;
}

.community-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 18px;
}

.community-panel {
  background: #ffffff;
  border-radius: 24px;
  padding: 20px;
  min-height: 420px;
  border: 1px solid rgba(37, 99, 235, 0.08);
}

.community-chat-panel {
  display: flex;
  flex-direction: column;
}

.group-list {
  display: grid;
  gap: 14px;
}

.group-card {
  background: #f3f7ff;
  border-radius: 20px;
  padding: 18px;
  cursor: pointer;
  border: 1px solid rgba(37, 99, 235, 0.12);
  transition: transform 0.2s ease, background 0.2s ease;
}

.group-card:hover {
  transform: translateY(-1px);
  background: #eef4ff;
}

.group-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
  color: #10263e;
}

.group-card p,
.group-card span {
  margin: 0;
  color: #475569;
  font-size: 14px;
}

.chat-placeholder {
  display: grid;
  place-items: center;
  min-height: 340px;
  color: #475569;
  text-align: center;
}

.group-chat-area {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-header {
  border-bottom: 1px solid rgba(37, 99, 235, 0.15);
  padding-bottom: 12px;
}

.chat-header h2 {
  margin: 0;
  font-size: 22px;
  color: #0f172a;
}

.chat-header p {
  margin: 6px 0 0;
  color: #475569;
  font-size: 14px;
}

.message-list {
  flex: 1;
  min-height: 260px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
}

/* Phone-style Message Bubbles */
.message-row {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  align-self: flex-start;
}

.message-row.own-message {
  align-self: flex-end;
}

.message-bubble {
  background: white;
  border-radius: 18px;
  padding: 10px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  position: relative;
}

.message-row.own-message .message-bubble {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 2px;
  padding-left: 4px;
}

.message-row.own-message .message-sender {
  color: #2563eb;
  text-align: right;
  padding-right: 4px;
  padding-left: 0;
}

.message-text {
  font-size: 14px;
  line-height: 1.4;
  color: #1f2937;
  word-wrap: break-word;
}

.message-row.own-message .message-text {
  color: white;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-left: 4px;
}

.message-row.own-message .message-meta {
  justify-content: flex-end;
  padding-right: 4px;
  padding-left: 0;
}

.message-time {
  font-size: 11px;
  color: #94a3b8;
}

.message-row.own-message .message-time {
  color: rgba(255, 255, 255, 0.7);
}

.message-date {
  font-size: 10px;
  color: #cbd5e1;
  font-weight: 500;
}

.message-row.own-message .message-date {
  color: rgba(255, 255, 255, 0.5);
}

/* Date Divider - Shows between messages from different days */
.message-date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  position: relative;
}

.message-date-divider::before {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
  margin-right: 12px;
}

.message-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
  margin-left: 12px;
}

.message-date-divider span {
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 500;
}

/* Typing Indicators */
.typing-indicator {
  padding: 8px 16px;
  color: #64748b;
  font-size: 13px;
  font-style: italic;
  background: #f8fafc;
  border-radius: 12px;
  margin: 8px 0;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Connection Status */
.community-status.connected {
  color: #10b981;
}

.community-status.reconnecting {
  color: #f59e0b;
}

.community-status.error {
  color: #ef4444;
}

.chat-form {
  display: grid;
  gap: 10px;
}

.chat-form textarea {
  width: 100%;
  min-height: 100px;
  border: 1px solid rgba(56, 83, 151, 0.18);
  border-radius: 18px;
  padding: 14px 16px;
  resize: vertical;
  font-size: 15px;
}

.chat-submit-btn {
  width: 100%;
  padding: 14px 22px;
  border: none;
  border-radius: 999px;
  background: #2563eb;
  color: white;
  font-size: 15px;
  cursor: pointer;
}

.empty-message {
  color: #64748b;
  font-size: 14px;
  text-align: center;
  padding: 20px 0;
}

/* Tab Styles */
.community-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0;
}

.community-tab {
  padding: 12px 20px;
  border: none;
  background: none;
  color: #64748b;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}

.community-tab:hover {
  color: #475569;
  background: rgba(37, 99, 235, 0.05);
}

.community-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}

/* Chat Sections */
.chat-section {
  display: none;
}

.chat-section.active {
  display: block;
}

/* Assembly/Conference Selectors */
.assembly-selector,
.conference-selector {
  margin-bottom: 16px;
}

.assembly-selector select,
.conference-selector select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid rgba(56, 83, 151, 0.18);
  border-radius: 18px;
  background: #ffffff;
  color: #1f2f4d;
  font-size: 15px;
}

/* DM Layout */
.dm-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  min-height: 500px;
}

.dm-users {
  background: #f8fafc;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.dm-users h3 {
  margin: 0 0 16px;
  color: #1e293b;
  font-size: 16px;
}

.online-users-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.online-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border-radius: 16px;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.online-user:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563eb;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-info {
  flex: 1;
}

.user-name {
  font-weight: 500;
  color: #1e293b;
  font-size: 14px;
}

.user-status {
  color: #10b981;
  font-size: 12px;
  margin-top: 2px;
}

.dm-create-btn {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #2563eb;
  background: #ffffff;
  color: #2563eb;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dm-create-btn:hover {
  background: #2563eb;
  color: white;
}

.dm-chat {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.dm-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: #64748b;
  text-align: center;
}

.dm-chat-area {
  display: flex;
  flex-direction: column;
  height: 500px;
}

.dm-chat-header {
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.dm-chat-header h3 {
  margin: 0;
  color: #1e293b;
  font-size: 18px;
}

/* Groups Layout */
.groups-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  min-height: 500px;
}

.groups-list {
  background: #f8fafc;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.groups-list h3 {
  margin: 0 0 16px;
  color: #1e293b;
  font-size: 16px;
}

.user-groups-list {
  display: grid;
  gap: 12px;
}

.groups-chat {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.groups-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: #64748b;
  text-align: center;
}

.groups-chat-area {
  display: flex;
  flex-direction: column;
  height: 500px;
}

.groups-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.groups-chat-header h3 {
  margin: 0;
  color: #1e293b;
  font-size: 18px;
}

.leave-group-btn {
  padding: 8px 16px;
  border: 1px solid #ef4444;
  background: #ffffff;
  color: #ef4444;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.leave-group-btn:hover {
  background: #ef4444;
  color: white;
}

/* Create Group Form */
.groups-create-btn {
  padding: 12px 20px;
  border: none;
  background: #2563eb;
  color: white;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.2s ease;
}

.groups-create-btn:hover {
  background: #1d4ed8;
}

.create-group-form {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 20px;
}

.create-group-form h3 {
  margin: 0 0 16px;
  color: #1e293b;
  font-size: 18px;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  margin-bottom: 6px;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 14px;
  resize: vertical;
}

.form-submit-btn {
  width: 100%;
  padding: 12px 20px;
  border: none;
  background: #2563eb;
  color: white;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.form-submit-btn:hover {
  background: #1d4ed8;
}

/* User Search Section */
.user-search-section {
  margin-bottom: 24px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
}

.search-box {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.search-box input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 15px;
}

.search-btn {
  padding: 12px 24px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-btn:hover {
  background: #1d4ed8;
}

.search-results {
  max-height: 300px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-result-item:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

.search-result-item .user-avatar {
  width: 44px;
  height: 44px;
  font-size: 16px;
}

.search-result-item .user-avatar.online {
  border: 2px solid #10b981;
}

.search-result-item .user-avatar.offline {
  border: 2px solid #9ca3af;
  opacity: 0.7;
}

.search-result-item .user-assembly {
  font-size: 12px;
  color: #64748b;
}

.search-result-item .dm-btn {
  margin-left: auto;
  padding: 8px 16px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.search-result-item .dm-btn:hover {
  background: #1d4ed8;
}

.search-hint,
.search-loading,
.search-empty,
.search-error {
  text-align: center;
  padding: 20px;
  color: #64748b;
  font-size: 14px;
}

/* Assembly Info */
.assembly-info {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.assembly-note {
  margin: 0;
  color: #1e40af;
  font-size: 14px;
  text-align: center;
}

/* DM Search */
.dm-search {
  margin-bottom: 12px;
}

.dm-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 13px;
}

/* User Profile Modal */
.user-profile-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  z-index: 1001;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 20px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #e5e7eb;
}

.profile-header {
  text-align: center;
  margin-bottom: 24px;
}

.profile-header .user-avatar {
  width: 80px;
  height: 80px;
  font-size: 32px;
  margin: 0 auto 16px;
}

.profile-header .user-avatar.online {
  border: 3px solid #10b981;
}

.profile-header .user-avatar.offline {
  border: 3px solid #9ca3af;
}

.profile-header h2 {
  margin: 0 0 8px;
  color: #1f2937;
  font-size: 24px;
}

.profile-assembly {
  margin: 0 0 12px;
  color: #6b7280;
  font-size: 14px;
}

.profile-status {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.profile-status.online {
  background: #d1fae5;
  color: #065f46;
}

.profile-status.offline {
  background: #f3f4f6;
  color: #6b7280;
}

.profile-actions {
  display: flex;
  gap: 12px;
}

.profile-btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-btn.primary {
  background: #2563eb;
  color: white;
  border: none;
}

.profile-btn.primary:hover {
  background: #1d4ed8;
}

/* Enhanced Profile Modal */
.profile-modal-enhanced {
  max-width: 450px;
  max-height: 80vh;
  overflow-y: auto;
}

.user-avatar-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #e5e7eb;
}

.user-avatar-photo.large {
  width: 100px;
  height: 100px;
  margin: 0 auto 16px;
  display: block;
}

.profile-section {
  margin: 20px 0;
  padding: 16px;
  background: #f9fafb;
  border-radius: 12px;
  text-align: left;
}

.profile-section h4 {
  margin: 0 0 8px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-about {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.6;
  font-style: italic;
}

.profile-verse {
  margin: 0;
  color: #1e40af;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px;
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  border-radius: 0 8px 8px 0;
}

/* Responsive Design */
@media (max-width: 980px) {
  .community-grid {
    grid-template-columns: 1fr;
  }
  
  .dm-layout,
  .groups-layout {
    grid-template-columns: 1fr;
  }
  
  .dm-users,
  .groups-list {
    margin-bottom: 20px;
  }
  
  .search-box {
    flex-direction: column;
  }
  
  .search-btn {
    width: 100%;
  }
  
  .community-tabs {
    flex-wrap: wrap;
  }
  
  .community-tab {
    flex: 1;
    min-width: 120px;
    text-align: center;
  }
}

/* --------------------------------------------------
   FRIENDS SECTION STYLES
-------------------------------------------------- */

.add-friends-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.add-friends-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.add-friends-btn span {
  font-size: 18px;
}

/* Friends Section */
.friends-section {
  margin-bottom: 24px;
  padding: 18px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(15, 42, 92, 0.06);
}

.friends-section-title {
  font-size: 18px;
  color: #10263e;
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.friends-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.friends-empty {
  color: #6b7280;
  font-size: 14px;
  margin: 0;
  padding: 12px 0;
}

/* Friend Card */
.friend-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.friend-card:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  transform: translateY(-2px);
}

.friend-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.friend-info {
  flex: 1;
  min-width: 0;
}

.friend-name {
  font-weight: 600;
  color: #10263e;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-assembly {
  color: #6b7280;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-remove {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #fee2e2;
  color: #dc2626;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.friend-remove:hover {
  background: #dc2626;
  color: white;
}

/* Add Friends Modal */
.friend-search-box {
  margin-bottom: 16px;
}

.friend-search-box input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 15px;
  transition: all 0.2s ease;
}

.friend-search-box input:focus {
  outline: none;
  border-color: #3b82f6;
}

.friend-search-results {
  max-height: 300px;
  overflow-y: auto;
}

.friend-search-hint {
  color: #9ca3af;
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

.friend-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.friend-result-item:hover {
  background: #f3f4f6;
}

.friend-result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #3b82f6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.friend-result-info {
  flex: 1;
  min-width: 0;
}

.friend-result-name {
  font-weight: 600;
  color: #111827;
  font-size: 14px;
}

.friend-result-assembly {
  color: #6b7280;
  font-size: 13px;
}

.friend-add-btn {
  padding: 8px 16px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.friend-add-btn:hover {
  background: #2563eb;
}

.friend-add-btn.added {
  background: #10b981;
  cursor: default;
}

/* Friend Profile Modal */
.friend-profile-modal {
  max-width: 400px;
}

.friend-profile-body {
  padding: 24px;
  text-align: center;
}

.friend-profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 600;
  margin: 0 auto 16px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.friend-profile-name {
  font-size: 24px;
  font-weight: 700;
  color: #10263e;
  margin-bottom: 4px;
}

.friend-profile-assembly {
  color: #6b7280;
  font-size: 15px;
  margin-bottom: 20px;
}

.friend-profile-details {
  text-align: left;
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.friend-profile-detail {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
}

.friend-profile-detail:last-child {
  border-bottom: none;
}

.friend-profile-label {
  color: #6b7280;
  font-size: 14px;
}

.friend-profile-value {
  color: #10263e;
  font-weight: 600;
  font-size: 14px;
}

.friend-profile-actions {
  display: flex;
  gap: 12px;
}

.friend-profile-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.friend-profile-btn.message {
  background: #3b82f6;
  color: white;
  border: none;
}

.friend-profile-btn.message:hover {
  background: #2563eb;
}

.friend-profile-btn.remove {
  background: #fee2e2;
  color: #dc2626;
  border: none;
}

.friend-profile-btn.remove:hover {
  background: #c53030;
}

/* ========== THEME SUPPORT ========== */

/* Dark Theme */
body.dark-theme .community-container {
  background: #12181f;
}

body.dark-theme .community-title,
body.dark-theme .community-header-card h2,
body.dark-theme .online-users-section h3,
body.dark-theme .friends-list-section h3,
body.dark-theme .chat-message .sender-name,
body.dark-theme .friend-profile-name {
  color: #ffffff;
}

body.dark-theme .community-subtitle,
body.dark-theme .community-status,
body.dark-theme .online-user .user-assembly,
body.dark-theme .friend-assembly,
body.dark-theme .friend-profile-assembly {
  color: #e8e8e8;
}

body.dark-theme .online-users-section,
body.dark-theme .friends-list-section,
body.dark-theme .chat-container,
body.dark-theme .message-input-container,
body.dark-theme .friend-card,
body.dark-theme .add-friends-modal-content,
body.dark-theme .friend-profile-modal-content {
  background: #1e1e1e;
  border-color: #3d3d3d;
}

body.dark-theme .online-user,
body.dark-theme .friend-card {
  background: #2d2d2d;
}

body.dark-theme .online-user:hover,
body.dark-theme .friend-card:hover {
  background: #3d3d3d;
}

body.dark-theme .message-row.own-message .message-bubble {
  background: #3b82f6;
  border-color: #3b82f6;
}

body.dark-theme .message-row.own-message .message-text {
  color: #ffffff;
}

body.dark-theme .message-row:not(.own-message) .message-bubble {
  background: #e5e7eb;
  border-color: #4b5563;
}

body.dark-theme .message-row:not(.own-message) .message-text {
  color: #1f2937;
}

body.dark-theme .message-input-container input,
body.dark-theme .friend-search-input {
  background: #2d2d2d;
  border-color: #3d3d3d;
  color: #e8e8e8;
}

body.dark-theme .friend-search-box input {
  background: #2d2d2d;
  border-color: #3d3d3d;
  color: #e8e8e8;
}

body.dark-theme .friend-search-hint {
  color: #9ca3af;
  background: transparent;
}

body.dark-theme .empty-message,
body.dark-theme .friends-empty,
body.dark-theme .search-empty,
body.dark-theme .search-error {
  color: #9ca3af;
  background: transparent;
}

body.dark-theme .friend-result-item {
  background: #2d2d2d;
}

body.dark-theme .friend-result-item:hover {
  background: #3d3d3d;
}

body.dark-theme .friend-profile-details {
  background: #2d2d2d;
}

/* Parchment Theme */
body.parchment-theme .community-container {
  background: #f5e6c8;
}

body.parchment-theme .community-title,
body.parchment-theme .community-header-card h2,
body.parchment-theme .online-users-section h3,
body.parchment-theme .friends-list-section h3,
body.parchment-theme .chat-message .sender-name,
body.parchment-theme .friend-profile-name {
  color: #1a1a1a;
}

body.parchment-theme .community-subtitle,
body.parchment-theme .community-status,
body.parchment-theme .online-user .user-assembly,
body.parchment-theme .friend-assembly,
body.parchment-theme .chat-message .message-text,
body.parchment-theme .friend-profile-assembly {
  color: #3d2914;
}

body.parchment-theme .online-users-section,
body.parchment-theme .friends-list-section,
body.parchment-theme .chat-container,
body.parchment-theme .message-input-container,
body.parchment-theme .friend-card,
body.parchment-theme .add-friends-modal-content,
body.parchment-theme .friend-profile-modal-content {
  background: #fff8e7;
  border-color: #d4c4a8;
}

body.parchment-theme .online-user,
body.parchment-theme .friend-card {
  background: #f0e6d0;
}

body.parchment-theme .online-user:hover,
body.parchment-theme .friend-card:hover {
  background: #e6d9b8;
}

body.parchment-theme .chat-message.mine .message-bubble {
  background: #8b7355;
}

body.parchment-theme .chat-message.theirs .message-bubble {
  background: #f0e6d0;
}

body.parchment-theme .message-input-container input,
body.parchment-theme .friend-search-input {
  background: #f0e6d0;
  border-color: #d4c4a8;
  color: #3d2914;
}

body.parchment-theme .friend-result-item {
  background: #f0e6d0;
}

body.parchment-theme .friend-result-item:hover {
  background: #e6d9b8;
}

body.parchment-theme .friend-profile-details {
  background: #f0e6d0;
}

/* Light Theme */
body.light-theme .community-container {
  background: #f8fafc;
}
