body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #edeef0;
    color: #2c5f8a;
}

.menu-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    background-color: #4a76a8;
    color: white;
    border: none;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 0 0 #3a5f8a;
    transition: background-color 0.2s;
}

.menu-toggle:hover {
    background-color: #3a5f8a;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -270px;
    width: 250px;
    height: 100%;
    background-color: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    padding-top: 60px;
    border-right: 1px solid #d3d9de;
}

.sidebar.open {
    left: 0;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    border-bottom: 1px solid #edeef0;
}

.sidebar a {
    display: block;
    padding: 12px 20px;
    color: #2c5f8a;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.sidebar a:hover {
    background-color: #edeef0;
}

.badge {
    background-color: red;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    margin-left: 8px;
}

.vk-header {
    background-color: #4a76a8;
    color: white;
    padding: 8px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo a {
    color: white;
    text-decoration: none;
    font-size: 1.4em;
    font-weight: bold;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    color: #e0e0e0;
}

.header-icon {
    position: relative;
    text-decoration: none;
    color: white;
    font-size: 1.2em;
}

.header-icon .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: red;
}

.content {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 20px;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    transition: opacity 0.3s;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

.post-card,
.wall-post-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 0 0 #d3d9de, 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    padding: 15px;
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.avatar-link {
    text-decoration: none;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #4a76a8;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: bold;
    font-size: clamp(14px, 3vw, 18px);
    overflow: hidden;
    line-height: 1;
}

.avatar.small {
    width: 40px;
    height: 40px;
    font-size: clamp(12px, 2.5vw, 14px);
}

.avatar.tiny {
    width: 30px;
    height: 30px;
    font-size: clamp(10px, 2vw, 12px);
}

.avatar.large {
    width: 80px;
    height: 80px;
    font-size: 2em;
}

.post-info {
    display: flex;
    flex-direction: column;
}

.post-author {
    font-weight: 600;
    color: #2c5f8a;
    text-decoration: none;
    font-size: 14px;
}

.post-date {
    font-size: 12px;
    color: #939393;
}

.post-title {
    font-size: 1.2em;
    font-weight: 600;
    margin: 10px 0;
    color: #000;
}

.post-content {
    line-height: 1.5;
    margin-bottom: 10px;
    color: #000;
}

.post-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

.post-image {
    display: flex;
    justify-content: center;
}

.post-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
}

.post-actions {
    margin-top: 10px;
    display: flex;
    gap: 20px;
    border-top: 1px solid #edeef0;
    padding-top: 10px;
}

.like-btn,
.comment-link,
.comment-btn {
    background: none;
    border: none;
    color: #2c5f8a;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.like-btn:hover,
.comment-link:hover,
.comment-btn:hover {
    background-color: #f0f2f5;
}

.like-btn.liked {
    color: red;
}

.like-btn.liked .like-icon {
    color: red;
}

.comments-section {
    margin-top: 20px;
}

.comment {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #edeef0;
}

.comment-avatar {
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 5px;
    font-size: 13px;
}

.comment-author {
    font-weight: 600;
    color: #2c5f8a;
    text-decoration: none;
}

.comment-date {
    color: #939393;
}

.comment-content {
    line-height: 1.4;
    color: #000;
}

.comment-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 5px;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

.comment-actions > * {
    flex: 0 0 auto;
}

.comment-form textarea {
    width: 100%;
    min-height: 60px;
    margin-bottom: 10px;
    border: 1px solid #d3d9de;
    border-radius: 4px;
    padding: 8px;
    box-sizing: border-box;
}

.profile {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 0 0 #d3d9de, 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.stats {
    display: flex;
    gap: 20px;
    color: #656565;
    font-size: 13px;
    flex-wrap: wrap;
}

.friend-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.wall-post-form {
    margin: 20px 0;
}

.wall-post-form textarea {
    width: 100%;
    min-height: 80px;
    margin-bottom: 10px;
    border: 1px solid #d3d9de;
    border-radius: 4px;
    padding: 8px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-bottom: 1px solid #edeef0;
}

.user-card .avatar {
    width: 40px;
    height: 40px;
    font-size: clamp(12px, 2.5vw, 14px);
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info a {
    font-weight: 600;
    color: #2c5f8a;
    text-decoration: none;
}

.user-info p {
    margin: 0;
    color: #656565;
    font-size: 12px;
}

.user-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.dialog-list {
    list-style: none;
    padding: 0;
}

.dialog-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-bottom: 1px solid #edeef0;
    text-decoration: none;
    color: inherit;
}

.dialog-item.unread {
    background-color: #f0f2f5;
}

.dialog-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #4a76a8;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.dialog-info {
    flex: 1;
}

.dialog-name {
    font-weight: 600;
    color: #2c5f8a;
}

.dialog-last {
    font-size: 13px;
    color: #656565;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.dialog-time {
    font-size: 11px;
    color: #939393;
}

.dialog-status {
    font-size: 12px;
    color: #4a76a8;
    margin-left: 5px;
}

.dialog-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.dialog-title {
    flex: 1;
}

.message-list {
    border: 1px solid #edeef0;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    background: white;
    max-height: 300px;
    overflow-y: auto;
    min-height: 300px;
}

.message {
    margin-bottom: 10px;
    max-width: 70%;
    clear: both;
}

.message.sent {
    float: right;
    text-align: right;
}

.message.received {
    float: left;
}

.message-content {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 18px;
    background-color: #f0f2f5;
    color: #000;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.message.sent .message-content {
    background-color: #4a76a8;
    color: white;
}

.message-time {
    font-size: 10px;
    color: #939393;
    display: block;
    margin-top: 2px;
}

.message-status {
    font-size: 11px;
    color: #4a76a8;
    margin-left: 5px;
}

.message.sent .message-status {
    color: #b3d4fc;
}

.message-form {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: flex-end;
}

.message-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.message-input-wrapper textarea {
    width: 100%;
    min-height: 60px;
    border: 1px solid #d3d9de;
    border-radius: 4px;
    padding: 8px;
    resize: vertical;
    margin-bottom: 5px;
}

.message-toolbar {
    display: flex;
    gap: 5px;
    align-items: center;
    position: relative;
}

.toolbar-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.toolbar-btn:hover {
    background-color: #f0f2f5;
}

.emoji-picker {
    position: absolute;
    bottom: 40px;
    left: 0;
    background: white;
    border: 1px solid #d3d9de;
    border-radius: 8px;
    padding: 5px;
    display: flex;
    flex-wrap: wrap;
    width: 200px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.emoji-picker.hidden {
    display: none;
}

.emoji {
    font-size: 24px;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.1s;
}

.emoji:hover {
    transform: scale(1.2);
}

.file-name {
    font-size: 12px;
    color: #656565;
    margin-left: 5px;
}

.notifications {
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.notif-item {
    padding: 10px;
    border-bottom: 1px solid #edeef0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-item.unread {
    background-color: #f0f2f5;
}

.notif-item a {
    color: #2c5f8a;
    text-decoration: none;
    font-size: 14px;
}

.notif-date {
    font-size: 11px;
    color: #939393;
}

.vk-button {
    background-color: #4a76a8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
    box-shadow: 0 1px 0 0 #3a5f8a;
}

.vk-button:hover {
    background-color: #3a5f8a;
}

.vk-button.small {
    padding: 6px 12px;
    font-size: 12px;
}

.vk-button.secondary {
    background-color: #e5e9f0;
    color: #2c5f8a;
    box-shadow: none;
}

.vk-button.secondary:hover {
    background-color: #d3d9de;
}

.vk-button.danger {
    background-color: #dc3545;
    box-shadow: 0 1px 0 0 #bd2130;
}

.vk-button.danger:hover {
    background-color: #bd2130;
}

.login-form,
.admin-panel,
.edit-form,
.post-page,
.search-users,
.friends,
.messages,
.dialog,
.groups,
.group,
.likes-list-page,
.admin-complaints {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 0 0 #d3d9de, 0 1px 2px 0 rgba(0, 0, 0, 0.1);
    padding: 20px;
}

input,
textarea,
select {
    width: 100%;
    padding: 8px;
    margin: 5px 0 15px;
    border: 1px solid #d3d9de;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
}

.flashes {
    list-style: none;
    padding: 10px;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    border-radius: 4px;
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-form input {
    flex: 1;
}

.clear-search {
    color: #2c5f8a;
    text-decoration: none;
    font-size: 13px;
}

#load-more,
#load-more-feed,
#load-more-users,
#load-more-notifs,
#load-more-wall,
#load-more-groups,
#load-more-group-posts,
#load-more-members,
#load-more-comments,
#load-more-photos,
#load-more-albums {
    margin: 20px auto;
    display: block;
    text-align: center;
}

#loading {
    text-align: center;
    color: #656565;
    margin: 20px;
}

.no-posts {
    text-align: center;
    color: #656565;
    padding: 40px;
}

.group-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    border-bottom: 1px solid #edeef0;
}

/* Исправленные стили для аватарок групп */
.group-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #4a76a8;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    overflow: hidden;
    flex-shrink: 0;
}

.group-avatar.large {
    width: 80px;
    height: 80px;
    font-size: 40px;
    line-height: 1;
    overflow: hidden;
    flex-shrink: 0;
}

.group-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.group-info {
    flex: 1;
}

.group-info a {
    font-weight: 600;
    color: #2c5f8a;
    text-decoration: none;
    font-size: 16px;
}

/* Кнопки в списке групп (в частности "Отправить заявку") */
.group-actions .vk-button.small {
    padding-left: 10;
    padding-right: 10;
    white-space: normal;
    word-wrap: break-word;
    max-width: 120px;
    text-align: center;
}

/* Общий класс для кнопок на странице группы */
.group-action-btn {
    padding-left: 10 !important;
    padding-right: 10 !important;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    width: auto;
    display: inline-block;
}

/* Контейнер для кнопок обычных действий (центрирование) */
.non-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

/* Контейнер для кнопок администратора (вертикальное центрирование) */
.admin-actions-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

@media (max-width: 600px) {
    .header-container {
        flex-direction: column;
        gap: 5px;
    }
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    .stats {
        flex-direction: column;
        gap: 5px;
    }
    .user-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .user-actions {
        align-self: flex-end;
    }
    .dialog-avatar {
        width: 30px;
        height: 30px;
    }
}

.button-like-text {
    font-weight: 500;
    font-size: 1.2em;
    color: #2c5f8a;
}

.albums-grid,
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.album-card,
.photo-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    padding: 10px;
    text-align: center;
}

.album-preview {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    background: #edeef0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #656565;
}

.photo-card img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
}

.photo-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 5px 0;
    flex-wrap: nowrap;
}

.photo-comments-section {
    margin-top: 10px;
    text-align: left;
}

.photo-comment-children {
    margin-left: 20px;
}

.photo-image {
    text-align: center;
}

.upload-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.upload-progress-overlay.hidden {
    display: none;
}

.upload-progress-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 300px;
    text-align: center;
}

.upload-progress-header {
    font-weight: bold;
    margin-bottom: 10px;
}

.upload-progress-bar {
    height: 20px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.upload-progress-fill {
    height: 100%;
    background-color: #4a76a8;
    width: 0%;
    transition: width 0.2s;
}

.upload-progress-percent {
    font-size: 14px;
}

.message-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 5px;
}

.message-toolbar {
    flex-shrink: 0;
}

.vk-button {
    flex-shrink: 0;
}

.dialog-actions-bottom {
    margin-top: 20px;
    text-align: center;
}

/* Исправление цвета кнопок в группах (белый для основных, синий для secondary) */
.groups .vk-button:not(.secondary),
.group .vk-button:not(.secondary),
.group-members .vk-button:not(.secondary),
.group-actions .vk-button:not(.secondary) {
    color: white !important;
}

.message-form {
    width: 100%;
}

.message-input-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 5px;
}

.message-toolbar {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1 1 auto;
}

.file-name {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    color: #656565;
}

.message-actions-row .vk-button {
    flex-shrink: 0;
    white-space: nowrap;
    width: auto;
    padding: 8px 16px;
}

/* Админ-панель: вертикальное расположение кнопок */
.admin-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
}

.admin-actions .vk-button {
    width: auto;
    min-width: 200px;
    text-align: center;
}

/* Класс для группы кнопок действий в админке */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Стили для ссылки скачивания файла в сообщениях */
.message-file {
    margin-top: 5px;
    padding: 5px;
    background-color: #f0f2f5;
    border-radius: 4px;
}
.message-file a {
    text-decoration: none;
    color: #2c5f8a;
    display: inline-block;
    word-break: break-all;
}
