* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-green: #25D366;
    --primary-green-dark: #128C7E;
    --primary-green-light: #DCF8C6;
    --gradient-start: #25D366;
    --gradient-end: #128C7E;
    --bg-color: #f0f2f5;
    --white: #ffffff;
    --text-primary: #111b21;
    --text-secondary: #667781;
    --border-color: #e9edef;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Custom Scrollbar Styles - Applied to all scrollable elements */

/* Webkit browsers (Chrome, Safari, Edge) */
*::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
}

*::-webkit-scrollbar-track {
    background: var(--bg-color) !important;
    border-radius: 10px !important;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%) !important;
    border-radius: 10px !important;
    border: none !important;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--gradient-end) 0%, var(--gradient-start) 100%) !important;
}

/* For horizontal scrollbars */
*::-webkit-scrollbar:horizontal {
    height: 6px !important;
}

/* For specific elements that need scrollbar */
body,
html,
.sidebar,
.chats-list,
.messages-container,
.profile-screen,
.search-results {
    scrollbar-width: thin !important;
    scrollbar-color: var(--gradient-start) var(--bg-color) !important;
}

body::-webkit-scrollbar,
html::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.chats-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar,
.profile-screen::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
}

body::-webkit-scrollbar-track,
html::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.chats-list::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track,
.profile-screen::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
    background: var(--bg-color) !important;
    border-radius: 10px !important;
}

body::-webkit-scrollbar-thumb,
html::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.chats-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb,
.profile-screen::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%) !important;
    border-radius: 10px !important;
    border: none !important;
}

body::-webkit-scrollbar-thumb:hover,
html::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.chats-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover,
.profile-screen::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--gradient-end) 0%, var(--gradient-start) 100%) !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

/* Auth Screen */
#auth-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Hide bottom nav only when auth screen is active */
#auth-screen.active ~ .bottom-nav,
body:has(#auth-screen.active) .bottom-nav {
    display: none !important;
}

.auth-container {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    font-size: 36px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary-green-dark);
    border-bottom-color: var(--primary-green-dark);
    font-weight: 600;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form input {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-green);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.error-message {
    margin-top: 15px;
    padding: 12px;
    background: #fee;
    color: #c33;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Main App */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    background: var(--white);
    padding-bottom: 60px;
}

@media (min-width: 769px) {
    .app-container {
        max-width: 1400px;
        margin: 0 auto;
        box-shadow: var(--shadow-lg);
        padding-bottom: 0;
    }
    
    .sidebar {
        width: 350px;
        flex: 0 0 350px;
        position: relative;
        display: flex !important;
    }
    
    .sidebar.hidden {
        display: none !important;
        width: 0 !important;
        flex: 0 0 0 !important;
    }
    
    .chat-area {
        flex: 1;
        position: relative;
        display: flex !important;
    }
    
    .chat-area.hidden {
        display: none !important;
    }
}

/* Copy toast animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Sidebar */
.sidebar {
    width: 100%;
    flex: 1;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--white);
    min-width: 0;
}

.sidebar-header {
    padding: 20px 20px 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.search-container {
    padding: 15px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--border-color);
}

.user-avatar, .chat-user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 18px;
}

#search-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    background: var(--bg-color);
}

#search-input:focus {
    outline: none;
    border-color: var(--primary-green);
    background: var(--white);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-color);
}

.chats-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-item:hover {
    background: var(--bg-color);
}

.chat-item.active {
    background: var(--primary-green-light);
}

.chat-item-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    flex-shrink: 0;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-item-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.chat-item-last-message {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-unread {
    background: var(--primary-green);
    color: var(--white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}

.empty-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-chat-content {
    text-align: center;
    color: var(--text-secondary);
}

.empty-chat-content svg {
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-chat-content h2 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.chat-header {
    padding: 15px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-user-name {
    font-weight: 600;
    font-size: 16px;
}

.chat-user-status {
    font-size: 13px;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.chat-user-status.online {
    color: var(--primary-green);
    font-weight: 500;
}

.chat-user-status.activity {
    color: var(--primary-green);
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.message {
    display: flex;
    gap: 8px;
    max-width: 70%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.message-content {
    background: var(--white);
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-width: 100%;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
    box-sizing: border-box;
    overflow: hidden;
}

.message.own .message-content {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: var(--white);
}

.message.own .voice-message-player {
    background: rgba(255, 255, 255, 0.15);
}

.message.deleted .message-text {
    color: var(--text-secondary);
    font-style: italic;
}

.message-text {
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    overflow: hidden;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.message-read-status {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    position: relative;
}

.message-read-status svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.message-read-status.sent {
    opacity: 0.6;
}

.message-read-status.read {
    opacity: 1;
}

.message-read-status.read svg:first-child {
    color: var(--primary-green);
}

.message.own .message-read-status.read svg:first-child {
    color: var(--white);
}

.message-read-status.read svg:last-child {
    color: var(--primary-green);
    margin-left: -12px;
}

.message.own .message-read-status.read svg:last-child {
    color: var(--white);
}

.message-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    overflow: hidden;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    background: var(--white);
    padding: 4px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
    z-index: 10;
    pointer-events: auto;
}

.message.own .message-wrapper {
    flex-direction: row-reverse;
}

.message-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--bg-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: background 0.2s;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.message-action-btn:hover {
    background: var(--border-color);
}

.message-action-btn:active {
    transform: scale(0.95);
}

.message-reply {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    border-left: 3px solid var(--primary-green);
}

.message.own .message-reply {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: var(--white);
}

.message-reply-line {
    width: 2px;
    background: var(--primary-green);
    border-radius: 2px;
}

.message.own .message-reply-line {
    background: var(--white);
}

.message-reply-content {
    flex: 1;
}

.message-reply-author {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
    opacity: 0.8;
}

.message-reply-text {
    font-size: 13px;
    opacity: 0.7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-reply {
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-reply:hover {
    opacity: 0.8;
    background: rgba(37, 211, 102, 0.1) !important;
    border-radius: 4px;
}

.reply-preview-content {
    cursor: pointer;
    transition: all 0.2s ease;
}

.reply-preview-content:hover {
    opacity: 0.8;
    background: rgba(37, 211, 102, 0.1);
    border-radius: 4px;
}

/* Эффект подсветки сообщения при прокрутке к нему */
.message-highlight {
    animation: messageHighlight 2s ease-in-out;
    background: rgba(37, 211, 102, 0.15) !important;
    border-left: 3px solid var(--primary-green) !important;
    padding-left: 12px !important;
    transition: all 0.3s ease;
}

@keyframes messageHighlight {
    0% {
        background: rgba(37, 211, 102, 0.3);
        transform: scale(1.02);
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    }
    50% {
        background: rgba(37, 211, 102, 0.2);
        transform: scale(1.01);
        box-shadow: 0 2px 8px rgba(37, 211, 102, 0.2);
    }
    100% {
        background: rgba(37, 211, 102, 0.15);
        transform: scale(1);
        box-shadow: none;
    }
}

.message-forward {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    font-size: 12px;
    opacity: 0.8;
}

.message-forward > span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-forward-text {
    font-size: 13px;
    color: var(--text-primary);
    margin-top: 4px;
    padding-left: 22px;
    opacity: 0.9;
}

.message.own .message-forward {
    background: rgba(255, 255, 255, 0.2);
}

.message-forward svg {
    flex-shrink: 0;
}

.reply-preview,
.forward-preview {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-green);
    border-radius: 0;
    margin: 0;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.reply-preview-content {
    display: flex;
    gap: 10px;
    flex: 1;
}

.reply-preview-line {
    width: 2px;
    background: var(--primary-green);
    border-radius: 2px;
}

.reply-preview-info {
    flex: 1;
}

.reply-preview-author {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.reply-preview-text {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reply-preview-close,
.forward-preview-close {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.reply-preview-close:hover,
.forward-preview-close:hover {
    background: var(--border-color);
}

.forward-preview-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.delete-menu {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 5px;
    z-index: 1000;
    min-width: 150px;
}

.delete-menu-item {
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.2s;
}

.delete-menu-item:hover {
    background: var(--bg-color);
}

.delete-menu-item[data-action="delete-all"] {
    color: #c33;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}


.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    position: relative;
}

.bottom-nav-item.active {
    color: var(--primary-green);
}

.bottom-nav-item svg {
    width: 24px;
    height: 24px;
}

.bottom-nav-label {
    font-size: 12px;
    font-weight: 500;
}

.bottom-nav-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 11px;
}

.bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: 20%;
    background: var(--primary-green);
    color: var(--white);
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* Profile Screen */
#profile-screen {
    display: none;
    background: var(--bg-color);
    min-height: 100vh;
}

#profile-screen.active {
    display: flex;
    flex-direction: column;
}

.profile-container {
    flex: 1;
    overflow-y: auto;
    background: var(--white);
    padding-bottom: 60px;
}

.profile-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
}

.profile-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.profile-content {
    padding: 30px 20px;
    text-align: center;
}

.profile-avatar-large {
    margin-bottom: 20px;
}

.profile-avatar-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 48px;
    margin: 0 auto;
}

.profile-info {
    margin-top: 20px;
}

.profile-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.profile-short-name {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.profile-email {
    font-size: 14px;
    color: var(--text-secondary);
}

.message-input-container {
    padding: 15px 20px;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.btn-attach {
    width: 45px;
    height: 45px;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-attach:hover {
    background: var(--border-color);
}

#message-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 15px;
}

#message-input:focus {
    outline: none;
    border-color: var(--primary-green);
}

/* Voice recording UI */
.voice-recording-ui {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 25px;
}

.voice-recording-timer {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-green);
    min-width: 50px;
    text-align: center;
}

.btn-voice-action {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-color);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-voice-action:hover {
    background: var(--border-color);
}

.btn-voice-send {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: var(--white);
}

.btn-voice-send:hover {
    background: linear-gradient(135deg, var(--gradient-end) 0%, var(--gradient-start) 100%);
}

.btn-voice-record {
    width: 45px;
    height: 45px;
    border: none;
    background: var(--bg-color);
    border-radius: 50%;
    color: var(--primary-green);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-voice-record:hover {
    background: var(--border-color);
}

.voice-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 25px;
    flex: 1;
    gap: 10px;
}

.voice-preview-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.voice-preview-duration {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 50px;
}

.btn-voice-preview {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--primary-green);
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-voice-preview:hover {
    background: var(--primary-green-dark);
}

.btn-voice-preview-cancel {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-voice-preview-cancel:hover {
    color: var(--text-primary);
}

/* Video message player */
.video-message-player {
    width: 100%;
    max-width: 100%;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.video-player-preview {
    position: relative;
    width: 100%;
    background: #000;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.video-player-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.video-player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.video-player-play-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary-green);
    transition: all 0.2s;
}

.video-player-play-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.video-player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--white);
}

.video-player-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--primary-green);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.video-player-btn:hover {
    background: var(--primary-green-dark);
    transform: scale(1.05);
}

.video-player-progress-container {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.video-player-progress-bar {
    height: 100%;
    background: var(--primary-green);
    border-radius: 2px;
    transition: width 0.1s;
}

.video-player-progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-green);
    cursor: grab;
    opacity: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.1s;
}

.video-player-progress-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

.video-player-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--white);
    border-top: 1px solid var(--border-color);
}

.video-player-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.video-player-actions {
    display: flex;
    gap: 8px;
}

.video-player-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.video-player-action-btn:hover {
    background: var(--bg-color);
    color: var(--primary-green);
}

/* Audio file player */
.audio-file-player {
    width: 100%;
    max-width: 100%;
    background: var(--white);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    overflow: hidden;
}

.audio-file-player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.audio-file-player-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--primary-green);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.audio-file-player-btn:hover {
    background: var(--primary-green-dark);
    transform: scale(1.05);
}

.audio-file-player-progress-container {
    flex: 1;
    min-width: 0;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.audio-file-player-progress-bar {
    height: 100%;
    background: var(--primary-green);
    border-radius: 2px;
    transition: width 0.1s;
}

.audio-file-player-progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-green);
    cursor: grab;
    opacity: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.1s;
}

.audio-file-player-progress-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

.audio-file-player-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.audio-file-player-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-file-player-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}

.audio-file-player-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.audio-file-player-speed {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.audio-file-player-speed-btn {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    background: var(--white);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.audio-file-player-speed-btn:hover {
    background: var(--bg-color);
}

.audio-file-player-speed-btn.active {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
}

/* Voice message player */
.voice-message-player {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 12px;
    min-width: 250px;
    max-width: 400px;
    width: 100%;
    box-sizing: border-box;
}

.voice-player-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-player-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--primary-green);
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.voice-player-btn:hover {
    background: var(--primary-green-dark);
}

.voice-player-btn.pause {
    background: var(--primary-green);
}

.voice-player-progress-container {
    flex: 1;
    position: relative;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    cursor: pointer;
}

.voice-player-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.voice-player-progress-handle {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    background: var(--primary-green);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    opacity: 1;
    transition: opacity 0.2s, transform 0.1s;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.3);
    z-index: 10;
}

.voice-player-progress-container:hover .voice-player-progress-handle {
    transform: translate(-50%, -50%) scale(1.2);
}

.voice-player-progress-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.3);
}

.voice-player-progress-container {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.voice-player-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.voice-player-speed {
    display: flex;
    align-items: center;
    gap: 5px;
}

.voice-player-speed-btn {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-player-speed-btn:hover {
    background: var(--bg-color);
}

.voice-player-speed-btn.active {
    background: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
}

.btn-send {
    width: 45px;
    height: 45px;
    border: none;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: var(--white);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.btn-send:hover {
    transform: scale(1.05);
}

.btn-send:active {
    transform: scale(0.95);
}

/* Attach Menu */
.attach-menu {
    position: absolute;
    bottom: 70px;
    left: 20px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    min-width: 200px;
    z-index: 1000;
    display: none;
}

.attach-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    color: var(--text-primary);
}

.attach-menu-item:hover {
    background: var(--border-color);
}

.attach-menu-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.attach-menu-item span {
    font-size: 15px;
}

/* File Message Styles */
.file-message {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 12px;
    max-width: 400px;
    position: relative;
}

.file-message-image {
    padding: 0;
    background: transparent;
    max-width: 100%;
}

.file-message-image-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    cursor: pointer;
    object-fit: contain;
}

.file-message-video {
    padding: 0;
    background: transparent;
    max-width: 100%;
}

.file-message-video-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
}

.file-message-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.file-message-image:hover .file-message-overlay,
.file-message-video:hover .file-message-overlay {
    opacity: 1;
}

.file-message-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.file-message-action-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.file-message-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
}

.file-message-info {
    flex: 1;
    min-width: 0;
}

.file-message-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-word;
}

.file-message-size {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.file-message-download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--primary-green);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.file-message-download-btn:hover {
    background: var(--primary-green-dark);
}

/* File Upload Progress */
.file-upload-progress-container {
    position: relative;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.file-upload-progress-bar {
    height: 100%;
    background: var(--primary-green);
    border-radius: 2px;
    transition: width 0.3s;
    width: 0%;
}

.file-upload-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: var(--text-primary);
    font-weight: 600;
}

.file-upload-cancel-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-upload-cancel-btn:hover {
    background: rgba(255, 255, 255, 1);
    color: #e74c3c;
    transform: scale(1.1);
}

.file-message-info {
    position: relative;
}

.file-upload-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* Fullscreen Modal */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-modal-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fullscreen-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10001;
}

.fullscreen-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.fullscreen-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.fullscreen-video-content {
    width: 100%;
    max-width: 95vw;
    max-height: 95vh;
}

.fullscreen-video-player {
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fullscreen-video-preview {
    position: relative;
    width: 100%;
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    max-height: 85vh;
}

.fullscreen-video-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.fullscreen-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.fullscreen-video-play-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary-green);
    transition: all 0.2s;
}

.fullscreen-video-play-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.fullscreen-video-controls,
.fullscreen-video-info {
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.fullscreen-video-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.8);
}

.fullscreen-video-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--primary-green);
    color: white;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

.fullscreen-video-btn:hover {
    background: var(--primary-green-dark);
    transform: scale(1.05);
}

.fullscreen-video-progress-container {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
}

.fullscreen-video-progress-bar {
    height: 100%;
    background: var(--primary-green);
    border-radius: 3px;
    transition: width 0.1s;
}

.fullscreen-video-progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-green);
    cursor: grab;
    opacity: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.1s;
}

.fullscreen-video-progress-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.2);
}

.fullscreen-video-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.fullscreen-video-time {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.fullscreen-video-actions {
    display: flex;
    gap: 12px;
}

.fullscreen-video .fullscreen-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.fullscreen-video .fullscreen-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.fullscreen-modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

.fullscreen-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.fullscreen-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show,
.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 22px;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    position: relative;
    pointer-events: auto;
}

.btn-close:hover {
    color: var(--text-primary);
    background: var(--bg-color);
    border-radius: 50%;
}

.btn-close:active {
    transform: scale(0.9);
}

.modal-body {
    padding: 20px;
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section h3 {
    margin-bottom: 15px;
    font-size: 18px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-green);
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: var(--bg-color);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Mobile navigation */
.mobile-only {
    display: flex !important;
}

@media (min-width: 769px) {
    #back-from-chat-btn {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex !important;
    }
    
    .app-container {
        position: relative;
        overflow: hidden;
        width: 100%;
        max-width: 100%;
    }
    
    .sidebar {
        width: 100%;
        height: 100vh;
        position: absolute;
        left: 0;
        top: 0;
        z-index: 10;
        transition: transform 0.3s ease;
        flex: none;
    }
    
    .sidebar.hidden {
        transform: translateX(-100%);
    }
    
    .chat-area {
        width: 100%;
        height: 100vh;
        position: absolute;
        right: 0;
        top: 0;
        z-index: 5;
        transition: transform 0.3s ease;
    }
    
    .chat-area.hidden {
        transform: translateX(100%);
    }
    
    .auth-container {
        padding: 30px 20px;
    }
    
    .logo h1 {
        font-size: 28px;
    }
    
    .message {
        max-width: calc(100% - 20px);
        width: auto;
    }
    
    .message.own {
        margin-left: auto;
        margin-right: 0;
    }
    
    .message:not(.own) {
        margin-left: 0;
        margin-right: auto;
    }
    
    .message-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    
    .message-wrapper {
        flex: 1;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }
    
    .voice-message-player {
        min-width: 200px;
        max-width: 100%;
        width: 100%;
        padding: 10px;
        gap: 6px;
    }
    
    .voice-player-controls {
        gap: 8px;
    }
    
    .voice-player-btn {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }
    
    .voice-player-info {
        font-size: 11px;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .voice-player-speed {
        gap: 3px;
    }
    
    .voice-player-speed-btn {
        padding: 3px 6px;
        font-size: 10px;
    }
    
    .message-content {
        padding: 8px 12px;
    }
    
    .chat-header {
        padding: 12px 15px;
    }
    
    .app-container {
        padding-bottom: 60px;
    }
    
    .bottom-nav {
        display: flex;
    }
}

@media (min-width: 769px) {
    .bottom-nav {
        display: flex;
    }
    
    .app-container {
        padding-bottom: 0;
    }
}

@media (max-width: 480px) {
    .sidebar-header {
        padding: 15px;
    }
    
    .chat-item {
        padding: 12px 15px;
    }
    
    .messages-container {
        padding: 15px 10px;
    }
    
    .message-input-container {
        padding: 12px 15px;
    }
    
    .voice-message-player {
        min-width: 180px;
        padding: 8px;
        gap: 6px;
    }
    
    .voice-player-btn {
        width: 28px;
        height: 28px;
    }
    
    .voice-player-info {
        font-size: 10px;
    }
    
    .voice-player-speed-btn {
        padding: 2px 4px;
        font-size: 9px;
    }
    
    .message {
        max-width: calc(100% - 16px);
        width: auto;
    }
    
    .message.own {
        margin-left: auto;
        margin-right: 0;
    }
    
    .message:not(.own) {
        margin-left: 0;
        margin-right: auto;
    }
    
    .message-content {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    
    .message-wrapper {
        flex: 1;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }
    
    .video-message-player,
    .audio-file-player {
        max-width: 100%;
    }
    
    .video-player-preview {
        aspect-ratio: 16 / 9;
    }
    
    .video-player-controls,
    .audio-file-player-controls {
        padding: 6px 8px;
    }
    
    .video-player-btn,
    .audio-file-player-btn {
        width: 32px;
        height: 32px;
    }
    
    .video-player-info,
    .audio-file-player-info {
        padding: 6px 8px;
    }
    
    .video-player-time,
    .audio-file-player-time {
        font-size: 11px;
    }
    
    .audio-file-player-title {
        font-size: 13px;
    }
    
    .audio-file-player-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .audio-file-player-time {
        width: 100%;
        margin-bottom: 4px;
    }
    
    .audio-file-player-speed {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .audio-file-player-speed-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 44px;
    }
    
    .audio-file-player-controls {
        gap: 6px;
    }
    
    .audio-file-player-progress-container {
        min-width: 0;
    }
    
    .audio-file-player {
        padding: 10px;
        box-sizing: border-box;
    }
    
    .audio-file-player-info {
        gap: 6px;
    }
}
