/* ==========================================================================
   ChatApp Stylesheet - Premium Dark Theme & Layout (Telegram-inspired)
   ========================================================================== */

/* Design Tokens & Variables */
:root {
  /* Premium Light Theme Colors (Telegram Web Light clone) */
  --tg-bg: #f4f4f5;
  --tg-sidebar-bg: #ffffff;
  --tg-chat-bg: #f4f4f5;
  --tg-active-item: #3390ec;
  --tg-item-hover: #f4f4f5;
  
  --color-primary: #3390ec;
  --color-primary-hover: #2b7ecf;
  --color-primary-glow: rgba(51, 144, 236, 0.2);
  
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f4f4f5;
  --bg-input: #f4f4f5;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(51, 144, 236, 0.5);
  
  --text-primary: #212121;
  --text-secondary: #707579;
  --text-muted: #9e9e9e;
  
  /* Message Bubble Colors (Light Theme Telegram) */
  --msg-self-bg: #eeffde; /* Signature light green */
  --msg-self-text: #212121;
  --msg-other-bg: #ffffff; /* Signature white */
  --msg-other-text: #212121;
  --msg-time-self: #5f925f;
  --msg-time-other: #707579;

  /* Typography */
  --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-family-display: 'Outfit', sans-serif;
  
  /* Animations */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 16px var(--color-primary-glow);
}

/* Global Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
}

body {
  font-family: var(--font-family-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* General Layout helpers */
.hidden {
  display: none !important;
}

/* Glassmorphism utility */
.glass-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

/* Button Component */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  font-family: var(--font-family-sans);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-full {
  width: 100%;
}

.primary-btn {
  background-color: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--color-primary-glow);
}

.primary-btn:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--color-primary-glow);
}

.primary-btn:active {
  transform: translateY(0);
}

.google-btn {
  background-color: #ffffff;
  color: #1f2937;
  font-family: var(--font-family-display);
  font-weight: 500;
  box-shadow: var(--shadow-md);
}

.google-btn:hover {
  background-color: #f7f9fa;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.google-btn:active {
  transform: translateY(0);
}

.google-svg {
  margin-right: 4px;
}

.text-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.text-btn:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

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

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

.icon-btn i, .icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Badge component */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.india-badge {
  background: rgba(255, 153, 51, 0.15);
  border: 1px solid rgba(255, 153, 51, 0.3);
  color: #ff9933;
}

.badge-sm {
  font-size: 0.8rem;
  vertical-align: middle;
}

/* ==========================================================================
   VIEW 1 & 2: Wizard & Login Screen
   ========================================================================== */
.view-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
}

.config-card, .login-card {
  width: 100%;
  max-width: 450px;
  padding: 40px;
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.logo-animation, .logo-wrapper {
  background: rgba(30, 136, 229, 0.15);
  border: 1.5px solid rgba(30, 136, 229, 0.3);
  width: 72px;
  height: 72px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  box-shadow: 0 8px 24px rgba(30, 136, 229, 0.15);
}

.logo-icon, .app-logo {
  width: 32px;
  height: 32px;
  color: var(--color-primary);
}

.config-card h2, .login-card .app-title {
  font-family: var(--font-family-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle, .tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.instructions {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--color-primary);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Input group */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-group textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  color: var(--text-primary);
  font-family: monospace;
  font-size: 0.85rem;
  resize: vertical;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.85rem;
}

/* Login specific decor */
.login-decorations .circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.15;
}

.login-decorations .c1 {
  width: 250px;
  height: 250px;
  background: var(--color-primary);
  top: -80px;
  right: -80px;
}

.login-decorations .c2 {
  width: 300px;
  height: 300px;
  background: #ff9933; /* Indian flag orange tint */
  bottom: -100px;
  left: -100px;
}

.features-preview {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.feature-item i {
  color: var(--color-primary);
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   VIEW 3: Main Dashboard Application Layout
   ========================================================================== */
.dashboard-container {
  display: grid;
  grid-template-columns: 350px 1fr;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* Sidebar Styling */
.sidebar {
  background-color: var(--tg-sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  z-index: 20;
}

.sidebar-header {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

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

.app-brand-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-title {
  font-family: var(--font-family-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Search bar styling */
.search-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-wrapper input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 10px 16px 10px 38px;
  color: var(--text-primary);
  font-family: var(--font-family-sans);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.search-wrapper input:focus {
  border-color: var(--color-primary);
  background-color: var(--tg-bg);
}

/* Chat Row / User List styling */
.chats-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.section-title {
  padding: 16px 16px 8px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 4px 8px; /* Floating capsule spacing */
  border-radius: 12px;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  border-left: none;
  position: relative;
}

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

.chat-item.active {
  background: linear-gradient(135deg, #3390ec, #1c7cd6) !important; /* Telegram blue capsule */
  color: #ffffff !important;
}

.chat-item.active .chat-name,
.chat-item.active .chat-last-msg,
.chat-item.active .chat-time {
  color: #ffffff !important;
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.global-avatar {
  background: linear-gradient(135deg, #1e88e5, #00d2ff);
  color: #ffffff;
}

.global-avatar i {
  width: 22px;
  height: 22px;
}

.avatar-initials {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
  color: #ffffff;
  background: var(--color-primary);
  text-transform: uppercase;
}

/* User status badge on avatar */
.avatar-status-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--tg-sidebar-bg);
  background-color: #5e6d7e;
}

.avatar-status-badge.online {
  background-color: #4caf50;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

.chat-item.active .avatar-status-badge {
  border-color: var(--tg-active-item);
}

.chat-details {
  flex: 1;
  min-width: 0; /* Important for ellipsis */
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

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

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

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

.chat-last-msg {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
}

.chat-item.active .chat-last-msg, .chat-item.active .chat-time {
  color: #a4bcd4;
}

/* Sidebar Footer (Profile Bar) */
.sidebar-footer {
  padding: 12px 16px;
  background-color: #f4f4f5;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-profile-summary img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.user-profile-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  font-size: 0.7rem;
  text-transform: capitalize;
}

.user-status.online {
  color: #4caf50;
}

.logout-btn {
  color: #e57373;
}

.logout-btn:hover {
  background-color: rgba(229, 115, 115, 0.15);
  color: #ef5350;
}

/* ==========================================================================
   Chat Window (Right Pane)
   ========================================================================== */
.chat-window {
  background-color: var(--tg-chat-bg);
  background-image: radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 20px 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Empty State */
.no-chat-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.no-chat-illustration {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 320px;
}

.chat-bubble-graphic {
  width: 80px;
  height: 80px;
  background: rgba(30, 136, 229, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.plane-graphic {
  width: 32px;
  height: 32px;
  transform: rotate(-10deg) translateX(2px);
}

.no-chat-illustration h3 {
  font-family: var(--font-family-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.no-chat-illustration p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Active Chat container */
.chat-active-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-header-avatar-container {
  position: relative;
  flex-shrink: 0;
}

.avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e88e5, #00d2ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.avatar-placeholder i {
  width: 18px;
  height: 18px;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

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

.chat-header-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chat-header-status.online {
  color: #4caf50;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Messages History Panel with Telegram Wallpaper Doodle */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #eefad6;
  /* Blended official Telegram doodle chat background wallpaper */
  background-image: linear-gradient(rgba(238, 250, 214, 0.88), rgba(238, 250, 214, 0.88)), url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
  background-repeat: repeat;
  background-size: 380px;
}

/* Message Bubble */
.message-bubble {
  display: inline-block;
  max-width: 68%;
  padding: 6px 10px 5px 10px;
  position: relative;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.4;
  margin-bottom: 2px;
  animation: messageIn 0.2s cubic-bezier(0, 0, 0.2, 1) forwards;
}

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

.message-bubble.self {
  align-self: flex-end;
  background-color: var(--msg-self-bg);
  color: var(--msg-self-text);
  border-radius: 12px 12px 0px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.message-bubble.other {
  align-self: flex-start;
  background-color: var(--msg-other-bg);
  color: var(--msg-other-text);
  border-radius: 12px 12px 12px 0px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

/* Message Meta (Sender details inside bubbles for groups) */
.message-sender {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
  font-family: var(--font-family-display);
}

/* Unique color tags for group senders */
.color-sender-1 { color: #f06292; }
.color-sender-2 { color: #4db6ac; }
.color-sender-3 { color: #ffb74d; }
.color-sender-4 { color: #a1887f; }
.color-sender-5 { color: #ba68c8; }
.color-sender-6 { color: #64b5f6; }
.color-sender-7 { color: #81c784; }
.color-sender-8 { color: #e57373; }

.message-text {
  display: inline;
}

.message-time-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 8px;
  float: right;
  position: relative;
  bottom: -3px;
  font-size: 0.65rem;
  user-select: none;
  pointer-events: none;
}

.message-time {
  font-size: 0.65rem;
  font-weight: 400;
}

.message-bubble.self .message-time-wrapper {
  color: var(--msg-time-self);
}

.message-bubble.other .message-time-wrapper {
  color: var(--msg-time-other);
}

.message-status-ticks {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -1.5px;
}

.message-status-ticks.sent {
  color: rgba(95, 146, 95, 0.45); /* Soft gray-green single tick */
}

.message-status-ticks.delivered {
  color: rgba(95, 146, 95, 0.45); /* Soft double ticks */
}

.message-status-ticks.read {
  color: #3390ec; /* Signature Telegram blue checkmarks when read */
}

/* Floating capsule input panel */
.chat-input-container {
  padding: 16px 24px;
  background-color: transparent;
  border-top: none;
  z-index: 10;
  display: flex;
  justify-content: center;
}

.message-form {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 760px; /* Slim centered capsule like Telegram/Apple */
}

.input-wrapper {
  flex: 1;
  background: #ffffff; /* Clean white for light mode */
  border: none; /* Borderless */
  border-radius: 24px; /* Capsule shape */
  padding: 6px 18px; /* Slightly increased padding for premium feel */
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06); /* Premium floating shadow */
  transition: box-shadow 0.3s ease;
}

.input-wrapper:focus-within {
  box-shadow: 0 8px 28px rgba(51, 144, 236, 0.15); /* Soft blue shadow on focus */
}

.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 0;
  color: var(--text-primary);
  font-family: var(--font-family-sans);
  font-size: 0.95rem;
}

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

.input-wrapper input:focus {
  border: none;
  box-shadow: none;
}

.emoji-btn, .paperclip-btn {
  color: var(--text-secondary);
  width: 36px !important;
  height: 36px !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.send-btn {
  background-color: #3390ec !important;
  color: #ffffff !important;
  border-radius: 50% !important;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0 !important;
  box-shadow: 0 4px 12px rgba(51, 144, 236, 0.3);
  transition: transform var(--transition-fast), background-color var(--transition-fast);
  border: none !important;
}

.send-btn.active-send {
  background-color: #3390ec !important;
  color: #ffffff !important;
}

.send-btn:hover {
  transform: scale(1.05);
  background-color: #2b7ecf !important;
  box-shadow: 0 6px 16px rgba(51, 144, 236, 0.4);
}

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

.send-btn i {
  width: 18px;
  height: 18px;
  transform: translate(-1px, 0); /* align plane center visually */
}

/* Loading animations */
.loading-spinner-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Mobile responsive navigation toggles */
.mobile-only-btn {
  display: none;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Media Queries)
   ========================================================================== */

/* Laptop / Desktop adaptation */
@media (min-width: 769px) {
  /* Ensure correct column display */
  .dashboard-container {
    grid-template-columns: 320px 1fr;
  }
  
  @media (min-width: 1024px) {
    .dashboard-container {
      grid-template-columns: 350px 1fr;
    }
  }
}

/* Mobile Screens (Phones and small Tablets) */
@media (max-width: 768px) {
  .dashboard-container {
    grid-template-columns: 1fr; /* Stack into single column overlay */
    position: relative;
  }
  
  .sidebar {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    transition: transform var(--transition-normal);
    transform: translateX(0);
  }
  
  .chat-window {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    transition: transform var(--transition-normal);
    transform: translateX(100%); /* Hidden to the right */
  }
  
  /* Slide states triggered by class on parent */
  .dashboard-container.chat-open .sidebar {
    transform: translateX(-25%); /* Partially slide away */
    filter: brightness(0.6);
  }
  
  .dashboard-container.chat-open .chat-window {
    transform: translateX(0); /* Slides in from right */
  }
  
  .mobile-only-btn {
    display: inline-flex;
  }
  
  #no-chat-selected {
    display: none; /* Never show empty state on mobile since we slide in only when open */
  }
}

/* Emoji Picker CSS */
.chat-input-container {
  position: relative; /* Ensure absolute positioning works for picker */
}

.emoji-picker {
  position: absolute;
  bottom: 70px;
  left: 20px;
  background: #ffffff; /* Clean white for light mode */
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  max-width: 250px;
}

.emoji-item {
  font-size: 1.25rem;
  padding: 6px;
  cursor: pointer;
  text-align: center;
  border-radius: 8px;
  transition: background-color var(--transition-fast);
  user-select: none;
}

.emoji-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

/* Real-time Call Modal Overlay */
.call-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  animation: fadeInFast var(--transition-normal);
}

.green-call-card {
  width: 100%;
  max-width: 440px;
  height: 520px;
  background: linear-gradient(135deg, #4fa853, #388e3c); /* Telegram Green style */
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.call-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  z-index: 10;
}

.call-icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.call-icon-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.05);
}

.call-icon-btn i, .call-icon-btn svg {
  width: 18px;
  height: 18px;
}

.call-main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex: 1;
  z-index: 10;
}

.call-main-content h2 {
  font-family: var(--font-family-display);
  font-size: 2.2rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

#call-status-label {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.5px;
}

.call-avatar-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  text-transform: uppercase;
}

.call-frame-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #0e1621;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.call-frame-container.hidden {
  display: none !important;
}

.call-controls-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 10px;
  z-index: 10;
}

.call-control-btn {
  background: none;
  border: none;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform var(--transition-fast);
  width: 76px;
}

.call-control-btn i, .call-control-btn svg {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  transition: background-color var(--transition-fast);
}

.call-control-btn:hover i, .call-control-btn:hover svg {
  background-color: rgba(255, 255, 255, 0.28);
}

.call-control-btn:hover {
  transform: translateY(-2px);
}

.call-control-btn span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  text-transform: capitalize;
}

.call-control-btn.end-call i, .call-control-btn.end-call svg {
  background-color: #e53935;
}

.call-control-btn.end-call:hover i, .call-control-btn.end-call:hover svg {
  background-color: #c62828;
}

.call-card.fullscreen {
  max-width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
}

/* Call button tweaks in header */
.chat-header-right button {
  transition: all var(--transition-fast);
}

#audio-call-btn:hover {
  color: #4caf50;
  background-color: rgba(76, 175, 80, 0.12);
}

#video-call-btn:hover {
  color: #2196f3;
  background-color: rgba(33, 150, 243, 0.12);
}

/* System call logs - sleek compact capsules aligning right/left like text */
.message-bubble.call-log-bubble {
  border-radius: 16px !important;
  padding: 10px 14px !important;
  max-width: 280px;
  margin: 6px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
}

.message-bubble.call-log-bubble.active {
  cursor: pointer;
  border: 1px solid rgba(51, 144, 236, 0.3) !important;
}

.message-bubble.call-log-bubble.active:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(51, 144, 236, 0.15);
}

.message-bubble.call-log-bubble.self {
  align-self: flex-end;
  background-color: var(--msg-self-bg);
  color: var(--msg-self-text);
}

.message-bubble.call-log-bubble.other {
  align-self: flex-start;
  background-color: var(--msg-other-bg);
  color: var(--msg-other-text);
}

.call-log-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.call-log-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.call-log-icon-wrapper.active {
  background-color: rgba(51, 144, 236, 0.15);
  color: #3390ec;
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(51, 144, 236, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(51, 144, 236, 0); }
  100% { box-shadow: 0 0 0 0 rgba(51, 144, 236, 0); }
}

.call-log-icon-wrapper.connected {
  background-color: rgba(76, 175, 80, 0.12);
  color: #4caf50;
}

.call-log-icon-wrapper.missed {
  background-color: rgba(244, 67, 54, 0.12);
  color: #f44336;
}

.call-log-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.call-log-status {
  font-size: 0.88rem;
  font-weight: 600;
}

.call-log-time {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.message-bubble.call-log-bubble.self .call-log-time {
  color: var(--msg-time-self);
}

.message-bubble.call-log-bubble.other .call-log-time {
  color: var(--msg-time-other);
}

/* Floating Chat Header Menu Dropdown */
.chat-more-dropdown {
  position: absolute;
  top: 50px;
  right: 10px;
  background-color: #ffffff;
  border-radius: 12px;
  width: 200px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  padding: 6px 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  animation: fadeInFast 0.15s ease-out;
}

.chat-more-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  color: #212121;
  font-size: 0.88rem;
  transition: background-color var(--transition-fast);
}

.chat-more-dropdown .dropdown-item:hover {
  background-color: #f4f4f5;
}

.chat-more-dropdown .dropdown-item i, .chat-more-dropdown .dropdown-item svg {
  width: 16px;
  height: 16px;
  color: #707579;
}

.chat-more-dropdown .dropdown-item.delete-item {
  color: #d32f2f;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: 4px;
  padding-top: 8px;
}

.chat-more-dropdown .dropdown-item.delete-item i, .chat-more-dropdown .dropdown-item.delete-item svg {
  color: #d32f2f;
}

/* Typing Indicator Bouncing Dots */
.chat-header-status.typing {
  color: #4fa853 !important;
  display: flex;
  align-items: center;
}

.typing-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 3px;
  align-items: center;
  height: 12px;
}

.typing-dots span {
  font-weight: bold;
  animation: bounce 1.4s infinite both;
  font-size: 1.1rem;
  line-height: 0.5;
}

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

.typing-dots span:nth-child(3) {
  animation-delay: .4s;
}

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
}

/* Friday/Monday Date Separators */
.date-separator {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  width: 100%;
}

.date-separator span {
  background: rgba(112, 117, 121, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 4px 14px;
  border-radius: 14px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Floating settings dropdown menu style */
.settings-dropdown {
  position: absolute;
  top: 50px;
  left: 0;
  background: rgba(255, 255, 255, 0.76) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-radius: 12px;
  width: 230px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  padding: 8px 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  animation: fadeInFast 0.15s ease-out;
}

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

.settings-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  cursor: pointer;
  color: #212121;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color var(--transition-fast);
}

.settings-dropdown .dropdown-item:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.settings-dropdown .dropdown-item i, .settings-dropdown .dropdown-item svg {
  width: 18px;
  height: 18px;
  color: #707579;
}

.settings-dropdown .dropdown-item.logout-item {
  color: #d32f2f;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: 4px;
  padding-top: 12px;
}

.settings-dropdown .dropdown-item.logout-item i, .settings-dropdown .dropdown-item.logout-item svg {
  color: #d32f2f;
}

/* Dropdown Toggle Switch CSS */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  background-color: #ccc;
  border-radius: 9px;
  transition: background-color 0.2s;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.toggle-switch.active {
  background-color: #3390ec;
}

.toggle-switch.active::after {
  transform: translateX(16px);
}

.dropdown-item-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* Microphone recording pulse animation */
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 115, 115, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(229, 115, 115, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 115, 115, 0); }
}

.recording-pulse {
  animation: pulse 1.2s infinite;
  background-color: #ef5350 !important;
  color: #ffffff !important;
}

/* Sidebar Unread Messages Styling */
.chat-item.has-unread {
  background-color: rgba(51, 144, 236, 0.06) !important; /* Soft Telegram blue highlight tint */
  border-left: 3px solid #3390ec; /* Soft blue bar indicator */
}

.unread-badge-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  flex-shrink: 0;
}

.unread-badge {
  background-color: #3390ec; /* Telegram blue badge */
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 12px;
  padding: 2px 7px;
  min-width: 18px;
  height: 18px;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(51, 144, 236, 0.25);
  display: inline-block;
}

/* Floating typing message bubble containing 3 scaling bouncing dots */
.message-bubble.typing-bubble {
  align-self: flex-start;
  background-color: var(--msg-other-bg);
  border-radius: 12px 12px 12px 0px;
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 36px;
  margin-bottom: 8px;
  border: 1px solid rgba(0, 0, 0, 0.03);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.typing-indicator-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-indicator-dots span {
  width: 6px;
  height: 6px;
  background-color: #a0a0a0;
  border-radius: 50%;
  display: inline-block;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ==========================================================================
   Profile details Drawer & Sidebar Edit Views Styles
   ========================================================================== */

.sidebar-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background-color: var(--tg-sidebar-bg);
}

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

.sidebar-view-header h3 {
  font-family: var(--font-family-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-view-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Edit Profile Avatar Overlay and Camera Hover Effect */
.edit-avatar-section {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.edit-avatar-container {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  border: 3px solid var(--tg-sidebar-bg);
}

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

.avatar-camera-overlay {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
  background-color: #3390ec;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border: 3px solid #ffffff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  opacity: 1 !important;
  transition: background-color var(--transition-fast) ease;
}

.avatar-camera-overlay:hover {
  background-color: #2b7ecf;
}

.avatar-camera-overlay i, .avatar-camera-overlay svg {
  width: 16px;
  height: 16px;
}

/* Edit form fields styling */
.edit-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.edit-form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
}

.edit-form-group input, .edit-form-group textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  color: var(--text-primary);
  font-family: var(--font-family-sans);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.edit-form-group input:focus, .edit-form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
  background-color: #ffffff;
}

.edit-form-group textarea {
  resize: none;
}

.username-input-wrapper {
  display: flex;
  align-items: center;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding-left: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.username-input-wrapper:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
  background-color: #ffffff;
}

.username-at {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  margin-right: 2px;
  user-select: none;
}

.username-input-wrapper input {
  border: none !important;
  padding-left: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.field-help {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.username-status-msg {
  font-size: 0.78rem;
  font-weight: 500;
  margin-top: 2px;
  min-height: 18px;
}

.username-status-msg.success {
  color: #4caf50;
}

.username-status-msg.error {
  color: #f44336;
}

/* ==========================================================================
   Right side Telegram-style Profile Details Drawer
   ========================================================================== */

.profile-panel {
  background-color: var(--tg-sidebar-bg);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  z-index: 25;
  transition: transform var(--transition-normal);
}

.profile-panel-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  min-height: 60px;
  background-color: var(--tg-sidebar-bg);
}

.profile-panel-header h3 {
  font-family: var(--font-family-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.profile-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  flex-shrink: 0;
}

.profile-avatar-wrapper {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 3px solid var(--border-color);
}

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

.profile-avatar-section h2 {
  font-family: var(--font-family-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

.profile-display-status {
  font-size: 0.8rem;
  color: #4caf50;
  font-weight: 500;
}

.profile-info-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 16px;
  background-color: var(--bg-tertiary);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.02);
  transition: background-color var(--transition-fast);
}

.info-card:hover {
  background-color: var(--tg-item-hover);
}

.info-card i, .info-card svg {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
  margin-top: 2px;
  flex-shrink: 0;
}

.info-card-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.info-card-details span:first-child {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.info-card-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.profile-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-top: 16px;
  flex-shrink: 0;
}

.profile-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  border-bottom: 2px solid transparent;
  text-align: center;
}

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

/* ==========================================================================
   Layout grid adaptability & Responsiveness
   ========================================================================== */

/* ==========================================================================
   Layout grid adaptability & Responsiveness
   ========================================================================== */

/* Bottom Navigation Bar (Mobile only) */
.mobile-nav {
  display: none;
}

/* Grid layout with 3 columns when profile drawer is open */
@media (min-width: 769px) {
  .profile-panel {
    display: none;
  }
  .desktop-only-btn {
    display: inline-flex !important;
  }
}

@media (min-width: 769px) and (max-width: 1023px) {
  .dashboard-container.profile-open {
    grid-template-columns: 320px 1fr;
    position: relative;
  }
  
  .dashboard-container.profile-open .profile-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    z-index: 100;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
    display: flex !important;
    transform: translateX(0);
    border-left: 1px solid var(--border-color);
  }
}

@media (min-width: 1024px) {
  .dashboard-container.profile-open {
    grid-template-columns: 350px 1fr 350px;
  }
  
  .dashboard-container.profile-open .profile-panel {
    display: flex !important;
    width: 350px;
    transform: translateX(0);
    border-left: 1px solid var(--border-color);
  }
}

/* Mobile responsive drawer sliding and tab views behaviour */
@media (max-width: 768px) {
  .dashboard-container {
    grid-template-columns: 1fr;
    position: relative;
  }
  
  .sidebar, .profile-panel {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding-bottom: 64px; /* Space for bottom nav bar */
    z-index: 20;
    transition: transform var(--transition-normal);
  }
  
  /* Slide transition for profile panel if used as drawer overlap */
  .profile-panel {
    z-index: 25;
    border-left: none;
  }
  
  /* Header adjustments for Telegram Mobile Screenshot 1 look */
  .sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--tg-sidebar-bg);
  }
  
  .header-top {
    height: 48px;
  }
  
  .app-brand-menu button {
    display: none; /* Hide hamburger settings menu on mobile */
  }
  
  .sidebar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2b90ef; /* Telegram blue color */
  }
  
  /* Chat window slides in full screen overlaying everything */
  .chat-window {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 150; /* Above bottom nav and other panels */
    transition: transform var(--transition-normal);
    transform: translateX(100%);
  }
  
  .dashboard-container.chat-open .chat-window {
    transform: translateX(0);
  }
  
  /* Hide bottom nav when chat window is active */
  .dashboard-container.chat-open .mobile-nav {
    transform: translateY(100%);
  }

  /* Bottom Navigation Layout */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background-color: var(--tg-sidebar-bg);
    border-top: 1px solid var(--border-color);
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-normal);
  }
  
  .nav-tab {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    width: 70px;
    height: 100%;
    transition: color var(--transition-fast);
  }
  
  .nav-tab i, .nav-tab svg {
    display: inline-flex;
    box-sizing: content-box;
    width: 22px;
    height: 22px;
    padding: 4px 14px;
    border-radius: 20px;
    transition: background-color var(--transition-fast), color var(--transition-fast), transform 0.2s;
  }
  
  .nav-tab.active {
    color: var(--color-primary);
  }
  
  .nav-tab.active i, .nav-tab.active svg {
    background-color: rgba(51, 144, 236, 0.12);
    color: var(--color-primary);
    transform: scale(1.05);
  }
  
  .nav-profile-avatar-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: content-box;
    width: 24px;
    height: 24px;
    padding: 3px 13px;
    border-radius: 20px;
    transition: background-color var(--transition-fast), color var(--transition-fast), transform 0.2s;
  }
  
  .nav-profile-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
  }
  
  .nav-tab.active .nav-profile-avatar-wrapper {
    background-color: rgba(51, 144, 236, 0.12);
  }
  
  .nav-tab.active .nav-profile-avatar {
    border-color: var(--color-primary);
  }
  
  .desktop-only-btn {
    display: none !important;
  }
  
  /* Hide search button inside chat header on mobile */
  .chat-header-right button:first-child {
    display: none !important;
  }
}

/* ==========================================================================
   Mockup screens exact styling matches (Screenshots 3, 4, 5)
   ========================================================================== */

/* Profile action pills matching Screenshot 3 */
.profile-action-pills {
  display: flex;
  justify-content: center;
  gap: 16px;
  width: 100%;
  margin: 16px 0;
  flex-shrink: 0;
}

.action-pill-btn {
  flex: 1;
  max-width: 110px;
  background-color: #f0f4f9;
  border: none;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}

.action-pill-btn:hover {
  background-color: #e2ebf5;
  transform: translateY(-1px);
}

.action-pill-btn i, .action-pill-btn svg {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
}

/* Profile details info list grouped into one card container */
.profile-panel-body .profile-info-cards {
  background-color: #ffffff;
  border-radius: 16px;
  padding: 8px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.profile-panel-body .info-card {
  background: none !important;
  border: none !important;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0 !important;
  padding: 12px 0 !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 20px !important;
}

.profile-panel-body .info-card:last-child {
  border-bottom: none;
}

.profile-panel-body .info-card i, .profile-panel-body .info-card svg {
  width: 22px;
  height: 22px;
  color: #707579;
  flex-shrink: 0;
  margin-top: 4px;
}

.profile-panel-body .info-card-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-panel-body .info-card-details span:first-child {
  font-size: 0.98rem;
  font-weight: 500;
  color: #212121;
  word-break: break-word;
}

.profile-panel-body .info-card-label {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Profile posts section (Screenshot 3) */
.profile-posts-content {
  padding: 24px 16px;
  text-align: center;
}

.no-posts-illustration {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.no-posts-illustration h3 {
  font-family: var(--font-family-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.no-posts-illustration p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 250px;
  line-height: 1.4;
  margin-bottom: 8px;
}

.add-post-btn {
  background-color: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 10px 24px;
  font-weight: 600;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--color-primary-glow);
  transition: transform 0.2s, background-color 0.2s;
}

.add-post-btn:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
}

.add-post-btn i, .add-post-btn svg {
  width: 16px;
  height: 16px;
}

/* Account card groups matching Screenshot 4 & 5 */
.account-edit-body {
  gap: 16px !important;
  background-color: #f4f4f7;
  padding: 16px !important;
}

.settings-card-group {
  background-color: #ffffff;
  border-radius: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.settings-card-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.2px;
}

.settings-card-fields {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.border-bottom-input {
  border-bottom: 1px solid var(--border-color);
}

.settings-card-fields input, .settings-card-fields textarea {
  border: none !important;
  background: transparent !important;
  padding: 8px 0 !important;
  box-shadow: none !important;
  font-size: 0.95rem;
  color: #212121;
}

.settings-card-fields input:focus, .settings-card-fields textarea:focus {
  background: transparent !important;
  box-shadow: none !important;
}

.bio-label-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.bio-char-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 8px 0 0 8px;
}

.field-help-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.field-help-label a {
  color: var(--color-primary);
  text-decoration: none;
}

/* Info list details inside cards (Screenshot 4) */
.info-list-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-list-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.info-list-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-item-icon-wrapper {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  margin-top: 4px;
}

.info-item-icon-wrapper i, .info-item-icon-wrapper svg {
  width: 20px;
  height: 20px;
}

.info-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-item-details input {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  font-size: 0.95rem;
  font-weight: 500;
  color: #212121;
  box-shadow: none !important;
}

.info-item-details .username-input-wrapper {
  background: transparent !important;
  border: none !important;
  padding-left: 0 !important;
}

.info-item-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* MegaPhone Channel elements (Screenshot 4 & 5) */
.clickable-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  cursor: pointer;
}

.row-icon-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.row-icon-title i, .row-icon-title svg {
  width: 20px;
  height: 20px;
}

.row-icon-title span {
  font-size: 0.92rem;
  font-weight: 500;
  color: #212121;
}

.orange-icon { color: #ff9800; }
.purple-icon { color: #9c27b0; }
.blue-icon { color: #2196f3; }

.text-link-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.badge-new-pill {
  background-color: var(--color-primary);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.5px;
}

.action-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  width: 100%;
}

.logout-red-btn {
  background-color: #ffffff !important;
  color: #d32f2f !important;
  border: 1px solid rgba(211, 47, 47, 0.2) !important;
  box-shadow: none !important;
}

.logout-red-btn:hover {
  background-color: #ffebee !important;
}

/* Contacts search and lists */
.contacts-search-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
}

.contacts-search-wrapper i, .contacts-search-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  width: 16px;
  height: 16px;
}

.contacts-search-wrapper input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 10px 16px 10px 38px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast);
}

.contacts-search-wrapper input:focus {
  border-color: var(--color-primary);
  background-color: #ffffff;
}

.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Settings Options Menu lists */
.settings-view-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px !important;
  background-color: #f4f4f7;
}

.settings-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background-color: #ffffff;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.settings-profile-header img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.settings-profile-meta h4 {
  font-family: var(--font-family-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-profile-meta span {
  font-size: 0.8rem;
  color: #4caf50;
  font-weight: 500;
}

.settings-options-list {
  background-color: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings-option-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  font-size: 0.92rem;
  font-weight: 500;
  color: #212121;
  border-bottom: 1px solid var(--border-color);
}

.settings-option-item:last-child {
  border-bottom: none;
}

.settings-option-item:hover {
  background-color: var(--tg-item-hover);
}

.settings-option-item i, .settings-option-item svg {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}

.settings-option-item.logout-red-item {
  color: #d32f2f;
}

.settings-option-item.logout-red-item i, .settings-option-item.logout-red-item svg {
  color: #d32f2f;
}

/* Chat list username styling */
.chat-username {
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 500;
  margin-left: 4px;
}

.chat-item.active .chat-username {
  color: rgba(255, 255, 255, 0.8) !important;
}


