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

:root {
    --bg-primary: #f8f9fa;
    --bg-secondary: white;
    --bg-sidebar: white;
    --bg-chat: #f8f9fa;
    --bg-input: #f8f9fa;
    --bg-message-own: #e0e0e0;
    --bg-message-other: white;
    --bg-message-system: #e3f2fd;
    --bg-hover: #f0f4ff;
    --bg-selected: #e3f2fd;
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --text-own: #333;
    --border-color: #e1e5e9;
    --border-light: #e0e0e0;
    --shadow-message: 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-sidebar: #16213e;
    --bg-chat: #1a1a2e;
    --bg-input: #0f3460;
    --bg-message-own: #444;
    --bg-message-other: #16213e;
    --bg-message-system: #0f3460;
    --bg-hover: #0f3460;
    --bg-selected: #1a1a2e;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #aaaaaa;
    --text-own: #ffffff;
    --border-color: #0f3460;
    --border-light: #0f3460;
    --shadow-message: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] * {
    color-scheme: dark;
}

[data-theme="dark"] .login-card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .theme-big-btn {
    color: #333;
}

[data-theme="dark"] .message:not(.own) .message-content {
    background: #2196F3 !important;
    color: white !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text-primary);
}

/* Cover Image Styles */
.cover-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://picsum.photos/seed/wammessenger/1920/1080.jpg') center/cover no-repeat;
    z-index: -1;
    opacity: 0.3;
}

.messenger-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://picsum.photos/seed/wammessenger/1920/1080.jpg') center/cover no-repeat;
    z-index: -1;
    opacity: 0.2;
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Hide all pages until auth check completes (prevents flash of login page) */
html.auth-pending .page {
    display: none !important;
}

html.auth-pending body {
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
}

/* Login/Register Styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo {
    margin-bottom: 30px;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.create-group-btn {
    width: 100%;
    padding: 10px 15px;
    margin-top: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.create-group-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.create-group-btn::before {
    content: "+";
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
}

/* Group styling */
.contacts-section-header {
    padding: 10px 15px;
    margin-top: 15px;
    border-bottom: 1px solid var(--border-light);
}

.contacts-section-header:first-child {
    margin-top: 0;
}

.contacts-section-header h4 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact.group {
    background: var(--bg-primary);
    border-left: 3px solid #1a3a5c;
}

.contact.group:hover {
    background: var(--bg-hover);
}

.contact.group.active {
    background: var(--bg-selected);
}

.contact.group.swipe-left {
    transform: translateX(-80px);
    transition: transform 0.3s ease;
}

.contact.group .delete-btn {
    position: absolute;
    right: -80px;
    top: 0;
    width: 80px;
    height: 100%;
    background: #dc3545;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.contact.group .delete-btn:hover {
    background: #c82333;
}

/* User contact swipe delete - same as groups */
.contact.swipe-left {
    transform: translateX(-80px);
    transition: transform 0.3s ease;
}

.contact .delete-btn {
    position: absolute;
    right: -80px;
    top: 0;
    width: 80px;
    height: 100%;
    background: #dc3545;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.contact .delete-btn:hover {
    background: #c82333;
}

/* Message Context Menu */
.message-context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    min-width: 140px;
    z-index: 10000;
    animation: fadeIn 0.15s ease;
}

.message-context-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    color: #dc3545;
    cursor: pointer;
    transition: background 0.15s ease;
}

.message-context-menu button:hover {
    background: var(--bg-primary);
}

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

.group-avatar {
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    color: white;
    font-weight: bold;
}

.group-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 12px;
    opacity: 0.7;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.emoji-panel {
    position: absolute;
    top: 60px;
    right: 10px;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
    max-width: 350px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
}

.emoji-panel-content {
    width: 100%;
}

.emoji-row {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    margin-bottom: 5px;
}

.emoji-item {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: all 0.2s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-item:hover {
    background: var(--bg-input);
    transform: scale(1.1);
}

.message-content {
    background: #7c4dff;
    color: white;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    margin-bottom: 8px;
    position: relative;
}

.message.emoji-only .message-content {
    font-size: 80px;
    max-width: 100%;
    text-align: center;
    padding: 10px;
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 10% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    transition: opacity 0.3s ease;
}

.close:hover {
    opacity: 0.7;
}

#createGroupForm {
    padding: 20px;
}

#createGroupForm .form-group {
    margin-bottom: 20px;
}

#createGroupForm label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

#createGroupForm input,
#createGroupForm textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

#createGroupForm input:focus,
#createGroupForm textarea:focus {
    outline: none;
    border-color: #667eea;
}

#groupAvatar {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.register-link {
    margin-top: 20px;
    color: var(--text-secondary);
}

.register-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.register-link a:hover {
    text-decoration: underline;
}

/* Messenger Styles */
.messenger-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-primary);
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: var(--bg-secondary);
    border-right: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

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

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
}

.user-details {
    flex: 1;
    margin-left: 15px;
    text-align: left;
}

.user-details span {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

.logout-btn {
    margin-top: 5px;
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
}

.settings-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.settings-btn:hover {
    background: var(--border-light);
    transform: scale(1.1);
}

.settings-back-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: #dc3545;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    padding: 0;
    transition: all 0.2s ease;
}

.settings-back-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Theme transition animation layers */
.theme-transition-circle {
    position: fixed;
    border-radius: 50%;
    transform: scale(0);
    pointer-events: none;
    z-index: 0;
    transition: transform 0.6s ease-out, opacity 0.3s ease-out;
}

.search-container {
    padding: 15px;
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    background: var(--bg-primary);
}

.search-container input:focus {
    outline: none;
    border-color: #667eea;
    background: var(--bg-secondary);
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: calc(100% - 5px);
    left: 15px;
    right: 15px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    padding: 6px 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.15s ease;
    gap: 12px;
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.search-result-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.search-result-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-result-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.search-result-status {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.search-result-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

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

.contact {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

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

.contact.active {
    background-color: var(--bg-selected);
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    margin-right: 15px;
}

.contact-info {
    flex: 1;
    text-align: left;
}

.contact-info h4 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

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

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

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

.header-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-input);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.header-action-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.add-members-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    color: white;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.add-members-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.members-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 20px;
}

.member-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    gap: 12px;
    margin-bottom: 6px;
}

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

.member-item.selected {
    background: var(--bg-selected);
    border: 1px solid #667eea;
}

.member-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.member-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.member-item.disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.member-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.members-hint {
    padding: 10px 20px 0;
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.members-count {
    padding: 10px 20px;
    font-size: 13px;
    color: #667eea;
    font-weight: 500;
    text-align: center;
}

#submitAddMembers {
    margin: 0 20px 20px;
    width: calc(100% - 40px);
}

#submitAddMembers:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Group Settings Modal */
.group-settings-content {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.group-info-section {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.group-info-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    color: white;
    font-size: 28px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.group-info-section h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--text-primary);
}

.group-settings-desc {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    word-break: break-word;
}

.group-members-section h4 {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.group-settings-members {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.group-settings-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    background: var(--bg-primary);
}

.group-settings-member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    color: white;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.group-settings-member-info {
    flex: 1;
    text-align: left;
}

.group-settings-member-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.group-settings-member-role {
    font-size: 12px;
    color: #888;
}

.group-settings-member-online {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-user-info {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.chat-user-details {
    min-width: 0;
    overflow: hidden;
}

.chat-user-details h3 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    margin-right: 15px;
}

.chat-user-details h3 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.status.online {
    color: #28a745;
    font-size: 12px;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-primary);
}

.empty-chat-message {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 40px 20px;
    font-size: 16px;
}

.empty-chat-message p {
    margin: 0;
}

.message {
    display: flex;
}

.message.own {
    justify-content: flex-end;
}

.message.system-message {
    justify-content: center;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    background: #2196F3;
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.own .message-content {
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    color: white;
}

.message.system-message .message-content {
    background: var(--bg-selected);
    color: var(--text-secondary);
    font-style: italic;
    font-size: 14px;
}

.message-content p {
    margin: 0;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
}

.message.own .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message:not(.own) .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message-input-container {
    padding: 20px;
    background: var(--bg-secondary);
    border-top: 1px solid #e0e0e0;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-primary);
    border-radius: 25px;
    padding: 5px;
}

.emoji-btn {
    background: var(--bg-input);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s ease;
}

.emoji-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.input-group input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2a42 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.1);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    color: var(--text-primary);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.mobile-menu-btn:hover {
    background: var(--bg-input);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.show {
    display: block;
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar {
        width: 85%;
        max-width: 320px;
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        height: 100dvh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .chat-area {
        width: 100%;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .messenger-container {
        height: 100dvh;
    }
    
    .chat-header {
        padding: 12px 15px;
        min-height: 60px;
        gap: 8px;
    }
    
    .chat-user-info {
        flex: 1;
        min-width: 0;
        order: 0;
    }
    
    .chat-header-actions {
        order: 2;
        margin-left: 0;
        flex-shrink: 0;
    }
    
    .mobile-menu-btn {
        order: -1;
        flex-shrink: 0;
    }
    
    .chat-user-details h3 {
        font-size: 16px;
    }
    
    .chat-avatar {
        width: 36px;
        height: 36px;
        margin-right: 10px;
        flex-shrink: 0;
    }
    
    /* Settings page mobile */
    .settings-mobile-back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: none;
        background: #dc3545;
        color: white;
        cursor: pointer;
        font-size: 18px;
        flex-shrink: 0;
    }
    
    .settings-mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    #settingsPage .chat-header {
        justify-content: flex-start;
        gap: 10px;
    }
    
    #settingsPage .chat-header h3 {
        flex: 1;
        margin: 0;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    #settingsSidebar.sidebar {
        left: -100%;
    }
    
    #settingsSidebar.sidebar.show {
        left: 0;
    }
    
    .messages-container {
        padding: 10px;
    }
    
    .message-input-container {
        padding: 8px 10px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    .input-group {
        gap: 6px;
        padding: 4px;
    }
    
    .emoji-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
        flex-shrink: 0;
    }
    
    .input-group input {
        padding: 0px 0px;
        font-size: 16px;
        min-width: 0;
    }
    
    .send-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    .file-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
        flex-shrink: 0;
    }
    
    .add-members-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .header-action-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .members-list {
        max-height: 50vh;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
