/* HarshGuruJi Private Chat System Styles */
:root {
  --chat-bg: #07090e;
  --chat-sidebar-bg: #0b0f19;
  --chat-header-bg: rgba(11, 15, 25, 0.94);
  --chat-border: rgba(255, 255, 255, 0.08);
  --chat-border-glow: rgba(255, 107, 74, 0.25);
  --chat-active-item: rgba(255, 107, 74, 0.12);
  --chat-hover-item: rgba(255, 255, 255, 0.04);
  --bubble-outgoing: linear-gradient(135deg, #ff6b4a, #e05333);
  --bubble-incoming: rgba(26, 32, 48, 0.85);
  --bubble-incoming-border: rgba(255, 255, 255, 0.08);
  --text-muted: #94a3b8;
  --online-green: #10b981;
}

/* Base Body tweaks for Chat Page */
body.is-chat-page {
  overflow: hidden !important;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--chat-bg) !important;
  padding-bottom: 0 !important;
}

/* Hide global footer and floating chat button on the chat page */
body.is-chat-page .hg-global-footer,
body.is-chat-page .hg-bottom-bar,
body.is-chat-page .hg-floating-chat-btn {
  display: none !important;
}

/* Chat Main Layout Container */
.chat-app-container {
  display: flex;
  flex: 1;
  width: 100%;
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  margin-top: 64px;
  background: var(--chat-bg);
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   LEFT SIDEBAR
   ========================================================================== */
.chat-sidebar {
  width: 380px;
  min-width: 320px;
  max-width: 420px;
  height: 100%;
  background: var(--chat-sidebar-bg);
  border-right: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-sidebar-header {
  padding: 1.2rem 1.25rem 0.85rem 1.25rem;
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-brand-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-brand-title h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-live-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--online-green);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 3px 9px;
  border-radius: 999px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--online-green);
  box-shadow: 0 0 8px var(--online-green);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Current User Profile Mini-Card */
.chat-my-profile-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
}

.my-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.my-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 107, 74, 0.4);
}

.online-status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--online-green);
  border: 2px solid var(--chat-sidebar-bg);
}

.my-profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.my-display-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.my-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.golden-tick-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-size: 10px;
  font-weight: 900;
  flex-shrink: 0;
}

.my-ids-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.my-username {
  color: #94a3b8;
  font-family: monospace;
}

.id-separator {
  color: rgba(255, 255, 255, 0.2);
}

.copy-id-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 107, 74, 0.1);
  border: 1px solid rgba(255, 107, 74, 0.25);
  color: #ff8b70;
  font-family: monospace;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-id-chip:hover {
  background: rgba(255, 107, 74, 0.22);
  border-color: rgba(255, 107, 74, 0.5);
  transform: translateY(-1px);
}

.copy-id-chip:active {
  transform: translateY(1px);
}

/* Search Bar Section */
.chat-search-section {
  padding: 0.85rem 1.25rem;
  position: relative;
  border-bottom: 1px solid var(--chat-border);
}

.chat-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  padding: 0 0.85rem;
  transition: all 0.2s ease;
}

.chat-search-input-wrapper:focus-within {
  border-color: #ff6b4a;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(255, 107, 74, 0.15);
}

.chat-search-input-wrapper .search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 8px;
}

.chat-search-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.88rem;
  padding: 0.65rem 0;
  outline: none;
  font-family: inherit;
}

.chat-search-input-wrapper input::placeholder {
  color: #64748b;
  font-size: 0.84rem;
}

.search-clear-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px;
}

.search-clear-btn:hover {
  color: #fff;
}

.search-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ff6b4a;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Live Search Suggestions Dropdown */
.chat-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 1.25rem;
  right: 1.25rem;
  background: rgba(13, 18, 30, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 107, 74, 0.3);
  border-radius: 12px;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.8);
  z-index: 50;
  max-height: 380px;
  overflow-y: auto;
  animation: dropdownIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.search-dropdown-header {
  padding: 0.6rem 0.9rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--chat-border);
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-result-item:hover {
  background: rgba(255, 107, 74, 0.1);
}

.search-user-info-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.search-user-avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.search-user-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
}

.search-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search-user-name-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-user-sub-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: #94a3b8;
}

.search-user-sub-line .hgj-tag {
  color: #ff8b70;
  font-family: monospace;
}

.search-msg-btn {
  padding: 5px 12px;
  background: rgba(255, 107, 74, 0.15);
  border: 1px solid rgba(255, 107, 74, 0.4);
  border-radius: 8px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.search-msg-btn:hover {
  background: #ff6b4a;
  border-color: #ff6b4a;
}

.search-no-results {
  padding: 1.5rem 1rem;
  text-align: center;
  color: #94a3b8;
}

.search-no-results h5 {
  font-size: 0.95rem;
  color: #e2e8f0;
  margin-bottom: 4px;
}

.search-no-results p {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
}

/* Conversations List */
.chat-conversations-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.conversations-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem 0.5rem 1.25rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.conversations-count {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.5rem 0.75rem 0.5rem;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  margin-bottom: 2px;
}

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

.conversation-item.active {
  background: var(--chat-active-item);
  border: 1px solid rgba(255, 107, 74, 0.3);
}

.conv-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.conv-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
}

.conv-online-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--online-green);
  border: 2px solid var(--chat-sidebar-bg);
  display: none;
}

.conv-online-dot.is-online {
  display: block;
}

.conv-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.conv-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.conv-name-block {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.conv-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-time {
  font-size: 0.72rem;
  color: #64748b;
  flex-shrink: 0;
}

.conv-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.conv-preview {
  font-size: 0.8rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.conv-unread-badge {
  background: #ff6b4a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* Empty & Skeleton States */
.conversations-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: #94a3b8;
}

.conversations-empty .empty-icon {
  font-size: 2.4rem;
  margin-bottom: 0.75rem;
}

.conversations-empty h4 {
  color: #e2e8f0;
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.conversations-empty p {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.45;
}

.conversations-skeleton {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.skeleton-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem;
}

.sk-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  animation: shimmer 1.5s infinite linear;
}

.sk-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sk-line-1 {
  width: 60%;
  height: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  animation: shimmer 1.5s infinite linear;
}

.sk-line-2 {
  width: 85%;
  height: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  0% { opacity: 0.3; }
  50% { opacity: 0.8; }
  100% { opacity: 0.3; }
}

/* ==========================================================================
   RIGHT PANEL (MAIN CHAT)
   ========================================================================== */
.chat-main {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #06080d;
}

/* No Active Conversation View */
.chat-no-active {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.no-active-content {
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.no-active-icon-wrap {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(255, 107, 74, 0.1);
  border: 1px solid rgba(255, 107, 74, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  color: #ff6b4a;
}

.no-active-content h3 {
  font-size: 1.4rem;
  color: #fff;
  margin-bottom: 0.5rem;
}

.no-active-content p {
  font-size: 0.88rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.start-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6b4a, #ff8b70);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 107, 74, 0.35);
  transition: all 0.2s ease;
}

.start-chat-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255, 107, 74, 0.5);
}

/* Active Conversation Screen */
.chat-active-screen {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.chat-header {
  height: 68px;
  padding: 0 1.25rem;
  background: var(--chat-header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.chat-back-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  padding: 6px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.chat-back-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.active-user-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

.active-user-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 107, 74, 0.4);
}

.active-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #64748b;
  border: 2px solid var(--chat-sidebar-bg);
}

.active-online-dot.is-online {
  background: var(--online-green);
}

.active-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.active-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.active-name {
  font-weight: 700;
  font-size: 1.02rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-sub-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.active-username {
  color: #94a3b8;
  font-family: monospace;
}

.active-status.is-online {
  color: var(--online-green);
  font-weight: 600;
}

.header-right {
  position: relative;
}

.header-menu-btn {
  background: none;
  border: 1px solid var(--chat-border);
  color: #94a3b8;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.header-menu-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.header-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: rgba(15, 20, 32, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
  padding: 6px;
  z-index: 100;
}

.header-dropdown-menu .menu-item {
  width: 100%;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 0.85rem;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.header-dropdown-menu .menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.header-dropdown-menu .menu-item.text-danger {
  color: #f87171;
}

.header-dropdown-menu .menu-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

/* ==========================================================================
   MESSAGES LIST & BUBBLES
   ========================================================================== */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  background: #06080d;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto; /* Push messages to bottom when few */
}

/* Date Separator */
.chat-date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.25rem 0 0.75rem 0;
}

.chat-date-separator span {
  font-size: 0.74rem;
  font-weight: 600;
  color: #64748b;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 12px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}

/* Message Bubble Rows */
.message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  position: relative;
  max-width: 75%;
}

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

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

.msg-bubble {
  padding: 9px 14px;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.1s ease;
}

.message-row.outgoing .msg-bubble {
  background: var(--bubble-outgoing);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.message-row.incoming .msg-bubble {
  background: var(--bubble-incoming);
  color: #e2e8f0;
  border: 1px solid var(--bubble-incoming-border);
  border-bottom-left-radius: 4px;
}

.msg-bubble.is-deleted {
  font-style: italic;
  opacity: 0.65;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px dashed rgba(255, 255, 255, 0.15) !important;
  color: #94a3b8 !important;
}

.msg-meta-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 3px;
  font-size: 0.68rem;
  opacity: 0.8;
}

.message-row.outgoing .msg-meta-line {
  color: rgba(255, 255, 255, 0.85);
}

.message-row.incoming .msg-meta-line {
  color: #64748b;
}

.msg-status-icon {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.msg-status-icon.seen {
  color: #38bdf8; /* Cyan seen checks */
}

/* Message Actions Menu (Delete) */
.msg-actions-trigger {
  opacity: 0;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: opacity 0.15s, background 0.15s;
}

.message-row:hover .msg-actions-trigger {
  opacity: 1;
}

.msg-actions-trigger:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Blocked Banner */
.chat-blocked-banner {
  padding: 0.85rem 1.25rem;
  background: rgba(239, 68, 68, 0.12);
  border-top: 1px solid rgba(239, 68, 68, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fca5a5;
  font-size: 0.88rem;
}

.unblock-btn {
  padding: 4px 12px;
  border-radius: 6px;
  background: #ef4444;
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.unblock-btn:hover {
  background: #dc2626;
}

/* ==========================================================================
   MESSAGE COMPOSER
   ========================================================================== */
.chat-composer-wrap {
  padding: 0.85rem 1.25rem 1rem 1.25rem;
  background: rgba(11, 15, 25, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--chat-border);
  z-index: 10;
}

.chat-composer-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--chat-border);
  border-radius: 24px;
  padding: 6px 10px 6px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-composer-form:focus-within {
  border-color: #ff6b4a;
  box-shadow: 0 0 0 3px rgba(255, 107, 74, 0.15);
}

.composer-input-box {
  flex: 1;
  display: flex;
  align-items: center;
}

.composer-input-box textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.94rem;
  line-height: 1.4;
  resize: none;
  max-height: 120px;
  min-height: 24px;
  padding: 4px 0;
}

.composer-input-box textarea::placeholder {
  color: #64748b;
}

.composer-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b4a, #ff8b70);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.composer-send-btn:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow: 0 0 15px rgba(255, 107, 74, 0.5);
}

.composer-send-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.composer-send-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.chat-modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chat-modal-box {
  background: #0f1420;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.chat-modal-header h4 {
  font-size: 1.15rem;
  color: #fff;
  margin: 0;
}

.chat-modal-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.chat-modal-close-btn:hover {
  color: #fff;
}

.chat-modal-body {
  padding: 1.5rem;
}

.chat-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-secondary {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  color: #cbd5e1;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-danger {
  padding: 8px 16px;
  background: #ef4444;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Toast Notifications */
.chat-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3000;
  pointer-events: none;
}

.chat-toast {
  pointer-events: auto;
  background: rgba(15, 20, 32, 0.96);
  border: 1px solid rgba(255, 107, 74, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 10px 18px;
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideIn {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (<= 900px)
   ========================================================================== */
@media (max-width: 900px) {
  .chat-app-container {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    margin-top: 60px;
  }

  .chat-sidebar {
    width: 100%;
    max-width: 100%;
    border-right: none;
  }

  .chat-main {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 30;
  }

  /* When chat is open on mobile */
  .chat-app-container.mobile-chat-open .chat-main {
    transform: translateX(0);
  }

  .chat-back-btn {
    display: flex;
  }

  .chat-composer-wrap {
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
  }
}
