/* Reset и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

/* Страницы авторизации */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    width: 90%;
    max-width: 400px;
    background: white;
    padding: 40px 30px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    text-align: center;
}

.auth-header h1 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.auth-header p {
    color: #718096;
    margin-bottom: 30px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    text-align: left;
}

.form-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.auth-btn {
    padding: 15px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.auth-btn:hover {
    background: #3182ce;
}

.auth-footer {
    margin-top: 25px;
    color: #718096;
}

.auth-footer a {
    color: #4299e1;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.message {
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
}

.message.error {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #feb2b2;
}

/* Основной контейнер мессенджера */
.messenger-container {
    width: 100%;
    height: 100vh;
    background: white;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0,0,0,0.1);
}

/* Хедер */
.header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 1.8em;
    font-weight: 300;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    font-weight: 500;
}

.user-info button {
    padding: 8px 15px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-info button:hover {
    background: rgba(255,255,255,0.3);
}

/* Основной контент */
.main-content {
    display: flex;
    flex: 1;
    height: calc(100vh - 80px);
}

/* Сайдбар */
.sidebar {
    width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.sidebar-header h3 {
    color: #4a5568;
    font-weight: 600;
}

.sidebar-header button {
    padding: 8px 12px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s ease;
}

.sidebar-header button:hover {
    background: #38a169;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    background: white;
}

.chat-item {
    padding: 18px 20px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.chat-item:hover {
    background: #f7fafc;
}

.chat-item.active {
    background: #ebf8ff;
    border-right: 3px solid #4299e1;
}

.chat-name {
    font-weight: 500;
    color: #4a5568;
}

.chat-type {
    color: #a0aec0;
    font-size: 0.9em;
}

/* Область чата */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f7fafc;
}

.chat-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.chat-header h3 {
    color: #4a5568;
    font-weight: 600;
}

/* Контейнер сообщений */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.no-messages {
    text-align: center;
    color: #a0aec0;
    padding: 60px 20px;
    font-style: italic;
    font-size: 1.1em;
}

/* Стили сообщений */
.message {
    max-width: 70%;
    padding: 0;
    margin-bottom: 5px;
}

.message.own {
    align-self: flex-end;
}

.message.other {
    align-self: flex-start;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    font-size: 0.85em;
}

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

.message.own .message-header strong {
    color: #2b6cb0;
}

.message.other .message-header strong {
    color: #4a5568;
}

.message-header span {
    color: #a0aec0;
    font-size: 0.8em;
}

.delete-btn, .report-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8em;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 2px 5px;
}

.message:hover .delete-btn,
.message:hover .report-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: #e53e3e;
}

.report-btn:hover {
    color: #dd6b20;
}

.message-text {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

.message.own .message-text {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.message.other .message-text {
    background: white;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Область ввода */
.input-area {
    padding: 20px 30px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.input-area input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.input-area input:focus {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.input-area button {
    padding: 15px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.input-area button:first-of-type {
    background: #4299e1;
    color: white;
    min-width: 120px;
}

.input-area button:first-of-type:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

.input-area button:last-of-type {
    background: #e2e8f0;
    color: #4a5568;
    min-width: 100px;
}

.input-area button:last-of-type:hover {
    background: #cbd5e0;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 6px;
}

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

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

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

/* Адаптивность */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 200px;
    }
    
    .chat-area {
        height: calc(100vh - 280px);
    }
    
    .message {
        max-width: 85%;
    }
    
    .header {
        padding: 15px 20px;
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    .input-area {
        padding: 15px 20px;
    }
    
    .input-area button {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: fadeIn 0.3s ease;
}

/* Статусы пользователей */
.user-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 5px;
}

.user-status.online {
    background: #48bb78;
}

.user-status.offline {
    background: #a0aec0;
}

.user-status.away {
    background: #ed8936;
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border-left: 4px solid #4299e1;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    border-left-color: #48bb78;
}

.notification.error {
    border-left-color: #f56565;
}

.notification.warning {
    border-left-color: #ed8936;
}

/* Загрузка */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Темная тема (дополнительно) */
@media (prefers-color-scheme: dark) {
    .messenger-container {
        background: #1a202c;
        color: #e2e8f0;
    }
    
    .sidebar {
        background: #2d3748;
        border-right-color: #4a5568;
    }
    
    .chat-area {
        background: #1a202c;
    }
    
    .message.other .message-text {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .input-area {
        background: #2d3748;
        border-top-color: #4a5568;
    }
    
    .input-area input {
        background: #1a202c;
        border-color: #4a5568;
        color: #e2e8f0;
    }
	/* Админ кнопка в хедере */
#adminBtn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    margin-right: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#adminBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

/* Админские кнопки в сообщениях */
.message .delete-btn[style*="color: red"] {
    color: #ff6b6b !important;
    font-weight: bold;
    background: rgba(255, 107, 107, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
}

.message .delete-btn[style*="color: red"]:hover {
    background: rgba(255, 107, 107, 0.2);
}
}
/* ===== МОБИЛЬНЫЕ СТИЛИ ===== */
@media (max-width: 768px) {
    .messenger-container {
        height: 100vh;
        width: 100vw;
        border-radius: 0;
    }
    
    .header {
        padding: 15px 20px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        border-radius: 0;
    }
    
    .header h1 {
        font-size: 1.4em;
    }
    
    .user-info {
        font-size: 0.9em;
    }
    
    .user-info button {
        padding: 6px 12px;
        font-size: 0.8em;
    }
    
    .main-content {
        flex-direction: column;
        height: calc(100vh - 70px);
        margin-top: 70px;
    }
    
    .sidebar {
        width: 100%;
        height: 120px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        position: relative;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .sidebar-header h3 {
        font-size: 1.1em;
    }
    
    .chats-list {
        display: flex;
        overflow-x: auto;
        padding: 10px;
        white-space: nowrap;
    }
    
    .chat-item {
        flex: 0 0 auto;
        width: 120px;
        margin-right: 10px;
        padding: 12px;
        text-align: center;
    }
    
    .chat-area {
        flex: 1;
        height: calc(100vh - 190px);
    }
    
    .chat-header {
        padding: 15px 20px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 100;
    }
    
    .messages {
        height: calc(100vh - 250px);
        padding: 15px 10px;
    }
    
    .message {
        max-width: 85%;
        margin: 8px 0;
    }
    
    .message-header {
        font-size: 0.8em;
    }
    
    .delete-btn, .report-btn {
        opacity: 1; /* Всегда показываем кнопки на мобильных */
        font-size: 0.9em;
    }
    
    .input-area {
        padding: 15px 20px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e0e0e0;
    }
    
    .input-area input {
        padding: 12px 15px;
        font-size: 16px; /* Убираем zoom на iOS */
    }
    
    .input-area button {
        padding: 12px 15px;
        font-size: 14px;
        min-width: auto;
    }
}

/* Еще более маленькие экраны */
@media (max-width: 480px) {
    .header {
        padding: 12px 15px;
    }
    
    .header h1 {
        font-size: 1.2em;
    }
    
    .user-info span {
        display: none; /* Скрываем имя пользователя на очень маленьких экранах */
    }
    
    .message {
        max-width: 90%;
    }
    
    .input-area {
        padding: 10px 15px;
    }
    
    .input-area button {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .input-area button:last-of-type {
        display: none; /* Скрываем кнопку обновления на маленьких экранах */
    }
}

/* ===== СВАЙПЫ И ЖЕСТЫ ===== */
.chat-item {
    transition: transform 0.2s ease;
}

.chat-item:active {
    transform: scale(0.95);
}

.message {
    transition: transform 0.2s ease;
}

.message:active {
    transform: scale(0.98);
}

/* Анимация появления сообщений */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideInUp 0.3s ease;
}

/* Свайп для удаления сообщений */
.message {
    position: relative;
    overflow: hidden;
}

.message-actions {
    position: absolute;
    right: -100px;
    top: 0;
    bottom: 0;
    background: #ff6b6b;
    display: flex;
    align-items: center;
    padding: 0 15px;
    transition: right 0.3s ease;
    border-radius: 0 15px 15px 0;
}

.message.swiped .message-actions {
    right: 0;
}

.delete-swipe {
    color: white;
    font-size: 0.9em;
    white-space: nowrap;
}

/* Вибрация при касании */
@media (hover: none) and (pointer: coarse) {
    .btn:active, .chat-item:active, .message:active {
        background-color: rgba(0, 0, 0, 0.1);
    }
}

/* Предотвращение выделения текста на мобильных */
.messages {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Скроллбар для мобильных */
.messages::-webkit-scrollbar {
    width: 3px;
}

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

/* ===== ОРИЕНТАЦИЯ ===== */
/* Портретная ориентация */
@media (max-width: 768px) and (orientation: portrait) {
    .sidebar {
        height: 100px;
    }
    
    .messages {
        height: calc(100vh - 270px);
    }
}

/* Ландшафтная ориентация */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        height: 80px;
    }
    
    .messages {
        height: calc(100vh - 230px);
    }
    
    .header {
        padding: 10px 15px;
    }
    
    .header h1 {
        font-size: 1.1em;
    }
}

/* ===== IOS SPECIFIC ===== */
@supports (-webkit-touch-callout: none) {
    .messages {
        -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
    }
    
    .input-area {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
}

/* ===== ANDROID SPECIFIC ===== */
@media (-webkit-device-pixel-ratio: 2) {
    .message-text {
        font-weight: 400; /* Более тонкий шрифт для Retina */
    }
}
/* ===== МОБИЛЬНЫЕ СТИЛИ - ПОЛНОСТЬЮ ПЕРЕРАБОТАННЫЕ ===== */
@media (max-width: 768px) {
    body {
        height: 100vh;
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    .messenger-container {
        height: 100vh;
        width: 100vw;
        border-radius: 0;
        position: fixed;
        top: 0;
        left: 0;
        display: flex;
        flex-direction: column;
    }
    
    .header {
        padding: 12px 15px;
        position: relative;
        flex-shrink: 0;
        height: 60px;
        min-height: 60px;
    }
    
    .header h1 {
        font-size: 1.3em;
    }
    
    .user-info {
        font-size: 0.8em;
    }
    
    .user-info button {
        padding: 5px 10px;
        font-size: 0.75em;
    }
    
    .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px);
        overflow: hidden;
    }
    
    .sidebar {
        width: 100%;
        height: 80px;
        min-height: 80px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        flex-shrink: 0;
    }
    
    .sidebar-header {
        padding: 8px 12px;
        height: 40px;
        min-height: 40px;
    }
    
    .sidebar-header h3 {
        font-size: 1em;
        margin: 0;
    }
    
    .sidebar-header button {
        padding: 4px 8px;
        font-size: 0.7em;
    }
    
    .chats-list {
        display: flex;
        overflow-x: auto;
        padding: 5px 8px;
        white-space: nowrap;
        height: 40px;
        min-height: 40px;
    }
    
    .chat-item {
        flex: 0 0 auto;
        width: 90px;
        margin-right: 6px;
        padding: 6px 8px;
        text-align: center;
        font-size: 0.8em;
        border-radius: 8px;
    }
    
    .chat-area {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }
    
    .chat-header {
        padding: 8px 12px;
        height: 50px;
        min-height: 50px;
        flex-shrink: 0;
    }
    
    .chat-header h3 {
        font-size: 1.1em;
        margin: 0;
    }
    
    .messages {
        flex: 1;
        overflow-y: auto;
        padding: 8px 10px;
        min-height: 0;
    }
    
    .message {
        max-width: 90%;
        margin: 5px 0;
    }
    
    .message-header {
        font-size: 0.7em;
    }
    
    .message-text {
        padding: 8px 12px;
        font-size: 0.85em;
    }
    
    .delete-btn, .report-btn {
        opacity: 1;
        font-size: 0.7em;
        padding: 1px 3px;
    }
    
    /* ОБЛАСТЬ ВВОДА - ФИКСИРОВАННАЯ И ВИДИМАЯ */
    .input-area {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 2px solid #4299e1;
        padding: 10px 12px;
        height: 70px;
        min-height: 70px;
        display: flex;
        align-items: center;
        gap: 8px;
        z-index: 1000;
        flex-shrink: 0;
        box-shadow: 0 -2px 15px rgba(0,0,0,0.1);
    }
    
    .input-area input {
        padding: 12px 15px;
        font-size: 16px;
        min-height: 45px;
        border-radius: 25px;
        border: 2px solid #4299e1;
        flex: 1;
    }
    
    .input-area button {
        padding: 12px 15px;
        font-size: 12px;
        min-height: 45px;
        border-radius: 25px;
        font-weight: 600;
    }
    
    .input-area button:first-of-type {
        background: #4299e1;
        color: white;
        min-width: 80px;
        border: none;
    }
    
    .input-area button:last-of-type {
        display: none;
    }
    
    /* Специальные стили когда клавиатура открыта */
    .keyboard-open .input-area {
        position: fixed;
        bottom: 0;
        border-top: 3px solid #48bb78;
    }
    
    .keyboard-open .messages {
        padding-bottom: 80px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .header {
        height: 55px;
        min-height: 55px;
        padding: 10px 12px;
    }
    
    .header h1 {
        font-size: 1.1em;
    }
    
    .user-info span {
        display: none;
    }
    
    .main-content {
        height: calc(100vh - 55px);
    }
    
    .sidebar {
        height: 70px;
        min-height: 70px;
    }
    
    .sidebar-header {
        height: 35px;
        min-height: 35px;
        padding: 6px 10px;
    }
    
    .chats-list {
        height: 35px;
        min-height: 35px;
        padding: 4px 6px;
    }
    
    .chat-item {
        width: 80px;
        padding: 4px 6px;
        font-size: 0.75em;
    }
    
    .chat-header {
        height: 45px;
        min-height: 45px;
        padding: 6px 10px;
    }
    
    .messages {
        padding: 6px 8px;
    }
    
    .input-area {
        height: 65px;
        min-height: 65px;
        padding: 8px 10px;
    }
    
    .input-area input {
        padding: 10px 12px;
        min-height: 40px;
        font-size: 16px;
    }
    
    .input-area button {
        padding: 10px 12px;
        min-height: 40px;
        font-size: 11px;
        min-width: 70px;
    }
}

/* Ландшафтная ориентация */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        height: 60px;
        min-height: 60px;
    }
    
    .sidebar-header {
        height: 30px;
        min-height: 30px;
    }
    
    .chats-list {
        height: 30px;
        min-height: 30px;
    }
    
    .chat-header {
        height: 40px;
        min-height: 40px;
    }
    
    .input-area {
        height: 60px;
        min-height: 60px;
        padding: 6px 10px;
    }
    
    .input-area input {
        min-height: 35px;
        padding: 8px 12px;
    }
    
    .input-area button {
        min-height: 35px;
        padding: 8px 10px;
    }
    
    .keyboard-open .messages {
        padding-bottom: 70px;
    }
}

/* iOS специфичные исправления */
@supports (-webkit-touch-callout: none) {
    .input-area {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
    
    .messages {
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
    
    .keyboard-open .input-area {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
}

/* Android специфичные исправления */
@media (-webkit-device-pixel-ratio: 2) {
    .input-area {
        border-top-width: 3px;
    }
}
/* ===== МОБИЛЬНЫЕ СТИЛИ ===== */
@media (max-width: 768px) {
    .messenger-container {
        height: 100vh;
        width: 100vw;
        border-radius: 0;
    }
    
    .header {
        padding: 15px 20px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        border-radius: 0;
    }
    
    .header h1 {
        font-size: 1.4em;
    }
    
    .user-info {
        font-size: 0.9em;
    }
    
    .user-info button {
        padding: 6px 12px;
        font-size: 0.8em;
    }
    
    .main-content {
        flex-direction: column;
        height: calc(100vh - 70px);
        margin-top: 70px;
    }
    
    .sidebar {
        width: 100%;
        height: 120px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        position: relative;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .sidebar-header h3 {
        font-size: 1.1em;
    }
    
    .chats-list {
        display: flex;
        overflow-x: auto;
        padding: 10px;
        white-space: nowrap;
    }
    
    .chat-item {
        flex: 0 0 auto;
        width: 120px;
        margin-right: 10px;
        padding: 12px;
        text-align: center;
    }
    
    .chat-area {
        flex: 1;
        height: calc(100vh - 190px);
    }
    
    .chat-header {
        padding: 15px 20px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 100;
    }
    
    .messages {
        height: calc(100vh - 250px);
        padding: 15px 10px;
    }
    
    .message {
        max-width: 85%;
        margin: 8px 0;
    }
    
    .message-header {
        font-size: 0.8em;
    }
    
    .delete-btn, .report-btn {
        opacity: 1;
        font-size: 0.9em;
    }
    
    .input-area {
        padding: 15px 20px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e0e0e0;
    }
    
    .input-area input {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    .input-area button {
        padding: 12px 15px;
        font-size: 14px;
        min-width: auto;
    }
}

/* Свайп для удаления сообщений */
.message {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.message-actions {
    position: absolute;
    right: -100px;
    top: 0;
    bottom: 0;
    background: #ff6b6b;
    display: flex;
    align-items: center;
    padding: 0 15px;
    transition: right 0.3s ease;
    border-radius: 0 15px 15px 0;
}

.message.swiped .message-actions {
    right: 0;
}

.delete-swipe {
    color: white;
    font-size: 0.9em;
    white-space: nowrap;
}

/* Анимация появления сообщений */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideInUp 0.3s ease;
}

/* Предотвращение выделения текста на мобильных */
.messages {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Плавный скролл на iOS */
.messages {
    -webkit-overflow-scrolling: touch;
}