* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #000000;
    color: #FFFFFF;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ============ МОДАЛЬНОЕ ОКНО АВТОРИЗАЦИИ ============ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: #0F0F0F;
    padding: 30px;
    border-radius: 20px;
    max-width: 450px;
    width: 90%;
    border: 1px solid #1F1F1F;
    max-height: 90vh;
    overflow-y: auto;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid #1F1F1F;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: #A9A9A9;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #2AABEE;
    border-bottom: 2px solid #2AABEE;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    margin-bottom: 24px;
    text-align: center;
    color: #FFFFFF;
}

.auth-form input {
    width: 100%;
    padding: 14px;
    margin-bottom: 16px;
    background: #1F1F1F;
    border: 1px solid #2A2A2A;
    border-radius: 10px;
    color: #FFFFFF;
    font-size: 14px;
}

.auth-form input:focus {
    outline: none;
    border-color: #2AABEE;
}

.auth-form button {
    width: 100%;
    padding: 14px;
    background: #2AABEE;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.auth-form button:hover {
    opacity: 0.9;
}

.username-status {
    font-size: 12px;
    margin-top: -10px;
    margin-bottom: 10px;
    padding: 4px 8px;
    border-radius: 6px;
}

.username-status.available {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.username-status.unavailable {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
}

#captchaBlock {
    background: #1A1A1A;
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 16px;
}

#captchaQuestion {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #2AABEE;
}

.captcha-refresh {
    background: #2A2A2A !important;
    margin-top: 8px;
    font-size: 14px !important;
}

/* ============ ОСНОВНОЙ ИНТЕРФЕЙС ============ */
.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    min-width: 900px;
    position: relative;
}

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    background: #0F0F0F;
    border: none;
    color: white;
    font-size: 24px;
    padding: 10px 15px;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid #1F1F1F;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mobile-menu-btn:hover {
    background: #1F1F1F;
}

.mobile-menu-btn-inline {
    background: #0F0F0F;
    border: none;
    color: white;
    font-size: 22px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    margin-right: 10px;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 95;
}

/* ============ ЛЕВАЯ ПАНЕЛЬ ============ */
.chats-panel {
    width: 380px;
    background: #0F0F0F;
    border-right: 1px solid #1F1F1F;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    transition: width 0.3s ease;
}

.chats-panel.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden;
    border-right: none;
}

.show-panel-btn {
    position: fixed;
    left: 10px;
    top: 70px;
    z-index: 90;
    background: #0F0F0F;
    border: 1px solid #1F1F1F;
    color: white;
    font-size: 18px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    display: none;
}

.show-panel-btn.visible {
    display: block;
}

.show-panel-btn:hover {
    background: #1F1F1F;
}

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    gap: 12px;
    border-bottom: 1px solid #1F1F1F;
}

.profile-click-area {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    cursor: pointer;
}

.panel-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-panel-btn {
    background: transparent;
    border: none;
    color: #A9A9A9;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
}

.toggle-panel-btn:hover {
    background: #1F1F1F;
    color: #FFFFFF;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2AABEE, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
}

.profile-fullname {
    font-size: 12px;
    color: #A9A9A9;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-coins {
    font-size: 12px;
    color: #F59E0B;
    margin-top: 2px;
}

.logout-icon {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #A9A9A9;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
}

.logout-icon:hover {
    background: #1F1F1F;
    color: #EF4444;
}

/* ============ НАВИГАЦИОННЫЕ ВКЛАДКИ ============ */
.nav-tabs {
    display: flex;
    padding: 8px;
    gap: 4px;
    background: #0F0F0F;
    border-bottom: 1px solid #1F1F1F;
}

.nav-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: #A9A9A9;
    font-size: 14px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-tab:hover {
    background: #1F1F1F;
}

.nav-tab.active {
    background: #2AABEE;
    color: white;
}

.page-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.page-content.active {
    display: block;
}

/* ============ ЛЕНТА ПОСТОВ ============ */
.create-post {
    background: #0F0F0F;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid #1F1F1F;
}

.create-post textarea {
    width: 100%;
    padding: 12px;
    background: #1F1F1F;
    border: 1px solid #2A2A2A;
    border-radius: 10px;
    color: #FFFFFF;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 12px;
    font-family: inherit;
}

.create-post textarea:focus {
    outline: none;
    border-color: #2AABEE;
}

.post-image-preview {
    position: relative;
    margin-bottom: 12px;
    display: inline-block;
}

.post-image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
}

.post-image-preview button {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #EF4444;
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
}

.create-post-buttons {
    display: flex;
    gap: 10px;
}

.attach-image-btn {
    background: #1F1F1F;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
}

.create-post-btn {
    background: #2AABEE;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    flex: 1;
}

.feed-sort {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.sort-btn {
    background: #1F1F1F;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    color: #A9A9A9;
    cursor: pointer;
}

.sort-btn.active {
    background: #2AABEE;
    color: white;
}

.feed-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-card {
    background: #0F0F0F;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #1F1F1F;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    cursor: pointer;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2AABEE, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    overflow: hidden;
}

.post-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-author {
    font-weight: 600;
    color: #FFFFFF;
}

.post-time {
    font-size: 11px;
    color: #A9A9A9;
}

.post-content {
    color: #FFFFFF;
    margin-bottom: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-image {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
}

.post-actions {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #1F1F1F;
}

.post-action-btn {
    background: transparent;
    border: none;
    color: #A9A9A9;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

.post-action-btn:hover {
    background: #1F1F1F;
}

.post-action-btn.liked {
    color: #2AABEE;
}

.post-action-btn.disliked {
    color: #EF4444;
}

.post-stats {
    font-size: 12px;
    color: #A9A9A9;
}

/* ============ ЧАТЫ ============ */
.search-bar {
    padding: 12px;
    border-bottom: 1px solid #1F1F1F;
}

.search-bar input {
    width: 100%;
    padding: 10px 14px;
    background: #1F1F1F;
    border: none;
    border-radius: 8px;
    color: #FFFFFF;
    font-size: 14px;
}

.search-bar input:focus {
    outline: none;
    border: 1px solid #2AABEE;
}

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

.loading {
    text-align: center;
    padding: 40px;
    color: #A9A9A9;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #1F1F1F;
}

.chat-item:hover {
    background: #1A1A1A;
}

.chat-item.active {
    background: #1F1F1F;
}

.chat-item.group {
    background: #0F0F0F;
    border-left: 3px solid #2AABEE;
}

.chat-item.group .chat-avatar {
    background: linear-gradient(135deg, #2AABEE, #764ba2);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2AABEE, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-details {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-size: 15px;
    font-weight: 500;
    color: #FFFFFF;
    margin-bottom: 4px;
}

.chat-last-message {
    font-size: 13px;
    color: #A9A9A9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    text-align: right;
}

.chat-time {
    font-size: 11px;
    color: #A9A9A9;
    margin-bottom: 4px;
}

.unread-badge {
    background: #EF4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 12px;
}

/* ============ ГРУППЫ ============ */
.create-group-btn-container {
    margin-bottom: 20px;
}

.create-group-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #2AABEE, #764ba2);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.create-group-btn:hover {
    transform: scale(1.02);
}

.groups-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.group-card {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #1A1A1A;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #1F1F1F;
}

.group-card:hover {
    background: #1F1F1F;
    border-color: #2AABEE;
}

.group-avatar {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2AABEE, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    overflow: hidden;
    margin-right: 12px;
    flex-shrink: 0;
}

.group-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-info {
    flex: 1;
}

.group-name {
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 4px;
}

.group-description {
    font-size: 12px;
    color: #A9A9A9;
}

.group-meta {
    font-size: 11px;
    color: #2AABEE;
    margin-top: 4px;
}

.group-role {
    font-size: 11px;
    color: #F59E0B;
    margin-top: 4px;
}

.join-group-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #1F1F1F;
}

.join-group-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #FFFFFF;
}

.join-group-input {
    display: flex;
    gap: 10px;
}

.join-group-input input {
    flex: 1;
    padding: 12px;
    background: #1F1F1F;
    border: 1px solid #2A2A2A;
    border-radius: 10px;
    color: white;
}

.join-group-input button {
    padding: 12px 20px;
    background: #2AABEE;
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
}

/* ============ ДРУЗЬЯ ============ */
.friend-requests-section,
.friends-section,
.search-friends-section {
    margin-bottom: 24px;
}

.friend-requests-section h3,
.friends-section h3,
.search-friends-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #FFFFFF;
}

.friend-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #1A1A1A;
    border-radius: 10px;
    margin-bottom: 8px;
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    flex: 1;
}

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2AABEE, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-name {
    font-weight: 500;
    color: #FFFFFF;
}

.accept-friend-btn {
    background: #10b981;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    color: white;
    cursor: pointer;
}

.friend-action-btn {
    background: #2AABEE;
    border: none;
    padding: 12px;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 15px;
}

.search-friends-section input {
    width: 100%;
    padding: 12px;
    background: #1F1F1F;
    border: 1px solid #2A2A2A;
    border-radius: 10px;
    color: #FFFFFF;
    margin-bottom: 12px;
}

/* ============ АДМИН ПАНЕЛЬ ============ */
.admin-stats {
    background: #0F0F0F;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.stat-card {
    background: #1A1A1A;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #2AABEE;
}

.stat-label {
    font-size: 12px;
    color: #A9A9A9;
}

.admin-users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.admin-user-card {
    background: #1A1A1A;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-user-info {
    flex: 1;
}

.admin-user-username {
    font-weight: 600;
    color: #FFFFFF;
}

.admin-user-email {
    font-size: 11px;
    color: #A9A9A9;
}

.admin-user-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-input {
    width: 80px;
    padding: 6px;
    background: #0F0F0F;
    border: 1px solid #2A2A2A;
    border-radius: 4px;
    color: white;
}

.admin-btn {
    background: #2AABEE;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 12px;
}

.admin-btn.danger {
    background: #EF4444;
}

/* ============ КОММЕНТАРИИ ============ */
.comments-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.comment-item {
    padding: 12px;
    background: #1A1A1A;
    border-radius: 8px;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
    color: #2AABEE;
    margin-bottom: 4px;
    cursor: pointer;
}

.comment-text {
    color: #FFFFFF;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-time {
    font-size: 10px;
    color: #A9A9A9;
    margin-top: 4px;
}

.add-comment textarea {
    width: 100%;
    padding: 10px;
    background: #1F1F1F;
    border: 1px solid #2A2A2A;
    border-radius: 8px;
    color: white;
    margin-bottom: 8px;
    font-family: inherit;
    resize: vertical;
}

.add-comment button {
    background: #2AABEE;
    border: none;
    padding: 10px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    width: 100%;
}

/* ============ ЦЕНТРАЛЬНАЯ ПАНЕЛЬ (ЧАТ) ============ */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000000;
    min-width: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #0F0F0F;
    border-bottom: 1px solid #1F1F1F;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-contact {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2AABEE, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}

.contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-name {
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
}

.contact-status {
    font-size: 12px;
    color: #A9A9A9;
}

.call-btn {
    background: #1F1F1F;
    border: none;
    color: #A9A9A9;
    font-size: 18px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 16px;
    transition: all 0.2s;
}

.call-btn:hover {
    background: #2AABEE;
    color: white;
}

.group-info-btn, .invite-btn {
    background: #1F1F1F;
    border: none;
    color: #A9A9A9;
    font-size: 13px;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 16px;
    transition: all 0.2s;
    font-weight: 500;
    height: max-content;
}

.group-info-btn:hover, .invite-btn:hover {
    background: #2AABEE;
    color: white;
}

.no-chat-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #A9A9A9;
    text-align: center;
    padding: 20px;
}

.no-chat-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.no-chat-selected h3 {
    color: #FFFFFF;
    margin-bottom: 10px;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.outgoing {
    justify-content: flex-end;
}

.message.incoming {
    justify-content: flex-start;
}

/* ============ МЕДИАФАЙЛЫ В СООБЩЕНИЯХ ============ */
.message-media {
    max-width: 280px;
    max-height: 280px;
    width: auto;
    height: auto;
    border-radius: 12px;
    cursor: pointer;
    object-fit: cover;
    transition: transform 0.2s;
    display: block;
    margin-top: 5px;
}

.message-media:hover {
    transform: scale(1.02);
}

.message-video {
    max-width: 320px;
    max-height: 280px;
    width: auto;
    height: auto;
    border-radius: 12px;
    display: block;
    margin-top: 5px;
}

.message-video-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
    border: 2px solid #2AABEE;
    background: #000;
    display: block;
    margin-top: 5px;
}

.message-video-circle:hover {
    transform: scale(1.02);
}

/* Аудио сообщения */
.message-audio {
    max-width: 250px;
    height: 40px;
    border-radius: 20px;
    margin-top: 5px;
}

.message-audio::-webkit-media-controls-panel {
    background: #1F1F1F;
}

/* Файлы в сообщениях */
.message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 5px;
    min-width: 180px;
}

.message-file:hover {
    background: rgba(255, 255, 255, 0.15);
}

.file-icon {
    font-size: 28px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    word-break: break-all;
}

.file-size {
    font-size: 11px;
    opacity: 0.7;
}

/* Контейнер сообщения */
.message-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow: hidden;
}

/* Исходящие сообщения */
.message.outgoing .message-bubble {
    background: #2AABEE;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Входящие сообщения */
.message.incoming .message-bubble {
    background: #1F1F1F;
    color: #FFFFFF;
    border-bottom-left-radius: 4px;
}

/* Имя отправителя в групповых чатах */
.message-sender {
    font-size: 11px;
    color: #2AABEE;
    margin-bottom: 4px;
    font-weight: 500;
    cursor: pointer;
}

.message-sender:hover {
    text-decoration: underline;
}

.message-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
    text-align: right;
}

.message-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: #0F0F0F;
    border-top: 1px solid #1F1F1F;
}

.input-icon {
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #A9A9A9;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.input-icon:hover {
    background: #1F1F1F;
    color: #FFFFFF;
}

.message-input-area input {
    flex: 1;
    padding: 12px 16px;
    background: #1F1F1F;
    border: none;
    border-radius: 24px;
    color: #FFFFFF;
    font-size: 14px;
}

.send-btn {
    background: #2AABEE;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: white;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

/* ============ МОДАЛЬНОЕ ОКНО ВИДЕОЗВОНКА ============ */
.call-container {
    background: #0F0F0F;
    border-radius: 20px;
    width: 90vw;
    max-width: 1200px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #1F1F1F;
    border-bottom: 1px solid #2A2A2A;
}

.call-header span {
    font-size: 18px;
    font-weight: 600;
    color: #FFFFFF;
}

.end-call-btn {
    background: #EF4444;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.end-call-btn:hover {
    background: #dc2626;
    transform: scale(1.02);
}

.video-container {
    flex: 1;
    position: relative;
    background: #000000;
    overflow: hidden;
}

.remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.local-video {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid #2AABEE;
    background: #1F1F1F;
    cursor: pointer;
    z-index: 10;
}

.call-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: #1F1F1F;
    border-top: 1px solid #2A2A2A;
}

.call-control-btn {
    background: #2A2A2A;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.call-control-btn:hover {
    background: #2AABEE;
    transform: scale(1.05);
}

.call-control-btn.muted {
    background: #EF4444;
}

/* ============ МОДАЛЬНОЕ ОКНО ПРОФИЛЯ ============ */
.profile-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #1F1F1F;
    position: sticky;
    top: 0;
    background: #0F0F0F;
    z-index: 10;
}

.profile-modal-header h2 {
    font-size: 20px;
    color: #FFFFFF;
    margin: 0;
}

.close-modal {
    background: transparent;
    border: none;
    color: #A9A9A9;
    font-size: 28px;
    cursor: pointer;
    padding: 0 10px;
    line-height: 1;
}

.close-modal:hover {
    color: #EF4444;
}

.profile-modal-body {
    text-align: center;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2AABEE, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
    margin: 0 auto 20px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.profile-avatar-large:hover .avatar-overlay {
    opacity: 1;
}

.avatar-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    font-size: 20px;
    padding: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-field {
    text-align: left;
    margin-bottom: 15px;
}

.profile-field label {
    display: block;
    font-size: 12px;
    color: #A9A9A9;
    margin-bottom: 5px;
}

.profile-field span {
    display: block;
    font-size: 16px;
    color: #FFFFFF;
    padding: 8px 0;
}

.profile-field input,
.profile-field textarea {
    width: 100%;
    padding: 12px;
    background: #1F1F1F;
    border: 1px solid #2A2A2A;
    border-radius: 10px;
    color: #FFFFFF;
    font-size: 14px;
    font-family: inherit;
}

.profile-field input:disabled,
.profile-field textarea:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #1A1A1A;
}

.profile-field textarea {
    resize: vertical;
}

.change-avatar-btn {
    background: #1F1F1F;
    border: none;
    padding: 10px;
    border-radius: 8px;
    color: #FFFFFF;
    cursor: pointer;
    width: 100%;
}

.change-avatar-btn:hover {
    background: #2A2A2A;
}

.save-profile-btn {
    background: #2AABEE;
    border: none;
    padding: 12px;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
}

.storage-upgrade-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.storage-btn {
    background: #1F1F1F;
    border: 1px solid #2A2A2A;
    padding: 8px 12px;
    border-radius: 8px;
    color: #F59E0B;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.storage-btn:hover {
    background: #2A2A2A;
    border-color: #F59E0B;
}

.storage-info {
    font-size: 11px;
    color: #A9A9A9;
    margin-top: 8px;
}

/* ============ ГРУППЫ (ПОЛНОЭКРАННЫЙ РЕЖИМ) ============ */
.group-info-modal .group-info-content {
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
}

#groupMembersList {
    max-height: 300px;
    overflow-y: auto;
}

.group-member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-bottom: 1px solid #1F1F1F;
    cursor: pointer;
}

.group-member-item:hover {
    background: #1A1A1A;
}

.group-member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2AABEE, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    overflow: hidden;
}

.group-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-member-name {
    flex: 1;
    font-size: 14px;
    color: #FFFFFF;
}

.group-member-role {
    font-size: 11px;
    color: #F59E0B;
}

/* ============ ПРИГЛАШЕНИЯ В ГРУППУ ============ */
.invite-friends-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

.invite-friend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #1A1A1A;
    border-radius: 8px;
    margin-bottom: 8px;
}

.invite-friend-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
}

.invite-friend-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2AABEE, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    overflow: hidden;
}

.invite-friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.invite-friend-name {
    font-weight: 500;
    color: #FFFFFF;
}

.invite-friend-btn {
    background: #2AABEE;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 12px;
}

.invite-friend-btn:hover {
    opacity: 0.9;
}

/* ============ УВЕДОМЛЕНИЯ ============ */
#notificationContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
}

.notification {
    background: #1F1F1F;
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #2AABEE;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

/* ============ АНИМАЦИЯ ВОЛНЫ ДЛЯ ЗАПИСИ ============ */
.wave-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
}

.wave-bar {
    width: 4px;
    height: 20px;
    background: #2AABEE;
    border-radius: 2px;
    transition: height 0.1s ease;
}

@keyframes wave {
    0% { height: 10px; }
    50% { height: 30px; }
    100% { height: 10px; }
}

/* ============ МОБИЛЬНАЯ АДАПТАЦИЯ ============ */
@media (max-width: 768px) {
    body {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .app-container {
        min-width: 100%;
    }
    
    .chats-panel {
        position: fixed;
        left: -380px;
        top: 0;
        height: 100vh;
        height: 100dvh;
        z-index: 100;
        width: 380px;
        transition: left 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chats-panel.open {
        left: 0;
    }
    
    .chats-panel.collapsed {
        left: -380px;
        width: 380px !important;
    }
    
    .chats-panel * {
        pointer-events: auto;
    }
    
    .overlay.active {
        display: block;
    }
    
    .chat-panel {
        width: 100%;
    }
    
    .chat-header {
        padding-left: 60px;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }
    
    .message-media {
        max-width: 200px;
        max-height: 200px;
    }
    
    .message-video {
        max-width: 240px;
        max-height: 200px;
    }
    
    .message-video-circle {
        width: 150px;
        height: 150px;
    }
    
    .message-audio {
        max-width: 200px;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .message-file {
        min-width: 140px;
    }
    
    .file-icon {
        font-size: 24px;
    }
    
    .file-name {
        font-size: 12px;
    }
    
    .call-container {
        width: 95vw;
        height: 85vh;
    }
    
    .local-video {
        width: 120px;
        height: 90px;
        bottom: 10px;
        right: 10px;
    }
    
    .call-control-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    .message-input-area {
        padding: 12px 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    
    .send-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .input-icon {
        font-size: 20px;
        padding: 6px;
    }
    
    .show-panel-btn {
        display: none !important;
    }
    
    .panel-buttons {
        gap: 4px;
    }
    
    .toggle-panel-btn {
        display: none;
    }
    
    .messages-area {
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-user-card {
        flex-direction: column;
        align-items: stretch;
    }
    
    .admin-user-controls {
        justify-content: flex-start;
    }
    
    .post-action-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .modal-content {
        padding: 20px;
        max-height: 85vh;
        width: calc(100% - 40px);
        margin: 20px;
    }
    
    .profile-modal-body {
        max-height: 70vh;
        overflow-y: auto;
        padding-right: 5px;
    }
    
    .storage-upgrade-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .storage-btn {
        width: 100%;
        padding: 10px;
    }
    
    .join-group-input {
        flex-direction: column;
    }
    
    .group-avatar {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .group-name {
        font-size: 14px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .message-media {
        max-width: 160px;
        max-height: 160px;
    }
    
    .message-video {
        max-width: 200px;
        max-height: 160px;
    }
    
    .message-video-circle {
        width: 130px;
        height: 130px;
    }
    
    .message-audio {
        max-width: 180px;
    }
    
    .local-video {
        width: 100px;
        height: 75px;
    }
}

/* Для устройств с вырезом */
@supports (padding-top: env(safe-area-inset-top)) {
    .chat-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
    
    .mobile-menu-btn {
        top: max(12px, env(safe-area-inset-top));
    }
}

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

::-webkit-scrollbar-track {
    background: #0F0F0F;
}

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

/* Стили для медиа-модального окна */
#mediaModal .modal-content {
    background: transparent;
    box-shadow: none;
}

#mediaContent {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

#mediaContent img,
#mediaContent video {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 12px;
}

.download-file-btn {
    background: #2AABEE;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
}

.download-file-btn:hover {
    opacity: 0.9;
}
/* ============ ФИКСИРОВАННАЯ ШИРИНА ЧАТА ============ */
.app-container {
    min-width: 100% !important;
    max-width: 100vw;
    overflow-x: hidden;
}

.chat-panel {
    width: 100%;
    max-width: 100%;
}

.messages-area {
    width: 100%;
}

.messages-container {
    width: 100%;
    max-width: 100%;
}

.message {
    max-width: 100%;
}

.message-bubble {
    max-width: 75%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Для ПК */
@media (min-width: 769px) {
    .app-container {
        min-width: 100% !important;
    }
    
    .message-bubble {
        max-width: 60%;
    }
}

/* Для мобильных */
@media (max-width: 768px) {
    .message-bubble {
        max-width: 85%;
    }
}
