/* ... (all your existing CSS code) ... */
:root {
    /* Primary colors */
    --primary-bg: #121212;
    --secondary-bg: #1e1e1e;
    --accent-color: #FF5722;
    --accent-light: #ff8a50;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
    --hover-color: #2a2a2a;
    
    /* Sizes */
    --sidebar-width: 280px;
    --header-height: 60px;
    --footer-height: 70px;
    --border-radius: 16px;
    
    /* Animations */
    --transition: all 0.3s ease;
    --scale-animation: scale(1.05);
}

/* Light theme styles */
.light-theme {
    --primary-bg: #f5f5f5;
    --secondary-bg: #ffffff;
    --text-primary: #000000;
    --text-secondary: #555555;
    --border-color: #e0e0e0;
    --hover-color: #f0f0f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--primary-bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    transition: var(--transition);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-light);
}

/* Loading animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes wave {
    0% { height: 5px; }
    50% { height: 20px; }
    100% { height: 5px; }
}

/* Splash screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #121212 0%, #2a0c00 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

.splash-logo {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 2rem;
    animation: pulse 2s infinite;
}

.splash-text {
    font-size: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

/* Main container */
.container {
    display: flex;
    height: 100vh;
    transition: var(--transition);
    position: relative;
}

/* Sidebar (menu) */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    z-index: 100;
}

/* App header */
.app-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--secondary-bg);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    cursor: pointer;
    transition: var(--transition);
}

.logo:hover {
    transform: var(--scale-animation);
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover {
    background-color: var(--hover-color);
}

/* Search */
.search-container {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    display: flex;
    align-items: center;
    background-color: var(--primary-bg);
    border-radius: var(--border-radius);
    padding: 8px 15px;
    transition: var(--transition);
}

.search-box:focus-within {
    box-shadow: 0 0 0 2px var(--accent-color);
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 100%;
    padding: 5px 10px;
    font-size: 0.9rem;
    outline: none;
}

/* Group and chat creation buttons */
.sidebar-actions {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-btn {
    flex: 1;
    padding: 10px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
}

.sidebar-btn:hover {
    transform: var(--scale-animation);
}

/* Chats list */
.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    animation: slideIn 0.3s ease backwards;
}

.chat-item:hover {
    background-color: var(--hover-color);
}

.chat-item.active {
    background-color: rgba(255, 87, 34, 0.1);
    border-left: 3px solid var(--accent-color);
}

.chat-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 15px;
    color: white;
    overflow: hidden;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main content area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Chat header */
.chat-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--secondary-bg);
}

.back-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background-color: var(--hover-color);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-actions {
    display: flex;
    gap: 10px;
    position: relative;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

/* Chat dropdown menu */
.chat-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 200px;
    overflow: hidden;
    z-index: 200;
    transform: translateY(10px);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.chat-dropdown-menu.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.chat-dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: var(--transition);
}

.chat-dropdown-item:hover {
    background-color: var(--hover-color);
}

.chat-dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
}

/* Group members */
.group-members {
    display: flex;
    margin-top: 5px;
    gap: 5px;
}

.member-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--accent-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
}

.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.more-members {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Messages area */
.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--secondary-bg);
    background-image: 
        linear-gradient(rgba(30, 30, 30, 0.05), rgba(30, 30, 30, 0.05)), 
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none" stroke="%23333" stroke-width="0.5" opacity="0.1"/></svg>');
    background-size: 30px 30px;
}

.light-theme .messages-container {
    background: var(--secondary-bg);
    background-image: 
        linear-gradient(rgba(245, 245, 245, 0.05), rgba(245, 245, 245, 0.05)), 
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none" stroke="%23e0e0e0" stroke-width="0.5" opacity="0.1"/></svg>');
}

.message {
    max-width: 75%;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    position: relative;
    animation: slideIn 0.3s ease forwards;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.incoming {
    align-self: flex-start;
    background-color: var(--secondary-bg);
    border-top-left-radius: 5px;
}

.outgoing {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
    border-top-right-radius: 5px;
}

.message-time {
    font-size: 0.7rem;
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 5px;
}

.image-message {
    max-width: 300px;
    border-radius: var(--border-radius);
    overflow: hidden;
    padding: 0;
}

.image-message img {
    width: 100%;
    display: block;
}

.voice-message {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-wave {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 25px;
}

.wave-bar {
    width: 3px;
    background-color: currentColor;
    border-radius: 2px;
    animation: wave 1.5s infinite ease-in-out;
}

.wave-bar:nth-child(1) { animation-delay: 0s; height: 8px; }
.wave-bar:nth-child(2) { animation-delay: 0.2s; height: 15px; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; height: 20px; }
.wave-bar:nth-child(4) { animation-delay: 0.6s; height: 15px; }
.wave-bar:nth-child(5) { animation-delay: 0.8s; height: 8px; }

.voice-play-btn {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.voice-play-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.voice-duration {
    font-size: 0.9rem;
}

/* Bottom panel */
.message-input-container {
    height: var(--footer-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
}

.attachment-btn, .send-btn, .voice-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-btn:hover, .voice-btn:hover {
    background-color: var(--hover-color);
}

.send-btn {
    background-color: var(--accent-color);
    color: white;
}

.send-btn:hover {
    transform: var(--scale-animation);
}

.message-input {
    flex: 1;
    background-color: var(--primary-bg);
    border: none;
    border-radius: 20px;
    padding: 12px 20px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.message-input:focus {
    box-shadow: 0 0 0 2px var(--accent-color);
}

/* Dropdown menu */
.dropdown-menu {
    position: absolute;
    top: var(--header-height);
    left: 20px;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 250px;
    overflow: hidden;
    z-index: 200;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.dropdown-menu.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--hover-color);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
}

/* Settings, contacts, etc. pages */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-bg);
    padding: 20px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 50;
    display: none;
}

.page.active {
    transform: translateX(0);
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-left: 15px;
}

.settings-item {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Custom checkbox styles */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 24px;
    width: 24px;
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: var(--transition);
}

.checkbox-container:hover input ~ .checkmark {
    background-color: var(--hover-color);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 8px;
    top: 4px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* Switch toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Language switcher */
.lang-switcher {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-top: 10px;
}

.lang-btn {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn.active {
    background-color: var(--accent-color);
    color: white;
}

/* Call window */
.call-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.call-container.active {
    opacity: 1;
    pointer-events: all;
}

.call-window {
    background: linear-gradient(135deg, #1e1e1e, #121212);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.call-container.active .call-window {
    transform: scale(1);
}

.call-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 20px;
    color: white;
    overflow: hidden;
}

.call-name {
    font-size: 1.8rem;
    margin-bottom: 30px;
    font-weight: bold;
}

.call-status {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.2rem;
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.call-answer {
    background-color: #4CAF50;
    color: white;
}

.call-decline {
    background-color: #F44336;
    color: white;
}

.call-btn:hover {
    transform: var(--scale-animation);
}

/* Modal windows */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background-color: var(--hover-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--primary-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 87, 34, 0.2);
}

.select-input {
    width: 100%;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--primary-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.select-input:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 87, 34, 0.2);
}

.contact-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.contact-item:hover {
    background-color: var(--hover-color);
}

.contact-item.selected {
    background-color: rgba(255, 87, 34, 0.1);
}

.contact-checkbox {
    margin-right: 10px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
}

.modal-btn.secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Buttons in settings */
.btn {
    padding: 8px 16px;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Message loading animation */
.message {
    animation: slideIn 0.3s ease forwards;
}

/* New styles for voice messages */
.recording-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background-color: var(--accent-light);
    border-radius: 20px;
    color: white;
    margin-right: 10px;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background-color: red;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

.recording-timer {
    font-size: 0.9rem;
}

.voice-message-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.voice-message-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Profile page styles */
.profile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.profile-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-edit {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: var(--secondary-bg);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.profile-name {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.profile-status {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.profile-info {
    width: 100%;
    max-width: 500px;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 500;
}

.profile-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.profile-btn {
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.profile-btn:hover {
    background-color: var(--accent-light);
}

/* Profile edit form */
.edit-form {
    width: 100%;
    max-width: 500px;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    display: none;
}

.edit-form.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--primary-bg);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-btn {
    flex: 1;
    padding: 10px;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.save-btn {
    background-color: var(--accent-color);
    color: white;
}

.cancel-btn {
    background-color: var(--primary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.form-btn:hover {
    opacity: 0.9;
}

/* Profile navigation */
.profile-navigation {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 10px;
}

.profile-nav-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 10px;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.profile-nav-btn:hover {
    background-color: var(--hover-color);
}

.profile-nav-btn.active {
    color: var(--accent-color);
}

/* Contact profile page */
.contact-profile {
    padding: 20px;
}

/* Group info modal */
.group-info-modal {
    max-height: 80vh;
    overflow-y: auto;
}

.group-members-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.group-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: var(--border-radius);
    background-color: var(--primary-bg);
    transition: var(--transition);
}

.group-member:hover {
    background-color: var(--hover-color);
}

.group-member-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 10px;
    overflow: hidden;
}

.group-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Group avatar upload */
.group-avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    cursor: pointer;
}

.group-avatar-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    overflow: hidden;
}

.group-avatar-edit {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: var(--secondary-bg);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    /* Hide sidebar by default on mobile */
    .sidebar {
        position: absolute;
        left: -100%;
        height: 100%;
        width: 85%;
        max-width: 300px;
        z-index: 150;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }
    
    /* Show sidebar when active */
    .sidebar.active {
        left: 0;
    }
    
    /* Show back button in chat header */
    .back-btn {
        display: flex;
    }
    
    /* Adjust chat avatar size */
    .chat-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    /* Make messages wider */
    .message {
        max-width: 85%;
    }
    
    /* Adjust dropdown menu for mobile */
    .dropdown-menu {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
        top: var(--header-height);
    }
    
    /* Chat dropdown menu adjustments */
    .chat-dropdown-menu {
        width: 180px;
        right: 10px;
    }
    
    /* Profile navigation adjustments */
    .profile-navigation {
        flex-wrap: wrap;
    }
    
    .profile-nav-btn {
        flex: 1 0 45%;
        margin: 5px;
    }
    
    /* Call window adjustments */
    .call-window {
        width: 95%;
        padding: 20px;
    }
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    /* Hide some elements on mobile */
    .chat-time {
        display: none;
    }
    
    /* Adjust group members display */
    .group-members {
        flex-wrap: wrap;
    }
}

/* Desktop specific styles */
@media (min-width: 769px) {
    /* Position pages next to sidebar */
    .page {
        position: absolute;
        top: 0;
        left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
        height: 100%;
        z-index: 100;
        transform: translateX(100%);
    }
    
    .page.active {
        transform: translateX(0);
    }
    
    /* Show back button in page headers */
    .page-header .back-btn {
        display: flex;
    }
}
/* New styles for the form switch link */
.form-switch-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-switch-link a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.form-switch-link a:hover {
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    /* ... (all your existing @media code) ... */
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    /* Auth modal on mobile */
    #auth-modal .modal-content {
        max-width: 100%;
        width: 90%;
    }
}

/* ... (the rest of your existing CSS code) ... */



/* ... (all your existing CSS code) ... */
:root {
    /* Primary colors */
    --primary-bg: #121212;
    --secondary-bg: #1e1e1e;
    --accent-color: #FF5722;
    --accent-light: #ff8a50;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
    --hover-color: #2a2a2a;
    
    /* Sizes */
    --sidebar-width: 280px;
    --header-height: 60px;
    --footer-height: 70px;
    --border-radius: 16px;
    
    /* Animations */
    --transition: all 0.3s ease;
    --scale-animation: scale(1.05);
}

/* Light theme styles */
.light-theme {
    --primary-bg: #f5f5f5;
    --secondary-bg: #ffffff;
    --text-primary: #000000;
    --text-secondary: #555555;
    --border-color: #e0e0e0;
    --hover-color: #f0f0f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--primary-bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    transition: var(--transition);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-light);
}

/* Loading animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes wave {
    0% { height: 5px; }
    50% { height: 20px; }
    100% { height: 5px; }
}

/* Splash screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #121212 0%, #2a0c00 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

.splash-logo {
    font-size: 4rem;
    color: var(--accent-color);
    margin-bottom: 2rem;
    animation: pulse 2s infinite;
}

.splash-text {
    font-size: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

/* Main container */
.container {
    display: flex;
    height: 100vh;
    transition: var(--transition);
    position: relative;
}

/* Sidebar (menu) */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    z-index: 100;
}

/* App header */
.app-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--secondary-bg);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    cursor: pointer;
    transition: var(--transition);
}

.logo:hover {
    transform: var(--scale-animation);
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover {
    background-color: var(--hover-color);
}

/* Search */
.search-container {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    display: flex;
    align-items: center;
    background-color: var(--primary-bg);
    border-radius: var(--border-radius);
    padding: 8px 15px;
    transition: var(--transition);
}

.search-box:focus-within {
    box-shadow: 0 0 0 2px var(--accent-color);
}

.search-box input {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 100%;
    padding: 5px 10px;
    font-size: 0.9rem;
    outline: none;
}

/* Group and chat creation buttons */
.sidebar-actions {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-btn {
    flex: 1;
    padding: 10px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
}

.sidebar-btn:hover {
    transform: var(--scale-animation);
}

/* Chats list */
.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    animation: slideIn 0.3s ease backwards;
}

.chat-item:hover {
    background-color: var(--hover-color);
}

.chat-item.active {
    background-color: rgba(255, 87, 34, 0.1);
    border-left: 3px solid var(--accent-color);
}

.chat-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 15px;
    color: white;
    overflow: hidden;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main content area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Chat header */
.chat-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--secondary-bg);
}

.back-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background-color: var(--hover-color);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-actions {
    display: flex;
    gap: 10px;
    position: relative;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

/* Chat dropdown menu */
.chat-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 200px;
    overflow: hidden;
    z-index: 200;
    transform: translateY(10px);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.chat-dropdown-menu.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.chat-dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: var(--transition);
}

.chat-dropdown-item:hover {
    background-color: var(--hover-color);
}

.chat-dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
}

/* Group members */
.group-members {
    display: flex;
    margin-top: 5px;
    gap: 5px;
}

.member-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--accent-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
}

.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.more-members {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Messages area */
.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--secondary-bg);
    background-image: 
        linear-gradient(rgba(30, 30, 30, 0.05), rgba(30, 30, 30, 0.05)), 
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none" stroke="%23333" stroke-width="0.5" opacity="0.1"/></svg>');
    background-size: 30px 30px;
}

.light-theme .messages-container {
    background: var(--secondary-bg);
    background-image: 
        linear-gradient(rgba(245, 245, 245, 0.05), rgba(245, 245, 245, 0.05)), 
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none" stroke="%23e0e0e0" stroke-width="0.5" opacity="0.1"/></svg>');
}

.message {
    max-width: 75%;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    position: relative;
    animation: slideIn 0.3s ease forwards;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.incoming {
    align-self: flex-start;
    background-color: var(--secondary-bg);
    border-top-left-radius: 5px;
}

.outgoing {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
    border-top-right-radius: 5px;
}

.message-time {
    font-size: 0.7rem;
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 5px;
}

.image-message {
    max-width: 300px;
    border-radius: var(--border-radius);
    overflow: hidden;
    padding: 0;
}

.image-message img {
    width: 100%;
    display: block;
}

.voice-message {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-wave {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 25px;
}

.wave-bar {
    width: 3px;
    background-color: currentColor;
    border-radius: 2px;
    animation: wave 1.5s infinite ease-in-out;
}

.wave-bar:nth-child(1) { animation-delay: 0s; height: 8px; }
.wave-bar:nth-child(2) { animation-delay: 0.2s; height: 15px; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; height: 20px; }
.wave-bar:nth-child(4) { animation-delay: 0.6s; height: 15px; }
.wave-bar:nth-child(5) { animation-delay: 0.8s; height: 8px; }

.voice-play-btn {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.voice-play-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.voice-duration {
    font-size: 0.9rem;
}

/* Bottom panel */
.message-input-container {
    height: var(--footer-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
}

.attachment-btn, .send-btn, .voice-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-btn:hover, .voice-btn:hover {
    background-color: var(--hover-color);
}

.send-btn {
    background-color: var(--accent-color);
    color: white;
}

.send-btn:hover {
    transform: var(--scale-animation);
}

.message-input {
    flex: 1;
    background-color: var(--primary-bg);
    border: none;
    border-radius: 20px;
    padding: 12px 20px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.message-input:focus {
    box-shadow: 0 0 0 2px var(--accent-color);
}

/* Dropdown menu */
.dropdown-menu {
    position: absolute;
    top: var(--header-height);
    left: 20px;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 250px;
    overflow: hidden;
    z-index: 200;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.dropdown-menu.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--hover-color);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
}

/* Settings, contacts, etc. pages */
.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-bg);
    padding: 20px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 50;
    display: none;
}

.page.active {
    transform: translateX(0);
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-left: 15px;
}

.settings-item {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Custom checkbox styles */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 24px;
    width: 24px;
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: var(--transition);
}

.checkbox-container:hover input ~ .checkmark {
    background-color: var(--hover-color);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 8px;
    top: 4px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* Switch toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Language switcher */
.lang-switcher {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-top: 10px;
}

.lang-btn {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn.active {
    background-color: var(--accent-color);
    color: white;
}

/* Call window */
.call-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.call-container.active {
    opacity: 1;
    pointer-events: all;
}

.call-window {
    background: linear-gradient(135deg, #1e1e1e, #121212);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.call-container.active .call-window {
    transform: scale(1);
}

.call-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 20px;
    color: white;
    overflow: hidden;
}

.call-name {
    font-size: 1.8rem;
    margin-bottom: 30px;
    font-weight: bold;
}

.call-status {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1.2rem;
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.call-answer {
    background-color: #4CAF50;
    color: white;
}

.call-decline {
    background-color: #F44336;
    color: white;
}

.call-btn:hover {
    transform: var(--scale-animation);
}

/* Modal windows */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background-color: var(--hover-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--primary-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 87, 34, 0.2);
}

.select-input {
    width: 100%;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--primary-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.select-input:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 87, 34, 0.2);
}

.contact-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.contact-item:hover {
    background-color: var(--hover-color);
}

.contact-item.selected {
    background-color: rgba(255, 87, 34, 0.1);
}

.contact-checkbox {
    margin-right: 10px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.modal-btn.primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
}

.modal-btn.secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Buttons in settings */
.btn {
    padding: 8px 16px;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Message loading animation */
.message {
    animation: slideIn 0.3s ease forwards;
}

/* New styles for voice messages */
.recording-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background-color: var(--accent-light);
    border-radius: 20px;
    color: white;
    margin-right: 10px;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background-color: red;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

.recording-timer {
    font-size: 0.9rem;
}

.voice-message-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.voice-message-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Profile page styles */
.profile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.profile-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: white;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-edit {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: var(--secondary-bg);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.profile-name {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.profile-status {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.profile-info {
    width: 100%;
    max-width: 500px;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 500;
}

.profile-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.profile-btn {
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.profile-btn:hover {
    background-color: var(--accent-light);
}

/* Profile edit form */
.edit-form {
    width: 100%;
    max-width: 500px;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    display: none;
}

.edit-form.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--primary-bg);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-btn {
    flex: 1;
    padding: 10px;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.save-btn {
    background-color: var(--accent-color);
    color: white;
}

.cancel-btn {
    background-color: var(--primary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.form-btn:hover {
    opacity: 0.9;
}

/* Profile navigation */
.profile-navigation {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
    background-color: var(--secondary-bg);
    border-radius: var(--border-radius);
    padding: 10px;
}

.profile-nav-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 10px;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.profile-nav-btn:hover {
    background-color: var(--hover-color);
}

.profile-nav-btn.active {
    color: var(--accent-color);
}

/* Contact profile page */
.contact-profile {
    padding: 20px;
}

/* Group info modal */
.group-info-modal {
    max-height: 80vh;
    overflow-y: auto;
}

.group-members-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.group-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: var(--border-radius);
    background-color: var(--primary-bg);
    transition: var(--transition);
}

.group-member:hover {
    background-color: var(--hover-color);
}

.group-member-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 10px;
    overflow: hidden;
}

.group-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Group avatar upload */
.group-avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    cursor: pointer;
}

.group-avatar-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    overflow: hidden;
}

.group-avatar-edit {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: var(--secondary-bg);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

/* New styles for Auth Avatar Upload */
.auth-avatar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.auth-avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: var(--primary-bg);
    border: 2px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    color: var(--text-secondary);
}

.auth-avatar-preview:hover {
    border-color: var(--accent-color);
    color: var(--accent-light);
}

.auth-avatar-preview i {
    font-size: 2rem;
    margin-bottom: 8px;
}

.auth-avatar-preview span {
    font-size: 0.9rem;
}

.auth-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    /* Hide sidebar by default on mobile */
    .sidebar {
        position: absolute;
        left: -100%;
        height: 100%;
        width: 85%;
        max-width: 300px;
        z-index: 150;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }
    
    /* Show sidebar when active */
    .sidebar.active {
        left: 0;
    }
    
    /* Show back button in chat header */
    .back-btn {
        display: flex;
    }
    
    /* Adjust chat avatar size */
    .chat-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    /* Make messages wider */
    .message {
        max-width: 85%;
    }
    
    /* Adjust dropdown menu for mobile */
    .dropdown-menu {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
        top: var(--header-height);
    }
    
    /* Chat dropdown menu adjustments */
    .chat-dropdown-menu {
        width: 180px;
        right: 10px;
    }
    
    /* Profile navigation adjustments */
    .profile-navigation {
        flex-wrap: wrap;
    }
    
    .profile-nav-btn {
        flex: 1 0 45%;
        margin: 5px;
    }
    
    /* Call window adjustments */
    .call-window {
        width: 95%;
        padding: 20px;
    }
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    /* Hide some elements on mobile */
    .chat-time {
        display: none;
    }
    
    /* Adjust group members display */
    .group-members {
        flex-wrap: wrap;
    }
}

/* Desktop specific styles */
@media (min-width: 769px) {
    /* Position pages next to sidebar */
    .page {
        position: absolute;
        top: 0;
        left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
        height: 100%;
        z-index: 100;
        transform: translateX(100%);
    }
    
    .page.active {
        transform: translateX(0);
    }
    
    /* Show back button in page headers */
    .page-header .back-btn {
        display: flex;
    }
}
/* New styles for the form switch link */
.form-switch-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-switch-link a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.form-switch-link a:hover {
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    /* ... (all your existing @media code) ... */
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    /* Auth modal on mobile */
    #auth-modal .modal-content {
        max-width: 100%;
        width: 90%;
    }
}

.logout-button {
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    margin-left: 10px;
}
/* ... (the rest of your existing CSS code) ... */

/* было:
body { ... height: 100vh; overflow: hidden; ... }
*/
body {
  background-color: var(--primary-bg);
  color: var(--text-primary);
  min-height: 100dvh;      /* динамическая высота вместо 100vh */
  overflow-x: clip;         /* убираем горизонтальный скролл */
  overflow-y: hidden;       /* страницы не скроллим — скролл внутри .messages-container */
  transition: var(--transition);
}

/* было:
.container { display:flex; height: 100vh; ... }
*/
.container {
  display: flex;
  min-height: 100dvh;       /* пусть тянется на реальную высоту окна */
  position: relative;
}