:root {
    --primary-color: #0A3D36; /* Navy Green */
    --primary-light: #145C52;
    --primary-gradient: linear-gradient(135deg, #0A3D36, #0F5549);
    --bg-color: #F0F2F5;
    --sidebar-width: 350px;
    --white: #FFFFFF;
    --text-color: #1a1a1a;
    --text-light: #65676B;
    --border-color: #E4E6EB;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

/* Ensure all form elements inherit the site font */
input, textarea, select, button {
    font-family: inherit;
}

/* Focus states for accessibility (keyboard users) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: var(--primary-gradient);
    position: relative;
    overflow: hidden;
    padding: 1rem;
    box-sizing: border-box;
}

/* WhatsApp-style repeating pattern (light bubbles/icons) */
.login-bg-pattern {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-repeat: repeat;
    background-size: 380px;
    opacity: 0.12;
    filter: brightness(0) invert(1);
}
.login-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.login-bg i {
    position: absolute;
    color: rgba(255, 255, 255, 0.18);
    font-size: clamp(1rem, 3vw, 2.5rem);
    animation: login-bg-float 22s ease-in-out infinite;
}
.login-bg i:nth-child(1) { top: 6%; left: 8%; animation-delay: 0s; font-size: clamp(1.4rem, 3.5vw, 2.8rem); }
.login-bg i:nth-child(2) { top: 14%; right: 10%; animation-delay: -2s; }
.login-bg i:nth-child(3) { top: 22%; left: 4%; animation-delay: -4s; font-size: clamp(1.1rem, 2.8vw, 2rem); }
.login-bg i:nth-child(4) { top: 72%; left: 6%; animation-delay: -1s; }
.login-bg i:nth-child(5) { top: 80%; right: 12%; animation-delay: -3s; font-size: clamp(1.5rem, 3.8vw, 3rem); }
.login-bg i:nth-child(6) { top: 10%; left: 72%; animation-delay: -5s; }
.login-bg i:nth-child(7) { top: 42%; left: 3%; animation-delay: -2.5s; font-size: clamp(1.2rem, 3vw, 2.2rem); }
.login-bg i:nth-child(8) { top: 52%; right: 4%; animation-delay: -6s; }
.login-bg i:nth-child(9) { top: 26%; left: 80%; animation-delay: -1.5s; }
.login-bg i:nth-child(10) { top: 32%; right: 16%; animation-delay: -4.5s; font-size: clamp(1.3rem, 3.2vw, 2.5rem); }
.login-bg i:nth-child(11) { top: 86%; left: 42%; animation-delay: -3.5s; }
.login-bg i:nth-child(12) { top: 4%; left: 42%; animation-delay: -7s; font-size: clamp(1rem, 2.5vw, 1.8rem); }
.login-bg i:nth-child(13) { top: 38%; left: 88%; animation-delay: -0.5s; }
.login-bg i:nth-child(14) { top: 58%; left: 85%; animation-delay: -3.2s; font-size: clamp(1.1rem, 2.7vw, 2rem); }
.login-bg i:nth-child(15) { top: 18%; left: 18%; animation-delay: -5.5s; }
.login-bg i:nth-child(16) { top: 64%; left: 12%; animation-delay: -2s; font-size: clamp(1.3rem, 3.3vw, 2.6rem); }
.login-bg i:nth-child(17) { top: 76%; left: 72%; animation-delay: -6.5s; }
.login-bg i:nth-child(18) { top: 8%; right: 28%; animation-delay: -4s; font-size: clamp(1.2rem, 3vw, 2.3rem); }
.login-bg i:nth-child(19) { top: 46%; right: 72%; animation-delay: -1.2s; }
.login-bg i:nth-child(20) { top: 88%; right: 38%; animation-delay: -5.2s; font-size: clamp(1rem, 2.6vw, 1.9rem); }
.login-bg i:nth-child(21) { top: 12%; left: 52%; animation-delay: -7.5s; }
.login-bg i:nth-child(22) { top: 62%; left: 48%; animation-delay: -3.8s; font-size: clamp(1.4rem, 3.4vw, 2.7rem); }
.login-bg i:nth-child(23) { top: 34%; left: 28%; animation-delay: -2.2s; }
.login-bg i:nth-child(24) { top: 70%; right: 52%; animation-delay: -6.2s; font-size: clamp(1.1rem, 2.8vw, 2.1rem); }
.login-bg i:nth-child(25) { top: 48%; left: 62%; animation-delay: -4.8s; }
.login-bg i:nth-child(26) { top: 28%; right: 42%; animation-delay: -1.8s; font-size: clamp(1.2rem, 3.1vw, 2.4rem); }
@keyframes login-bg-float {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.16; }
    25% { transform: translate(8px, -6px) scale(1.03); opacity: 0.22; }
    50% { transform: translate(-5px, 6px) scale(0.97); opacity: 0.14; }
    75% { transform: translate(6px, 5px) scale(1.02); opacity: 0.2; }
}

.login-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    display: block;
    margin: 0 auto 1.75rem;
    height: 56px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}
.login-card h2 {
    color: var(--primary-color);
    margin-bottom: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.auth-tab {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.auth-tab:hover { color: var(--text-color); }
.auth-tab.active {
    color: var(--primary-color);
    font-weight: 600;
    border-bottom-color: var(--primary-color);
}
.auth-error {
    color: #d32f2f;
    margin-top: 1rem;
    font-size: 0.9rem;
}
.auth-help { color: var(--text-light); font-size: 0.9rem; margin-bottom: 1.25rem; }
.auth-footer { margin-top: 1.25rem; font-size: 0.9rem; }
.auth-footer a { color: var(--primary-color); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }
.form-group-inline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.auth-forgot { color: var(--primary-color); font-size: 0.9rem; text-decoration: none; }
.auth-forgot:hover { text-decoration: underline; }

.form-group {
    margin-bottom: 1.2rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: all 0.3s;
    background: #f9f9f9;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(10, 61, 54, 0.1);
    background: #fff;
}

.btn-primary {
    width: 100%;
    padding: 0.8rem;
    background: var(--primary-gradient);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(10, 61, 54, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(10, 61, 54, 0.3);
}

.btn-secondary {
    padding: 0.6rem 1.2rem;
    background: #e9ecef;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-secondary:hover {
    background: #dee2e6;
}

/* Chat Layout */
.chat-container {
    display: flex;
    height: 100vh;
    background: #fff;
}

/* Sidebar â€“ Futuristic White & Navy Green */
.sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    z-index: 2;
    box-shadow: 2px 0 5px rgba(0,0,0,0.03);
}

.sidebar-brand {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    background-color: #0A3D36; /* Dark Green */
    color: #fff;
    min-height: 56px;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.brand-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo-icon {
    font-size: 1.5rem;
    color: #fff;
}

.brand-name {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

/* User profile block – positioned at top-right of the chat area header */
.user-profile-topright {
    position: relative;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 12px;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    min-width: 56px;
    max-width: 140px;
    display: flex;
    align-items: center;
}

/* Chat header top-right: avatar centered over name (this block only) */
.user-profile-topright .user-profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 6px;
    width: 100%;
    min-width: 44px;
    max-width: 100%;
    overflow: hidden;
}


.user-avatar-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    border-radius: 50%;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.user-avatar-link:hover {
    opacity: 0.85;
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2px solid rgba(10, 61, 54, 0.15);
    flex-shrink: 0;
}

/* Row: three-dots to left of name, both centered under avatar */
.user-name-options-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.user-name-options-row .menu-trigger {
    flex-shrink: 0;
}

.user-profile-topright .user-profile-section .user-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    min-width: 0;
}

/* 3-Dots Menu Button (Options) */
.menu-trigger {
    color: #54656f !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 0.95rem !important;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.menu-trigger:hover {
    background-color: rgba(10, 61, 54, 0.1) !important;
}

/* Global Image Safety */
img {
    max-width: 100%;
}

/* Ensure all avatars/profile images cover their container and are centered */
.avatar, 
.user-avatar, 
.profile-photo-img, 
.chat-header-avatar, 
.group-icon,
.group-info-photo-img,
.msg-image {
    object-fit: cover;
    object-position: center;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Right align text */
}

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

.user-status {
    font-size: 0.75rem;
    color: #a8d5c2; /* Light green/white text */
}

/* User dropdown positioned relative to .user-profile-topright */

.btn-icon {
    background: transparent;
    border: none;
    color: #54656f;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

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

.sidebar-header {
    padding: 10px 16px;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-header h3 {
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar-header button:hover {
    background: rgba(255,255,255,0.3);
}

.search-bar {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem;
    padding-left: 2.5rem; /* For icon if added */
    border: none;
    background: #F0F2F5;
    border-radius: 20px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.search-input:focus {
    background: #fff;
    border: 1px solid rgba(10, 61, 54, 0.25);
    box-shadow: 0 0 0 2px rgba(10, 61, 54, 0.1);
}

.search-input:focus-visible {
    outline: none;
}

.search-empty {
    padding: 1.5rem 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
    text-align: center;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    border-radius: 10px;
    margin: 0.5rem;
    border-left: 3px solid transparent;
}

.chat-item:hover {
    background-color: #F0F2F5;
}

.chat-item.active {
    background-color: rgba(10, 61, 54, 0.08);
    border-left-color: var(--primary-color);
}

.chat-item-pin {
    color: #667781;
    font-size: 0.75rem;
    margin-right: 4px;
    flex-shrink: 0;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    margin-right: 1rem;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-info {
    flex: 1;
    overflow: hidden;
}

.chat-name {
    display: block;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.2rem;
}

.chat-preview {
    display: block;
    color: var(--text-light);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #f5f5f5;
    position: relative;
    z-index: 1;
    min-height: 0;
}

/* Message Actions (React + Menu) - visible on message hover */
.message-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: none;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.95) 25%, #fff 100%);
    border-top-right-radius: 7.5px;
    border-bottom-left-radius: 6px;
    padding: 2px 6px 2px 12px;
    height: 30px;
    align-items: center;
    gap: 4px;
    z-index: 20;
    box-shadow: -2px 1px 4px rgba(0,0,0,0.08);
}

.message.sent .message-actions {
    background: linear-gradient(90deg, transparent 0%, rgba(226, 238, 237, 0.95) 25%, #e2eeed 100%);
}

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

.msg-action-btn {
    cursor: pointer;
    color: #54656f;
    font-size: 17px;
    opacity: 0.85;
    transition: opacity 0.2s, transform 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.msg-action-btn:hover {
    opacity: 1;
    transform: scale(1.15);
    color: var(--primary-color);
}

.msg-action-btn.react-btn {
    font-size: 18px;
}

/* Reaction selector popup (emoji bar when clicking React) */
.context-menu-reactions {
    display: flex !important;
    gap: 6px;
    padding: 8px 12px !important;
    border-radius: 24px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
}

.context-menu-reactions > div {
    font-size: 1.6rem !important;
    padding: 4px;
    border-radius: 50%;
    transition: transform 0.15s;
}

.context-menu-reactions > div:hover {
    transform: scale(1.25);
    background: rgba(0,0,0,0.06);
}

/* Context Menu for Reactions */
.context-menu-reactions {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    padding: 6px 12px;
    gap: 8px;
    animation: fadeIn 0.1s ease-out;
}

/* Chat Header - stack above messages so dropdown is never covered by reaction pills */
.chat-area-top {
    display: flex;
    align-items: center;
    min-height: 60px;
    padding: 0 16px;
    background: #f0f2f5; /* Authentic WhatsApp Chat Header Gray */
    border-bottom: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
    z-index: 100;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Placeholder when no chat selected â€“ keeps header from breaking on first load */
.chat-header-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    /* padding-right: 16px; removed as user block is gone */
}

.chat-header-placeholder-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.chat-header {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
    height: 100%;
    gap: 12px;
    overflow: visible;
}

/* Active Chat Info */
.active-chat-info {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
    cursor: pointer;
}

.chat-header-avatar-wrap {
    flex-shrink: 0;
    margin-right: 12px;
}

.chat-header-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    display: block;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.active-chat-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.active-chat-meta h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.chat-status {
    font-size: 0.85rem;
    color: #111b21;
    font-weight: 500;
    opacity: 1;
}

/* Removed user-block CSS as it is now in sidebar-brand */

/* Date Divider */
.date-divider {
    text-align: center;
    margin: 12px 0;
    display: flex;
    justify-content: center;
}

.date-divider span {
    background-color: #ffffff;
    color: #54656f;
    padding: 5px 12px;
    border-radius: 7.5px;
    font-size: 12.5px;
    box-shadow: 0 1px 2px rgba(11,20,26,0.13);
    text-transform: uppercase;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);
    min-width: 180px;
    padding: 6px 0;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

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

.user-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.user-dropdown .dropdown-item:hover {
    background: rgba(10, 61, 54, 0.06);
}

/* User Profile Menu in Header */
.user-profile-menu {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.user-profile-menu .dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; /* Changed from right: 0 to left: 0 for sidebar alignment */
    background: white;
    box-shadow: var(--shadow-md);
    border-radius: 8px;
    min-width: 200px;
    z-index: 1000; /* Increased z-index */
    overflow: hidden;
    margin-top: 10px;
}

.user-profile-menu:hover .dropdown {
    display: block;
}

.dropdown-header {
    background-color: #f7f7f7;
    color: var(--primary-color);
}

.dropdown-item {
    display: block;
    padding: 10px 15px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background-color: #f0f0f0;
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: 15px;
}

.header-actions .action-btn {
    color: #54656f;
    font-size: 1.2rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
}

/* Mobile-only back button in chat header (WhatsApp-style) */
.chat-back-btn {
    display: none;
    background: none;
    border: none;
    color: #54656f;
    font-size: 1.4rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-right: 4px;
}

.chat-back-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Search in chat bar (below header) */
.search-in-chat-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0f2f5;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.search-in-chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

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

.search-in-chat-count {
    font-size: 12px;
    color: #667781;
    min-width: 60px;
}

.message.search-match .message-bubble {
    background: #fff9c4 !important;
    box-shadow: 0 0 0 2px #fbc02d;
}

.message.search-match.search-current {
    background: transparent;
}

.message.search-match.search-current .message-bubble {
    background: #fff59d !important;
    box-shadow: 0 0 0 2px #f9a825;
}

.messages-container {
    flex: 1;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    z-index: 0;
}

/* Messages - WhatsApp style */
.message {
    max-width: 75%;
    margin-bottom: 8px;
    position: relative;
    font-size: 14.2px;
    line-height: 19px;
    display: flex;
    flex-direction: column;
}

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

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

/* Message row: avatar + bubble (WhatsApp: profile icon beside message) */
.message-outer {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    max-width: 100%;
}

.message.sent .message-outer {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.message.received .message-outer {
    flex-direction: row;
    justify-content: flex-start;
}

/* User profile avatar next to message - WhatsApp style */
.message-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    align-self: flex-end;
    border: 1px solid rgba(0,0,0,0.08);
}

.message.sent .message-avatar {
    margin-left: 4px;
}

.message.received .message-avatar {
    margin-right: 4px;
}

/* Sender name above message in groups */
.message-sender-name {
    font-size: 12.5px;
    color: #e542a3; /* Randomish color - typically WA assigns different colors */
    font-weight: 500;
    margin-bottom: 4px;
    margin-left: 0;
    display: none; /* Hidden by default, JS toggles for groups */
}

.message.sent .message-time {
    color: #111b21; /* Black/dark so visible on light green bubble */
}

/* Reply Preview within Message - WhatsApp style */
.reply-preview {
    background: rgba(0,0,0,0.06);
    border-radius: 6px 6px 6px 4px;
    padding: 6px 10px 6px 8px;
    margin-bottom: 6px;
    display: flex;
    align-items: stretch;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    min-height: 36px;
}

.message.received .reply-preview {
    background: rgba(0,0,0,0.05);
    border-radius: 4px 6px 6px 6px;
}

.message.sent .reply-preview:hover {
    background: rgba(0,0,0,0.08);
}

.message.received .reply-preview:hover {
    background: rgba(0,0,0,0.08);
}

/* Vertical bar like WhatsApp - left accent */
.reply-bar {
    width: 4px;
    min-height: 100%;
    border-radius: 2px;
    margin-right: 10px;
    flex-shrink: 0;
}

.message.sent .reply-bar {
    background: #1b5e20;
}

.message.received .reply-bar {
    background: #00a884;
}

.reply-info {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    overflow: hidden;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

.reply-info strong {
    color: #00a884;
    margin-bottom: 2px;
    font-size: 12.5px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message.sent .reply-info strong {
    color: #1b5e20;
}

.reply-snippet {
    color: #667781;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    line-height: 1.3;
}
.chat-type-group .message.received .message-sender-name {
    display: block;
}

/* Bubble wrapper */
.message-bubble {
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(11,20,26,0.13);
    color: #111b21;
    overflow: visible;
    max-width: 100%;
    min-width: 0;
}

.message.sent .message-bubble {
    background: #e2eeed; /* Soft navy-green tint (app palette) */
    color: #111b21;
    border-top-right-radius: 0;
}

.message.sent .message-bubble::after {
    content: "";
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top-color: #e2eeed;
    border-left-color: #e2eeed;
    border-bottom: 0;
    border-right: 0;
}

.message.received .message-bubble {
    background: #ffffff;
    border-top-left-radius: 0;
}

.message.received .message-bubble::after {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-top-color: #ffffff;
    border-right-color: #ffffff;
    border-bottom: 0;
    border-left: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
}

/* Preserve line breaks and spacing in messages (e.g. pasted code) */
.text-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.message-time {
    font-size: 11px;
    color: #667781;
    float: right;
    margin-top: 4px;
    margin-left: 10px;
    display: flex;
    align-items: center;
    gap: 3px;
    position: relative;
    top: 2px;
    line-height: 1;
}

/* Reactions - visible pills below message (below header dropdown) */
.reactions {
    position: absolute;
    bottom: -10px;
    right: 4px;
    background: #fff;
    border-radius: 12px;
    padding: 3px 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    display: flex;
    gap: 4px;
    z-index: 5;
    font-size: 13px;
    cursor: default;
    border: 1px solid #e2e2e2;
    min-height: 22px;
    align-items: center;
    line-height: 1;
}

.message.received .reactions {
    right: auto;
    left: 4px;
}

.message.sent .reactions {
    background: #e2eeed;
    border-color: #c5ddd9;
}

.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Context Menu / Options Button */
.message-options-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 30px;
    height: 30px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.8) 40%, #fff 100%); /* Fade in effect */
    border-radius: 0 7.5px 0 0;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    color: #54656f;
    opacity: 0;
    transition: opacity 0.2s;
}

.message.sent .message-options-btn {
    background: linear-gradient(90deg, transparent 0%, rgba(226, 238, 237, 0.8) 40%, #e2eeed 100%);
}

.message:hover .message-options-btn {
    display: flex;
    opacity: 1;
}

.read-receipt {
    font-size: 14px;
    color: #667781; /* Gray when sent but not seen */
}

.read-receipt.read {
    color: #53bdeb; /* Blue double tick when seen/read (WhatsApp style) */
}

/* Input Area */
.input-area {
    padding: 12px 16px;
    background: #f0f2f5;
    border-top: 1px solid #d1d7db;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 80px; /* Increased height */
}

.input-area input,
.input-area .message-input {
    flex: 1;
    padding: 14px 18px; /* Increased padding */
    border-radius: 8px;
    border: 1px solid #fff;
    background: #ffffff;
    font-size: 16px; /* Slightly larger font */
    outline: none;
    margin: 5px 0;
}

/* Textarea: preserve pasted newlines (e.g. code); single-line height by default, grows with content */
.input-area .message-input {
    min-height: 60px; /* Bigger default height */
    max-height: 140px;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
}

.input-area .message-input::placeholder {
    color: #667781;
    opacity: 1;
    font-size: 16px;
    font-family: inherit;
}

.action-btn {
    background: none;
    border: none;
    color: #54656f;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--primary-color);
}

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

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lightbox.active {
    display: flex;
    animation: fadeIn 0.2s;
}

.lightbox img {
    max-width: 90%;
    max-height: 85%;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    user-select: none;
}

.lightbox-download {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #fff;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 50%;
    font-size: 1.25rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
    transition: background 0.2s, transform 0.2s;
    z-index: 3010;
}

.lightbox-download:hover {
    background: #f0f0f0;
    transform: translateX(-50%) translateY(-2px);
    color: var(--primary-color);
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 70px;
    left: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    width: 300px;
    height: 350px;
    overflow-y: auto;
    display: none;
    grid-template-columns: repeat(6, 1fr);
    padding: 10px;
    gap: 5px;
    z-index: 1000;
}

.emoji-picker.active {
    display: grid;
}

.emoji-item {
    font-size: 1.5rem;
    cursor: pointer;
    text-align: center;
    padding: 5px;
    border-radius: 4px;
}

.emoji-item:hover {
    background: #f0f0f0;
}

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

/* Message Image */
.message-image {
    max-width: min(300px, 100%);
    max-height: 300px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 2px;
    display: block;
}

/* Message Video + Download */
.message-file-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 100%;
    overflow: hidden;
}

.message-video {
    max-width: min(300px, 100%);
    max-height: 280px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    background: #000;
    margin-bottom: 0;
    display: block;
}

.message-download-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(10, 61, 54, 0.12);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 50%;
    font-size: 1rem;
    transition: background 0.2s;
    margin-top: 4px;
}

.message-download-link:hover {
    background: rgba(10, 61, 54, 0.25);
    color: var(--primary-color);
}

.message-file-wrap .message-image {
    margin-bottom: 0;
}

.message-document-wrap {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.message-document-wrap .message-document {
    margin-bottom: 0;
}

/* Message Document â€” WhatsApp Style Card */
.message-document-wrap {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: rgba(0,0,0,0.03);
    border-radius: 6px;
    padding: 0;
    margin-bottom: 2px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0,0,0,0.05);
    max-width: min(280px, 100%);
}

.message-document {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    text-decoration: none;
    color: inherit;
    flex: 1;
    min-width: 0; /* For truncation */
}

.message-document:hover {
    background: rgba(0,0,0,0.02);
}

.message-document i {
    font-size: 24px;
    color: #e55353; /* Red for PDF/File */
}

.message-document .doc-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.message-document .doc-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

.message-document .doc-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

.message-download-link {
    display: none !important; /* Hide separate download button, card is clickable */
}

/* Reply Indicator in Input (WhatsApp Style) */
.reply-indicator {
    padding: 8px 12px;
    background: #f0f2f5; /* Light gray */
    border-left: 4px solid var(--primary-color);
    margin: 8px 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
}

.reply-indicator .reply-content {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: var(--text-color);
}

.reply-indicator strong {
    color: var(--primary-color);
    margin-bottom: 2px;
    font-size: 12px;
}

.reply-indicator .close-reply {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.reply-indicator .close-reply:hover {
    color: var(--text-color);
}

/* Highlight the original message when user clicks "reply" preview */
.message.reply-highlight .message-bubble {
    animation: replyHighlight 2.5s ease-out;
}

@keyframes replyHighlight {
    0% { box-shadow: 0 0 0 2px rgba(10, 61, 54, 0.6); background-color: rgba(226, 238, 237, 0.8); }
    30% { box-shadow: 0 0 0 4px rgba(10, 61, 54, 0.3); }
    100% { box-shadow: 0 1px 0.5px rgba(0,0,0,0.13); background-color: inherit; }
}

.message.received.reply-highlight .message-bubble {
    animation: replyHighlightReceived 2.5s ease-out;
}

@keyframes replyHighlightReceived {
    0% { box-shadow: 0 0 0 2px rgba(10, 61, 54, 0.5); background-color: rgba(255, 255, 255, 0.95); }
    30% { box-shadow: 0 0 0 4px rgba(10, 61, 54, 0.25); }
    100% { box-shadow: 0 1px 0.5px rgba(0,0,0,0.13); background-color: #ffffff; }
}

/* Removed conflicting reactions block */

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Create Group modal â€“ participant search & chips */
.group-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}
.group-search-item:hover {
    background: rgba(10, 61, 54, 0.06);
}
.group-search-item .avatar.small {
    width: 32px;
    height: 32px;
    margin-right: 0;
}
.group-search-item .add-tag {
    margin-left: auto;
    color: var(--primary-color);
    font-size: 0.85rem;
}
.group-search-item .added-tag {
    margin-left: auto;
    color: var(--text-light);
    font-size: 0.8rem;
}
#groupSearchResults {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 8px;
    background: #fff;
}
#selectedParticipants {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 24px;
}
.participant-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(10, 61, 54, 0.1);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--primary-color);
}
.participant-chip .chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: #666;
    padding: 0 2px;
}
.participant-chip .chip-remove:hover {
    color: var(--primary-color);
}
.avatar.small {
    width: 32px;
    height: 32px;
    margin-right: 0;
}

/* Group info modal */
.group-info-participants {
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 1rem;
}
.group-info-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}
.group-info-member:last-child {
    border-bottom: none;
}
.modal-actions {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.btn-danger {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-danger:hover {
    background: #c82333;
}

/* Chat header dropdown (Group info / Leave group) */
.header-actions-chat {
    position: relative;
}
.chat-header-menu-wrap {
    position: relative;
}
.chat-header-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);
    min-width: 180px;
    padding: 6px 0;
    z-index: 10001;
    border: 1px solid var(--border-color);
}
.chat-header-dropdown.show {
    display: block;
}
.chat-header-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: background 0.2s;
}
.chat-header-dropdown .dropdown-item:hover {
    background: rgba(10, 61, 54, 0.06);
}

/* Call trigger and dropdown */
.call-trigger-wrap {
    position: relative;
    overflow: visible;
}
.call-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);
    min-width: 160px;
    padding: 6px 0;
    z-index: 10002;
    border: 1px solid var(--border-color);
}
.call-dropdown.show {
    display: block;
}
.call-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
}
.call-dropdown .dropdown-item:hover {
    background: rgba(10, 61, 54, 0.06);
}
.call-dropdown .dropdown-item-divider {
    height: 1px;
    padding: 0;
    margin: 4px 0;
    background: var(--border-color);
    cursor: default;
}
.call-dropdown .dropdown-item-divider:hover {
    background: var(--border-color);
}

/* Call history modal */
.call-history-modal-content {
    max-width: 420px;
    width: 95%;
}
.call-history-toolbar {
    padding: 0 1rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
.call-history-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-color);
    cursor: pointer;
}
.call-history-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 0.5rem 0;
}
.call-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}
.call-history-item:hover {
    background: rgba(10, 61, 54, 0.04);
}
.call-history-item:last-child {
    border-bottom: none;
}
.call-history-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.call-history-item-icon.voice { background: rgba(10, 61, 54, 0.12); color: var(--primary-color); }
.call-history-item-icon.video { background: rgba(39, 174, 96, 0.15); color: #27ae60; }
.call-history-item-icon.incoming { color: #3498db; }
.call-history-item-icon.outgoing { color: var(--primary-color); }
.call-history-item-icon.missed { background: rgba(231, 76, 60, 0.12); color: #e74c3c; }
.call-history-item-body {
    flex: 1;
    min-width: 0;
}
.call-history-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}
.call-history-item-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 2px;
}
.call-history-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Call overlay (full-screen call UI) */
.call-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, #0A3D36 0%, #0d4d44 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.call-overlay-content {
    text-align: center;
    color: #fff;
}
.call-overlay-avatar-wrap {
    margin-bottom: 16px;
}
.call-overlay-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.3);
}
.call-overlay-name {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
}
.call-overlay-status {
    margin: 0 0 24px 0;
    opacity: 0.9;
    font-size: 1rem;
}
.call-overlay-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}
.call-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.call-action-btn.end-call {
    background: #e74c3c;
    color: #fff;
}
.call-overlay-video-wrap {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto 16px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}
.call-remote-video {
    width: 100%;
    height: auto;
    max-height: 360px;
    display: block;
}
.call-local-video {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.5);
}
.call-action-btn.accept-call {
    background: #27ae60;
    color: #fff;
}

/* Incoming call modal */
.incoming-call-modal {
    z-index: 10001;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
}

.incoming-call-modal .incoming-call-content {
    background: radial-gradient(circle at top, #15b894 0%, #0d4d44 40%, #0a3d36 70%, #041916 100%);
    border-radius: 28px;
    padding: 2.5rem 2.25rem;
    text-align: center;
    max-width: 380px;
    width: 92%;
    box-shadow:
        0 26px 52px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.incoming-call-modal .incoming-call-content::before {
    content: "";
    position: absolute;
    inset: -40%;
    background: radial-gradient(circle at 10% -10%, rgba(255, 255, 255, 0.18), transparent 60%);
    opacity: 0.7;
    pointer-events: none;
}

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

.incoming-call-avatar-wrap {
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
    z-index: 1;
}

.incoming-call-avatar-pulse {
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    background: rgba(39, 174, 96, 0.15);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.5;
    }
}

.incoming-call-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(39, 174, 96, 0.6);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(39, 174, 96, 0.3);
    position: relative;
    z-index: 1;
    animation: avatarPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes avatarPop {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.incoming-call-label {
    margin: 0 0 8px 0;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(236, 252, 250, 0.84);
}

.incoming-call-name {
    margin: 0 0 4px 0;
    font-size: 1.7rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.incoming-call-type {
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.22rem 0.8rem;
    border-radius: 999px;
    background: rgba(2, 22, 21, 0.45);
    border: 1px solid rgba(179, 255, 229, 0.2);
}

.incoming-call-type::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.22);
}

.incoming-call-timer {
    margin: 0 0 24px 0;
    font-size: 0.82rem;
    color: rgba(226, 252, 246, 0.85);
    font-weight: 500;
}
.incoming-call-actions {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.incoming-call-actions .call-action-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 13px 26px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 18px;
    min-width: 120px;
    border: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.incoming-call-actions .call-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.incoming-call-actions .call-btn-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.incoming-call-actions .call-action-btn.end-call .call-btn-icon {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.5), rgba(192, 57, 43, 0.5));
    color: #ff6b5a;
}

.incoming-call-actions .call-action-btn.accept-call .call-btn-icon {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.6), rgba(27, 155, 72, 0.6));
    color: #52d469;
}

.incoming-call-actions .call-btn-label {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
}

.incoming-call-actions .call-action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.incoming-call-actions .call-action-btn:hover:not(:disabled) .call-btn-icon {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.incoming-call-actions .call-action-btn.accept-call:hover:not(:disabled) .call-btn-icon {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.8), rgba(27, 155, 72, 0.8));
    box-shadow: 0 8px 24px rgba(39, 174, 96, 0.4);
}

.incoming-call-actions .call-action-btn.end-call:hover:not(:disabled) .call-btn-icon {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.7), rgba(192, 57, 43, 0.7));
    box-shadow: 0 8px 24px rgba(231, 76, 60, 0.3);
}

.incoming-call-actions .call-action-btn:active:not(:disabled) {
    transform: translateY(0);
}

.incoming-call-actions .call-action-btn:active:not(:disabled) .call-btn-icon {
    transform: scale(0.95);
}

/* Sidebar tasks row */
.sidebar-tasks-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
}
.tasks-trigger-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
}
.tasks-trigger-btn:hover {
    opacity: 0.85;
}
.tasks-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tasks-trigger-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
}

/* Tasks modal */
.tasks-modal-content {
    max-width: 520px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}
.tasks-modal-content .modal-header.tasks-modal-header {
    position: relative;
    flex-shrink: 0;
    padding: 1rem 1.25rem 1rem 1.25rem;
    padding-right: 3.5rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(to bottom, #fafbfc 0%, var(--white) 100%);
}
.tasks-modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem 0;
}
.tasks-modal-header h3 i {
    margin-right: 8px;
    color: var(--primary-color);
}
.tasks-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-light);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.2s, color 0.2s;
}
.tasks-modal-close:hover {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}
.tasks-modal-close:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
.tasks-modal-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.tasks-list-wrap {
    padding: 1rem 1.25rem 1.25rem;
}
.tasks-list {
    max-height: 380px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 4px;
}
.tasks-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}
.tasks-tabs {
    display: flex;
    gap: 0;
    background: #eef0f2;
    border-radius: 10px;
    padding: 3px;
}
.tasks-tab {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--text-light);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.tasks-tab:hover { color: var(--text-color); background: rgba(255,255,255,0.6); }
.tasks-tab.active {
    background: var(--white);
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tasks-list .task-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1rem 1rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 10px;
    background: var(--white);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, border-color 0.2s;
    border-left: 3px solid var(--primary-color);
}
.tasks-list .task-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border-color: rgba(10, 61, 54, 0.2);
}
.tasks-list .task-item.completed {
    border-left-color: #27ae60;
    background: #f8fcf9;
}
.tasks-list .task-item.completed .task-title { text-decoration: line-through; color: var(--text-light); }
.tasks-list .task-item .task-body { flex: 1; min-width: 0; }
.tasks-list .task-item .task-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-color);
}
.tasks-list .task-item .task-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 6px;
    line-height: 1.4;
}
.tasks-list .task-item .task-notes {
    font-size: 0.85rem;
    color: var(--text-color);
    margin-top: 10px;
    padding: 10px 12px;
    background: #f5f6f8;
    border-radius: 8px;
    border-left: 3px solid rgba(10, 61, 54, 0.3);
    white-space: pre-wrap;
    line-height: 1.45;
}
.tasks-list .task-item .task-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 14px;
}
.tasks-list .task-item .task-actions .task-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    transition: transform 0.15s, background 0.15s;
}
.tasks-list .task-item .task-actions .task-btn:hover {
    transform: translateY(-1px);
}
.tasks-list .task-item .task-actions .task-btn:active {
    transform: translateY(0);
}
.task-btn-complete { background: rgba(39, 174, 96, 0.12); color: #1e8449; }
.task-btn-complete:hover { background: rgba(39, 174, 96, 0.22); }
.task-btn-note { background: rgba(10, 61, 54, 0.08); color: var(--primary-color); }
.task-btn-note:hover { background: rgba(10, 61, 54, 0.15); }
.task-btn-delete { background: rgba(231, 76, 60, 0.1); color: #c0392b; }
.task-btn-delete:hover { background: rgba(231, 76, 60, 0.2); }
.task-note-form { margin-top: 10px; display: none; }
.task-note-form.show { display: block; }
.task-note-form textarea {
    width: 100%;
    min-height: 72px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    resize: vertical;
}
.task-note-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(10, 61, 54, 0.15);
}
.task-note-form .task-note-save { margin-right: 8px; }
.task-note-form .btn-primary.small, .task-note-form .btn-secondary.small { padding: 6px 14px; font-size: 0.85rem; border-radius: 8px; }

#createTaskBtn {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s, box-shadow 0.15s;
}
#createTaskBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(10, 61, 54, 0.25);
}
.tasks-empty {
    padding: 2rem 1rem !important;
    text-align: center;
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.5;
}
.create-task-form,
.assign-task-step {
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
}
.create-task-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.create-task-form-actions .btn-primary,
.create-task-form-actions .btn-secondary {
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.tasks-cancel-btn {
    background: #f0f0f0;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}
.tasks-cancel-btn:hover {
    background: #e5e5e5;
    border-color: #ccc;
}
.task-assign-results {
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin: 8px 0;
}
.task-assign-results .user-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
}
.task-assign-results .user-option:hover {
    background: rgba(10, 61, 54, 0.06);
}

/* Selected user for task assign */
.task-assign-selected {
    margin: 12px 0;
}
.task-assign-selected-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
}
.task-assign-selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(10, 61, 54, 0.08);
    border: 1px solid rgba(10, 61, 54, 0.2);
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--text-color);
    min-width: 0;
}
.task-assign-selected-chip i {
    color: var(--primary-color);
    font-size: 1rem;
    flex-shrink: 0;
}
.task-assign-selected-chip span {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.task-assign-change-btn {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary-color);
    background: rgba(10, 61, 54, 0.1);
    border: 1px solid rgba(10, 61, 54, 0.25);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.task-assign-change-btn:hover {
    background: rgba(10, 61, 54, 0.15);
    border-color: var(--primary-color);
}

.tasks-empty {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0;
    padding: 1rem 0;
}
.task-new {
    color: var(--primary-color);
    font-weight: 600;
}

/* Starred messages modal list */
.starred-messages-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.starred-message-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.starred-message-item:hover {
    background: #f5f5f5;
}

.starred-message-item .snippet {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    color: #111;
}

.starred-message-item .meta {
    font-size: 0.75rem;
    color: #667781;
    margin-top: 2px;
}

.starred-message-item .jump-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 0.8rem;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.starred-message-item .jump-btn:hover {
    opacity: 0.9;
}

.message-bubble .starred-indicator {
    color: #f9a825;
    font-size: 11px;
    margin-left: 4px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    margin-top: -81px;
}

.close:hover {
    color: #000;
}

/* Context Menu */
.context-menu {
    position: absolute;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    padding: 5px 0;
    z-index: 1000;
    min-width: 120px;
}

.context-menu-reactions {
    min-width: auto;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
}

.context-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-item:hover {
    background-color: #f0f0f0;
}

/* Reply Indicator in Input */
/* Overwritten by block above */

/* Edit Indicator in Input */
.edit-indicator {
    padding: 8px 12px;
    background: rgba(10, 61, 54, 0.08);
    border-left: 4px solid var(--primary-color);
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--primary-color);
}
.edit-indicator .close-edit {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
}
.edit-indicator .close-edit:hover {
    color: var(--primary-color);
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 50vh;
    overflow-y: auto;
    pointer-events: none;
}

.toast-container .toast {
    pointer-events: auto;
}

.toast {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { border-left: 4px solid #4CAF50; }
.toast.error { border-left: 4px solid #F44336; }
.toast.info { border-left: 4px solid #2196F3; }

/* Message list loading state */
.messages-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: var(--text-light);
}

.messages-loading-spinner {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.messages-loading-text {
    margin: 0;
    font-size: 0.95rem;
}

/* Send button loading state */
.send-btn-loading {
    cursor: wait;
}

.send-btn-loading i {
    font-size: 1.2rem;
}

/* Empty State – No Chat Selected */
.no-chat-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
    background: transparent;
    text-align: center;
    padding: 40px 20px;
    box-sizing: border-box;
}

.no-chat-icon {
    font-size: 72px;
    color: rgba(10, 61, 54, 0.12);
    margin-bottom: 20px;
    opacity: 0.9;
}

.no-chat-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.no-chat-subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
    max-width: 320px;
}

/* Settings page */
.settings-page {
    background: var(--bg-color);
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem;
    box-sizing: border-box;
}
.settings-container { max-width: 560px; margin: 0 auto; }
.settings-header { margin-bottom: 1.25rem; }
.settings-back {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.5rem;
    transition: gap 0.2s ease, text-decoration 0.2s ease;
}

.settings-back:hover {
    text-decoration: underline;
}

.settings-back:hover i {
    transform: translateX(-3px);
}

.settings-back i {
    transition: transform 0.2s ease;
}
.settings-header h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 750;
    color: var(--text-color);
    letter-spacing: -0.02em;
}
.settings-card {
    background: #fff;
    border-radius: 14px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.settings-profile-photo { margin-bottom: 1.5rem; text-align: center; }
.settings-profile-photo label { display: block; margin-bottom: 0.5rem; color: var(--text-light); font-size: 0.9rem; font-weight: 600; }

.profile-photo-wrap { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 1rem; 
}

.profile-photo-img {
    width: clamp(100px, 30vw, 150px);
    height: clamp(100px, 30vw, 150px);
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 0.5rem;
    border: 4px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: block;
    flex-shrink: 0;
}

/* Styled Upload Button */
.profile-photo-upload {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #f0f2f5;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.profile-photo-upload:hover {
    background: #e2e6ea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    color: var(--primary-color);
}

.profile-photo-upload:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.profile-photo-upload i {
    font-size: 1.1rem;
    color: var(--primary-color);
}

/* Settings form: icon-prefixed inputs */
.form-input-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.form-input-icon-wrap .form-input-icon {
    position: absolute;
    left: 0.85rem;
    color: var(--primary-color);
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0.7;
}
.form-input-icon-wrap .form-control {
    padding-left: 2.4rem;
}

.settings-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
.settings-actions .btn-primary {
    width: auto;
    padding: 0.75rem 2rem;
    font-size: 0.95rem;
}

/* =======================================================================
   Mobile Responsive Layout â€“ WhatsApp-style
   - Small screens: first show chat list (sidebar)
   - When a chat is opened: show full-screen chat with back arrow
   ======================================================================= */
@media (max-width: 768px) {
    body {
        overflow: hidden;
        background: #000;
    }

    body.settings-page {
        overflow-y: auto;
        background: var(--bg-color);
        padding: 1rem;
    }

    body.settings-page .settings-card {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .chat-container {
        position: relative;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        overflow: hidden;
        background: #000;
    }

    /* Sidebar acts as the main WhatsApp \"Chats\" screen */
    .sidebar {
        width: 100%;
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        height: 100vh;
    }

    .sidebar-brand {
        min-height: 60px;
        height: auto;
    }

    .search-bar {
        padding: 8px 12px;
    }

    .chat-list {
        height: calc(100vh - 60px - 56px); /* header + search */
    }

    /* Chat area overlays the whole screen when a conversation is open */
    .chat-area {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        display: none;
        flex-direction: column;
    }

    /* Mobile chat header: consistent layout; overflow visible so dropdowns show above chat */
    .chat-area-top {
        min-height: 56px;
        padding: 0 10px;
        gap: 8px;
        background: #fff;
        border-bottom: 1px solid var(--border-color);
        flex-wrap: nowrap;
        overflow: visible;
        align-items: center;
        z-index: 200;
    }

    .chat-header-placeholder,
    .chat-header {
        flex: 1;
        min-width: 0;
        overflow: visible;
    }

    /* Left: contact block – avatar over name/status */
    .active-chat-info {
        min-width: 0;
        flex: 1;
        overflow: hidden;
        gap: 4px;
    }

    .chat-header-avatar-wrap {
        flex-shrink: 0;
    }

    .chat-header-avatar {
        width: 36px;
        height: 36px;
    }

    .active-chat-meta {
        min-width: 0;
        overflow: hidden;
        flex: 1;
        width: 100%;
    }

    .active-chat-meta h3 {
        font-size: 0.9rem;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin: 0;
        display: block;
    }

    .chat-status {
        font-size: 0.7rem;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--text-light);
        display: block;
    }

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

    .header-actions {
        gap: 6px;
        flex-shrink: 0;
        margin-left: 6px;
    }

    .header-actions .action-btn:first-child {
        margin-left: -25px;
    }

    .header-actions .action-btn,
    .chat-back-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .chat-back-btn {
        margin-right: 2px;
    }

    /* Right: logged-in user block – same pattern (avatar over name), not cut off */
    .user-profile-topright {
        padding-left: 8px;
        padding-right: 6px;
        border-left: 1px solid rgba(0, 0, 0, 0.08);
        flex-shrink: 0;
        min-width: 52px;
        max-width: 60px;
        overflow: visible;
    }

    .user-profile-topright .user-profile-section {
        gap: 4px;
        min-width: 0;
        align-items: center;
    }

    .user-name-options-row .user-name {
        display: block;
        font-size: 0.7rem;
        font-weight: 600;
        line-height: 1.25;
        max-width: 68px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-height: 1.25em;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    /* Messages: comfortable padding and spacing */
    .messages-container {
        padding: 16px 12px;
        min-height: 0;
        background: #f5f5f5;
        position: relative;
        z-index: 0;
    }

    /* Dropdowns (3-dots menus) must appear above chat on mobile */
    .chat-header-dropdown.show,
    .user-dropdown.show {
        z-index: 10002;
    }

    .message {
        max-width: 88%;
    }

    .message-bubble {
        padding: 10px 12px;
        font-size: 15px;
    }

    .message-time {
        font-size: 11px;
    }

    .date-divider {
        margin: 10px 0;
    }

    .date-divider span {
        font-size: 11px;
        padding: 4px 10px;
    }

    /* Input area: clearly separate from chat on mobile (strong contrast) */
    .input-area {
        flex-shrink: 0;
        padding: 12px 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        background: #e4e6eb;
        border-top: 2px solid #cfd3d8;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
        gap: 8px;
    }

    .input-area .action-btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 1.25rem;
        color: #54656f;
    }

    .input-area .message-input {
        min-height: 44px;
        max-height: 120px;
        padding: 12px 14px;
        font-size: 16px;
        background: #fff;
        border: 2px solid #cfd3d8;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .menu-trigger {
        color: #54656f !important;
        width: 0px !important;
        height: 28px !important;
        font-size: 0.95rem !important;
        background: transparent;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }

    /* Back button only visible when chat view is active */
    body.mobile-conversation-open .chat-back-btn {
        display: flex;
    }

    /* When a chat is open on mobile: hide sidebar, show chat area */
    body.mobile-conversation-open .sidebar {
        display: none;
    }

    body.mobile-conversation-open .chat-area {
        display: flex;
    }

    /* When no chat is open, make sure chat area stays hidden */
    body:not(.mobile-conversation-open) .chat-area {
        display: none;
    }

    /* Message images/videos: never wider than available bubble space */
    .message-image,
    .message-video {
        max-width: 100%;
        max-height: 240px;
    }

    /* User profile modal: tighter on phones */
    .user-profile-modal-content {
        max-width: 96vw;
    }

    /* Settings page: reduce profile photo slightly on very small phones */
    .profile-photo-wrap {
        gap: 0.75rem;
    }

    /* Modal: tighter margin on small phones */
    .modal-content {
        width: 95%;
        padding: 1.25rem;
    }
}

/* ── User Profile View Modal ─────────────────────────────────────────────── */
.user-profile-modal-content {
    text-align: center;
    padding: 0;
    max-width: 360px;
    position: relative;
    overflow: hidden;
}

.user-profile-modal-content .close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    font-size: 1.4rem;
    cursor: pointer;
    color: rgba(255,255,255,0.9);
    line-height: 1;
    z-index: 2;
    transition: color 0.15s;
}

.user-profile-modal-content .close:hover {
    color: #fff;
}

.user-profile-modal-avatar-wrap {
    background: var(--primary-gradient);
    padding: 2rem 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.user-profile-modal-avatar {
    width: clamp(72px, 20vw, 96px);
    height: clamp(72px, 20vw, 96px);
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.9);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    display: block;
}

.user-profile-modal-name {
    font-size: clamp(1rem, 4vw, 1.25rem);
    font-weight: 700;
    margin: 0;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.user-profile-modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.user-profile-modal-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.user-profile-modal-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: #333;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    background: #f5f7f9;
    border: 1px solid #e8ecef;
    word-break: break-all;
}

.user-profile-modal-row i {
    color: var(--primary-color);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.quick-profile-modal-content {
    padding: 0;
    background: transparent;
    box-shadow: none;
    max-width: 560px;
    position: relative;
}

.quick-profile-modal-content .settings-card {
    border-radius: 15px;
}

.chat-header-avatar {
    cursor: pointer;
}

.message.received .message-avatar {
    cursor: default;
}

