* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
    background: #0f0f12;
    color: #fff;
    overflow-x: hidden;
}

/* --- Логин --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(145deg, #1e1e2f 0%, #0a0a0f 100%);
}
.login-card {
    background: rgba(28, 28, 38, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 32px;
    padding: 32px 24px;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
    text-align: center;
}
.login-card h2 {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 28px;
    background: linear-gradient(135deg, #6c5ce7, #a363d9);
    -webkit-background-clip: text;
    background-clip: text;
    #color: transparent;
}
.login-card input {
    width: 100%;
    padding: 16px;
    background: #1f1f2a;
    border: 1px solid #2e2e3a;
    border-radius: 28px;
    font-size: 16px;
    color: white;
    outline: none;
    transition: 0.2s;
}
.login-card input:focus {
    border-color: #6c5ce7;
    box-shadow: 0 0 10px 8px rgba(108,92,231,0.3);
}
.login-card button {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    background: #6c5ce7;
    border: none;
    border-radius: 40px;
    font-weight: 600;
    font-size: 17px;
    color: white;
    transition: 0.2s;
    cursor: pointer;
}
.login-card button:active { transform: scale(0.97); background: #5b4bc4; }

/* --- Основной контейнер --- */
.app-main {
    display: none;
    flex-direction: column;
    height: 100vh;
    background: #0f0f12;
}

/* Чат экран */
.chat-header-mobile {
    display: flex;
    align-items: center;
    gap: 80px;
    padding: 12px 16px;
    background: #131318;
    border-bottom: 0.5px solid #2c2c30;
}
.back-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6c5ce7;
}
.chat-title {
    font-weight: 600;
    font-size: 18px;
}

/* Toast уведомления сверху */
.toast-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    pointer-events: none;
}
.toast-mob {
    pointer-events: auto;
    background: #2c2c34;
    padding: 12px 20px;
    border-radius: 60px;
    text-align: center;
    color: white;
    font-weight: 500;
    animation: slideDown 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    background: rgba(44, 44, 52, 0.95);
}
.toast-mob.success {
    background: rgba(72, 187, 120, 0.95);
}
.toast-mob.error {
    background: rgba(245, 87, 108, 0.95);
}
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-bar {
    padding: 12px 16px 8px;
    background: rgba(15,15,18,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 0.5px solid #2c2c30;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.status-bar h1 {
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, #c084fc, #6c5ce7);
    -webkit-background-clip: text;
    background-clip: text;
   #color: transparent;
}
.stats-badge {
    background: #2c2c34;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
}
.logout-mobile {
    background: none;
    border: none;
    color: #ff5e7c;
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
}

/* Tab Bar */
.tab-bar {
    display: flex;
    background: #111116;
    border-bottom: 0.5px solid #2a2a30;
    padding: 6px 16px;
    gap: 28px;
}
.tab-btn {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: #8e8e98;
    transition: 0.2s;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tab-btn.active {
    color: #6c5ce7;
    background: rgba(108,92,231,0.12);
}
.tab-btn span { font-size: 20px; }

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}
.tab-pane {
    display: none;
    flex-direction: column;
    height: 100%;
}
.tab-pane.active-pane {
    display: flex;
}

/* Список пользователей */
.users-list-mobile {
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.user-card {
    background: #17171f;
    border-radius: 20px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: 0.1s;
    border: 0.5px solid #2a2a32;
    cursor: pointer;
}
.user-card:active { background: #22222c; transform: scale(0.99); }
.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}
.user-name {
    font-weight: 600;
    font-size: 17px;
}
.user-last {
    font-size: 12px;
    color: #8e8e98;
}
.unread-badge-mobile {
    background: #6c5ce7;
    color: white;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
    box-shadow: 0 0 0 2px #17171f;
}

/* Чат экран - сообщения */
.messages-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.message-bubble {
    max-width: 85%;
    padding: 12px 14px;
    border-radius: 20px;
    font-size: 15px;
    word-wrap: break-word;
}
.incoming {
    background: #1e4c34;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}
.outgoing {
    background: #6c5ce7;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    color: white;
}
.media-preview {
    margin-top: 8px;
    border-radius: 16px;
    overflow: hidden;
}
.media-preview img, .media-preview video {
    max-width: 100%;
    max-height: 200px;
    border-radius: 14px;
    cursor: pointer;
}
.message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 6px;
    text-align: right;
}

/* Область ввода - НОВАЯ ВЕРСИЯ */
.chat-input-area {
    background: #131318;
    padding: 12px 16px;
    border-top: 0.5px solid #2c2c30;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Контейнер для поля ввода и кнопок в одной строке */
.input-row-top {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* Поле ввода - занимает всё свободное место */
.chat-input-area .msg-input {
    flex: 1;
    background: #1f1f2a;
    border: none;
    border-radius: 24px;
    padding: 12px 16px;
    color: white;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
    box-sizing: border-box;
}

.chat-input-area .msg-input:focus {
    outline: none;
    background: #2a2a36;
}

/* Кнопки рядом с полем ввода */
.emoji-btn-mobile {
    background: #2a2a35;
    border: none;
    border-radius: 30px;
    padding: 10px 14px;
    font-size: 20px;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.attach-btn {
    background: #2c2c38;
    border: none;
    border-radius: 30px;
    padding: 10px 14px;
    font-size: 18px;
    cursor: pointer;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
}

/* Кнопка отправить - на всю ширину снизу */
.send-btn-full {
    background: #1b6d0c;
    border: none;
    border-radius: 30px;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    color: white;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.send-btn-full:active {
    transform: scale(0.98);
    background: #5b4bc4;
}

.selected-file-label {
    font-size: 12px;
    color: #a5b4fc;
    padding-left: 8px;
    margin-top: -4px;
}

/* Emoji кнопки в рассылке */
.emoji-btn {
    background: #2a2a35;
    border: none;
    border-radius: 25px;
    padding: 8px 15px;
    font-size: 16px;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
}

.emoji-btn:hover {
    background: #3a3a45;
    transform: scale(1.02);
}

/* Emoji панель */
.emoji-panel {
    background: #1e1e2e;
    border-radius: 12px;
    padding: 10px;
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #2a2a35;
}

.emoji-item {
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 8px;
    transition: all 0.2s;
    text-align: center;
    min-width: 40px;
}

.emoji-item:hover {
    background: #2a2a35;
    transform: scale(1.1);
}

/* Рассылка */
.broadcast-card {
    background: #17171f;
    margin: 16px;
    border-radius: 28px;
    padding: 20px;
    border: 0.5px solid #2e2e38;
}
.broadcast-input-mob {
    width: 100%;
    background: #1f1f2a;
    border: none;
    border-radius: 24px;
    padding: 14px;
    color: white;
    font-size: 15px;
    margin-bottom: 12px;
    font-family: inherit;
    resize: vertical;
}
.broadcast-actions {
   # display: flex;
   # gap: 10px;
   # align-items: center;
   # margin: 8px 0;
    display: flex;
    gap: 10px;
    margin: 8px 0;
    /* flex-direction: column-reverse; */
    flex-wrap: wrap;
    align-content: center;
    justify-content: space-evenly;
    align-items: stretch;
	

}
.broadcast-file-btn {
    background: #2c2c38;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 40px;
    font-size: 14px;
    cursor: pointer;
    flex: 1;
    justify-content: center;
}
.broadcast-send {
    background: #e86a6a;
    border: none;
    padding: 10px 18px;
    border-radius: 40px;
    font-weight: bold;
    color: white;
    cursor: pointer;
   # flex: 2;
   # display: inline-flex;
   # align-items: center;
   # justify-content: center;
   # gap: 6px;
}
.history-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 20px;
}
.history-item-mob {
    background: #111116;
    padding: 12px;
    border-radius: 20px;
    font-size: 13px;
    border: 0.5px solid #292932;
}

/* Модалка */
.modal-media {
    display: none;
    position: fixed;
    top:0;left:0;width:100%;height:100%;
    background: rgba(0,0,0,0.96);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}
.modal-media.active {
    display: flex;
}
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6b6b76;
}

/* Анимация нового сообщения */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.message-bubble {
    animation: fadeInUp 0.2s ease;
}

/* Индикатор загрузки */
.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #8e8e98;
    font-size: 13px;
}

/* Стили для мобильной версии */
@media (max-width: 768px) {
    .emoji-item {
        font-size: 28px;
        min-width: 50px;
    }
    
    .emoji-btn-mobile {
        padding: 8px 12px;
        font-size: 18px;
        height: 40px;
    }
    
    .attach-btn {
        padding: 8px 12px;
        font-size: 18px;
        height: 40px;
    }
    
    .send-btn-full {
        padding: 10px 16px;
    }
    
    .emoji-panel {
        gap: 10px;
        padding: 8px;
    }
    
    .input-row-top {
        gap: 6px;
    }
}
