/* ──────────────────────────────────────────
   FRIENDS SIDEBAR — PROFESSIONAL THEME
   With animations, collapsible sections, and avatars
────────────────────────────────────────── */

#friends-section {
  text-align: left;
  position: relative;
  width: 100%;
  max-width: 22rem;
  min-height: 100%;
  display: none;
  flex-direction: column;
  gap: 0;
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 250, 251, 0.9) 100%);
  border-right: 1px solid var(--border-divider);
  overflow: hidden;
}

/* ════════════════════════════════════════
   SIDEBAR HEADER — App Branding
════════════════════════════════════════ */

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.2rem;
  border-bottom: 1px solid var(--border-divider);
  flex-shrink: 0;
  background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.8) 100%);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: opacity 200ms ease;
  text-decoration: none;
  color: var(--accent-violet);
}

.app-logo:hover {
  opacity: 0.8;
}

.logo-icon {
  flex-shrink: 0;
  color: var(--accent-violet);
  filter: drop-shadow(0 2px 4px rgba(124, 58, 237, 0.15));
}

.app-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.01em;
}

/* ════════════════════════════════════════
   FRIENDS CONTROL PANEL — User Info & Search
════════════════════════════════════════ */

.friends-control {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-divider);
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.sidebar-compat-controls {
  display: none !important;
}

.friends-control button {
  font: inherit;
  padding: 0;
  margin: 0;
  border: none;
  background-color: transparent;
  cursor: pointer;
  color: inherit;
}

/* ── User Info Row ── */
.friends-control .friends-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.friends-control .friends-user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.friends-control .user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
  transition: transform 200ms ease;
}

.friends-control .user-avatar:hover {
  transform: scale(1.05);
}

.friends-control .friends-actions p {
  padding: 0;
  margin: 0;
  position: relative;
  flex: 1;
  min-width: 0;
}

.friends-control .user-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "Space Grotesk", sans-serif;
}

.friends-control .new-messages-count {
  font-size: 0.65rem;
  font-weight: bold;
  border-radius: 50%;
  width: 1.4rem;
  height: 1.4rem;
  background: #ef4444;
  color: white;
  position: absolute;
  right: -12px;
  top: -12px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

.friends-control .friends-actions-buttons {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.friends-control .friends-actions-buttons button {
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 150ms ease, opacity 150ms ease;
}

.friends-control .add-friend-btn {
  height: 36px;
  width: 36px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.08);
  border: 1.5px solid rgba(124, 58, 237, 0.3);
  color: var(--accent-violet);
  transition: all 200ms ease;
}

.friends-control .add-friend-btn:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--accent-violet);
  transform: scale(1.1);
}

.friends-control .add-friend-btn:disabled {
  cursor: auto;
  opacity: 0.5;
}

/* ── Phone Search Form ── */
.friends-control .phone-search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
}

.friends-control .phone-search-input {
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.75rem;
  outline: none;
  background: #ffffff;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  transition: border-color 200ms ease, box-shadow 150ms ease;
}

.friends-control .phone-search-input:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.friends-control .phone-search-btn,
.friends-control .phone-direct-btn,
.friends-control .phone-add-group-btn {
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 150ms ease;
  font-weight: 500;
}

.friends-control .phone-search-btn,
.friends-control .phone-direct-btn {
  background: var(--accent-gradient);
  color: #fff;
}

.friends-control .phone-search-btn:hover,
.friends-control .phone-direct-btn:hover {
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  transform: translateY(-1px);
}

.friends-control .phone-add-group-btn {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.3);
  color: var(--accent-violet);
}

.friends-control .phone-add-group-btn:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: var(--accent-violet);
}

.friends-control .phone-search-result {
  margin: 0.5rem 0 0 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
}

.friends-control .phone-search-result-error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.friends-control .phone-search-actions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ════════════════════════════════════════
   SIDEBAR TABS NAVIGATION
════════════════════════════════════════ */

.sidebar-sections {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.7rem;
  border-top: 1px solid var(--border-divider);
  border-bottom: 1px solid var(--border-divider);
  background: rgba(255, 255, 255, 0.72);
  flex: 1;
  overflow-y: auto;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.section-title {
  margin: 0;
  padding: 0.35rem 0.45rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  color: var(--text-secondary);
  font-weight: 700;
}

.section-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.62rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
  text-align: left;
  font-family: inherit;
}

.sidebar-item:hover {
  color: var(--accent-violet);
  background: rgba(124, 58, 237, 0.06);
}

.sidebar-item.active {
  color: var(--accent-violet);
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.22);
}

.badge,
.sidebar-unread-badge,
.sidebar-requests-badge {
  min-width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.3rem;
}

/* ════════════════════════════════════════
   TAB CONTENT CONTAINER
════════════════════════════════════════ */

.sidebar-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem;
  gap: 0.3rem;
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ── Tab Section Headers ── */
.tab-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  flex-shrink: 0;
}

.tab-section-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.friends-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(124, 58, 237, 0.05);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
}

.tab-create-group-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--accent-violet);
  background: rgba(124, 58, 237, 0.08);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(124, 58, 237, 0.2);
  transition: all 150ms ease;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
}

.tab-create-group-btn:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-1px);
}

.tab-create-group-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Conversation Search + Chat Filter Bar ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.conversation-search-wrap {
  padding: 0.15rem 0 0.35rem;
}

.conversation-search-input {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: #fff;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.55rem 0.7rem;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.conversation-search-input:focus {
  outline: none;
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.chat-filter-bar {
  display: flex;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-divider);
  flex-shrink: 0;
  overflow-x: auto;
}

.chat-filter-btn {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
  position: relative;
  font-family: inherit;
}

.chat-filter-btn:hover {
  background: rgba(124, 58, 237, 0.05);
  color: var(--accent-violet);
}

.chat-filter-active {
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent-violet);
  border-color: rgba(124, 58, 237, 0.3);
}

.friends-filter-bar {
  display: flex;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-divider);
  flex-shrink: 0;
}

.friends-filter-btn {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
  font-family: inherit;
}

.friends-filter-btn:hover {
  background: rgba(124, 58, 237, 0.05);
  color: var(--accent-violet);
}

.friends-filter-active {
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent-violet);
  border-color: rgba(124, 58, 237, 0.3);
}

.friends-filter-panel {
  display: block;
  min-height: 0;
}

.filter-badge {
  margin-left: 0.3rem;
  background: #ef4444;
  color: white;
  padding: 0 0.3rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: bold;
}

/* ── Empty States ── */
.messages-empty-state,
.list-empty-state {
  margin: 0;
  padding: 1rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
  display: none;
}

/* ════════════════════════════════════════
   CHAT LIST ITEMS
════════════════════════════════════════ */

.chat-list-container {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
  min-height: 0;
}

.friend-chat-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.62rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.friend-chat-item:hover {
  background: #fff;
  border-color: rgba(124, 58, 237, 0.2);
  transform: translateY(-1px);
}

.friend-chat-item:focus-visible {
  outline: none;
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.friend-chat-item-selected {
  background: rgba(124, 58, 237, 0.11);
  border-color: rgba(124, 58, 237, 0.35);
}

.friend-chat-item-unread .friend-chat-name,
.friend-chat-item-unread .friend-chat-preview p {
  font-weight: 700;
}

.friend-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.18);
}

.friend-chat-main-info {
  flex: 1;
  min-width: 0;
}

.friend-chat-top-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.friend-chat-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin: 0;
}

.friend-chat-time {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.friend-chat-name {
  margin: 0;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.86rem;
}

.friend-chat-preview-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.friend-chat-preview {
  min-width: 0;
  flex: 1;
}

.friend-chat-preview p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-chat-unread-badge {
  min-width: 1.1rem;
  height: 1.1rem;
  border-radius: 99px;
  background: var(--accent-violet);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0 0.32rem;
}

.conversation-skeleton-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.conversation-skeleton-item {
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.05) 25%, rgba(124, 58, 237, 0.12) 50%, rgba(124, 58, 237, 0.05) 75%);
  background-size: 200% 100%;
  animation: pulseSkeleton 1.2s linear infinite;
}

@keyframes pulseSkeleton {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

/* ════════════════════════════════════════
   FRIENDS SECTION — Collapsible
════════════════════════════════════════ */

.friends-list-section,
.friends-requests-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.friends-section-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}

.friends-section-toggle:hover {
  background: rgba(124, 58, 237, 0.05);
  color: var(--accent-violet);
}

.friends-section-toggle .toggle-icon {
  width: 16px;
  height: 16px;
  transition: transform 200ms ease;
  flex-shrink: 0;
  color: inherit;
}

.friends-section-toggle[aria-expanded="false"] .toggle-icon {
  transform: rotate(-90deg);
}

.friends-count-badge,
.requests-count-badge {
  margin-left: auto;
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent-violet);
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: bold;
  flex-shrink: 0;
}

.friends-section-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 1000px;
  opacity: 1;
  transition: all 200ms ease;
  overflow: hidden;
}

.friends-section-toggle[aria-expanded="false"]~.friends-section-content {
  max-height: 0;
  opacity: 0;
}

.friends-list-container,
.friend-requests-list,
.sent-requests-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.friend-list-item,
.friend-request-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: all 150ms ease;
}

.friend-list-item:hover,
.friend-request-item:hover {
  background: rgba(255, 255, 255, 0.8);
}

.friend-list-avatar,
.friend-request-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(124, 58, 237, 0.15);
}

.friend-list-info,
.friend-request-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.friend-list-name,
.friend-request-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
}

.friend-list-status,
.friend-request-phone {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-request-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.friend-request-accept-btn,
.friend-request-reject-btn {
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent-violet);
  font-family: inherit;
}

.friend-request-accept-btn:disabled,
.friend-request-reject-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.friend-request-accept-btn:active,
.friend-request-reject-btn:active {
  transform: translateY(1px);
}

.friend-request-accept-btn:hover {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.friend-request-reject-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* ── Friend Requests Sub-Tabs ── */
.requests-sub-tabs {
  display: flex;
  gap: 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-divider);
  margin-bottom: 0.3rem;
  flex-shrink: 0;
}

.req-sub-tab {
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}

.req-sub-tab:hover {
  background: rgba(124, 58, 237, 0.05);
  color: var(--accent-violet);
}

.req-sub-tab-active {
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent-violet);
  border-color: rgba(124, 58, 237, 0.3);
}

/* ════════════════════════════════════════
   FIND SECTION — Global Search
════════════════════════════════════════ */

.global-search-wrapper {
  position: relative;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
}

.find-actions-panel {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.55rem;
  border: 1px solid var(--border-divider);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
}

.find-actions-panel .add-friend-btn {
  align-self: flex-start;
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-pill);
  background: rgba(124, 58, 237, 0.08);
  color: var(--accent-violet);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.find-actions-panel .phone-search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
}

.find-actions-panel .phone-search-input {
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-pill);
  padding: 0.48rem 0.72rem;
  background: #fff;
  color: var(--text-primary);
  font: inherit;
  outline: none;
}

.find-actions-panel .phone-search-btn,
.find-actions-panel .phone-direct-btn,
.find-actions-panel .phone-add-group-btn {
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
}

.find-actions-panel .phone-search-btn,
.find-actions-panel .phone-direct-btn {
  background: var(--accent-gradient);
  color: #fff;
}

.find-actions-panel .phone-add-group-btn {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.3);
  color: var(--accent-violet);
}

.find-actions-panel .phone-search-result {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.find-actions-panel .phone-search-result-error {
  color: #ef4444;
}

.find-actions-panel .phone-search-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.global-search-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: #ffffff;
  font: inherit;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 200ms ease, box-shadow 150ms ease;
}

.global-search-input::placeholder {
  color: var(--text-muted);
}

.global-search-input:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.global-search-results {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
  padding: 0.4rem;
  z-index: 60;
  animation: slideDown 200ms ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-loading,
.search-empty,
.search-error {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.search-result-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 150ms ease;
}

.search-result-item:hover,
.search-result-item:focus {
  background: rgba(124, 58, 237, 0.05);
  outline: none;
}

.search-result-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.search-result-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.search-result-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
}

.search-result-phone,
.search-result-username {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.search-action-btn {
  border: 1px solid rgba(124, 58, 237, 0.25);
  background: rgba(124, 58, 237, 0.08);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 0.22rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
}

.search-action-message {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
}

.search-action-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.search-result-msg {
  margin: 0.35rem 0 0;
  min-height: 1rem;
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.search-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.18);
}

/* ════════════════════════════════════════
   SIDEBAR FOOTER — Settings & Logout
════════════════════════════════════════ */

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border-divider);
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}

.sidebar-footer-btn:hover {
  background: rgba(124, 58, 237, 0.08);
  color: var(--accent-violet);
  transform: translateX(3px);
}

.sidebar-footer-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════
   GROUP CREATE MODAL
════════════════════════════════════════ */

.group-create-modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 23, 41, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.group-create-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.group-create-modal-box {
  background: linear-gradient(180deg, #ffffff, #f8faff);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 500px;
  width: 100%;
  border: 1px solid rgba(124, 58, 237, 0.14);
  box-shadow: 0 24px 55px rgba(18, 24, 51, 0.25);
  transform: translateY(18px);
  transition: transform 180ms ease;
}

.group-create-modal.is-open .group-create-modal-box {
  transform: translateY(0);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.group-create-modal-box h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.group-create-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.group-name-input,
.group-user-search-input {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 200ms ease, box-shadow 150ms ease;
}

.group-name-input:focus,
.group-user-search-input:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.group-user-list-loader {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
}

.group-user-list {
  margin: 0;
  padding: 0.2rem;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(124, 58, 237, 0.16);
  border-radius: 10px;
  background: #fff;
}

.group-user-list-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 0.5rem;
}

.group-user-row {
  border-radius: 8px;
  transition: background 140ms ease;
}

.group-user-row.group-user-row-selected {
  background: rgba(124, 58, 237, 0.12);
}

.group-user-label {
  display: grid;
  grid-template-columns: auto 32px 1fr;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
}

.group-user-checkbox {
  accent-color: #7c3aed;
}

.group-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.group-user-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-width: 0;
}

.group-user-name {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.group-user-online {
  background: #10b981;
}

.group-user-offline {
  background: #9ca3af;
}

.group-selected-members {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.6rem;
  border: 1px dashed rgba(124, 58, 237, 0.35);
  border-radius: 10px;
  min-height: 42px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.group-selected-chip {
  border: none;
  padding: 0.22rem 0.32rem;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
}

.group-selected-chip-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.63rem;
  font-weight: 700;
}

.group-selected-chip-remove {
  font-size: 0.74rem;
  color: var(--text-primary);
}

.group-create-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.group-create-btn,
.group-close-modal-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}

.group-create-btn {
  background: var(--accent-gradient);
  color: white;
}

.group-create-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.group-create-btn:hover {
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  transform: translateY(-2px);
}

.group-close-modal-btn {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  border-color: var(--border-glass);
}

.group-close-modal-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.group-create-error {
  margin: 0;
  color: #b91c1c;
  font-size: 0.82rem;
}

/* ════════════════════════════════════════
   SCROLLBAR STYLING
════════════════════════════════════════ */

.sidebar-tab-content::-webkit-scrollbar,
.chat-list-container::-webkit-scrollbar,
.friends-list-container::-webkit-scrollbar,
.friend-requests-list::-webkit-scrollbar,
.sent-requests-list::-webkit-scrollbar,
.global-search-results::-webkit-scrollbar {
  width: 6px;
}

.sidebar-tab-content::-webkit-scrollbar-track,
.chat-list-container::-webkit-scrollbar-track,
.friends-list-container::-webkit-scrollbar-track,
.friend-requests-list::-webkit-scrollbar-track,
.sent-requests-list::-webkit-scrollbar-track,
.global-search-results::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-tab-content::-webkit-scrollbar-thumb,
.chat-list-container::-webkit-scrollbar-thumb,
.friends-list-container::-webkit-scrollbar-thumb,
.friend-requests-list::-webkit-scrollbar-thumb,
.sent-requests-list::-webkit-scrollbar-thumb,
.global-search-results::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.2);
  border-radius: 3px;
  transition: background 150ms ease;
}

.sidebar-tab-content::-webkit-scrollbar-thumb:hover,
.chat-list-container::-webkit-scrollbar-thumb:hover,
.friends-list-container::-webkit-scrollbar-thumb:hover,
.friend-requests-list::-webkit-scrollbar-thumb:hover,
.sent-requests-list::-webkit-scrollbar-thumb:hover,
.global-search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.4);
}

/* ════════════════════════════════════════
   MOBILE RESPONSIVE
════════════════════════════════════════ */

@media (max-width: 767px) {
  #friends-section {
    position: fixed;
    left: 0;
    top: 3.5rem;
    width: min(21.5rem, 90vw);
    height: calc(100vh - 3.5rem);
    max-width: none;
    transform: translateX(-105%);
    transition: transform 0.19s ease;
    z-index: 40;
    border-right: none;
    border-radius: 0 12px 12px 0;
    box-shadow: 2px 4px 16px rgba(0, 0, 0, 0.15);
  }

  body.sidebar-open #friends-section {
    transform: translateX(0);
  }

  .sidebar-header {
    padding: 0.9rem;
  }

  .app-name {
    font-size: 1rem;
  }

  .sidebar-sections {
    border-radius: 0;
    padding: 0.45rem;
  }

  .sidebar-footer {
    margin-top: auto;
  }
}