/* 
 * WhatsApp Web Modern Design System & Stylesheet - Full Enterprise Edition
 * Features: Global Multi-Chat Search, Chat Analytics Dashboard, Legal PDF Export,
 * Inline Voice Note Player, Starred Messages, Mobile Drawer, and Audit Trail.
 */

@import url('https://fonts.googleapis.com/css2?family=Segoe+UI:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

:root {
  /* Dark Theme Default - Authentic WhatsApp Web OLED Dark */
  --bg-app: #0b141a;
  --bg-sidebar: #111b21;
  --bg-chat: #0b141a;
  --bg-header: rgba(32, 44, 51, 0.92);
  --bg-input: #2a3942;
  --bg-msg-in: #202c33;
  --bg-msg-out: #005c4b;
  --bg-system: #182229;
  --bg-card: #1f2c34;
  --bg-modal: #111b21;
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;
  --accent-green: #00a884;
  --accent-green-hover: #06cf9c;
  --accent-blue: #53bdeb;
  --border-color: rgba(134, 150, 160, 0.15);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --chat-wallpaper: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
  --chat-wallpaper-size: 24px 24px;
}

[data-theme="light"] {
  --bg-app: #e1e1e0;
  --bg-sidebar: #ffffff;
  --bg-chat: #efeae2;
  --bg-header: rgba(240, 242, 245, 0.92);
  --bg-input: #f0f2f5;
  --bg-msg-in: #ffffff;
  --bg-msg-out: #d9fdd3;
  --bg-system: #f0f2f5;
  --bg-card: #f9f9f9;
  --bg-modal: #ffffff;
  --text-primary: #111b21;
  --text-secondary: #667781;
  --text-muted: #8696a0;
  --accent-green: #00a884;
  --accent-green-hover: #008f70;
  --accent-blue: #53bdeb;
  --border-color: rgba(0, 0, 0, 0.08);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --chat-wallpaper: radial-gradient(circle, rgba(0,0,0,0.04) 1px, transparent 1px);
  --chat-wallpaper-size: 24px 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Glassmorphic Login Screen Overlay */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, rgba(0, 168, 132, 0.15) 0%, rgba(11, 20, 26, 0.98) 70%);
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.login-screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.04);
}

.login-card {
  width: 92%;
  max-width: 440px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: loginCardIn 0.4s cubic-bezier(0.1, 0.9, 0.2, 1);
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #128c7e);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 18px;
  box-shadow: 0 6px 20px rgba(0, 168, 132, 0.4);
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.login-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 26px;
  text-align: center;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.login-input-wrapper {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 44px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input-wrapper:focus-within {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.2);
}

.login-input-wrapper i {
  color: var(--text-secondary);
  font-size: 15px;
  margin-right: 12px;
}

.login-input-wrapper input {
  background: none;
  border: none;
  color: var(--text-primary);
  width: 100%;
  font-size: 14.5px;
  outline: none;
}

.btn-toggle-pwd {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.btn-login-submit {
  margin-top: 10px;
  background-color: var(--accent-green);
  color: white;
  border: none;
  height: 46px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.4);
  transition: transform 0.2s, background-color 0.2s;
}

.btn-login-submit:hover {
  background-color: var(--accent-green-hover);
  transform: translateY(-1px);
}

.login-error {
  background-color: rgba(234, 67, 53, 0.15);
  color: #ea4335;
  border: 1px solid #ea4335;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  display: none;
  align-items: center;
  gap: 8px;
}

.login-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 18px;
  text-align: center;
  line-height: 1.5;
  background: rgba(255,255,255,0.03);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  width: 100%;
}

#app-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  background-color: var(--bg-sidebar);
  position: relative;
  overflow: hidden;
}

/* Toast Notifications Bar (App-wide Errors & Notices outside chat) */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-modal);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  max-width: 400px;
}

.toast.warning {
  border-left: 4px solid #ff922b;
}

.toast.warning i {
  color: #ff922b;
  font-size: 16px;
}

.toast.error {
  border-left: 4px solid #ea4335;
}

.toast.error i {
  color: #ea4335;
  font-size: 16px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Sidebar Styles */
.sidebar {
  width: 380px;
  min-width: 300px;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 10;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.sidebar-header {
  height: 62px;
  padding: 10px 16px;
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #128c7e);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
  cursor: pointer;
  transition: transform 0.2s;
}

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

.sidebar-header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: var(--accent-green);
  transform: translateY(-1px);
}

[data-theme="light"] .icon-btn:hover {
  background-color: rgba(0, 0, 0, 0.06);
}

/* Search Box */
.search-container {
  padding: 10px 14px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
}

.search-input-wrapper {
  background-color: var(--bg-input);
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 38px;
  transition: box-shadow 0.2s, border-color 0.2s;
  border: 1px solid transparent;
}

.search-input-wrapper:focus-within {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.2);
}

.search-input-wrapper i {
  color: var(--text-secondary);
  margin-right: 10px;
  font-size: 14px;
}

.search-input-wrapper input {
  background: none;
  border: none;
  color: var(--text-primary);
  width: 100%;
  font-size: 14px;
  outline: none;
}

.search-input-wrapper input::placeholder {
  color: var(--text-secondary);
}

/* Chat Item List */
.chats-list {
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s ease;
  position: relative;
}

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

.chat-item.active {
  background-color: var(--bg-header);
  border-left: 4px solid var(--accent-green);
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #128c7e, #25d366);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  margin-right: 14px;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.chat-avatar.group-avatar {
  background: linear-gradient(135deg, #00838f, #00acc1);
}

.chat-avatar .online-badge {
  width: 12px;
  height: 12px;
  background-color: #25d366;
  border: 2px solid var(--bg-sidebar);
  border-radius: 50%;
  position: absolute;
  bottom: 0;
  right: 0;
}

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

.chat-info-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.chat-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

.chat-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.unread-badge {
  background-color: var(--accent-green);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  margin-left: 8px;
  flex-shrink: 0;
}

.unread-badge.group-badge {
  background-color: #00838f;
}

/* Sidebar Media & Navigation Tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-header);
}

.sidebar-tab {
  flex: 1;
  padding: 12px 6px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sidebar-tab.active {
  color: var(--accent-green);
  border-bottom-color: var(--accent-green);
}

/* Main Chat Area - STRICT FLEX & MIN-WIDTH PREVENT OVERFLOW */
.main-chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-chat);
  position: relative;
  overflow: hidden;
}

.chat-header {
  height: 62px;
  padding: 10px 20px;
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  z-index: 5;
  flex-shrink: 0;
}

.chat-contact-info {
  display: flex;
  align-items: center;
  cursor: pointer;
  min-width: 0;
}

.contact-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #008f70);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  margin-right: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
}

.contact-avatar.group-avatar {
  background: linear-gradient(135deg, #00838f, #00acc1);
  box-shadow: 0 2px 8px rgba(0, 131, 143, 0.3);
}

.contact-details {
  min-width: 0;
}

.contact-details h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-details p {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Floating Date Range & Jump Bar */
.date-filter-bar {
  position: absolute;
  top: 64px;
  right: 20px;
  background-color: var(--bg-header);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 350px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.date-filter-bar.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.date-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.date-filter-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.date-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.date-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.date-input {
  flex: 1;
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  outline: none;
  font-family: inherit;
}

.date-input:focus {
  border-color: var(--accent-green);
}

.preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.preset-pill {
  background-color: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-pill:hover, .preset-pill.active {
  background-color: var(--accent-green);
  color: white;
  border-color: var(--accent-green);
}

.date-filter-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.date-action-btn {
  background-color: var(--accent-green);
  color: white;
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.date-action-btn:hover {
  background-color: var(--accent-green-hover);
}

.date-action-btn.secondary {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.date-action-btn.secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Date Highlight Flash */
@keyframes dateFlash {
  0% { background-color: rgba(0, 168, 132, 0.6); transform: scale(1.05); }
  50% { background-color: rgba(0, 168, 132, 0.8); transform: scale(1.08); }
  100% { background-color: var(--bg-system); transform: scale(1); }
}

.date-divider.highlight span {
  animation: dateFlash 1.5s ease-out;
}

/* Member Filter Select in Group Header */
.member-filter-select {
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
}

/* Chat Messages Container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  padding: 24px 5%;
  background-color: var(--bg-chat);
  background-image: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  box-sizing: border-box;
}

/* Date Divider */
.date-divider {
  display: flex;
  justify-content: center;
  margin: 18px 0 10px 0;
  width: 100%;
}

.date-divider span {
  background-color: var(--bg-system);
  color: var(--text-secondary);
  font-size: 11.5px;
  padding: 6px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: 1px solid var(--border-color);
  max-width: 90%;
  text-align: center;
  word-wrap: break-word;
}

/* System Message */
.system-message {
  display: flex;
  justify-content: center;
  margin: 10px 0;
  width: 100%;
}

.system-message-body {
  background-color: var(--bg-system);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 7px 16px;
  border-radius: 8px;
  text-align: center;
  max-width: 85%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.system-message-body i {
  margin-right: 6px;
  color: var(--accent-green);
}

/* Message Bubble Animation & Strict Wrapping */
@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-wrapper {
  display: flex;
  width: 100%;
  max-width: 100%;
  margin-bottom: 2px;
  animation: msgFadeIn 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
  box-sizing: border-box;
}

.msg-wrapper.inbound {
  justify-content: flex-start;
}

.msg-wrapper.outbound {
  justify-content: flex-end;
}

.msg-bubble {
  max-width: 78%;
  min-width: 130px;
  padding: 8px 12px 8px 12px;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-sizing: border-box;
  overflow: hidden;
}

.msg-bubble:hover .btn-star-msg {
  opacity: 1;
}

.btn-star-msg {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.4);
  border: none;
  color: var(--text-secondary);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  opacity: 0;
  transition: all 0.2s ease;
}

.btn-star-msg.starred, .btn-star-msg:hover {
  color: #fcc419;
  opacity: 1;
}

.msg-wrapper.inbound .msg-bubble {
  background-color: var(--bg-msg-in);
  border-top-left-radius: 2px;
}

.msg-wrapper.outbound .msg-bubble {
  background-color: var(--bg-msg-out);
  border-top-right-radius: 2px;
}

.msg-sender {
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
  word-wrap: break-word;
  padding-right: 20px;
}

.msg-wrapper.outbound .msg-sender {
  color: #25d366;
}

.msg-text {
  font-size: 14px;
  line-height: 1.48;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.msg-text a {
  color: var(--accent-blue);
  text-decoration: underline;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.msg-text pre {
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 12.5px;
  margin: 6px 0;
  border: 1px solid var(--border-color);
  overflow-x: auto;
}

.msg-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  float: right;
  margin-top: 4px;
  margin-left: 14px;
}

.msg-time {
  font-size: 11px;
  color: var(--text-secondary);
}

.msg-status-icon {
  color: var(--accent-blue);
  font-size: 13px;
}

/* Voice Note Audio Player Bubble */
.voice-note-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 6px;
  border: 1px solid var(--border-color);
  min-width: 240px;
}

.vn-play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--accent-green);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.4);
}

.vn-play-btn:hover {
  transform: scale(1.06);
  background-color: var(--accent-green-hover);
}

.vn-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vn-waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
}

.vn-bar {
  width: 3px;
  height: 60%;
  background-color: var(--text-secondary);
  border-radius: 3px;
  transition: height 0.2s, background-color 0.2s;
}

.vn-bar.active {
  background-color: var(--accent-green);
  height: 100%;
}

.vn-timer {
  font-size: 11px;
  color: var(--text-secondary);
}

.vn-speed-btn {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* Attachment Displays - Premium Cards */
.attachment-card {
  margin-bottom: 8px;
  border-radius: 10px;
  overflow: hidden;
  max-width: 100%;
}

.attachment-image {
  max-width: 100%;
  max-height: 380px;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  object-fit: cover;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.attachment-image:hover {
  transform: scale(1.015);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

.attachment-doc {
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  padding: 12px 14px;
  border-radius: 10px;
  gap: 14px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  max-width: 100%;
}

.attachment-doc:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

.doc-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

.doc-icon.pdf { background: linear-gradient(135deg, #ff5252, #c62828); }
.doc-icon.doc { background: linear-gradient(135deg, #42a5f5, #1565c0); }
.doc-icon.excel { background: linear-gradient(135deg, #2e7d32, #1b5e20); }
.doc-icon.vcard { background: linear-gradient(135deg, #ffa726, #ef6c00); }
.doc-icon.markdown { background: linear-gradient(135deg, #ab47bc, #6a1b9a); }
.doc-icon.file { background: linear-gradient(135deg, #78909c, #37474f); }

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

.doc-filename {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.doc-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.doc-btn {
  background-color: var(--accent-green);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 2px 6px rgba(0, 168, 132, 0.3);
}

.doc-btn:hover {
  background-color: var(--accent-green-hover);
  transform: scale(1.04);
}

/* Chat Input Bar */
.chat-footer {
  min-height: 64px;
  padding: 10px 20px;
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.input-box {
  flex: 1;
  min-width: 0;
  background-color: var(--bg-input);
  border-radius: 10px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 15px;
  border: 1px solid transparent;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-box:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.2);
}

.input-box::placeholder {
  color: var(--text-secondary);
}

.send-btn {
  background-color: var(--accent-green);
  color: white;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 10px rgba(0, 168, 132, 0.4);
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.08);
  background-color: var(--accent-green-hover);
}

/* Dropzone Overlay */
.dropzone-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 20, 26, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
}

.dropzone-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.dropzone-box {
  width: 82%;
  max-width: 520px;
  padding: 44px;
  border: 2px dashed var(--accent-green);
  border-radius: 20px;
  text-align: center;
  background-color: var(--bg-sidebar);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.dropzone-box i {
  font-size: 58px;
  color: var(--accent-green);
  margin-bottom: 18px;
}

.dropzone-box h2 {
  font-size: 22px;
  margin-bottom: 10px;
}

.dropzone-box p {
  color: var(--text-secondary);
  font-size: 14.5px;
  margin-bottom: 24px;
}

.btn-upload {
  background-color: var(--accent-green);
  color: white;
  padding: 12px 28px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.4);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.88);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(5px);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-modal);
  border-radius: 14px;
  width: 92%;
  max-width: 980px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

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

.modal-header h3 {
  font-size: 16.5px;
  font-weight: 600;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Stats Analytics Modal Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #00a884, #128c7e);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-info h4 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-info p {
  font-size: 12px;
  color: var(--text-secondary);
}

.stats-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.member-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.member-name {
  width: 140px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-bar-track {
  flex: 1;
  height: 10px;
  background-color: var(--bg-input);
  border-radius: 5px;
  overflow: hidden;
}

.member-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00a884, #25d366);
  border-radius: 5px;
}

.member-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  width: 50px;
  text-align: right;
}

/* PDF Embedded Viewer Container */
.pdf-container {
  width: 100%;
  height: 75vh;
  display: flex;
  flex-direction: column;
}

.pdf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
  background-color: #ffffff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}

/* Print Legal Report Styling */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  #sidebar, .chat-header, .chat-footer, .toast-container, .date-filter-bar, .modal-overlay {
    display: none !important;
  }
  .main-chat {
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }
  .messages-container {
    background: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  .msg-bubble {
    background: #f0f2f5 !important;
    color: #000000 !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }
  .msg-text {
    color: #000000 !important;
  }
}

/* Mobile Slide-Out Drawer & Responsiveness */
.mobile-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.6);
  z-index: 8;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 82%;
    max-width: 320px;
    height: 100%;
    z-index: 20;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .msg-bubble {
    max-width: 88%;
  }

  .date-filter-bar {
    width: 90%;
    right: 5%;
  }
}
