/* WhatsApp Web Exact Design System */
:root {
  --wa-primary: #00a884;
  --wa-primary-hover: #02906f;
  --wa-primary-light: rgba(0, 168, 132, 0.12);
  --wa-blue-tick: #53bdeb;
  --wa-danger: #ea4335;

  /* Dark Mode Default */
  --bg-app: #0c1317;
  --bg-sidebar: #111b21;
  --bg-header: #202c33;
  --bg-search: #202c33;
  --bg-search-input: #111b21;
  --bg-chat: #0b141a;
  --bg-bubble-incoming: #202c33;
  --bg-bubble-outgoing: #005c4b;
  --bg-hover: #202c33;
  --bg-active: #2a3942;
  --bg-modal: #222e35;
  --bg-dropdown: #233138;
  --border-color: #222e35;
  --border-subtle: rgba(134, 150, 160, 0.15);

  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-subtle: #667781;
  --text-light: #ffffff;
  
  --shadow-sm: 0 1px 3px rgba(11, 20, 26, 0.4);
  --shadow-md: 0 4px 16px rgba(11, 20, 26, 0.6);
  --shadow-dropdown: 0 2px 5px 0 rgba(11, 20, 26, 0.26), 0 2px 10px 0 rgba(11, 20, 26, 0.16);

  --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', Roboto, Helvetica, Arial, sans-serif;
}

body.light-theme {
  --bg-app: #eae6df;
  --bg-sidebar: #ffffff;
  --bg-header: #f0f2f5;
  --bg-search: #ffffff;
  --bg-search-input: #f0f2f5;
  --bg-chat: #efeae2;
  --bg-bubble-incoming: #ffffff;
  --bg-bubble-outgoing: #d9fdd3;
  --bg-hover: #f5f6f6;
  --bg-active: #ebebeb;
  --bg-modal: #ffffff;
  --bg-dropdown: #ffffff;
  --border-color: #e9edef;
  --border-subtle: rgba(11, 20, 26, 0.08);

  --text-primary: #111b21;
  --text-secondary: #667781;
  --text-subtle: #8696a0;
  --text-light: #111b21;

  --shadow-sm: 0 1px 3px rgba(11, 20, 26, 0.08);
  --shadow-md: 0 4px 16px rgba(11, 20, 26, 0.15);
  --shadow-dropdown: 0 2px 5px 0 rgba(11, 20, 26, 0.1), 0 2px 10px 0 rgba(11, 20, 26, 0.08);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* WhatsApp Green Header Stripe (top decoration) */
.app-background-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 127px;
  background-color: var(--wa-primary);
  z-index: 0;
}

/* Authentication Login Overlay */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-app);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-modal);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 36px 32px 28px 32px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 10001;
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  text-align: center;
}

.auth-logo {
  margin-bottom: 14px;
}

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

.auth-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.auth-alert {
  width: 100%;
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(234, 67, 53, 0.15);
  border: 1px solid var(--wa-danger);
  color: #ff8075;
  font-size: 13px;
  margin-bottom: 18px;
  text-align: center;
}

.auth-form {
  width: 100%;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-search-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: border-color 0.15s ease;
}

.input-with-icon:focus-within {
  border-color: var(--wa-primary);
}

.input-with-icon svg {
  margin-left: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.input-with-icon input {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14.5px;
}

.input-with-icon input::placeholder {
  color: var(--text-subtle);
}

.toggle-pw-btn {
  background: none;
  border: none;
  padding: 0 12px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  user-select: none;
}

.auth-submit-btn {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
}

.auth-footer-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* App Container */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: 1680px;
  max-height: 100vh;
  display: flex;
  background-color: var(--bg-sidebar);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

@media (min-width: 1441px) {
  .app-container {
    width: 98vw;
    height: 96vh;
    border-radius: 4px;
  }
}

/* ========================================================
   SIDEBAR (LEFT PANE)
   ======================================================== */
.sidebar {
  width: 35%;
  min-width: 320px;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  position: relative;
}

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

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

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00a884, #00705a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}

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

.user-info-text {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #ffd600; /* Yellow default: connecting */
}

.connection-badge.connected .badge-dot {
  background-color: #00a884;
}

.connection-badge.disconnected .badge-dot {
  background-color: var(--wa-danger);
}

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

.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;
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

/* Dropdown Menu */
.menu-dropdown-container {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 48px;
  right: 0;
  background-color: var(--bg-dropdown);
  border-radius: 6px;
  box-shadow: var(--shadow-dropdown);
  width: 220px;
  padding: 8px 0;
  z-index: 1000;
  display: none;
  animation: fadeIn 0.15s ease;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

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

.dropdown-item.danger {
  color: var(--wa-danger);
}

/* Connection Alert Banner */
.connection-banner {
  background-color: #182229;
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.connection-banner:hover {
  background-color: #1f2c34;
}

.banner-icon {
  font-size: 20px;
}

.banner-content {
  flex: 1;
}

.banner-title {
  font-size: 13px;
  font-weight: 600;
  color: #ffaa00;
}

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

.banner-btn {
  background: var(--wa-primary);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

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

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

.search-input-wrapper {
  background-color: var(--bg-search-input);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 36px;
  border: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--wa-primary);
}

.search-icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  padding: 0 8px;
}

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

.clear-search-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: none;
}

/* Filter Chips */
.filter-chips {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  background-color: var(--bg-search-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

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

.chip.active {
  background-color: var(--wa-primary-light);
  color: var(--wa-primary);
  border-color: var(--wa-primary);
  font-weight: 600;
}

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

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

.chat-list::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 3px;
}

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

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

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

.chat-item-avatar {
  margin-right: 14px;
  position: relative;
}

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

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

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

.chat-item-time {
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-left: 8px;
}

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

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

.chat-item.unread .chat-item-name {
  font-weight: 600;
}

.chat-item.unread .chat-item-lastmsg {
  color: var(--text-primary);
  font-weight: 500;
}

.unread-badge {
  background-color: var(--wa-primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
}

.list-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  gap: 12px;
  font-size: 14px;
  text-align: center;
}

/* ========================================================
   MAIN CHAT (RIGHT PANE)
   ======================================================== */
.main-chat {
  flex: 1;
  height: 100%;
  display: flex;
  position: relative;
  background-color: var(--bg-chat);
  overflow: hidden;
}

/* Welcome Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-chat);
  border-bottom: 6px solid var(--wa-primary);
  text-align: center;
  padding: 40px;
}

.welcome-content {
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.welcome-illustration {
  margin-bottom: 24px;
}

.welcome-title {
  font-size: 30px;
  font-weight: 300;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.welcome-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
}

.welcome-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-subtle);
  font-size: 13px;
}

/* Active Chat Layout */
.active-chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
  background-color: var(--bg-chat);
}

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

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.mobile-back-btn {
  display: none;
  margin-right: 4px;
}

.chat-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

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

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

/* Chat Messages Container with Authentic WA Doodle pattern */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 5%;
  position: relative;
  background-color: var(--bg-chat);
  background-image: radial-gradient(rgba(134, 150, 160, 0.05) 1px, transparent 1px);
  background-size: 18px 18px;
}

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

.chat-messages-container::-webkit-scrollbar-thumb {
  background-color: rgba(134, 150, 160, 0.2);
  border-radius: 3px;
}

.messages-flow {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 100%;
  justify-content: flex-end;
}

/* Date Pill Divider */
.date-divider {
  display: flex;
  justify-content: center;
  margin: 12px 0;
  user-select: none;
}

.date-pill {
  background-color: var(--bg-header);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Speech Bubbles */
.message-bubble {
  max-width: 65%;
  min-width: 100px;
  padding: 6px 9px 8px 9px;
  border-radius: 7.5px;
  font-size: 14.2px;
  line-height: 19px;
  position: relative;
  box-shadow: var(--shadow-sm);
  word-wrap: break-word;
}

.message-bubble.outgoing {
  align-self: flex-end;
  background-color: var(--bg-bubble-outgoing);
  color: var(--text-primary);
  border-top-right-radius: 0;
}

.message-bubble.incoming {
  align-self: flex-start;
  background-color: var(--bg-bubble-incoming);
  color: var(--text-primary);
  border-top-left-radius: 0;
}

/* Message Sender Name (in groups) */
.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: #53bdeb;
  margin-bottom: 2px;
}

/* Message Text */
.message-text {
  white-space: pre-wrap;
  user-select: text;
}

.message-text a {
  color: #53bdeb;
  text-decoration: underline;
}

/* Media in Bubbles */
.message-media {
  margin-bottom: 4px;
  border-radius: 6px;
  overflow: hidden;
  max-width: 320px;
}

.message-media img,
.message-media video {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  border-radius: 6px;
}

.message-doc-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 4px;
}

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

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

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

.doc-download-btn {
  color: var(--wa-primary);
  cursor: pointer;
}

/* Bubble Meta (Time + Ticks) */
.message-meta {
  float: right;
  margin-left: 12px;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  user-select: none;
}

.message-bubble.outgoing .message-meta {
  color: rgba(255, 255, 255, 0.6);
}

.status-tick {
  display: inline-flex;
  align-items: center;
}

.status-tick.read svg {
  color: var(--wa-blue-tick) !important;
}

/* Scroll Bottom Button */
.scroll-bottom-btn {
  position: absolute;
  bottom: 80px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--bg-header);
  color: var(--text-secondary);
  border: none;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: transform 0.15s ease;
}

.scroll-bottom-btn:hover {
  transform: scale(1.08);
  color: var(--text-primary);
}

/* Chat Input Footer */
.chat-footer {
  min-height: 62px;
  padding: 8px 16px;
  background-color: var(--bg-header);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  position: relative;
  z-index: 15;
}

.footer-actions-left {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 6px;
}

.chat-input-wrapper {
  flex: 1;
  background-color: var(--bg-search-input);
  border-radius: 8px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  min-height: 42px;
}

.chat-input-wrapper textarea {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  line-height: 20px;
  resize: none;
  max-height: 120px;
}

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

.footer-actions-right {
  padding-bottom: 4px;
}

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--wa-primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

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

/* Emoji Panel */
.emoji-panel {
  position: absolute;
  bottom: 70px;
  left: 16px;
  width: 320px;
  height: 240px;
  background-color: var(--bg-dropdown);
  border-radius: 8px;
  box-shadow: var(--shadow-dropdown);
  display: flex;
  flex-direction: column;
  z-index: 100;
  border: 1px solid var(--border-color);
}

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

.emoji-cat-btn {
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}

.emoji-cat-btn:hover,
.emoji-cat-btn.active {
  background: var(--bg-hover);
}

.emoji-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 10px;
  overflow-y: auto;
  font-size: 22px;
}

.emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  padding: 4px;
  transition: background-color 0.1s ease;
}

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

/* Attachment Menu */
.attachment-menu {
  position: absolute;
  bottom: 70px;
  left: 56px;
  background-color: var(--bg-dropdown);
  border-radius: 8px;
  box-shadow: var(--shadow-dropdown);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  border: 1px solid var(--border-color);
}

.attach-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 14px;
  transition: background-color 0.15s ease;
}

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

.attach-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attach-photo { background: linear-gradient(135deg, #ac44cf, #bf59cf); }
.attach-doc { background: linear-gradient(135deg, #5157ae, #5f66cd); }

/* Slide Drawer: Contact Info */
.contact-info-drawer {
  width: 380px;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  position: absolute;
  right: -380px;
  top: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  box-shadow: var(--shadow-md);
}

.contact-info-drawer.open {
  right: 0;
}

.drawer-header {
  height: 60px;
  padding: 10px 16px;
  background-color: var(--bg-header);
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
}

.drawer-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.drawer-avatar {
  width: 120px;
  height: 120px;
  font-size: 42px;
  margin-bottom: 14px;
}

.drawer-avatar-section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.drawer-avatar-section p {
  font-size: 14px;
  color: var(--text-secondary);
}

.drawer-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-section label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: block;
}

.drawer-about {
  font-size: 14px;
  color: var(--text-primary);
}

.drawer-action-btn {
  width: 100%;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-header);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.15s ease;
}

.drawer-action-btn:hover {
  background: var(--bg-hover);
}

.drawer-action-btn.danger {
  color: var(--wa-danger);
}

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

.modal-card {
  background-color: var(--bg-modal);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.qr-modal-card {
  max-width: 580px;
}

.contacts-modal-card {
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
}

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

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.modal-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

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

.modal-body {
  padding: 24px;
}

/* QR Code Display */
#qrView {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

@media (min-width: 600px) {
  #qrView {
    flex-direction: row;
    align-items: flex-start;
  }
}

.qr-instructions ol {
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.qr-instructions strong {
  color: var(--text-primary);
}

.qr-display-box {
  position: relative;
  width: 240px;
  height: 240px;
  background: #ffffff;
  padding: 12px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qr-display-box img {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-reload-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 27, 33, 0.9);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 8px;
  text-align: center;
  padding: 16px;
}

/* Pairing Code View */
.pairing-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.phone-input-group {
  display: flex;
  align-items: center;
  background: var(--bg-search-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.country-prefix {
  padding: 10px 14px;
  background: var(--bg-header);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  border-right: 1px solid var(--border-color);
}

.phone-input-group input {
  flex: 1;
  padding: 10px 14px;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
}

.pairing-result-box {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-header);
  border-radius: 8px;
  text-align: center;
}

.pairing-code-display {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--wa-primary);
  margin: 12px 0;
  font-family: monospace;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

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

.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-search-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.form-group input:focus {
  border-color: var(--wa-primary);
}

.helper-text {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 4px;
  display: block;
}

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

.btn-primary {
  background-color: var(--wa-primary);
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

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

.btn-primary.full-width {
  width: 100%;
}

.btn-secondary {
  background: none;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

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

/* Contacts Directory Modal */
.contacts-search-box {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.contacts-search-box input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-search-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.contacts-list-container {
  flex: 1;
  overflow-y: auto;
  max-height: 400px;
}

/* Media Preview Modal */
.media-modal-card {
  max-width: 500px;
}

.media-preview-body {
  padding: 16px;
}

.preview-media-holder {
  max-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.preview-media-holder img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
}

.media-caption-input-box {
  display: flex;
  gap: 10px;
}

.media-caption-input-box input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-search-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 168, 132, 0.2);
  border-top-color: var(--wa-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* Notification Subscriptions Styling */
.notif-modal-card {
  max-width: 640px;
}

.notif-status-card {
  background: var(--bg-header);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.notif-status-icon {
  font-size: 28px;
}

.notif-status-info {
  flex: 1;
}

.notif-status-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.notif-status-info p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.table-container {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-top: 8px;
}

.notif-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.notif-table th {
  background: var(--bg-search-input);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 600;
}

.notif-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

/* Responsive Styles */
@media (max-width: 768px) {
  .app-container {
    width: 100vw;
    height: 100vh;
  }

  .sidebar {
    width: 100%;
    max-width: 100%;
  }

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

  .main-chat.mobile-active {
    display: flex;
  }

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

/* ========================================================
   MODERN 2026 WHATSAPP WEB EXTENSIONS
   Status Stories, Settings & Profile, Contact Info Overhaul
   ======================================================== */

/* Slide Drawers (Left Sidebar Overlays) */
.sidebar-slide-drawer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-sidebar);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.35);
}

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

.drawer-header-modern {
  height: 60px;
  background-color: var(--bg-header);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.drawer-header-modern h2,
.drawer-header-modern h3 {
  font-size: 19px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

/* Status Drawer Elements */
.status-indicator-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--wa-primary);
  border: 2px solid var(--bg-header);
}

.status-item-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  position: relative;
}

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

.status-avatar-wrapper {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-avatar-wrapper .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.status-ring {
  position: absolute;
  top: -2px;
  left: -2px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
}

.status-ring.unseen {
  border-color: var(--wa-primary);
}

.status-ring.seen {
  border-color: var(--text-subtle);
}

.status-add-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--wa-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-sidebar);
}

.status-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

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

.status-time-sub {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-action-pill {
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  background-color: var(--bg-search);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
}

.status-action-pill:hover {
  background-color: var(--wa-primary);
  color: #ffffff;
  border-color: var(--wa-primary);
}

.status-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 8px 16px;
}

.status-section-header {
  padding: 10px 16px 4px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--wa-primary);
  letter-spacing: 0.5px;
}

.status-empty-box {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-secondary);
}

.status-empty-box p {
  font-size: 14px;
  margin-bottom: 6px;
}

.status-empty-box small {
  font-size: 12px;
  color: var(--text-subtle);
}

/* Fullscreen Story Viewer */
.story-viewer-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-viewer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 20, 26, 0.94);
  backdrop-filter: blur(8px);
}

.story-viewer-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 85vh;
  max-height: 820px;
  background: #111b21;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 20001;
}

@media (max-width: 540px) {
  .story-viewer-container {
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}

.story-progress-wrapper {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 10;
}

.story-progress-segment {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.story-progress-fill {
  height: 100%;
  width: 0%;
  background: #ffffff;
  border-radius: 2px;
}

.story-progress-segment.completed .story-progress-fill {
  width: 100%;
}

.story-top-header {
  position: absolute;
  top: 22px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  padding: 4px 8px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%);
  border-radius: 8px;
}

.story-sender-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.story-sender-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.story-sender-text {
  display: flex;
  flex-direction: column;
}

.story-sender-name {
  font-size: 14.5px;
  font-weight: 600;
  color: #ffffff;
}

.story-time-ago {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.story-header-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.story-ctrl-btn {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.story-ctrl-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}

.story-canvas {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.story-tap-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  z-index: 5;
  cursor: pointer;
}

.story-tap-zone.left {
  left: 0;
}

.story-tap-zone.right {
  right: 0;
}

.story-content-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-text-view {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  color: #ffffff;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
  user-select: none;
}

.story-media-view {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.story-caption-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
  color: #ffffff;
  font-size: 15px;
  text-align: center;
  z-index: 10;
}

/* Status Creation Modals */
.status-create-card {
  max-width: 480px;
}

.text-status-preview-box {
  width: 100%;
  height: 240px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: background-color 0.25s ease;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.25);
}

.text-status-preview-box textarea {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 20px;
  font-weight: 500;
  text-align: center;
  resize: none;
  outline: none;
  font-family: inherit;
}

.text-status-preview-box textarea::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.color-palette-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.color-palette-bar label {
  font-size: 13px;
  color: var(--text-secondary);
}

.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: #ffffff;
  transform: scale(1.2);
}

.media-upload-dropzone {
  width: 100%;
  min-height: 220px;
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-search-input);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s;
}

.media-upload-dropzone:hover {
  border-color: var(--wa-primary);
}

.dropzone-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

.dropzone-placeholder p {
  font-size: 14px;
  color: var(--text-secondary);
}

.btn-secondary-small {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 16px;
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.btn-primary-small {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  background-color: var(--wa-primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

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

.status-media-preview-holder {
  width: 100%;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.status-media-preview-holder img,
.status-media-preview-holder video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Settings & Profile Drawer Styles */
.settings-card {
  background-color: var(--bg-search-input);
  border-radius: 10px;
  padding: 16px;
  margin: 12px 16px;
  border: 1px solid var(--border-color);
}

.settings-card-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--wa-primary);
  letter-spacing: 0.6px;
  margin-bottom: 14px;
}

.settings-avatar-center {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.settings-avatar-wrapper {
  position: relative;
}

.settings-big-avatar {
  width: 88px;
  height: 88px;
  font-size: 28px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 2px solid var(--wa-primary);
}

.settings-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

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

.field-with-action {
  display: flex;
  gap: 8px;
}

.field-with-action input {
  flex: 1;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.field-with-action input:focus {
  border-color: var(--wa-primary);
}

.field-hint {
  font-size: 11.5px;
  color: var(--text-subtle);
}

.readonly-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--bg-sidebar);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-size: 13.5px;
  color: var(--text-primary);
  font-family: monospace;
}

.readonly-badge .verified-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wa-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

.settings-divider-mini {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 14px 0;
}

.password-toggle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.password-toggle-header small {
  font-size: 11px;
  color: var(--text-subtle);
}

.settings-field-group input[type="text"],
.settings-field-group input[type="email"],
.settings-field-group input[type="tel"],
.settings-field-group input[type="password"] {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.settings-field-group input:focus {
  border-color: var(--wa-primary);
}

.settings-alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.settings-alert.success {
  background-color: rgba(0, 168, 132, 0.15);
  color: #00a884;
  border: 1px solid rgba(0, 168, 132, 0.3);
}

.settings-alert.error {
  background-color: rgba(234, 67, 53, 0.15);
  color: #ea4335;
  border: 1px solid rgba(234, 67, 53, 0.3);
}

/* Overhauled Contact Info Drawer (100% accurate) */
.contact-info-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 30;
  transform: translateX(105%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.contact-info-drawer.open {
  transform: translateX(0);
}

@media (max-width: 900px) {
  .contact-info-drawer {
    width: 100%;
  }
}

.contact-hero-section {
  padding: 24px 20px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--bg-search-input);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.contact-hero-avatar {
  width: 96px;
  height: 96px;
  font-size: 32px;
  border-radius: 50%;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.contact-hero-name {
  font-size: 19px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.contact-hero-phone {
  font-size: 14px;
  color: var(--text-secondary);
}

.contact-hero-badge {
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 12px;
  background-color: rgba(0, 168, 132, 0.15);
  color: var(--wa-primary);
  font-size: 12px;
  font-weight: 500;
}

.contact-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background-color: var(--bg-sidebar);
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.stat-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.drawer-info-card {
  background-color: var(--bg-search-input);
  padding: 14px 16px;
  margin-bottom: 10px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.drawer-info-card.no-padding {
  padding: 0;
}

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

.drawer-about-text {
  font-size: 14.5px;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.group-desc-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
  white-space: pre-wrap;
}

.group-meta-sub {
  font-size: 12px;
  color: var(--text-subtle);
  margin-top: 6px;
}

.participants-badge {
  font-size: 12px;
  color: var(--wa-primary);
}

.participants-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.participant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  background-color: var(--bg-sidebar);
}

.participant-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.participant-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.admin-pill {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background-color: rgba(0, 168, 132, 0.15);
  color: var(--wa-primary);
}

/* Contact Media Tabs */
.contact-media-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
}

.media-tab-btn {
  flex: 1;
  padding: 12px 4px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

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

.media-tab-btn .count-badge {
  padding: 1px 6px;
  border-radius: 10px;
  background-color: var(--bg-search);
  font-size: 11px;
  color: var(--text-secondary);
}

.media-tab-btn.active .count-badge {
  background-color: rgba(0, 168, 132, 0.18);
  color: var(--wa-primary);
}

.contact-tab-content {
  display: none;
  padding: 14px;
  max-height: 260px;
  overflow-y: auto;
}

.contact-tab-content.active {
  display: block;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.media-grid-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background-color: var(--bg-chat);
}

.media-grid-item img,
.media-grid-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.media-grid-item:hover img {
  transform: scale(1.08);
}

.tab-empty-hint {
  text-align: center;
  color: var(--text-subtle);
  font-size: 13px;
  padding: 20px 0;
}

.docs-list,
.links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-item-row,
.link-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background-color: var(--bg-sidebar);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.doc-item-row:hover,
.link-item-row:hover {
  background-color: var(--bg-hover);
}

.doc-item-icon,
.link-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background-color: rgba(0, 168, 132, 0.12);
  color: var(--wa-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-item-text,
.link-item-text {
  flex: 1;
  min-width: 0;
}

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

.link-url {
  color: var(--wa-blue-tick);
}

.doc-meta,
.link-meta {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.contact-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}

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

.contact-action-item.danger {
  color: var(--wa-danger);
}

.contact-action-item.danger:hover {
  background-color: rgba(234, 67, 53, 0.1);
}

/* ============================================================
   PLAYCANVAS 3D INTERACTIVE HERO
   ============================================================ */
.playcanvas-hero-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  cursor: grab;
}

.playcanvas-hero-wrapper:active {
  cursor: grabbing;
}

#playcanvas3d {
  width: 340px;
  height: 220px;
  max-width: 100%;
  border-radius: 16px;
  outline: none;
  filter: drop-shadow(0 12px 28px rgba(0, 168, 132, 0.25));
  transition: transform 0.3s ease;
}

#playcanvas3d:hover {
  transform: scale(1.02);
}

.playcanvas-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(0, 168, 132, 0.12);
  border: 1px solid rgba(0, 168, 132, 0.25);
  font-size: 11px;
  font-weight: 600;
  color: var(--wa-primary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.pc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wa-primary);
  box-shadow: 0 0 8px var(--wa-primary);
  animation: pulsePc 2s infinite ease-in-out;
}

@keyframes pulsePc {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* ============================================================
   FULLSCREEN MEDIA & DOCUMENT VIEWER MODAL
   ============================================================ */
.fullscreen-media-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 20, 26, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fadeInViewer 0.2s ease-out;
}

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

.media-viewer-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.media-viewer-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Viewer Top Bar */
.media-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(11, 20, 26, 0.85) 0%, rgba(11, 20, 26, 0) 100%);
  z-index: 10;
}

.media-viewer-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.media-viewer-icon {
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.media-viewer-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.media-viewer-filename {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
}

.media-viewer-sub {
  font-size: 12px;
  color: #8696a0;
}

.media-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.viewer-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.06);
}

.viewer-action-btn.close-viewer-btn {
  background: rgba(234, 67, 53, 0.2);
  border-color: rgba(234, 67, 53, 0.4);
}

.viewer-action-btn.close-viewer-btn:hover {
  background: rgba(234, 67, 53, 0.8);
}

/* Viewer Body Viewport */
.media-viewer-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  overflow: auto;
  position: relative;
  user-select: none;
}

.fullscreen-img-element {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease-out;
  cursor: grab;
}

.fullscreen-img-element:active {
  cursor: grabbing;
}

.fullscreen-video-element {
  max-width: 90vw;
  max-height: 82vh;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  outline: none;
}

.fullscreen-audio-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 36px 48px;
  border-radius: 20px;
  background: rgba(32, 44, 51, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  max-width: 480px;
  width: 90%;
}

.audio-card-disc {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, #00a884 0%, #111b21 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  box-shadow: 0 8px 24px rgba(0, 168, 132, 0.35);
  animation: rotateDisc 10s linear infinite;
}

@keyframes rotateDisc {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fullscreen-doc-container {
  width: 92vw;
  height: 82vh;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
}

.fullscreen-doc-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

.fullscreen-doc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 48px;
  border-radius: 16px;
  background: rgba(32, 44, 51, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  text-align: center;
  max-width: 520px;
  width: 90%;
}

.doc-big-icon {
  font-size: 64px;
}

.doc-details-name {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  word-break: break-all;
}

.doc-details-meta {
  font-size: 14px;
  color: #8696a0;
}

/* Viewer Caption Footer */
.media-viewer-footer {
  padding: 14px 24px;
  background: linear-gradient(0deg, rgba(11, 20, 26, 0.85) 0%, rgba(11, 20, 26, 0) 100%);
  text-align: center;
  z-index: 10;
}

.media-viewer-caption-text {
  font-size: 15px;
  color: #e9edef;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 16px;
  border-radius: 20px;
  display: inline-block;
  max-width: 80vw;
}

/* Responsive viewer adjustments */
@media (max-width: 768px) {
  .media-viewer-header {
    padding: 10px 14px;
  }
  .media-viewer-filename {
    max-width: 35vw;
  }
  .viewer-action-btn {
    width: 36px;
    height: 36px;
  }
  .fullscreen-doc-container {
    width: 98vw;
    height: 85vh;
  }
}

/* ============================================================
   AVATAR PHOTO & FALLBACK STYLING
   ============================================================ */
.avatar {
  position: relative;
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  z-index: 2;
  transition: opacity 0.2s ease;
}

.avatar-initials {
  position: relative;
  z-index: 1;
}

/* ============================================================
   VOICE NOTE RECORDING BAR & MICROPHONE CONTROLS
   ============================================================ */
.mic-btn {
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.mic-btn:hover {
  color: var(--wa-primary);
  transform: scale(1.1);
}

.voice-recording-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 14px;
  background: var(--bg-hover);
  border-radius: 24px;
  border: 1px solid rgba(0, 168, 132, 0.3);
  animation: slideInRec 0.25s ease-out;
}

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

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

.rec-pulsing-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ea4335;
  box-shadow: 0 0 10px #ea4335;
  animation: pulseRec 1s infinite alternate;
}

@keyframes pulseRec {
  from { opacity: 0.4; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.2); }
}

.rec-timer {
  font-family: monospace;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.rec-wave-animation {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.rec-wave-animation span {
  width: 3px;
  height: 6px;
  background: var(--wa-primary);
  border-radius: 2px;
  animation: waveBar 1.2s infinite ease-in-out;
}
.rec-wave-animation span:nth-child(2) { animation-delay: 0.2s; }
.rec-wave-animation span:nth-child(3) { animation-delay: 0.4s; }
.rec-wave-animation span:nth-child(4) { animation-delay: 0.6s; }
.rec-wave-animation span:nth-child(5) { animation-delay: 0.8s; }

@keyframes waveBar {
  0%, 100% { height: 4px; }
  50% { height: 18px; }
}

.voice-rec-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-cancel-btn {
  color: var(--wa-danger);
  background: rgba(234, 67, 53, 0.12);
  width: 34px;
  height: 34px;
  border-radius: 50%;
}
.rec-cancel-btn:hover {
  background: rgba(234, 67, 53, 0.25);
}

.rec-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

/* ============================================================
   IN-APP FLOATING NOTIFICATION TOAST
   ============================================================ */
.in-app-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  width: calc(100vw - 40px);
  pointer-events: none;
}

.in-app-toast-card {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(32, 44, 51, 0.95);
  border: 1px solid rgba(0, 168, 132, 0.35);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  animation: slideToastDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.2s ease;
}

.in-app-toast-card:hover {
  transform: translateY(-2px);
  border-color: var(--wa-primary);
  box-shadow: 0 16px 40px rgba(0, 168, 132, 0.25);
}

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

.toast-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--wa-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(0, 168, 132, 0.3);
}

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

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-body {
  font-size: 12.5px;
  color: #8696a0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.toast-close-btn {
  background: none;
  border: none;
  color: #8696a0;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.toast-close-btn:hover {
  color: #ffffff;
}



