/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

:root {
  --primary-color: #0085ff;
  --secondary-color: #ff8a00;
  --sidebar-bg: #0a2342;
  --outgoing-msg-bg: #0085ff;
  --incoming-msg-bg: #f1f1f1;
  --active-bg: #eaf3fc;
  --text-primary: #333;
  --text-secondary: #666;
  --text-light: #999;
  --border-color: #eee;
  --hover-bg: #f5f5f5;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --white: #fff;
  --red: #ff3b30;
  --green: #34c759;
  --blue: #007aff;
}

/* Dark Mode and Light Mode Toggle */
body.light-mode {
  --primary-color: #0085ff;
  --secondary-color: #ff8a00;
  --sidebar-bg: #0a2342;
  --outgoing-msg-bg: #0085ff;
  --incoming-msg-bg: #f1f1f1;
  --active-bg: #eaf3fc;
  --text-primary: #333;
  --text-secondary: #666;
  --text-light: #999;
  --border-color: #eee;
  --hover-bg: #f5f5f5;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --white: #fff;
  --red: #ff3b30;
  --green: #34c759;
  --blue: #007aff;
}

body.dark-mode {
  --primary-color: #3b82f6;
  --secondary-color: #f97316;
  --sidebar-bg: #111827;
  --outgoing-msg-bg: #3b82f6;
  --incoming-msg-bg: #374151;
  --active-bg: #1e293b;
  --text-primary: #f3f4f6;
  --text-secondary: #d1d5db;
  --text-light: #9ca3af;
  --border-color: #1f2937;
  --hover-bg: #1f2937;
  --shadow-color: rgba(0, 0, 0, 0.3);
  --white: #111827;
  --red: #ef4444;
  --green: #10b981;
  --blue: #3b82f6;
}

body {
  background-color: var(--white);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  position: relative;
}

/* Sidebar Styles */
.sidebar {
  width: 4rem;
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 1000;
}

.sidebar-header {
  margin-bottom: 2rem;
}

.logo-img {
  width: 2rem;
  height: 2rem;
  margin-right: 0.5rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 0.5rem;
  margin: 0 0.5rem;
}

.nav-item:hover,
.nav-item.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-item i {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.nav-item span {
  font-size: 0.7rem;
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 3rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: calc(100% - 4rem);
}

/* Header */
.header {
  height: 60px;
  background-color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-left: 1px solid var(--border-color);
  margin-bottom: 5px;
  border-radius: 10px;
  transition: background-color 0.3s, border-color 0.3s;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
}

.brand {
  font-family: sans-serif;
  font-size: 20px;
  font-weight: 600;
}

.brand-name {
  color: var(--primary-color);
}

.brand-highlight {
  color: var(--secondary-color);
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  position: relative;
}

.search-bar {
  background-color: #f3f4f6;
  border-radius: 7px;
  display: flex;
  align-items: center;
  padding: 0 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: auto;
  box-sizing: border-box;
  cursor: pointer;
  width: 300px;
  max-width: 100%;
  height: 35px;
  border: 1px solid #b6e3fa;
  margin-right: 1%;
}

.search-bar:focus-within,
.search-bar.expanded {
  width: 800px;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.search-bar:active,
.search-bar:focus-within {
  background-color: #f3f4f6;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-primary);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 70%;
  transform: translateX(-50%);
  width: 349px;
  max-height: 500px;
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 4px 12px var(--shadow-color);
  z-index: 100;
  overflow-y: auto;
  display: none;
}

.search-results.show {
  display: block;
}

.search-result-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-result-item:hover {
  background-color: var(--hover-bg);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
}

.search-result-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-result-details {
  flex: 1;
}

.search-result-name {
  font-weight: 500;
  margin-bottom: 2px;
}

.search-result-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.search-result-type {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  background-color: var(--hover-bg);
}

.header-right {
  display: flex;
  align-items: center;
  /* gap: 32px; */
}

.icon-btn {
  position: relative;
  /* width: 2.5rem;
    height: 2.5rem; */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s;
}

.icon-btn:hover {
  background-color: var(--hover-bg);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  background-color: var(--secondary-color);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Right Side Panels */
.right-side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  background: var(--white);
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
}

.right-side-panel.hidden {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 1.1em;
  font-weight: 600;
}

.panel-close {
  cursor: pointer;
  font-size: 1.3em;
  color: var(--text-secondary);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.notification-item {
  padding: 10px 0;
  border-bottom: 1px solid #f2f2f2;
  font-size: 0.98em;
}

.notification-item .time {
  color: var(--text-light);
  font-size: 0.9em;
  margin-left: 8px;
}

/* Center Navigation */
.center-nav {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  position: fixed;
  top: 4rem;
  width: calc(100% - 4rem);
  background: var(--white);
  z-index: 4;
  font-size: 0.875rem;
  font-weight: 500;
  /* margin-left: 4rem; */
}

.tabs {
  display: flex;
}

.tab {
  padding: 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  /* margin-left: 1%; */
  transition: all 0.2s;
}

.tab:hover {
  color: var(--primary-color);
}

.tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.new-items-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin-left: auto;
  /* margin-right: 4%; */
  background-color: #0085ff;
  padding: 0.5rem 0.5rem;
  border-radius: 2rem;
  transition: background 0.2s;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--white);
  min-width: 160px;
  box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
  overflow-y: auto;
  max-height: 15rem;
  right: 0;
}

.new-items-dropdown:hover .dropdown-content,
.dropdown-content.show {
  display: block;
}

.dropdown-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s;
}

.dropdown-item:hover {
  background-color: var(--hover-bg);
}

/* Collapse All Button */
.collapse-all-button {
  background: none;
  border: none;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  width: 100%;
  text-align: left;
  transition: color 0.2s;
}

.collapse-all-button:hover {
  color: var(--primary-color);
}

/* Chat Container */
.chat-container {
  display: flex;
  flex: 1;
  margin-top: 4rem;
  height: calc(100% - 8rem);
}

/* Chat List */
.chat-list {
  width: 20rem;
  border-right: 1px solid var(--border-color);
  height: 100%;
  overflow-y: auto;
  margin-left: 0.5rem;
}

.chat-section {
  margin-bottom: 1rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
}

.section-title {
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.section-more {
  cursor: pointer;
  position: relative;
}

.section-options {
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
}

.section-options:hover {
  background-color: var(--hover-bg);
}

.section-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px var(--shadow-color);
  z-index: 10;
  min-width: 10rem;
}

.chat-items {
  display: flex;
  flex-direction: column;
}

.chat-item {
  display: flex;
  /* padding: 0.5rem 1rem; */
  cursor: pointer;
  position: relative;
  align-items: center;
  transition: background-color 0.2s;
}

.chat-items.hidden {
  display: none !important;
}

.chat-item:hover {
  background-color: var(--hover-bg);
}

.chat-item.active {
  background-color: var(--active-bg);
}

.chat-item.unread::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.25rem;
  height: 0.25rem;
  background-color: var(--green);
  border-radius: 50%;
}

.chat-avatar {
  width: 2.5rem;
  height: 2.5rem;
  background-color: #ccc;
  border-radius: 50%;
  margin-right: 0.75rem;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.chat-profile {
  width: 2.5rem;
  height: 2.5rem;
  background-color: #ccc;
  border-radius: 50%;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

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

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.chat-name {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-time {
  font-size: 0.75rem;
  color: var(--text-light);
  white-space: nowrap;
}

.chat-message {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
  max-width: 100%;
}

.chat-options {
  opacity: 0;
  transition: opacity 0.2s;
  position: relative;
  padding: 0.25rem;
}

.chat-item:hover .chat-options {
  opacity: 1;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px var(--shadow-color);
  z-index: 10;
  min-width: 10rem;
}

.see-more {
  text-align: center;
  padding: 1rem;
  color: var(--primary-color);
  font-size: 0.875rem;
  cursor: pointer;
}

.more-options-container {
  position: relative;
  display: inline-block;
}

.action-icon {
  cursor: pointer;
  font-size: 20px;
  padding: 10px;
  border-radius: 6px;
  background: #eee;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.more-options-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: white;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 8px;
  width: 200px;
  z-index: 1000;
}

.option-item {
  display: flex;
  align-items: center;
  padding: 8px;
  cursor: pointer;
  border-radius: 6px;
}

.option-item:hover {
  background-color: #f0f0f0;
}

.option-item i {
  margin-right: 10px;
}

.hidden {
  display: none;
}

.has-submenu {
  position: relative;
}

.has-submenu .nested-dropdown {
  top: 0;
  left: 100%;
  margin-left: 4px;
}

.rename-input {
  font-size: 14px;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
}

.custom-alert-card {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: #0f62fe;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.custom-alert-card.fade-out {
  opacity: 0;
}

/* Chat Window */
.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.empty-state-text {
  margin-top: 1%;
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.empty-state h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-secondary);
}

.active-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.chat-user {
  display: flex;
  align-items: center;
  margin-left: 15%;
}

.back-button {
  display: none;
  margin-right: 0.5rem;
  cursor: pointer;
}

.user-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  margin-right: 0.75rem;
  cursor: pointer;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  margin-left: 0.75rem;
}

.user-name {
  font-weight: 500;
}

.user-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chat-actions {
  display: flex;
  gap: 0.75rem;
  margin-right: 15%;
}

.action-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s;
}

.action-icon:hover {
  background-color: var(--hover-bg);
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
  margin-bottom: 0.1rem;
  margin-left: 15%;
  margin-right: 15%;
}

.message {
  display: flex;
  max-width: 70%;
  position: relative;
}

.message.outgoing {
  align-self: flex-end;
}

.message.incoming {
  align-self: flex-start;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-content {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  position: relative;
}

.message.outgoing .message-content {
  background-color: var(--outgoing-msg-bg);
  color: var(--white);
  border-radius: 1rem 1rem 0rem 1rem;
}

.message.incoming .message-content {
  background-color: var(--incoming-msg-bg);
  color: var(--text-primary);
  border-radius: 1rem 1rem 1rem 0rem;
}

.message-time {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

.message.outgoing .message-time {
  color: rgba(255, 255, 255, 0.7);
}

.message.incoming .message-time {
  color: var(--text-light);
}

/* Message Actions */
.message-actions {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px var(--shadow-color);
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}

.message-action {
  width: 2rem;
  height: 2rem;
  border: none;
  background: none;
  border-radius: 0.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.message-action:hover {
  background-color: var(--hover-bg);
  color: var(--primary-color);
}

/* Reply Indicator */
.reply-indicator {
  background-color: rgba(0, 133, 255, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  margin: 0 1rem 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-left: 15%;
  margin-right: 15%;
}

.reply-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.cancel-reply {
  cursor: pointer;
  color: var(--text-light);
  padding: 0.25rem;
  border-radius: 50%;
  transition: all 0.2s;
}

.cancel-reply:hover {
  color: var(--red);
  background-color: var(--hover-bg);
}

/* Message Status Icons */
.message-status {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
}

.message-status-icon {
  font-size: 0.75rem;
}

.message-status-icon.sent {
  color: rgba(255, 255, 255, 0.7);
}

.message-status-icon.delivered {
  color: rgba(255, 255, 255, 0.7);
}

.message-status-icon.seen {
  color: var(--blue);
}

.message-input-container {
  padding: 1rem;
  margin-left: 15%;
  margin-right: 15%;
}

.message-input-wrapper {
  display: flex;
  align-items: center;
  background-color: #f5f5f5;
  border-radius: 2rem;
  padding: 0.5rem 1rem;
}

.input-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
  transition: color 0.2s;
}

.input-icon:hover {
  color: var(--primary-color);
}

.input-icon.send {
  color: var(--primary-color);
}

.recording-indicator {
  position: absolute;
  bottom: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--red);
  color: var(--white);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.message-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem;
  outline: none;
  font-size: 0.875rem;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  overflow-y: auto;
  word-wrap: break-word;
  line-height: 1.5;
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Voice Message Design */
.voice-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--incoming-msg-bg);
  border-radius: 1rem;
  max-width: 250px;
}

.voice-play-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.voice-play-button:hover {
  transform: scale(1.05);
}

.voice-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.wave-bar {
  width: 3px;
  background-color: var(--primary-color);
  border-radius: 2px;
  animation: wave 1.5s ease-in-out infinite;
}

.wave-bar:nth-child(1) {
  height: 10px;
  animation-delay: 0s;
}
.wave-bar:nth-child(2) {
  height: 20px;
  animation-delay: 0.1s;
}
.wave-bar:nth-child(3) {
  height: 15px;
  animation-delay: 0.2s;
}
.wave-bar:nth-child(4) {
  height: 25px;
  animation-delay: 0.3s;
}
.wave-bar:nth-child(5) {
  height: 12px;
  animation-delay: 0.4s;
}

@keyframes wave {
  0%,
  100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(0.5);
  }
}

.voice-duration {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 2rem;
}

/* Emoji Picker */
.emoji-picker {
  position: absolute;
  bottom: 4rem;
  left: 1rem;
  background-color: var(--white);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px var(--shadow-color);
  width: 16rem;
  z-index: 20;
  border: 1px solid var(--border-color);
  margin-left: 30%;
}

.emoji-categories {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem;
}

.emoji-category {
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
}

.emoji-category.active,
.emoji-category:hover {
  background-color: var(--hover-bg);
}

.emoji-list {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  padding: 0.5rem;
  max-height: 12rem;
  overflow-y: auto;
}

.emoji {
  font-size: 1.25rem;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: background-color 0.2s;
}

.emoji:hover {
  background-color: var(--hover-bg);
}

/* Attachment Options */
.attachment-options {
  position: absolute;
  bottom: 4rem;
  right: 4rem;
  background-color: var(--white);
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px var(--shadow-color);
  padding: 0.5rem;
  z-index: 20;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-right: 13%;
}

.attachment-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.attachment-option:hover {
  background-color: var(--hover-bg);
}

.attachment-option i {
  width: 1.5rem;
  text-align: center;
  color: var(--primary-color);
}

/* User Info Panel */
.user-info-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 400px;
  background-color: var(--white);
  border-left: 1px solid var(--border-color);
  box-shadow: -2px 0 10px var(--shadow-color);
  z-index: 20;
  display: flex;
  flex-direction: column;
}

.user-info-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-panel {
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.close-panel:hover {
  background-color: var(--hover-bg);
}

.user-info-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.user-info-avatar {
  margin-bottom: 1rem;
}

.large-avatar {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  object-fit: cover;
}

.user-info-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.user-info-status {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.user-info-details {
  width: 100%;
  margin-bottom: 1.5rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.info-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.user-info-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  margin-bottom: 1rem;
}

.action-button {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: 0.5rem;
  background-color: var(--hover-bg);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.action-button.call {
  background-color: var(--primary-color);
  color: var(--white);
}

.action-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.user-info-options {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-button {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--white);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s;
}

.option-button:hover {
  background-color: var(--hover-bg);
  border-color: var(--primary-color);
}

/* Call History Styles */
.call-history-container {
  flex: 0 0 280px;
  max-width: 420px;
  min-width: 540px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  font-size: 13px;
  background-color: var(--white);
}

.call-history-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.call-history-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.call-history-filters {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.filter-button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  white-space: nowrap;
  color: var(--text-primary);
  transition: all 0.2s;
}

.filter-button.active {
  background-color: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

.call-list {
  display: flex;
  flex-direction: column;
}

.call-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  cursor: pointer;
  gap: 1rem;
  transition: background-color 0.2s;
}

.call-item:hover {
  background-color: var(--hover-bg);
}

.call-item.missed .call-info {
  color: var(--red);
}

.call-item.missed .call-name {
  color: var(--red);
}

.call-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  margin-right: 1rem;
  flex-shrink: 0;
}

.call-details {
  flex: 1;
}

.call-name {
  font-weight: 500;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.call-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.call-actions {
  display: flex;
  gap: 0.5rem;
}

.call-button,
.video-call-button,
.info-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background-color: var(--hover-bg);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.call-button {
  background-color: var(--primary-color);
  color: var(--white);
}

.call-history-close {
  cursor: pointer;
  padding: 10px;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.call-history-close:hover {
  color: var(--text-primary);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background-color: var(--white);
  border-radius: 0.75rem;
  width: 100%;
  max-width: 30rem;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.modal-close:hover {
  background-color: var(--hover-bg);
}

.modal-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background-color: var(--white);
  color: var(--text-primary);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-note {
  background-color: rgba(0, 133, 255, 0.1);
  border: 1px solid rgba(0, 133, 255, 0.2);
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-top: 1rem;
}

.form-note p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Button Styles */
.cancel-button,
.create-chat-button,
.create-group-button,
.create-section-button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.cancel-button {
  background-color: var(--hover-bg);
  color: var(--text-primary);
  margin-right: 0.5rem;
}

.cancel-button:hover {
  background-color: var(--border-color);
}

.create-chat-button,
.create-group-button,
.create-section-button {
  background-color: var(--primary-color);
  color: var(--white);
}

.create-chat-button:hover,
.create-group-button:hover,
.create-section-button:hover {
  background-color: #0066cc;
}

/* Contact Selection */
.selected-members {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
  min-height: 40px;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--hover-bg);
}

.selected-member {
  display: flex;
  align-items: center;
  background-color: var(--primary-color);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.875rem;
}

.remove-member {
  margin-left: 0.5rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.remove-member:hover {
  opacity: 1;
}

.contact-list {
  max-height: 15rem;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
}

.contact-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.contact-item:hover {
  background-color: var(--hover-bg);
}

.contact-item:last-child {
  border-bottom: none;
}

.contact-item.selected {
  background-color: var(--active-bg);
  opacity: 0.6;
}

.contact-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  margin-right: 0.75rem;
}

.contact-name {
  font-size: 0.875rem;
  font-weight: 500;
}

/* Video Call Styles */
.video-call-content {
  max-width: 80vw;
  width: 80vw;
  height: 80vh;
  display: flex;
  flex-direction: column;
}

.video-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  position: relative;
  background-color: #000;
  border-radius: 0.75rem 0.75rem 0 0;
  overflow: hidden;
}

.video-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-name {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.self-video {
  position: absolute;
  width: 20%;
  height: 20%;
  bottom: 1rem;
  right: 1rem;
  border: 2px solid white;
  border-radius: 0.5rem;
  overflow: hidden;
}

.video-call-controls {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background-color: #f5f5f5;
  border-radius: 0 0 0.75rem 0.75rem;
}

.call-action {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: #f5f5f5;
  border: none;
  transition: all 0.2s;
}

.call-action.end {
  background-color: var(--red);
  color: var(--white);
}

.call-action:hover {
  transform: scale(1.05);
}

/* Status Indicators */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 5px;
  margin-right: 5px;
}

.status-indicator.online {
  background-color: #34c759;
}

.status-indicator.offline {
  background-color: #ff3b30;
}

/* Message Reactions */
.message-reactions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.message-reaction {
  background: #f0f0f0;
  border-radius: 1rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: background-color 0.2s;
}

.message-reaction:hover {
  background-color: var(--hover-bg);
}

.reaction-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Pinned Message Indicator */
.pin-indicator {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 5px;
  margin-right: 5px;
}

.status-indicator.online {
  background-color: #34c759;
}

.status-indicator.offline {
  background-color: #ff3b30;
}

.typing-indicator {
  color: #34c759;
  font-style: italic;
}

.typing-indicator .dot-1,
.typing-indicator .dot-2,
.typing-indicator .dot-3 {
  animation: typingAnimation 1.4s infinite;
  display: inline-block;
}

.typing-indicator .dot-2 {
  animation-delay: 0.2s;
}

.typing-indicator .dot-3 {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0% {
    opacity: 0.2;
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0.2;
  }
}

.message-input {
  resize: none;
  min-height: 40px;
  max-height: 120px;
  overflow-y: auto;
  word-wrap: break-word;
  line-height: 1.5;
}

.username-in-message {
  font-weight: 600;
  color: #0085ff;
  cursor: pointer;
}

.username-in-message:hover {
  text-decoration: underline;
}

.reply-indicator {
  background-color: rgba(0, 133, 255, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reply-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background-color: rgba(232, 148, 255, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.cancel-reply {
  cursor: pointer;
  color: var(--text-light);
}

.cancel-reply:hover {
  color: var(--red);
}

.blocked-indicator,
.muted-indicator {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--red);
  font-size: 0.875rem;
}

.muted-indicator {
  color: var(--text-light);
}

.blocked-badge {
  background-color: var(--red);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-left: 5px;
}

.contact-item.hidden-from-search {
  display: none !important;
}

/* Message Status Icons */
.message-status {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  font-size: 0.75rem;
}

.message-status.sent {
  color: #999;
}

.message-status.delivered {
  color: #999;
}

.message-status.seen {
  color: #0085ff;
}

.message-status i {
  margin-right: 2px;
}

/* Call History Enhancements */
.call-item.missed {
  background-color: rgba(255, 59, 48, 0.1);
}

.call-item.missed .call-name {
  color: #ff3b30;
}

.call-type-icon {
  margin-right: 5px;
}

.call-type-icon.voice {
  color: #34c759;
}

.call-type-icon.video {
  color: #007aff;
}

.call-type-icon.missed {
  color: #ff3b30;
}

/* New User Placeholder */
.new-user-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
}

/* Group Member Selection */
.selected-members {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
  min-height: 40px;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--hover-bg);
}

.selected-member {
  display: flex;
  align-items: center;
  background-color: var(--primary-color);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.875rem;
}

.remove-member {
  margin-left: 0.5rem;
  cursor: pointer;
  opacity: 0.8;
}

.remove-member:hover {
  opacity: 1;
}

.contact-item.selected {
  background-color: var(--active-bg);
  opacity: 0.6;
}

/* Voice Message Design */
.voice-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--incoming-msg-bg);
  border-radius: 1rem;
  max-width: 250px;
}

.voice-play-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.voice-play-button:hover {
  transform: scale(1.05);
}

.voice-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.wave-bar {
  width: 3px;
  background-color: var(--primary-color);
  border-radius: 2px;
  animation: wave 1.5s ease-in-out infinite;
}

.wave-bar:nth-child(1) {
  height: 10px;
  animation-delay: 0s;
}
.wave-bar:nth-child(2) {
  height: 20px;
  animation-delay: 0.1s;
}
.wave-bar:nth-child(3) {
  height: 15px;
  animation-delay: 0.2s;
}
.wave-bar:nth-child(4) {
  height: 25px;
  animation-delay: 0.3s;
}
.wave-bar:nth-child(5) {
  height: 12px;
  animation-delay: 0.4s;
}

@keyframes wave {
  0%,
  100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(0.5);
  }
}

.voice-duration {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 2rem;
}

/* Message Reactions */
.message-reactions {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.message-reaction {
  background: #f0f0f0;
  border-radius: 1rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: background-color 0.2s;
}

.message-reaction:hover {
  background-color: var(--hover-bg);
}

.reaction-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Pinned Message Indicator */
.pin-indicator {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

/* Deleted Message Styles */
.deleted-message {
  background-color: var(--hover-bg) !important;
  color: var(--text-light) !important;
  font-style: italic;
}

.deleted-message p {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* File Message Styles */
.file-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--hover-bg);
  border-radius: 0.5rem;
  max-width: 300px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.file-message:hover {
  background-color: var(--border-color);
}

.file-icon {
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Image Message Styles */
.image-message {
  max-width: 250px;
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: pointer;
}

.image-message img {
  width: 100%;
  height: auto;
  display: block;
}

/* Video Message Styles */
.video-message {
  max-width: 250px;
  border-radius: 0.5rem;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.video-message video {
  width: 100%;
  height: auto;
  display: block;
}

.video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

/* Audio Message Styles */
.audio-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--hover-bg);
  border-radius: 1rem;
  max-width: 300px;
}

.audio-play-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.audio-play-button:hover {
  transform: scale(1.05);
}

.audio-progress {
  flex: 1;
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.audio-progress-bar {
  height: 100%;
  background-color: var(--primary-color);
  width: 0%;
  transition: width 0.1s;
}

.audio-duration {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 2rem;
}

/* Location Message Styles */
.location-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--incoming-msg-bg);
  border-radius: 1rem;
  max-width: 300px;
}

.location-message i {
  color: var(--red);
  font-size: 1.5rem;
}

.location-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.location-coords {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.location-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.75rem;
}

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

/* Message forwarded indicator */
.forwarded-indicator {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Message replied indicator */
.replied-message {
  background-color: rgba(0, 133, 255, 0.1);
  border-left: 3px solid var(--primary-color);
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 0 0.5rem 0.5rem 0;
  font-size: 0.875rem;
}

.replied-message-author {
  font-weight: 500;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.replied-message-text {
  color: var(--text-secondary);
}

/* Deleted Message Styles */
.deleted-message {
  background-color: var(--hover-bg) !important;
  color: var(--text-light) !important;
  font-style: italic;
}

.deleted-message p {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* File Message Styles */
.file-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--hover-bg);
  border-radius: 0.5rem;
  max-width: 300px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.file-message:hover {
  background-color: var(--border-color);
}

.file-icon {
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Image Message Styles */
.image-message {
  max-width: 250px;
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: pointer;
}

.image-message img {
  width: 100%;
  height: auto;
  display: block;
}

/* Video Message Styles */
.video-message {
  max-width: 250px;
  border-radius: 0.5rem;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.video-message video {
  width: 100%;
  height: auto;
  display: block;
}

.video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3rem;
  height: 3rem;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

/* Audio Message Styles */
.audio-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--hover-bg);
  border-radius: 1rem;
  max-width: 300px;
}

.audio-play-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.audio-play-button:hover {
  transform: scale(1.05);
}

.audio-progress {
  flex: 1;
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.audio-progress-bar {
  height: 100%;
  background-color: var(--primary-color);
  width: 0%;
  transition: width 0.1s;
}

.audio-duration {
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 2rem;
}

/* Location Message Styles */
.location-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--incoming-msg-bg);
  border-radius: 1rem;
  max-width: 300px;
}

.location-message i {
  color: var(--red);
  font-size: 1.5rem;
}

.location-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.location-coords {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.location-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.75rem;
}

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

/* File Preview Modal */
.file-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.file-preview-content {
  max-width: 90%;
  max-height: 80%;
  position: relative;
}

.file-preview-content img,
.file-preview-content video {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

.file-preview-controls {
  position: absolute;
  bottom: -50px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.file-preview-control {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.file-preview-control:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.file-preview-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Responsive Styles */
@media (max-width: 576px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    justify-content: space-around;
    padding: 0.5rem;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .center-nav {
    margin-left: 0;
    width: 100%;
  }

  .chat-container {
    flex-direction: column;
  }

  .chat-list {
    width: 100% !important;
    height: auto;
    max-height: 100%;
  }

  .chat-window {
    width: 100%;
  }

  .active-chat {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background-color: var(--white);
  }

  .messages-container {
    margin-left: 5%;
    margin-right: 5%;
  }

  .message-input-container {
    margin-left: 5%;
    margin-right: 5%;
  }

  .chat-user {
    margin-left: 5%;
  }

  .chat-actions {
    margin-right: 5%;
  }

  .user-info-panel {
    width: 100%;
  }

  .call-history-container {
    width: 100%;
  }

  .search-bar {
    width: 8rem;
  }

  .center-nav {
    padding: 0 0.5rem;
  }

  .tab {
    padding: 1rem 0.5rem;
  }

  .back-button {
    display: block;
  }
}

@media (min-width: 577px) and (max-width: 768px) {
  .chat-list {
    width: 40%;
  }

  .messages-container {
    margin-left: 10%;
    margin-right: 10%;
  }

  .message-input-container {
    margin-left: 10%;
    margin-right: 10%;
  }

  .user-info-panel {
    width: 50%;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .chat-list {
    width: 30%;
  }

  .messages-container {
    margin-left: 10%;
    margin-right: 10%;
  }

  .message-input-container {
    margin-left: 10%;
    margin-right: 10%;
  }
}

@media (min-width: 1025px) {
  .chat-list {
    width: 25rem;
  }

  .messages-container {
    margin-left: 15%;
    margin-right: 15%;
  }

  .message-input-container {
    margin-left: 15%;
    margin-right: 15%;
  }
}

@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-width: 95%;
  }

  .video-call-content {
    width: 95vw;
    max-width: 95vw;
  }

  .new-items-dropdown {
    padding: 0.5rem;
    font-size: 1rem;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Animation for message sending */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.new {
  animation: messageSlideIn 0.3s ease-out;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  background-color: var(--hover-bg);
  border-radius: 1rem;
  max-width: 100px;
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
}

.typing-dot {
  width: 0.5rem;
  height: 0.5rem;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingDot {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Scroll to bottom button */
.scroll-to-bottom {
  position: absolute;
  bottom: 5rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px var(--shadow-color);
  transition: all 0.2s;
  z-index: 10;
}

.scroll-to-bottom:hover {
  transform: scale(1.05);
}

.scroll-to-bottom.hidden {
  opacity: 0;
  pointer-events: none;
}
