/* assets/css/style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Навигация */
.navbar {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background 0.3s;
}

.nav-links a:hover {
    background: #f0f0f0;
}

/* Контейнер чата */
.chat-container {
    max-width: 800px;
    margin: 2rem auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.message {
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-radius: 5px;
    background: #f8f9fa;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.username {
    font-weight: bold;
    color: #333;
}

.time {
    font-size: 0.8rem;
    color: #999;
}

.message-content {
    margin-left: 2.5rem;
}

.message-attachment {
    margin-left: 2.5rem;
    margin-top: 0.5rem;
}

.attachment-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 5px;
}

.message-footer {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.reactions {
    display: flex;
    gap: 0.25rem;
}

.reaction {
    padding: 0.2rem 0.5rem;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 0.9rem;
    cursor: pointer;
}

.message-input-container {
    padding: 1rem;
    border-top: 1px solid #eee;
}

#messageForm {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

#messageForm textarea {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: none;
    min-height: 40px;
}

.file-attachment {
    position: relative;
}

.file-preview {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.preview-image {
    max-width: 100px;
    max-height: 100px;
}

.emoji-picker {
    position: relative;
}

.emoji-list {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 0.5rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.emoji-list span {
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
}

.emoji-list span:hover {
    background: #f0f0f0;
    border-radius: 3px;
}

/* Панель администратора */
.admin-panel {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.admin-tabs {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 1rem;
}

.tab-button {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
}

.tab-button.active {
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.badge.blocked {
    background: #dc3545;
    color: white;
}

.badge.active {
    background: #28a745;
    color: white;
}

/* Формы */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

button {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

button:hover {
    opacity: 0.9;
}

/* Поиск */
.search-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

#searchInput {
    width: 100%;
    padding: 1rem;
    border: 2px solid #eee;
    border-radius: 5px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.search-results {
    display: grid;
    gap: 1rem;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
}

.user-card:hover {
    background: #e9ecef;
}

.user-card .avatar {
    width: 50px;
    height: 50px;
}

.user-info h3 {
    color: #333;
}

.user-info p {
    color: #666;
}

/* Профиль */
.profile-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}

.profile-info {
    margin-bottom: 2rem;
}

.profile-info p {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 5px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .chat-container {
        margin: 1rem;
        height: calc(100vh - 2rem);
    }
    
    .admin-panel {
        margin: 1rem;
        padding: 1rem;
    }
    
    .profile-container {
        margin: 1rem;
        padding: 1rem;
    }
}
/* Дополнительные стили */

/* Главная страница */
.home-container {
    display: flex;
    height: calc(100vh - 80px);
}

.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.user-info {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #eee;
}

.mini-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.chats-list h3 {
    margin-bottom: 1rem;
    color: #666;
}

.chat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
}

.chat-item:hover {
    background: #e9ecef;
}

.chat-info h4 {
    margin-bottom: 0.25rem;
}

.last-message {
    font-size: 0.8rem;
    color: #999;
}

.chat-type {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: #667eea;
    color: white;
    border-radius: 12px;
}

.no-chats {
    text-align: center;
    color: #999;
    padding: 2rem;
}

.create-chat-btn {
    display: block;
    margin: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    text-align: center;
    border-radius: 5px;
}

.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-message {
    text-align: center;
    color: white;
}

.welcome-message h2 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

/* Уведомления */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Формы авторизации */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
}

.auth-form {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.auth-form h2 {
    margin-bottom: 2rem;
    text-align: center;
    color: #333;
}

.error-message {
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
}

.success-message {
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
}

.auth-link {
    margin-top: 1rem;
    text-align: center;
}

.auth-link a {
    color: #667eea;
    text-decoration: none;
}

/* Комментарии */
.comments-section {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 5px;
}

.comment {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: white;
    border-radius: 5px;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.comment-content {
    margin-left: 2.5rem;
}

.comment-input {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.comment-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Статусы пользователей */
.status-online {
    color: #28a745;
}

.status-offline {
    color: #dc3545;
}

/* Загрузка файлов */
.upload-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 10000;
}

.progress-bar {
    width: 300px;
    height: 20px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* Bluetooth кнопка */
.bluetooth-btn {
    padding: 0.25rem 0.5rem;
    background: #0088cc;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

.bluetooth-btn:hover {
    background: #006699;
}

/* Адаптивность для главной */
@media (max-width: 768px) {
    .home-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
    }
    
    .main-content {
        height: calc(100vh - 380px);
    }
}

/* Стили для сообщений как в Telegram */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f0f2f5;
}

.message {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Мои сообщения (справа) */
.my-message {
    justify-content: flex-end;
}

.my-message .message-content-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    padding: 8px 12px;
    position: relative;
}

/* Чужие сообщения (слева) */
.other-message {
    justify-content: flex-start;
}

.other-message .message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.other-message .message-content-wrapper {
    background: white;
    border-radius: 18px 18px 18px 4px;
    max-width: 60%;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-author {
    font-size: 0.85rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 4px;
}

.message-content {
    word-wrap: break-word;
    line-height: 1.4;
}

.message-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
}

.my-message .message-time {
    color: rgba(255,255,255,0.8);
}

.other-message .message-time {
    color: #999;
}

/* Вложения */
.attachment-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 5px;
}

.attachment-image:hover {
    opacity: 0.9;
}

audio, video {
    max-width: 250px;
    margin-top: 5px;
    border-radius: 8px;
}

/* Кнопка ответа */
.reply-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 5px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.reply-btn:hover {
    opacity: 1;
}

/* Превью ответа */
.reply-preview {
    background: #f0f0f0;
    border-left: 3px solid #667eea;
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.reply-content {
    color: #666;
    flex: 1;
}

.reply-preview button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #999;
}

.reply-preview button:hover {
    color: #666;
}

/* Поле ввода */
.message-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: white;
    border-radius: 24px;
    padding: 8px 12px;
    border: 1px solid #ddd;
}

#messageContent {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    max-height: 100px;
    font-size: 0.95rem;
    padding: 8px 0;
}

.attach-btn, .emoji-btn, .send-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px;
    color: #666;
    transition: color 0.2s;
}

.attach-btn:hover, .emoji-btn:hover, .send-btn:hover {
    color: #667eea;
}

.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    transform: scale(1.1);
    color: white;
}

/* Эмодзи пикер */
.emoji-picker {
    position: relative;
}

.emoji-list {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 1000;
}

.emoji-list span {
    cursor: pointer;
    font-size: 1.5rem;
    padding: 5px;
    text-align: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.emoji-list span:hover {
    background: #f0f0f0;
}

/* Превью файла */
.file-preview {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 1000;
}

.preview-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
}

.file-info {
    color: #666;
    font-size: 0.9rem;
}

/* Статус пользователя в шапке */
.chat-header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.user-status {
    font-size: 0.9rem;
    color: #666;
}

/* Адаптивность */
@media (max-width: 768px) {
    .my-message .message-content-wrapper {
        max-width: 85%;
    }
    
    .other-message .message-content-wrapper {
        max-width: 75%;
    }
    
    .attachment-image {
        max-width: 150px;
    }
}

/* Панель реакций как в Telegram */
.reactions-panel {
    position: fixed;
    background: white;
    border-radius: 40px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
    padding: 10px;
    z-index: 10000;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reactions-panel-content {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.reaction-emoji {
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.reaction-emoji:hover {
    background: #f0f0f0;
    transform: scale(1.2);
}

/* Контейнер для реакций под сообщением */
.message-reactions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-right: 8px;
}

.reaction {
    background: rgba(0,0,0,0.05);
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.reaction:hover {
    background: rgba(0,0,0,0.1);
    border-color: #667eea;
}

.reaction-count {
    font-size: 0.8rem;
    color: #666;
}

.my-message .reaction {
    background: rgba(255,255,255,0.2);
}

.my-message .reaction:hover {
    background: rgba(255,255,255,0.3);
}

.my-message .reaction-count {
    color: rgba(255,255,255,0.8);
}

/* Кнопка открытия реакций */
.reaction-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 5px;
    opacity: 0.5;
    transition: opacity 0.2s;
    border-radius: 12px;
}

.reaction-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}

.my-message .reaction-btn {
    color: white;
}

.my-message .reaction-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Анимация появления реакции */
@keyframes pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.reaction-emoji:active {
    animation: pop 0.2s ease;
}