/* ==========================================================================
   WhatsApp Web Chatrooms - Modern, Lightweight, Secure Design System
   ========================================================================== */

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

:root {
  /* WhatsApp Dark Theme Palette */
  --bg-app: #0c1317;
  --bg-container: #111b21;
  --bg-sidebar: #111b21;
  --bg-sidebar-header: #202c33;
  --bg-chat-header: #202c33;
  --bg-chat-area: #0b141a;
  --bg-input-bar: #202c33;
  --bg-input: #2a3942;
  --bg-hover: #202c33;
  --bg-active: #2a3942;
  --bg-modal: #1f2c34;
  --bg-modal-overlay: rgba(11, 20, 26, 0.85);

  /* Form & Input Variables */
  --bg-input-field: #202c33;
  --border-input-field: #2a3942;
  --bg-viewport: #17242c;
  --slider-track: #2a3942;
  --avatar-fallback-bg: #2a3942;
  --avatar-fallback-text: #ffffff;

  /* Message Bubble Colors */
  --bubble-outgoing: #005c4b;
  --bubble-outgoing-text: #e9edef;
  --bubble-incoming: #202c33;
  --bubble-incoming-text: #e9edef;
  --bubble-meta: #8696a0;
  --bubble-ticks-blue: #53bdeb;

  /* Accent Colors */
  --wa-green: #00a884;
  --wa-green-hover: #06cf9c;
  --wa-green-light: #25d366;
  --wa-danger: #ea4335;
  --wa-danger-hover: #d93025;

  /* Typography Colors */
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;
  --text-link: #53bdeb;

  /* Borders & Dividers */
  --border-color: #222d34;
  --border-subtle: rgba(134, 150, 160, 0.15);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(0, 168, 132, 0.3);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-app: #eae6df;
  --bg-container: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-sidebar-header: #f0f2f5;
  --bg-chat-header: #f0f2f5;
  --bg-chat-area: #efeae2;
  --bg-input-bar: #f0f2f5;
  --bg-input: #ffffff;
  --bg-hover: #f5f6f6;
  --bg-active: #ebebeb;
  --bg-modal: #ffffff;
  --bg-modal-overlay: rgba(0, 0, 0, 0.55);

  /* Form & Input Variables */
  --bg-input-field: #f0f2f5;
  --border-input-field: #d1d7db;
  --bg-viewport: #f8fafc;
  --slider-track: #d1d7db;
  --avatar-fallback-bg: #dfe5e7;
  --avatar-fallback-text: #54656f;

  --bubble-outgoing: #d9fdd3;
  --bubble-outgoing-text: #111b21;
  --bubble-incoming: #ffffff;
  --bubble-incoming-text: #111b21;
  --bubble-meta: #667781;

  --text-primary: #111b21;
  --text-secondary: #667781;
  --text-muted: #8696a0;
  --border-color: #e9edef;
  --border-subtle: rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* Keep form fields typable even when body disables user-select */
input,
textarea,
select,
[contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

/* ==========================================================================
   PASSWORD SECURITY GATE (Lock Screen)
   ========================================================================== */
#lockScreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #17242c 0%, #0a1014 100%);
  padding: 20px;
  transition: opacity 0.5s ease, transform 0.5s var(--transition-smooth), visibility 0.5s;
}

#lockScreen.unlocked {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  pointer-events: none;
}

.lock-card {
  width: 100%;
  max-width: 440px;
  background: rgba(17, 27, 33, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 168, 132, 0.25);
  border-radius: 20px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 168, 132, 0.15);
  animation: cardAppear 0.6s var(--transition-smooth);
}

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

.lock-logo-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0, 168, 132, 0.2) 0%, rgba(37, 211, 102, 0.1) 100%);
  border-radius: 50%;
  border: 2px solid var(--wa-green);
  box-shadow: var(--shadow-glow);
}

.lock-logo-icon {
  width: 44px;
  height: 44px;
  color: var(--wa-green);
}

.lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(0, 168, 132, 0.15);
  border: 1px solid rgba(0, 168, 132, 0.3);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--wa-green);
  margin-bottom: 12px;
}

.lock-title {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.lock-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 28px;
}

.lock-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-password-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-password-group .lock-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  pointer-events: none;
  transition: color var(--transition-fast);
}

.lock-input {
  width: 100%;
  height: 50px;
  background: #202c33;
  border: 1.5px solid #2a3942;
  border-radius: 12px;
  padding: 0 46px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.lock-input:focus {
  border-color: var(--wa-green);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.25);
  background: #222e35;
}

.lock-input:focus ~ .lock-input-icon {
  color: var(--wa-green);
}

.btn-toggle-eye {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: color var(--transition-fast);
}

.btn-toggle-eye:hover {
  color: var(--text-primary);
}

.lock-error-msg {
  min-height: 20px;
  font-size: 12.5px;
  color: var(--wa-danger);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  transition: all var(--transition-fast);
}

.lock-error-msg.visible {
  opacity: 1;
  transform: translateY(0);
}

.btn-unlock {
  height: 48px;
  background: var(--wa-green);
  color: #0b141a;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.4);
}

.btn-unlock:hover {
  background: var(--wa-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 168, 132, 0.5);
}

.btn-unlock:active {
  transform: translateY(1px);
}

/* Shake Animation for incorrect password */
.shake {
  animation: shakeAnimation 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shakeAnimation {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.lock-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
}

.lock-hint code {
  color: var(--wa-green);
  background: rgba(0, 168, 132, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ==========================================================================
   MAIN APPLICATION LAYOUT (WhatsApp Web)
   ========================================================================= */
#appContainer {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  background-color: var(--bg-container);
  overflow: hidden;
}

/* Left Green Accent Bar background like native WhatsApp Web */
.wa-backdrop-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 127px;
  background-color: #00a884;
  z-index: 0;
  opacity: 0.15;
}

.app-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   SIDEBAR (Profiles List & Add Button)
   ========================================================================== */
.sidebar {
  width: 400px;
  min-width: 320px;
  max-width: 500px;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
  transition: transform var(--transition-normal);
}

/* Sidebar Header */
.sidebar-header {
  height: 60px;
  background-color: var(--bg-sidebar-header);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

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

/* Primary Top-Left Add Profile Button */
.btn-add-profile-main {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 168, 132, 0.15);
  border: 1px solid rgba(0, 168, 132, 0.4);
  color: var(--wa-green);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-add-profile-main:hover {
  background: var(--wa-green);
  color: #111b21;
  border-color: var(--wa-green);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
}

.btn-add-profile-main .plus-icon {
  width: 18px;
  height: 18px;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

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

.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* Search Bar Container */
.sidebar-search-container {
  padding: 8px 12px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
}

.search-input-wrapper {
  background-color: var(--bg-sidebar-header);
  border-radius: 8px;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

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

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

/* Profiles Section Heading */
.profiles-section-header {
  padding: 10px 16px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--wa-green);
}

.profiles-count-badge {
  background: rgba(0, 168, 132, 0.15);
  color: var(--wa-green);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
}

/* Profiles List */
.profiles-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.profiles-list::-webkit-scrollbar {
  width: 6px;
}

.profiles-list::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* Single Profile Item (WhatsApp Web Chat Item) */
.profile-item {
  display: flex;
  align-items: center;
  height: 72px;
  padding: 0 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast);
  position: relative;
}

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

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

/* Square Profile Photo as requested: "(square)" */
.profile-avatar-square {
  width: 48px;
  height: 48px;
  border-radius: 8px; /* Square with sleek rounded edges */
  object-fit: cover;
  background-color: var(--avatar-fallback-bg);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--avatar-fallback-text);
  text-transform: uppercase;
  overflow: hidden;
  position: relative;
}

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

.profile-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
  margin-right: 14px;
}

.online-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background-color: var(--wa-green-light);
  border: 2px solid var(--bg-sidebar);
  border-radius: 50%;
}

.profile-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

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

.profile-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-time {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.profile-last-msg {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

.profile-unread-badge {
  background-color: var(--wa-green);
  color: #111b21;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Action dropdown inside profile item */
.profile-item-actions {
  display: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.profile-item:hover .profile-item-actions {
  display: flex;
}

.btn-del-profile {
  background: rgba(234, 67, 53, 0.15);
  border: 1px solid rgba(234, 67, 53, 0.3);
  color: var(--wa-danger);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-del-profile:hover {
  background: var(--wa-danger);
  color: #fff;
}

/* Empty Profile State */
.empty-profiles-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-icon {
  width: 56px;
  height: 56px;
  color: var(--text-muted);
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 16px;
}

/* ==========================================================================
   MAIN CHATROOM AREA
   ========================================================================== */
.main-chat {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-chat-area);
  position: relative;
  overflow: hidden;
}

/* WhatsApp Doodle Pattern Background */
.chat-bg-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: radial-gradient(#00a884 0.75px, transparent 0.75px), radial-gradient(#00a884 0.75px, var(--bg-chat-area) 0.75px);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
  pointer-events: none;
  z-index: 0;
}

/* No Chat Selected Welcome Splash */
.no-chat-splash {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  position: relative;
  z-index: 1;
}

.splash-icon-wrapper {
  width: 90px;
  height: 90px;
  background: rgba(0, 168, 132, 0.12);
  border: 2px solid rgba(0, 168, 132, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  color: var(--wa-green);
  box-shadow: var(--shadow-glow);
}

.splash-title {
  font-size: 28px;
  font-weight: 300;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.splash-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 460px;
  line-height: 1.6;
  margin-bottom: 30px;
}

.splash-security-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.splash-security-tag svg {
  width: 16px;
  height: 16px;
  color: var(--wa-green);
}

/* Active Chatroom View */
.active-chatroom {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 1;
}

.active-chatroom.hidden {
  display: none;
}

/* Chatroom Header */
.chat-header {
  height: 60px;
  background-color: var(--bg-chat-header);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.chat-header-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px; /* Square */
  object-fit: cover;
  background-color: var(--avatar-fallback-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  color: var(--avatar-fallback-text);
  overflow: hidden;
}

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

.chat-header-details {
  display: flex;
  flex-direction: column;
}

.chat-header-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-header-status {
  font-size: 12px;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.chat-header-status.typing {
  color: var(--wa-green);
  font-weight: 500;
}

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

/* Back button for mobile view */
.btn-back-sidebar {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px;
  cursor: pointer;
}

/* Chat Messages Container */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-messages-container::-webkit-scrollbar {
  width: 6px;
}

.chat-messages-container::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* Encryption Banner inside chat */
.chat-security-banner {
  align-self: center;
  background-color: rgba(24, 34, 41, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 11.5px;
  color: #ffd279;
  text-align: center;
  max-width: 500px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Date Pill Divider */
.chat-date-divider {
  align-self: center;
  background-color: #182229;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  margin: 10px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Chat Bubbles */
.chat-bubble {
  max-width: 65%;
  min-width: 80px;
  padding: 6px 9px 8px 10px;
  border-radius: 8px;
  position: relative;
  font-size: 14px;
  line-height: 19px;
  word-wrap: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  animation: bubblePop 0.2s var(--transition-smooth);
}

@keyframes bubblePop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Outgoing Message (Sent by user) */
.chat-bubble.outgoing {
  align-self: flex-end;
  background-color: var(--bubble-outgoing);
  color: var(--bubble-outgoing-text);
  border-top-right-radius: 2px;
}

/* Incoming Message (Sent by profile) */
.chat-bubble.incoming {
  align-self: flex-start;
  background-color: var(--bubble-incoming);
  color: var(--bubble-incoming-text);
  border-top-left-radius: 2px;
}

.chat-bubble-content {
  font-size: 14px;
  color: inherit;
  white-space: pre-wrap;
  user-select: text;
}

.chat-bubble-meta {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--bubble-meta);
  margin-top: 2px;
  margin-left: 12px;
  flex-shrink: 0;
}

.ticks-icon {
  width: 16px;
  height: 16px;
  color: var(--bubble-ticks-blue);
}

/* Typing Indicator Bubble */
.typing-indicator-bubble {
  align-self: flex-start;
  background-color: var(--bubble-incoming);
  padding: 10px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.typing-dot {
  width: 7px;
  height: 7px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

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

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* Message Input Bar */
.chat-input-bar {
  min-height: 62px;
  background-color: var(--bg-input-bar);
  padding: 8px 16px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
  position: relative;
  z-index: 2;
}

.chat-input-wrapper {
  flex: 1;
  background-color: var(--bg-input);
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 6px 14px;
  min-height: 42px;
  max-height: 120px;
}

.chat-text-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14.5px;
  color: var(--text-primary);
  font-family: inherit;
  resize: none;
  line-height: 20px;
  max-height: 100px;
  user-select: text;
}

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

.btn-send-message {
  width: 44px;
  height: 44px;
  background-color: var(--wa-green);
  border: none;
  border-radius: 50%;
  color: #111b21;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
}

.btn-send-message:hover {
  background-color: var(--wa-green-hover);
  transform: scale(1.05);
}

.btn-send-message:active {
  transform: scale(0.96);
}

.btn-send-message svg {
  width: 20px;
  height: 20px;
}

/* Quick Emoji Picker Bar */
.quick-emoji-bar {
  position: absolute;
  bottom: 70px;
  left: 16px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  box-shadow: var(--shadow-md);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition-fast);
}

.quick-emoji-bar.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.emoji-btn {
  font-size: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: transform var(--transition-fast);
}

.emoji-btn:hover {
  transform: scale(1.25);
  background-color: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   MODAL POPUP: TAMBAH PROFILE (Square Photo & Nama Profile)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bg-modal-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--transition-normal);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 440px;
  background-color: var(--bg-modal);
  border: 1px solid rgba(0, 168, 132, 0.3);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: var(--shadow-lg), 0 0 25px rgba(0, 168, 132, 0.15);
  transform: scale(0.92);
  transition: transform var(--transition-smooth);
}

.modal-overlay.open .modal-content {
  transform: scale(1);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title svg {
  color: var(--wa-green);
  width: 22px;
  height: 22px;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

/* Square Photo Upload Component */
.square-upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 22px;
}

.square-preview-box {
  width: 120px;
  height: 120px;
  border-radius: 12px; /* Perfect Square with gentle corner radius */
  border: 2px dashed rgba(0, 168, 132, 0.5);
  background-color: var(--bg-viewport);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.square-preview-box:hover {
  border-color: var(--wa-green);
  background-color: var(--bg-hover);
  transform: scale(1.02);
}

.square-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.square-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-align: center;
  padding: 8px;
}

.square-upload-placeholder svg {
  width: 32px;
  height: 32px;
  color: var(--wa-green);
}

.square-upload-placeholder span {
  font-size: 11.5px;
  font-weight: 500;
}

.square-upload-badge {
  position: absolute;
  bottom: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

.square-preview-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-file-select {
  font-size: 12px;
  color: var(--wa-green);
  background: rgba(0, 168, 132, 0.1);
  border: 1px solid rgba(0, 168, 132, 0.3);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-file-select:hover {
  background: rgba(0, 168, 132, 0.2);
}

.modal-form-group {
  margin-bottom: 16px;
}

.modal-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.modal-input {
  width: 100%;
  height: 42px;
  background-color: var(--bg-input-field);
  border: 1.5px solid var(--border-input-field);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.modal-input:focus {
  background-color: var(--bg-container);
  border-color: var(--wa-green);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.2);
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.btn-secondary {
  padding: 9px 18px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.btn-primary {
  padding: 9px 20px;
  background-color: var(--wa-green);
  border: none;
  color: #111b21;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
}

.btn-primary:hover {
  background-color: var(--wa-green-hover);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-modal);
  color: var(--text-primary);
  border: 1px solid rgba(0, 168, 132, 0.4);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s var(--transition-smooth);
}

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

.toast svg {
  color: var(--wa-green);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ==========================================================================
   RESPONSIVENESS (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    max-width: 100%;
  }

  .main-chat {
    position: absolute;
    inset: 0;
    z-index: 5;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
  }

  .main-chat.mobile-active {
    transform: translateX(0);
  }

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

  .chat-messages-container {
    padding: 12px 16px;
  }

  .chat-bubble {
    max-width: 85%;
  }
}

/* ==========================================================================
   BUTTON: TUTUP WEB & KUNCI PROFIL SAYA & CHAT SEARCH
   ========================================================================== */

/* Button Tutup Web */
.btn-tutup-web {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: rgba(234, 67, 53, 0.12);
  border: 1px solid rgba(234, 67, 53, 0.35);
  color: #ff6b6b;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-tutup-web:hover {
  background: var(--wa-danger);
  color: #ffffff;
  border-color: var(--wa-danger);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(234, 67, 53, 0.4);
}

/* Button Kunci Profil Saya */
.btn-lock-profile {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 168, 132, 0.15);
  border: 1px solid rgba(0, 168, 132, 0.4);
  color: var(--wa-green);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-lock-profile:hover {
  background: var(--wa-green);
  color: #111b21;
  border-color: var(--wa-green);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
}

.btn-lock-profile.is-locked {
  background: rgba(255, 170, 0, 0.15);
  border-color: rgba(255, 170, 0, 0.4);
  color: #ffb703;
}

.btn-lock-profile.is-locked:hover {
  background: #ffb703;
  color: #111b21;
}

/* Inline Chat Message Search Bar */
.chat-search-bar {
  background-color: var(--bg-sidebar-header);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideDownSearch 0.25s ease;
  z-index: 3;
}

.chat-search-bar.hidden {
  display: none;
}

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

.chat-search-input-wrapper {
  flex: 1;
  max-width: 480px;
  background-color: var(--bg-input);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 4px 12px;
  gap: 8px;
}

.chat-search-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
}

.btn-close-search {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.btn-close-search:hover {
  color: var(--text-primary);
}

.chat-search-count {
  font-size: 12px;
  color: var(--wa-green);
  font-weight: 500;
  white-space: nowrap;
}

/* Locked Profile Badge on Avatar */
.profile-lock-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background-color: #ffb703;
  color: #111b21;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Danger outline button */
.btn-danger-outline {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--wa-danger);
  color: var(--wa-danger);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-danger-outline:hover {
  background: var(--wa-danger);
  color: #fff;
}

.btn-danger-outline.hidden {
  display: none;
}

/* Highlight search text in bubbles */
.highlight-match {
  background-color: #ffd166;
  color: #0b141a;
  padding: 1px 2px;
  border-radius: 2px;
  font-weight: 600;
}

/* ==========================================================================
   INTERACTIVE SQUARE PHOTO CROPPER & PAN/ZOOM
   ========================================================================== */
.square-cropper-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.square-crop-viewport {
  width: 170px;
  height: 170px;
  border-radius: 12px;
  border: 2px dashed rgba(0, 168, 132, 0.55);
  background-color: var(--bg-viewport);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: border-color var(--transition-fast);
}

.square-crop-viewport.has-image {
  border-style: solid;
  border-color: var(--wa-green);
  cursor: grab;
}

.square-crop-viewport.has-image:active {
  cursor: grabbing;
}

.cropper-source-img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

/* Grid Guidelines Overlay for Rule of Thirds */
.cropper-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.cropper-grid-overlay.hidden {
  display: none;
}

.grid-line {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.25);
}

.grid-line-h1 { top: 33.33%; left: 0; right: 0; height: 1px; }
.grid-line-h2 { top: 66.66%; left: 0; right: 0; height: 1px; }
.grid-line-v1 { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.grid-line-v2 { left: 66.66%; top: 0; bottom: 0; width: 1px; }

/* Cropper Controls */
.cropper-controls {
  width: 100%;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: fadeIn 0.2s ease;
}

.cropper-controls.hidden {
  display: none;
}

.zoom-slider-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
}

.zoom-slider-row input[type="range"] {
  flex: 1;
  height: 4px;
  background: var(--slider-track);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
}

.zoom-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--wa-green);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  transition: transform 0.1s ease;
}

.zoom-slider-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.cropper-instruction-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ==========================================================================
   SWEETALERT2 CUSTOM DARK THEME STYLING
   ========================================================================== */
.swal2-popup {
  font-family: 'Inter', -apple-system, sans-serif !important;
  border-radius: 16px !important;
  border: 1px solid rgba(0, 168, 132, 0.3) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7) !important;
}

.swal2-title {
  font-size: 20px !important;
  font-weight: 600 !important;
}

.swal2-input {
  background: #2a3942 !important;
  border: 1.5px solid #374248 !important;
  color: #fff !important;
  border-radius: 8px !important;
  font-size: 15px !important;
  letter-spacing: 2px !important;
  text-align: center !important;
  height: 44px !important;
  box-shadow: none !important;
}

.swal2-input:focus {
  border-color: var(--wa-green) !important;
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.25) !important;
}

.swal2-styled.swal2-confirm {
  border-radius: 8px !important;
  font-weight: 600 !important;
  padding: 8px 20px !important;
}

.swal2-styled.swal2-cancel {
  border-radius: 8px !important;
  font-weight: 500 !important;
  padding: 8px 20px !important;
}

/* Reset Crop Button in Modal */
.btn-reset-crop {
  color: var(--text-muted) !important;
  border-color: var(--border-color) !important;
  background: transparent !important;
}

.btn-reset-crop:hover {
  background-color: var(--bg-hover) !important;
  color: var(--text-primary) !important;
}

/* ==========================================================================
   COMPREHENSIVE LIGHT THEME INPUT & UI REFINEMENTS
   ========================================================================== */

/* SweetAlert2 Light Mode */
[data-theme="light"] .swal2-popup {
  background: #ffffff !important;
  color: #111b21 !important;
  border: 1px solid rgba(0, 168, 132, 0.25) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .swal2-title {
  color: #111b21 !important;
}

[data-theme="light"] .swal2-html-container {
  color: #54656f !important;
}

[data-theme="light"] .swal2-input {
  background: #f0f2f5 !important;
  border: 1.5px solid #d1d7db !important;
  color: #111b21 !important;
  box-shadow: none !important;
}

[data-theme="light"] .swal2-input:focus {
  background: #ffffff !important;
  border-color: var(--wa-green) !important;
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.2) !important;
}

[data-theme="light"] .swal2-validation-message {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
}

/* Sidebar Search Input (Light Mode) */
[data-theme="light"] .sidebar-search-container {
  background-color: #ffffff;
  border-bottom-color: #e9edef;
}

[data-theme="light"] .search-input-wrapper {
  background-color: #f0f2f5;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

[data-theme="light"] .search-input-wrapper:focus-within {
  background-color: #ffffff;
  border-color: var(--wa-green);
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.15);
}

[data-theme="light"] .search-input {
  color: #111b21;
}

[data-theme="light"] .search-input::placeholder {
  color: #8696a0;
}

/* Chat Input Bar & Textarea (Light Mode) */
[data-theme="light"] .chat-input-bar {
  background-color: #f0f2f5;
  border-top-color: #e9edef;
}

[data-theme="light"] .chat-input-wrapper {
  background-color: #ffffff;
  border: 1px solid #d1d7db;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

[data-theme="light"] .chat-input-wrapper:focus-within {
  border-color: var(--wa-green);
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.18);
}

[data-theme="light"] .chat-text-input {
  color: #111b21;
}

[data-theme="light"] .chat-text-input::placeholder {
  color: #8696a0;
}

/* Chat Search Bar & Input (Light Mode) */
[data-theme="light"] .chat-search-bar {
  background-color: #f0f2f5;
  border-bottom-color: #e9edef;
}

[data-theme="light"] .chat-search-input-wrapper {
  background-color: #ffffff;
  border: 1px solid #d1d7db;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

[data-theme="light"] .chat-search-input-wrapper:focus-within {
  border-color: var(--wa-green);
  box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.18);
}

[data-theme="light"] .chat-search-input-wrapper input {
  color: #111b21;
}

[data-theme="light"] .chat-search-input-wrapper input::placeholder {
  color: #8696a0;
}

/* Modal Inputs & Controls (Light Mode) */
[data-theme="light"] .modal-input {
  background-color: #f0f2f5;
  border-color: #d1d7db;
  color: #111b21;
}

[data-theme="light"] .modal-input:focus {
  background-color: #ffffff;
  border-color: var(--wa-green);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.2);
}

[data-theme="light"] .modal-input::placeholder {
  color: #8696a0;
}

[data-theme="light"] .square-preview-box,
[data-theme="light"] .square-crop-viewport {
  background-color: #f0f2f5;
  border-color: rgba(0, 168, 132, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .square-upload-placeholder {
  color: #54656f;
}

[data-theme="light"] .square-upload-placeholder span {
  color: #54656f;
}

[data-theme="light"] .zoom-slider-row {
  color: #54656f;
}

[data-theme="light"] .zoom-slider-row input[type="range"] {
  background: #d1d7db;
}

[data-theme="light"] .cropper-instruction-hint {
  color: #54656f;
}

[data-theme="light"] .btn-secondary {
  border-color: #d1d7db;
  color: #54656f;
}

[data-theme="light"] .btn-secondary:hover {
  background-color: #f0f2f5;
  color: #111b21;
}

[data-theme="light"] .btn-file-select {
  background: rgba(0, 168, 132, 0.08);
  border-color: rgba(0, 168, 132, 0.3);
  color: #008069;
}

[data-theme="light"] .btn-file-select:hover {
  background: rgba(0, 168, 132, 0.16);
}

[data-theme="light"] .btn-close-modal {
  color: #8696a0;
}

[data-theme="light"] .btn-close-modal:hover {
  background-color: #f0f2f5;
  color: #111b21;
}

/* Date Dividers, Notices, and Tags (Light Mode) */
[data-theme="light"] .chat-date-divider {
  background-color: #ffffff;
  color: #54656f;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .chat-security-notice {
  background-color: #ffeecd;
  color: #54656f;
  border-color: rgba(0, 0, 0, 0.05);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .splash-security-tag {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .quick-emoji-bar {
  background-color: #ffffff;
  border-color: #e9edef;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .emoji-btn:hover {
  background-color: #f0f2f5;
}

[data-theme="light"] .toast {
  background: #ffffff;
  color: #111b21;
  border-color: rgba(0, 168, 132, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

[data-theme="light"] .btn-tutup-web {
  color: var(--wa-danger);
  background: rgba(234, 67, 53, 0.08);
  border-color: rgba(234, 67, 53, 0.25);
}

[data-theme="light"] .btn-lock-profile.is-locked {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.35);
  color: #b45309;
}

/* Lock Screen Input & Card (Light Mode) */
[data-theme="light"] #lockScreen {
  background: radial-gradient(circle at 50% 30%, #f0f4f8 0%, #d9e2ec 100%);
}

[data-theme="light"] .lock-card {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(0, 168, 132, 0.3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08), 0 0 30px rgba(0, 168, 132, 0.12);
}

[data-theme="light"] .lock-title {
  color: #111b21;
}

[data-theme="light"] .lock-subtitle {
  color: #54656f;
}

[data-theme="light"] .lock-input {
  background: #f0f2f5;
  border-color: #d1d7db;
  color: #111b21;
}

[data-theme="light"] .lock-input:focus {
  background: #ffffff;
  border-color: var(--wa-green);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.2);
}

[data-theme="light"] .lock-input::placeholder {
  color: #8696a0;
}

/* ==========================================================================
   DEDICATED 1:1 SQUARE PHOTO CROPPER MODAL (Cropper.js & Custom Theming)
   ========================================================================== */
.modal-crop-content {
  max-width: 720px !important;
  width: 95% !important;
}

.crop-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 640px) {
  .crop-modal-body {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 20px;
    align-items: start;
  }
}

.cropper-stage-wrapper {
  background-color: #0c1317;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  position: relative;
  min-height: 280px;
  max-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="light"] .cropper-stage-wrapper {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
}

.cropper-stage {
  width: 100%;
  height: 340px;
  max-height: 380px;
}

.cropper-stage img {
  max-width: 100%;
  display: block;
}

.cropper-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.crop-preview-box-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px;
  background-color: var(--bg-input-field);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.crop-preview-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.crop-preview-circle {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--wa-green);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background-color: var(--bg-container);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crop-preview-square {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.crop-badge-ratio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--wa-green);
  background: rgba(0, 168, 132, 0.12);
  padding: 3px 10px;
  border-radius: 12px;
}

.cropper-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cropper-tool-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.cropper-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background-color: var(--bg-input-field);
  border: 1px solid var(--border-input-field);
  color: var(--text-primary);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cropper-tool-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--wa-green);
  color: var(--wa-green);
}

.crop-helper-text {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.crop-helper-text svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--wa-green);
}

/* Custom Cropper.js Styling matching WhatsApp Web Green Aesthetic */
.cropper-view-box {
  outline: 2px solid var(--wa-green) !important;
  outline-color: var(--wa-green) !important;
  border-radius: 4px;
}

.cropper-line {
  background-color: var(--wa-green) !important;
}

.cropper-point {
  background-color: var(--wa-green) !important;
  width: 10px !important;
  height: 10px !important;
  opacity: 0.95 !important;
}

.cropper-point.point-se,
.cropper-point.point-sw,
.cropper-point.point-ne,
.cropper-point.point-nw {
  width: 14px !important;
  height: 14px !important;
  border-radius: 3px !important;
  border: 1.5px solid #ffffff !important;
}

.cropper-dashed {
  border-color: rgba(255, 255, 255, 0.45) !important;
}

.cropper-modal {
  opacity: 0.65 !important;
}

/* ==========================================================================
   DRAG & DROP VISUAL OVERLAY (WhatsApp Web Aesthetic)
   ========================================================================== */
.chat-drag-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 20, 26, 0.88);
  border: 3px dashed var(--wa-green);
  border-radius: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  backdrop-filter: blur(5px);
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

[data-theme="light"] .chat-drag-overlay {
  background: rgba(240, 242, 245, 0.92);
}

.chat-drag-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  display: none;
}

.chat-drag-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 30px;
}

.drag-icon-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(0, 168, 132, 0.15);
  border: 2px solid var(--wa-green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wa-green);
  animation: floatDragIcon 1.5s ease-in-out infinite alternate;
}

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

.drag-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.drag-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   LINK PREVIEW DRAWER (Above Chat Input Bar)
   ========================================================================== */
.link-preview-drawer {
  background-color: var(--bg-container);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
  animation: slideDownIn 0.25s ease-out;
  position: relative;
  z-index: 10;
}

[data-theme="light"] .link-preview-drawer {
  background-color: #ffffff;
  border-color: #d1d7db;
}

.link-preview-drawer.hidden {
  display: none;
}

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

.link-preview-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  background-color: var(--bg-input-field);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 12px;
}

[data-theme="light"] .link-preview-inner {
  background-color: #f0f2f5;
  border-color: #e9edef;
}

.link-preview-media {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background-color: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-preview-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.link-preview-media.no-image {
  display: none;
}

.link-preview-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.link-preview-desc {
  font-size: 12px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.link-preview-domain {
  font-size: 11px;
  font-weight: 500;
  color: var(--wa-green);
  text-transform: lowercase;
}

.btn-close-link-preview {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-close-link-preview:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

[data-theme="light"] .btn-close-link-preview:hover {
  background-color: rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   ATTACHMENT PREVIEW DRAWER (File / Photo to Send)
   ========================================================================== */
.attachment-preview-drawer {
  background-color: var(--bg-container);
  border-top: 1px solid var(--border-color);
  padding: 10px 16px;
  animation: slideDownIn 0.25s ease-out;
  position: relative;
  z-index: 10;
}

[data-theme="light"] .attachment-preview-drawer {
  background-color: #ffffff;
  border-color: #d1d7db;
}

.attachment-preview-drawer.hidden {
  display: none;
}

/* Attachment Preview Drawer (Bulk Multi-File Support) */
.attachment-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 4px;
}

.attachment-summary-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--wa-green);
  font-size: 12.5px;
  font-weight: 600;
}

.attachment-files-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.attachment-files-list::-webkit-scrollbar {
  height: 4px;
}

.attachment-files-list::-webkit-scrollbar-thumb {
  background: var(--wa-green);
  border-radius: 4px;
}

.attachment-file-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-input-field);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 170px;
  max-width: 240px;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s;
}

[data-theme="light"] .attachment-file-chip {
  background-color: #f0f2f5;
  border-color: #d1d7db;
}

.chip-thumb {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 168, 132, 0.12);
  color: var(--wa-green);
  flex-shrink: 0;
}

.chip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.chip-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-size {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-remove-chip {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-remove-chip:hover {
  background-color: rgba(234, 67, 53, 0.15);
  color: var(--wa-danger);
}

.btn-cancel-attachment {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-cancel-attachment:hover {
  background-color: rgba(234, 67, 53, 0.15);
  color: var(--wa-danger);
}

/* ==========================================================================
   CHAT BUBBLE: RICH LINK PREVIEW CARD
   ========================================================================== */
.chat-link-card {
  display: block;
  margin-top: 6px;
  margin-bottom: 2px;
  border-radius: 8px;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  transition: all 0.2s ease;
}

[data-theme="light"] .chat-link-card {
  background-color: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
}

.chat-bubble.outgoing .chat-link-card {
  background-color: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 92, 75, 0.3);
}

[data-theme="light"] .chat-bubble.outgoing .chat-link-card {
  background-color: rgba(0, 168, 132, 0.1);
  border-color: rgba(0, 168, 132, 0.2);
}

.chat-link-card:hover {
  background-color: rgba(0, 0, 0, 0.26);
  border-color: var(--wa-green);
  transform: translateY(-1px);
}

.chat-link-thumb-container {
  width: 100%;
  max-height: 170px;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="light"] .chat-link-thumb-container {
  background-color: rgba(0, 0, 0, 0.04);
}

.chat-link-thumb {
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  display: block;
}

.chat-link-details {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-link-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-link-card-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-link-card-domain {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--wa-green);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

/* Clickable Links inside Chat Bubbles */
.chat-bubble-content a {
  color: #53bdeb;
  text-decoration: underline;
  word-break: break-all;
  transition: color 0.15s;
}

.chat-bubble.outgoing .chat-bubble-content a {
  color: #70e6c5;
}

[data-theme="light"] .chat-bubble-content a {
  color: #027eb5;
}

[data-theme="light"] .chat-bubble.outgoing .chat-bubble-content a {
  color: #0b674d;
}

.chat-bubble-content a:hover {
  text-decoration: none;
  opacity: 0.85;
}

/* ==========================================================================
   CHAT BUBBLE: FILE & IMAGE ATTACHMENTS
   ========================================================================== */
.chat-attachment-wrapper {
  margin-bottom: 6px;
}

.chat-image-attachment {
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
  display: block;
  cursor: pointer;
  object-fit: cover;
  transition: opacity 0.2s, transform 0.2s;
}

.chat-image-attachment:hover {
  opacity: 0.92;
  transform: scale(0.995);
}

.chat-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background-color: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  margin-bottom: 4px;
}

[data-theme="light"] .chat-file-card {
  background-color: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
}

.chat-bubble.outgoing .chat-file-card {
  background-color: rgba(0, 0, 0, 0.12);
  border-color: rgba(0, 92, 75, 0.3);
}

[data-theme="light"] .chat-bubble.outgoing .chat-file-card {
  background-color: rgba(0, 168, 132, 0.1);
  border-color: rgba(0, 168, 132, 0.2);
}

.chat-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-file-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background-color: rgba(0, 168, 132, 0.2);
  color: var(--wa-green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-file-icon.pdf {
  background-color: rgba(234, 67, 53, 0.2);
  color: #ea4335;
}

.chat-file-icon.doc {
  background-color: rgba(66, 133, 244, 0.2);
  color: #4285f4;
}

.chat-file-icon.zip {
  background-color: rgba(251, 188, 4, 0.2);
  color: #fbbc04;
}

.chat-file-texts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.chat-file-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.chat-file-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.chat-file-download-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: rgba(0, 168, 132, 0.2);
  color: var(--wa-green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: all 0.2s;
}

.chat-file-download-btn:hover {
  background-color: var(--wa-green);
  color: #ffffff;
  transform: scale(1.08);
}

/* ==========================================================================
   IMAGE LIGHTBOX MODAL WITH NAVIGATION
   ========================================================================== */
.image-lightbox-overlay {
  background: rgba(0, 0, 0, 0.94) !important;
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
}

.lightbox-top-bar {
  position: absolute;
  top: 18px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2010;
}

.lightbox-counter-badge {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 5px 14px;
  border-radius: 20px;
  color: #e9edef;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.lightbox-actions-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-lightbox-action {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-lightbox-action:hover {
  background: var(--wa-green);
  color: #111b21;
  transform: scale(1.08);
}

.btn-close-lightbox {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-close-lightbox:hover {
  background: rgba(234, 67, 53, 0.8);
  color: #ffffff;
  transform: scale(1.08);
}

/* Left & Right Navigation Buttons */
.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.22s ease;
  z-index: 2010;
  backdrop-filter: blur(4px);
}

.lightbox-nav-btn.prev {
  left: 24px;
}

.lightbox-nav-btn.next {
  right: 24px;
}

.lightbox-nav-btn:hover {
  background: var(--wa-green);
  color: #111b21;
  border-color: var(--wa-green);
  transform: translateY(-50%) scale(1.12);
  box-shadow: 0 4px 16px rgba(0, 168, 132, 0.45);
}

.lightbox-nav-btn:active {
  transform: translateY(-50%) scale(0.96);
}

.lightbox-nav-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 86vw;
  max-height: 86vh;
}

.lightbox-content img {
  max-width: 82vw;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85);
  animation: zoomIn 0.2s ease-out;
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.lightbox-caption {
  margin-top: 14px;
  color: #e9edef;
  font-size: 14px;
  text-align: center;
  max-width: 600px;
  line-height: 1.4;
}

/* ==========================================================================
   HEADER ACTIONS: TRASH / MANAGE MESSAGES BUTTON
   ========================================================================== */
.btn-trash-manage {
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-trash-manage:hover {
  color: #ea4335 !important;
  background-color: rgba(234, 67, 53, 0.12) !important;
  transform: scale(1.05);
}

.btn-trash-manage.active {
  color: #ea4335 !important;
  background-color: rgba(234, 67, 53, 0.18) !important;
}

/* ==========================================================================
   MESSAGE SELECTION TOOLBAR (#chatSelectionBar)
   ========================================================================== */
.chat-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background-color: var(--bg-container);
  border-bottom: 2px solid rgba(234, 67, 53, 0.3);
  position: relative;
  z-index: 15;
  animation: slideDownIn 0.22s ease-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .chat-selection-bar {
  background-color: #ffffff;
  border-bottom-color: rgba(234, 67, 53, 0.35);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.chat-selection-bar.hidden {
  display: none;
}

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

.btn-selection-circle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

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

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

.selection-count-badge {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.selection-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-selection-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background-color: var(--bg-input-field);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

[data-theme="light"] .btn-selection-action {
  background-color: #f0f2f5;
  border-color: #d1d7db;
}

.btn-selection-action:hover {
  background-color: var(--bg-hover);
  border-color: var(--wa-green);
  color: var(--wa-green);
}

.btn-selection-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  background-color: #ea4335;
  border: none;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(234, 67, 53, 0.35);
}

.btn-selection-delete:hover:not(:disabled) {
  background-color: #d93025;
  transform: scale(1.03);
}

.btn-selection-delete:disabled {
  background-color: rgba(234, 67, 53, 0.35);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}

/* ==========================================================================
   MESSAGES IN SELECTION MODE
   ========================================================================== */
.chat-message-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  position: relative;
}

.chat-message-row.row-outgoing {
  justify-content: flex-end;
}

.chat-message-row.row-incoming {
  justify-content: flex-start;
}

/* Checkbox on message */
.msg-select-checkbox-wrapper {
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
  order: -1;
  transition: all 0.2s;
}

.in-selection-mode .msg-select-checkbox-wrapper {
  display: flex;
}

.msg-select-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  outline: none;
  cursor: pointer;
  position: relative;
  background-color: var(--bg-input-field);
  transition: all 0.18s;
}

[data-theme="light"] .msg-select-checkbox {
  background-color: #ffffff;
  border-color: #8696a0;
}

.msg-select-checkbox:checked {
  background-color: #ea4335;
  border-color: #ea4335;
}

.msg-select-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.in-selection-mode .chat-bubble {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, outline 0.15s;
}

.in-selection-mode .chat-bubble:hover {
  transform: scale(1.01);
}

.chat-bubble.is-selected-bubble {
  outline: 2px solid #ea4335 !important;
  box-shadow: 0 0 12px rgba(234, 67, 53, 0.45) !important;
}

/* ==========================================================================
   WHATSAPP-STYLE CHAT SEARCH BAR & HIGHLIGHTS
   ========================================================================== */
.chat-search-bar {
  background-color: var(--bg-container);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 12;
  animation: slideDownIn 0.2s ease-out;
}

[data-theme="light"] .chat-search-bar {
  background-color: #ffffff;
  border-color: #d1d7db;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.chat-search-bar.hidden {
  display: none;
}

.chat-search-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-input-field);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 4px 12px;
}

[data-theme="light"] .chat-search-input-wrapper {
  background-color: #f0f2f5;
  border-color: #e9edef;
}

.search-input-icon {
  color: var(--text-secondary);
  flex-shrink: 0;
}

#inputChatSearch {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: var(--text-primary);
  font-family: inherit;
  min-width: 0;
}

#inputChatSearch::placeholder {
  color: var(--text-secondary);
}

.search-nav-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-search-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0 6px;
  white-space: nowrap;
}

.btn-search-nav {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-search-nav:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.12);
  color: var(--wa-green);
}

[data-theme="light"] .btn-search-nav:hover:not(:disabled) {
  background-color: rgba(0, 0, 0, 0.08);
}

.btn-search-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-close-search {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-close-search:hover {
  background-color: rgba(234, 67, 53, 0.15);
  color: #ea4335;
}

/* WhatsApp-Style Search Highlights */
.chat-search-mark {
  background-color: rgba(254, 215, 0, 0.45);
  color: inherit;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
  transition: all 0.2s ease;
}

[data-theme="light"] .chat-search-mark {
  background-color: rgba(255, 222, 89, 0.65);
}

/* Active Search Match (Focused) */
.chat-search-mark.active-search-match {
  background-color: #ff9800 !important;
  color: #111b21 !important;
  box-shadow: 0 0 0 2.5px rgba(255, 152, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3) !important;
  border-radius: 3px;
}

/* Subtle pulse animation when match is navigated to */
@keyframes matchPulseHighlight {
  0% { transform: scale(1.03); box-shadow: 0 0 16px rgba(255, 152, 0, 0.6); }
  50% { transform: scale(1.01); box-shadow: 0 0 10px rgba(255, 152, 0, 0.4); }
  100% { transform: scale(1); box-shadow: none; }
}

.chat-bubble.search-pulse {
  animation: matchPulseHighlight 1.2s ease-out;
}






