/* ==========================================================================
   Kaz.Holiday Premium Chat & Communication Design System
   Vanilla CSS — Dark Bento Glass Architecture (UI Factory Standard)
   ========================================================================== */

:root {
  --chat-primary: #ffd700;
  --chat-primary-hover: #ffdf33;
  --chat-primary-rgb: 255, 215, 0;
  --chat-accent: #202227;
  --chat-accent-hover: #202227;
  --chat-accent-rgb: 2, 132, 199;

  --chat-bg: #202227;
  --chat-sidebar-bg: #202227;
  --chat-main-bg: #202227;
  --chat-card-bg: rgba(32,34,39, 0.75);

  --chat-message-sent: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  --chat-message-received: rgba(30, 41, 59, 0.85);
  --chat-message-vizir: rgba(15, 23, 42, 0.95);

  --chat-border: rgba(255, 255, 255, 0.08);
  --chat-border-hover: rgba(255, 215, 0, 0.3);

  --chat-text-primary: #f8fafc;
  --chat-text-secondary: #94a3b8;
  --chat-text-muted: #64748b;

  --chat-hover: rgba(255, 255, 255, 0.04);
  --chat-active: rgba(255, 215, 0, 0.08);
  --chat-success: #10b981;
  --chat-danger: #ef4444;
  --chat-warning: #f59e0b;

  --chat-gold-gradient: linear-gradient(135deg, #ffd700 0%, #f59e0b 100%);
  --chat-blue-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);

  --chat-radius-sm: 8px;
  --chat-radius-md: 14px;
  --chat-radius-lg: 20px;
  --chat-radius-full: 9999px;

  --chat-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --chat-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --chat-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --chat-shadow-glow: 0 0 20px rgba(255, 215, 0, 0.15);
}

/* Base resets specifically for chat container */
html:has(.is-chat-page-layout),
body:has(.is-chat-page-layout),
body:has(.chat-app-wrapper),
html.is-chat-page-active,
body.is-chat-page-active {
  overflow: hidden !important;
  height: 100vh !important;
  max-height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.is-chat-page-active .booking-layout,
.is-chat-page-layout {
  height: 100vh !important;
  max-height: 100vh !important;
  min-height: 100vh !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  display: flex !important;
  overflow: hidden !important;
}

body.is-chat-page-active .booking-sidebar,
.is-chat-page-layout .booking-sidebar {
  height: 100vh !important;
  max-height: 100vh !important;
  top: 0 !important;
  overflow-y: auto !important;
  flex-shrink: 0 !important;
}

body.is-chat-page-active .booking-page-wrapper,
.is-chat-page-layout .booking-page-wrapper {
  flex: 1 1 0% !important;
  height: calc(100vh - var(--header-height, 64px)) !important;
  max-height: calc(100vh - var(--header-height, 64px)) !important;
  min-height: calc(100vh - var(--header-height, 64px)) !important;
  margin-top: var(--header-height, 64px) !important;
  margin-left: var(--sidebar-width, 250px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
}

@media (max-width: 991.98px) {
  body.is-chat-page-active .booking-layout,
  .is-chat-page-layout {
    height: calc(100vh - var(--header-height, 64px)) !important;
    max-height: calc(100vh - var(--header-height, 64px)) !important;
    margin-top: var(--header-height, 64px) !important;
  }
  body.is-chat-page-active .booking-page-wrapper,
  .is-chat-page-layout .booking-page-wrapper {
    margin-left: 0 !important;
    margin-top: 0 !important;
    height: 100% !important;
  }
}

body.is-chat-page-active .sub-nav-tabs,
.is-chat-page-layout .sub-nav-tabs {
  flex-shrink: 0 !important;
  margin-bottom: 0 !important;
}

body.is-chat-page-active .booking-main-row,
.is-chat-page-layout .booking-main-row {
  flex: 1 1 0% !important;
  height: calc(100% - 46px) !important;
  max-height: calc(100% - 46px) !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.is-chat-page-active .booking-content,
.is-chat-page-layout .booking-content,
.booking-content.is-chat-content {
  padding: 0 !important;
  margin: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0% !important;
}

.chat-app-wrapper {
  flex: 1 1 0% !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  background: var(--chat-bg);
  overflow: hidden;
  position: relative;
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  display: flex !important;
  flex-direction: column !important;
}

.chat-container {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  background: var(--chat-bg);
  overflow: hidden;
  position: relative;
  flex: 1 1 0% !important;
  display: flex !important;
  flex-direction: column !important;
}

.chat-container .row,
.chat-container > .row {
  margin: 0 !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  flex: 1 1 0% !important;
  flex-wrap: nowrap;
}

/* ==========================================================================
   SIDEBAR (Conversations List & Navigation)
   ========================================================================== */

.chat-sidebar {
  background: var(--chat-sidebar-bg);
  border-right: 1px solid var(--chat-border);
  height: 100%;
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 25;
  flex-shrink: 0;
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.25s ease;
}

.chat-sidebar-header {
  padding: 1.15rem 1.15rem 0.85rem 1.15rem;
  border-bottom: 1px solid var(--chat-border);
  background: rgba(32,34,39, 0.7);
  backdrop-filter: blur(16px);
  flex-shrink: 0;
}

.chat-sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.chat-sidebar-title h5 {
  color: var(--chat-text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-new-chat {
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: var(--chat-primary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--chat-radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-new-chat:hover {
  background: var(--chat-primary);
  color: #070d1a;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 215, 0, 0.3);
}

/* Search input in sidebar */
.chat-search-wrapper {
  position: relative;
  margin-bottom: 0.75rem;
}

.chat-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--chat-border) !important;
  border-radius: var(--chat-radius-md) !important;
  padding: 0.6rem 2.25rem 0.6rem 2.75rem !important;
  padding-left: 2.75rem !important;
  color: var(--chat-text-primary) !important;
  font-size: 0.88rem !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.chat-search-input:focus {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 215, 0, 0.4) !important;
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.12) !important;
}

.chat-search-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--chat-text-muted);
  font-size: 0.95rem;
  pointer-events: none;
  z-index: 2;
}

.chat-search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--chat-text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  display: none;
  padding: 2px 4px;
}

.chat-search-clear:hover {
  color: var(--chat-text-primary);
}

/* Filter Navigation Tabs */
.chat-filter-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: none;
}

.chat-filter-tabs::-webkit-scrollbar {
  display: none;
}

.chat-filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--chat-border);
  color: var(--chat-text-secondary);
  padding: 0.3rem 0.75rem;
  border-radius: var(--chat-radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
}

.chat-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--chat-text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.chat-filter-btn.active {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.4);
  color: var(--chat-primary);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
}

/* Conversations List container */
#conversations-list {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.6rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Custom Scrollbars */
#conversations-list::-webkit-scrollbar,
#messages-container::-webkit-scrollbar,
.chat-custom-scroll::-webkit-scrollbar {
  width: 6px;
}

#conversations-list::-webkit-scrollbar-track,
#messages-container::-webkit-scrollbar-track,
.chat-custom-scroll::-webkit-scrollbar-track {
  background: transparent;
}

#conversations-list::-webkit-scrollbar-thumb,
#messages-container::-webkit-scrollbar-thumb,
.chat-custom-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

#conversations-list::-webkit-scrollbar-thumb:hover,
#messages-container::-webkit-scrollbar-thumb:hover,
.chat-custom-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Conversation Item Card */
.conversation-item {
  padding: 0.85rem 1rem;
  border-radius: var(--chat-radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.conversation-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3.5px;
  background: var(--chat-primary);
  border-radius: 0 4px 4px 0;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  transform: scaleY(0.4);
}

.conversation-item.active::before {
  opacity: 1;
  transform: scaleY(1);
}

.conversation-item:hover {
  background: var(--chat-hover);
  border-color: rgba(255, 255, 255, 0.05);
  transform: translateX(3px);
}

.conversation-item.active {
  background: rgba(32,34,39, 0.14);
  border-color: rgba(2, 132, 199, 0.35);
  box-shadow: inset 0 0 12px rgba(32,34,39, 0.1);
}

.conversation-item.is-vizir-item {
  background: rgba(255, 215, 0, 0.04);
  border-color: rgba(255, 215, 0, 0.18);
}

.conversation-item.is-vizir-item:hover {
  background: rgba(255, 215, 0, 0.08);
  border-color: rgba(255, 215, 0, 0.3);
}

.conversation-item.is-vizir-item.active {
  background: rgba(255, 215, 0, 0.14);
  border-color: rgba(255, 215, 0, 0.45);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.12);
}

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

.conversation-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: var(--chat-accent);
  box-shadow: var(--chat-shadow-sm);
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.conversation-avatar.ai-avatar {
  background: var(--chat-gold-gradient);
  color: #000;
  font-size: 1.15rem;
  border: 2px solid rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.25);
}

@keyframes pulse-online {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.online-indicator {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--chat-success);
  border: 2px solid var(--chat-sidebar-bg);
  animation: pulse-online 2s infinite;
}

.conversation-meta-name {
  color: var(--chat-text-primary);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.25;
}

.conversation-meta-time {
  color: var(--chat-text-muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}

.conversation-meta-last {
  color: var(--chat-text-secondary);
  font-size: 0.82rem;
  line-height: 1.35;
  max-width: 85%;
  margin-top: 2px;
}

.conversation-unread-badge {
  background: var(--chat-primary);
  color: #070d1a;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

/* ==========================================================================
   CHAT MAIN AREA
   ========================================================================== */

.chat-main {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--chat-main-bg);
  position: relative;
  overflow: hidden;
  flex: 1 1 0%;
}

/* Chat Header */
.chat-header {
  padding: 0.85rem 1.35rem;
  border-bottom: 1px solid var(--chat-border);
  background: rgba(32,34,39, 0.75);
  backdrop-filter: blur(18px);
  z-index: 10;
  flex-shrink: 0;
}

.chat-header-user {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.chat-header-title {
  color: var(--chat-text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.chat-header-status {
  color: var(--chat-text-muted);
  font-size: 0.78rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chat-header-status.online {
  color: var(--chat-success);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-btn-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--chat-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--chat-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-btn-action:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-1px);
}

.chat-btn-action.active {
  background: rgba(255, 215, 0, 0.15);
  border-color: var(--chat-primary);
  color: var(--chat-primary);
}

.call-btn-audio:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--chat-success);
  color: var(--chat-success);
}

.call-btn-video:hover {
  background: rgba(32,34,39, 0.2);
  border-color: var(--chat-accent);
  color: var(--chat-accent);
}

/* In-Chat Message Search Bar */
#in-chat-search-bar {
  background: rgba(32,34,39, 0.9);
  border-bottom: 1px solid var(--chat-border);
  padding: 0.5rem 1.25rem;
  display: none;
  align-items: center;
  gap: 0.75rem;
  backdrop-filter: blur(16px);
  z-index: 9;
}

.in-chat-search-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius-md);
  padding: 0.4rem 0.85rem;
  color: var(--chat-text-primary);
  font-size: 0.85rem;
  outline: none;
}

.in-chat-search-input:focus {
  border-color: var(--chat-primary);
}

.in-chat-search-count {
  color: var(--chat-text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ==========================================================================
   MESSAGES CONTAINER
   ========================================================================== */

#messages-container,
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 1.5rem;
  background:
    radial-gradient(circle at top right, rgba(32,34,39, 0.04), transparent 60%),
    radial-gradient(circle at bottom left, rgba(255, 215, 0, 0.03), transparent 50%);
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Date Separator Badge */
.chat-date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0 0.5rem 0;
  position: relative;
}

.chat-date-separator span {
  background: rgba(32,34,39, 0.8);
  border: 1px solid var(--chat-border);
  backdrop-filter: blur(10px);
  color: var(--chat-text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.3rem 0.95rem;
  border-radius: var(--chat-radius-full);
  letter-spacing: 0.02em;
  box-shadow: var(--chat-shadow-sm);
}

/* Message Wrapper & Bubbles */
.message-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.message-sent .message-wrapper {
  align-items: flex-end;
}

.message-received .message-wrapper {
  align-items: flex-start;
}

.message-bubble {
  padding: 0.85rem 1.15rem;
  border-radius: var(--chat-radius-lg);
  position: relative;
  word-wrap: break-word;
  word-break: break-word;
  box-shadow: var(--chat-shadow-sm);
  font-size: 0.92rem;
  line-height: 1.5;
  animation: messageFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes messageFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-sent .message-bubble {
  background: var(--chat-message-sent);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-bottom-right-radius: 4px;
}

.message-received .message-bubble {
  background: var(--chat-message-received);
  color: var(--chat-text-primary);
  border: 1px solid var(--chat-border);
  border-bottom-left-radius: 4px;
  backdrop-filter: blur(16px);
}

/* Special VIZIR AI Bubble */
.message-received.is-vizir-message .message-bubble {
  background: rgba(32,34,39, 0.94);
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(255, 215, 0, 0.08);
  max-width: 100%;
}

.vizir-bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 215, 0, 0.15);
  padding-bottom: 0.45rem;
  margin-bottom: 0.65rem;
}

.vizir-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.35);
  color: var(--chat-primary);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--chat-radius-full);
}

/* Markdown styling inside VIZIR bubbles */
.message-content h1,
.message-content h2,
.message-content h3 {
  color: var(--chat-primary);
  font-family: 'Outfit', sans-serif;
  margin-top: 0.6rem;
  margin-bottom: 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.message-content p {
  margin-bottom: 0.45rem;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul,
.message-content ol {
  margin: 0.35rem 0 0.5rem 1.25rem;
  padding: 0;
}

.message-content li {
  margin-bottom: 0.25rem;
}

.message-content blockquote {
  border-left: 3px solid var(--chat-primary);
  padding-left: 0.65rem;
  margin: 0.45rem 0;
  color: var(--chat-text-secondary);
  font-style: italic;
}

.message-content code {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fca5a5;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.84em;
  font-family: monospace;
}

.message-content a {
  color: var(--chat-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-content a:hover {
  color: var(--chat-primary-hover);
}

/* AI Feedback Buttons (Thumbs Up / Down) */
.vizir-feedback-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-feedback {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--chat-border);
  color: var(--chat-text-muted);
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: var(--chat-radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-feedback:hover {
  color: var(--chat-text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.btn-feedback.active-like {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--chat-success);
  color: var(--chat-success);
}

.btn-feedback.active-dislike {
  background: rgba(239, 68, 68, 0.18);
  border-color: var(--chat-danger);
  color: var(--chat-danger);
}

/* Message Meta & Ticks */
.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.65);
}

.message-received .message-meta {
  color: var(--chat-text-muted);
}

.message-check-icon {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
}

.message-check-icon.read {
  color: #38bdf8 !important;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  margin-left: 5px;
  vertical-align: middle;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  background: var(--chat-primary);
  border-radius: 50%;
  display: inline-block;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {
  0%,
  80%,
  100% {
    transform: scale(0.3);
    opacity: 0.35;
  }
  40% {
    transform: scale(1.15);
    opacity: 1;
    box-shadow: 0 0 6px var(--chat-primary);
  }
}

.btn-attach.timer-active {
  background: rgba(245, 158, 11, 0.22) !important;
  border-color: #f59e0b !important;
  color: #fde68a !important;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.4) !important;
}

.timer-active-pill {
  position: absolute;
  top: -7px;
  right: -7px;
  font-size: 9px;
  font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  padding: 1px 5px;
  border-radius: 99px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Reply Block Inside Bubble */
.message-reply {
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--chat-primary);
  padding: 0.4rem 0.65rem;
  border-radius: var(--chat-radius-sm);
  margin-bottom: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: opacity 0.2s;
}

.message-reply:hover {
  opacity: 0.85;
}

.message-reply strong {
  color: var(--chat-primary);
  display: block;
  font-size: 0.75rem;
  margin-bottom: 2px;
}

.message-reply p {
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

/* Message Hover Actions (Emoji, Reply, Copy, Edit, Delete) */
.message-actions {
  position: absolute;
  top: -14px;
  right: 8px;
  background: rgba(32,34,39, 0.96);
  border: 1px solid var(--chat-border);
  backdrop-filter: blur(14px);
  border-radius: var(--chat-radius-full);
  padding: 3px 6px;
  display: none;
  align-items: center;
  gap: 3px;
  box-shadow: var(--chat-shadow-md);
  z-index: 10;
}

.message-wrapper:hover .message-actions {
  display: flex;
}

.message-action-btn {
  background: transparent;
  border: none;
  color: var(--chat-text-secondary);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.message-action-btn:hover {
  color: var(--chat-primary);
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

/* Emoji Reactions Bar */
.reactions-popup-bar {
  display: none;
  position: absolute;
  top: -46px;
  right: 0;
  background: rgba(32,34,39, 0.98);
  border: 1px solid var(--chat-border);
  backdrop-filter: blur(16px);
  border-radius: var(--chat-radius-full);
  padding: 4px 8px;
  gap: 4px;
  box-shadow: var(--chat-shadow-lg);
  z-index: 15;
  animation: popupBounce 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popupBounce {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.emoji-react-btn {
  background: transparent;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 50%;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.emoji-react-btn:hover {
  transform: scale(1.35);
}

/* Emoji Reactions Badge Container below bubble */
.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius-full);
  padding: 2px 8px;
  font-size: 0.74rem;
  color: var(--chat-text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.reaction-badge:hover,
.reaction-badge.active {
  background: rgba(255, 215, 0, 0.18);
  border-color: rgba(255, 215, 0, 0.45);
  color: var(--chat-primary);
}

/* ==========================================================================
   VOICE MESSAGE PLAYER
   ========================================================================== */

.voice-message-player {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.45rem 0.25rem;
  min-width: 240px;
}

.voice-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--chat-primary);
  color: #070d1a !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
  transition:
    transform 0.15s ease,
    background 0.15s ease;
}

.voice-play-btn:hover {
  transform: scale(1.08);
  background: var(--chat-primary-hover);
}

.voice-waveform-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.voice-waveform-progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--chat-radius-full);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.voice-waveform-bar {
  height: 100%;
  background: var(--chat-primary);
  border-radius: var(--chat-radius-full);
  width: 0%;
  transition: width 0.1s linear;
}

.voice-time-text {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   INPUT BAR & QUICK PROMPTS
   ========================================================================== */

.chat-input-container {
  background: rgba(32,34,39, 0.95);
  border-top: 1px solid var(--chat-border);
  backdrop-filter: blur(20px);
  padding: 0.75rem 1.25rem;
  flex-shrink: 0;
  position: relative;
  z-index: 15;
  margin-top: auto;
}

/* VIZIR Quick Actions Bar */
#vizir-quick-actions {
  padding: 0.25rem 0.1rem 0.75rem 0.1rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

#vizir-quick-actions::-webkit-scrollbar {
  display: none;
}

.quick-action-chip {
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.25);
  color: var(--chat-primary);
  padding: 0.38rem 0.85rem;
  border-radius: var(--chat-radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.quick-action-chip:hover {
  background: var(--chat-primary);
  color: #070d1a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.25);
}

/* Reply Preview Bar */
#reply-preview {
  background: rgba(32,34,39, 0.85);
  border-left: 3px solid var(--chat-primary);
  border-radius: var(--chat-radius-sm);
  padding: 0.45rem 0.85rem;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideDown 0.2s ease;
}

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

.reply-preview-content strong {
  color: var(--chat-primary);
  font-size: 0.78rem;
  display: block;
}

.reply-preview-content p {
  color: var(--chat-text-secondary);
  font-size: 0.78rem;
  margin: 0;
}

.reply-cancel-btn {
  background: transparent;
  border: none;
  color: var(--chat-text-muted);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 0 4px;
}

.reply-cancel-btn:hover {
  color: var(--chat-danger);
}

/* Chat Form & Inputs */
#message-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.btn-attach {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--chat-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--chat-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.btn-attach:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--chat-text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-attach.active {
  background: rgba(255, 215, 0, 0.15);
  border-color: var(--chat-primary);
  color: var(--chat-primary);
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius-full);
  padding: 0.65rem 1.25rem;
  color: var(--chat-text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: all 0.2s ease;
}

.chat-input:focus {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(2, 132, 199, 0.5);
  box-shadow: 0 0 0 3px rgba(32,34,39, 0.15);
}

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

.btn-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--chat-primary);
  color: #070d1a !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 3px 14px rgba(255, 215, 0, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-send:hover {
  background: var(--chat-primary-hover);
  transform: scale(1.06);
}

/* Audio Recording Bar Overlay */
#audio-recording-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--chat-radius-full);
  padding: 0.45rem 1.15rem;
  animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
  0%,
  100% {
    border-color: rgba(239, 68, 68, 0.35);
  }
  50% {
    border-color: rgba(239, 68, 68, 0.8);
  }
}

.recording-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--chat-danger);
  box-shadow: 0 0 10px var(--chat-danger);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.recording-timer {
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.recording-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-cancel-recording {
  background: transparent;
  border: none;
  color: var(--chat-text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s;
}

.btn-cancel-recording:hover {
  color: var(--chat-danger);
}

.btn-send-recording {
  background: var(--chat-success);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
  transition: transform 0.15s ease;
}

.btn-send-recording:hover {
  transform: scale(1.08);
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2.5rem;
  text-align: center;
}

.empty-state-icon {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.25);
  color: var(--chat-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 1.35rem;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.12);
}

.empty-state-title {
  color: var(--chat-text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.empty-state-text {
  color: var(--chat-text-secondary);
  font-size: 0.92rem;
  max-width: 420px;
  line-height: 1.55;
  margin-bottom: 1.75rem;
}

.empty-state-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ==========================================================================
   MODALS (New Chat, Lightbox, WebRTC)
   ========================================================================== */

.modal-content.dark-glass-modal {
  background: #202227;
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius-lg);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65);
  color: var(--chat-text-primary);
}

.modal-content.dark-glass-modal .modal-header {
  border-bottom: 1px solid var(--chat-border);
  padding: 1.15rem 1.5rem;
}

.modal-content.dark-glass-modal .modal-footer {
  border-top: 1px solid var(--chat-border);
}

.contact-card-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--chat-radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--chat-border);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.contact-card-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 215, 0, 0.35);
  transform: translateX(3px);
}

.contact-card-item.is-vizir-card {
  background: rgba(255, 215, 0, 0.06);
  border-color: rgba(255, 215, 0, 0.25);
}

/* ==========================================================================
   RESPONSIVENESS (Mobile & Tablet Full Sliding Architecture)
   ========================================================================== */

@media (max-width: 768px) {
  .chat-app-wrapper {
    height: 100%;
    min-height: 0;
    max-height: 100%;
  }

  .chat-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(0);
    z-index: 30;
  }

  .chat-sidebar.hidden-mobile {
    transform: translateX(-100%);
    pointer-events: none;
  }

  .chat-main {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 20;
  }

  .chat-input-container {
    padding: 0.65rem 0.85rem;
  }

  .message-wrapper {
    max-width: 88%;
  }

  .chat-header {
    padding: 0.65rem 0.95rem;
  }

  #messages-container {
    padding: 0.85rem 0.95rem;
  }
}

/* ==========================================================================
   CONSULTANTS & ADS SIDEBAR EXTENSIONS (UI Factory Standard)
   ========================================================================== */

.pinned-consultants-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(32,34,39, 0.2) 0%, rgba(32,34,39, 0.1) 100%);
  border: 1px solid rgba(2, 132, 199, 0.35);
  border-radius: var(--chat-radius-md);
  padding: 10px 14px;
  margin: 8px 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(32,34,39, 0.15);
}

.pinned-consultants-banner:hover {
  background: linear-gradient(135deg, rgba(32,34,39, 0.35) 0%, rgba(32,34,39, 0.2) 100%);
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(32,34,39, 0.3);
}

.pinned-consultants-banner .icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #202227;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(32,34,39, 0.4);
}

.chat-topics-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(32,34,39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--chat-border);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.chat-topics-bar::-webkit-scrollbar {
  display: none;
}

.chat-topic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--chat-radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--chat-text-primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
}

.chat-topic-btn:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: #ffd700;
  color: #ffd700;
  transform: translateY(-1px);
}

.chat-ads-sidebar {
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  background: #202227;
  border-left: 1px solid var(--chat-border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.chat-ad-box {
  flex: 1 1 0%;
  min-height: 0;
  background: linear-gradient(145deg, rgba(32,34,39, 0.9) 0%, rgba(32,34,39, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.chat-ad-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.chat-ad-box:hover {
  border-color: rgba(255, 215, 0, 0.35);
  background: linear-gradient(145deg, rgba(32,34,39, 0.95) 0%, rgba(32,34,39, 0.98) 100%);
  transform: translateY(-2px);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.45),
    0 0 12px rgba(255, 215, 0, 0.1);
}

.chat-ad-box:hover::before {
  opacity: 1;
}

.chat-ad-content {
  display: flex;
  flex-direction: column;
}

.chat-ad-badge {
  align-self: flex-start;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  line-height: 1;
}

.chat-ad-title {
  color: #f8fafc;
  font-size: 0.84rem;
  font-weight: 700;
  margin: 4px 0 2px 0;
  line-height: 1.25;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.01em;
}

.chat-ad-desc {
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 2px;
}

.chat-ad-action {
  color: #ffd700;
  font-size: 0.74rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 4px;
  transition:
    transform 0.2s ease,
    color 0.2s ease;
}

.chat-ad-box:hover .chat-ad-action {
  color: #ffdf33;
  transform: translateX(3px);
}

/* Contact cards in New Chat modal */
.contact-card-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.contact-card-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 215, 0, 0.3);
  transform: translateX(3px);
}

.contact-card-item.is-vizir-card {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.08) 0%, rgba(32,34,39, 0.06) 100%);
  border-color: rgba(255, 215, 0, 0.3);
}

.contact-card-item.is-vizir-card:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(32,34,39, 0.12) 100%);
  border-color: rgba(255, 215, 0, 0.6);
}
