:root {
    /* Цветовая палитра */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-accent: #1f1f1f;
    --bg-card: rgba(26, 26, 26, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #f0f0f0;
    --text-muted: #aaaaaa;
    /* Более акцентный красный */
    --accent-primary: #ff3b3b;
    --accent-secondary: #ff5a5a;
    --accent-dark: #c81d2b;
    --accent-light: rgba(255, 59, 59, 0.14);
    --accent-rgb: 255, 59, 59;
    --white: #ffffff;
    --black: #000000;
    --error: #ff5252;
    --success: #4caf50;
    --warning: #ff9800;
    --info: #2196f3;
    
    /* Градиенты */
    --gradient-primary: linear-gradient(135deg, var(--accent-primary), var(--accent-dark));
    --gradient-secondary: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    
    /* Размеры */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --box-shadow: 0 4px 20px rgba(255, 59, 59, 0.18);
    --box-shadow-lg: 0 8px 30px rgba(255, 59, 59, 0.30);
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

input,
textarea,
select,
[contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

img,
a {
    -webkit-user-drag: none;
}

body {
    background-color: var(--bg-primary);
    background-image:
        linear-gradient(rgba(10, 10, 10, 0.45), rgba(10, 10, 10, 0.75)),
        url('/assets/images/bg-mesh.svg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    font-size: 14px;
}

/* Background: canvas network (dots + lines) */
#bgNetwork {
    display: none;
}

/* оставляем гамму, но убираем лишнюю “суету” */

/* Основная структура */
.container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    gap: 1.5rem;
    min-height: calc(100vh - 80px);
}

.main-content {
    flex: 1;
    min-width: 0;
    min-height: 0; /* allow nested flex/grid children to scroll */
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
}

/* Header */
.header {
    background-color: rgba(10, 10, 10, 0.95);
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.18);
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.25);
    height: 70px;
}


.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    gap: 0.5rem;
}

.logo-icon {
    color: var(--accent-primary);
    font-size: 1.8rem;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.92rem;
    color: var(--text-muted);
    position: relative;
    padding: 0.55rem 0.8rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent-primary);
    background: var(--accent-light);
}

.nav-icon {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

/* Карточки */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 1px 0 rgba(255,255,255,0.03), 0 10px 30px rgba(0,0,0,0.25);
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: 0 1px 0 rgba(255,255,255,0.03), 0 16px 45px rgba(0,0,0,0.30);
}

/* Заголовки и типографика */
h1, h2, h3 {
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h2 {
    font-size: 1.25rem;
    margin: 0 0 1rem 0;
}

p {
    color: var(--text-secondary);
}

/* Alerts */
.alert {
    border-radius: var(--border-radius-sm);
    padding: 0.9rem 1rem;
    border: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 1rem;
    background: rgba(31, 31, 31, 0.55);
}

.alert-success {
    border-color: rgba(76, 175, 80, 0.35);
    background: rgba(76, 175, 80, 0.12);
    color: #bff3c2;
}

.alert-error {
    border-color: rgba(255, 82, 82, 0.35);
    background: rgba(255, 82, 82, 0.10);
    color: #ffb3b3;
}

/* Layout helpers */
.page-container {
    max-width: 860px;
    margin: 0 auto;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Auth / forms pages */
.auth-container {
    max-width: 420px;
    margin: 48px auto;
}

.auth-container .btn {
    width: 100%;
}

.auth-footer {
    margin-top: 14px;
    text-align: center;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
}

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

/* Settings / Search containers */
.settings-container {
    max-width: none;
    margin: 0;
}

.search-container {
    max-width: 860px;
    margin: 0 auto;
}

/* Settings layout polish */
.settings-container .card {
    padding: 1.75rem;
}

.settings-container label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.settings-container small {
    display: block;
    color: var(--text-muted);
    margin-top: 0.4rem;
    font-size: 0.85rem;
}

.settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0 1.25rem 0;
    flex-wrap: wrap;
}
.settings-tab {
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(31,31,31,0.35);
    color: var(--text-secondary);
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.settings-tab:hover {
    border-color: rgba(var(--accent-rgb), 0.35);
    color: var(--accent-primary);
}
.settings-tab.active {
    background: var(--accent-light);
    border-color: rgba(var(--accent-rgb), 0.35);
    color: var(--accent-primary);
}

.settings-section { display: none; }
.settings-section.active { display: block; }

.form-control-file {
    display: block;
    width: 100%;
    padding: 0.75rem 0.9rem;
    background: rgba(31,31,31,0.55);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
}

.toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(31,31,31,0.35);
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}
.toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

/* Search page */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-user-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.search-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.10);
    flex-shrink: 0;
}

.search-user-meta {
    flex: 1;
    min-width: 0;
}

.search-user-name {
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.search-user-name:hover {
    color: var(--accent-primary);
}

.search-user-actions {
    flex-shrink: 0;
}

/* Friends page */
.friends-page .card h2 {
    margin: 0;
    font-size: 1.2rem;
}

.friends-page .friend-item,
.friends-page .request-item {
    display: flex;
    align-items: center;
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    background: rgba(31,31,31,0.45);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--border-radius);
    gap: 0.9rem;
}

.friends-page .friend-item:hover,
.friends-page .request-item:hover {
    background: rgba(31,31,31,0.62);
    border-color: rgba(var(--accent-rgb), 0.22);
}

.friends-page .friend-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.10);
}

.friends-page .friend-info {
    flex: 1;
    min-width: 0;
}

.friends-page .friend-info a {
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}
.friends-page .friend-info a:hover {
    color: var(--accent-primary);
}
.friends-page .friend-username {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 2px;
}

.friends-page .friend-actions,
.friends-page .request-actions {
    display: flex;
    gap: 0.5rem;
}

.friends-page .request-actions form {
    margin: 0;
}

/* Settings previews */
.settings-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.10);
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}

.settings-cover-preview {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255,255,255,0.08);
}

.settings-cover-empty {
    width: 100%;
    height: 160px;
    border-radius: var(--border-radius);
    background: rgba(31,31,31,0.7);
    border: 1px dashed rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.settings-action-btn {
    margin-top: 8px;
}

/* Buttons additions */
.btn-success {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
}

.btn-success:hover {
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.25);
}

/* Comments: input look */
.comment-input-wrapper input[type="text"] {
    flex: 1;
    padding: 0.85rem 1rem;
    background: rgba(31, 31, 31, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: var(--text-primary);
}

.comment-input-wrapper button[type="submit"] {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: var(--white);
    cursor: pointer;
}

/* Custom menu: minimal */
.custom-menu {
    background: rgba(26, 26, 26, 0.98);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.55);
    overflow: hidden;
}

.custom-menu.custom-menu--sheet {
    border-radius: 16px;
    box-shadow: 0 22px 70px rgba(0,0,0,0.65);
}

.custom-menu .menu-item,
.custom-menu button.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 10px 12px;
    color: var(--text-primary);
    text-decoration: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
}

.custom-menu .menu-item-form {
    margin: 0;
}

.custom-menu .menu-item:hover {
    background: rgba(255,255,255,0.05);
}

.custom-menu .menu-item.danger,
.custom-menu button.menu-item.danger {
    color: #ffb3b3;
}

.custom-menu .menu-item.danger:hover,
.custom-menu button.menu-item.danger:hover {
    background: rgba(255, 82, 82, 0.12);
}

/* Error pages */
.error-page {
    text-align: center;
    padding: 3rem;
}

.error-page-icon {
    font-size: 3.25rem;
    color: var(--accent-primary);
    margin-bottom: 1rem;
    opacity: 0.95;
}

.error-page-actions {
    margin-top: 1.25rem;
}

/* ==================== Messenger ==================== */
.messages-page {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1rem;
    align-items: start;
    height: calc(100vh - 110px); /* header(70) + container padding approx */
    min-height: 0;
}

@media (max-width: 1100px) {
    .messages-page {
        grid-template-columns: 1fr;
    }
}

.messages-sidebar {
    padding: 0;
    overflow: hidden;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.messages-sidebar-header {
    padding: 1rem 1rem 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.messages-title {
    font-weight: 700;
    letter-spacing: -0.01em;
}

.messages-chat-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-height: none;
    overflow: auto;
}

.chat-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: var(--transition-fast);
}

.chat-item:hover {
    background: rgba(255,255,255,0.03);
}

.chat-item.active {
    background: rgba(var(--accent-rgb), 0.10);
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.10);
    flex-shrink: 0;
    background: rgba(31,31,31,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.chat-avatar-fallback {
    color: var(--text-muted);
}

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

.chat-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 2px;
}

.messages-main {
    padding: 0;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0; /* allow inner flex child to scroll */
    position: relative; /* for scroll-to-bottom button */
}

.messages-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.messages-header-title {
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messages-back {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(31,31,31,0.35);
    color: var(--text-primary);
    text-decoration: none;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.messages-back:hover {
    border-color: rgba(230,70,70,0.25);
    color: var(--accent-primary);
}

.messages-thread {
    padding: 1rem;
    overflow: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0; /* allow scroll instead of expanding */
}


.chat-scroll-bottom{
  position: absolute;
  right: 18px;
  bottom: 78px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35);
  color: var(--text-primary);
  cursor: pointer;
  z-index: 5;
}

.chat-scroll-bottom:hover {
    border-color: rgba(var(--accent-rgb), 0.35);
    color: var(--accent-primary);
}

.messages-thread-empty {
    margin: auto;
    padding: 1rem;
    color: var(--text-muted);
    text-align: center;
}

.comment-empty {
    padding: 0.75rem;
    text-align: center;
    color: var(--text-muted);
    background: rgba(31,31,31,0.25);
    border: 1px dashed rgba(255,255,255,0.10);
    border-radius: 12px;
}

.messages-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.messages-empty-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.messages-composer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(10,10,10,0.35);
}

.composer-hint {
    padding: 0.5rem 0.75rem 0.75rem 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: rgba(10,10,10,0.25);
}

.composer-file {
    position: relative;
    width: 140px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(31,31,31,0.35);
    padding: 0.5rem;
    overflow: hidden;
}

.composer-file-thumb {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    margin-bottom: 0.4rem;
    border: 1px solid rgba(255,255,255,0.08);
}

.composer-file-icon {
    width: 100%;
    height: 90px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.composer-file-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer-file-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.35);
    color: var(--text-primary);
    cursor: pointer;
}

/* Lightbox */
.lightbox-content {
    position: relative;
    max-width: 94vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    padding: 12px;
    background: rgba(10,10,10,0.9);
    border: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    display: block;
    max-width: calc(94vw - 24px);
    max-height: calc(92vh - 24px);
    object-fit: contain;
    border-radius: 12px;
    margin: 0 auto;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.35);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.25);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
    display: none;
}

.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

@media (max-width: 600px) {
    .lightbox-nav {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        font-size: 1.7rem;
    }
    .lightbox-prev { left: 6px; }
    .lightbox-next { right: 6px; }
    .lightbox-close {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }
}

.composer-attach {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(31,31,31,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.composer-attach:hover {
    color: var(--accent-primary);
    border-color: rgba(230,70,70,0.35);
}

.messages-composer input[type="text"] {
    flex: 1;
    height: 42px;
    padding: 0 1rem;
    background: rgba(31,31,31,0.55);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 999px;
    color: var(--text-primary);
}

.composer-send {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    padding: 0;
}

.msg {
    position: relative;
    width: fit-content;
    max-width: 85%;
    padding: 0.85rem 1rem 1.2rem 0.95rem;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(31,31,31,0.45);
}

.msg-row {
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.msg-row-in {
    justify-content: flex-start;
}

.msg-row-out {
    justify-content: flex-end;
}

.msg-in {
    align-self: flex-start;
    border-top-left-radius: 6px;
}

.msg-out {
    align-self: flex-end;
    border-top-right-radius: 6px;
    background: rgba(230, 70, 70, 0.10);
    border-color: rgba(230,70,70,0.22);
}

.msg-avatar-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 999px;
    overflow: hidden;
    background: rgba(31,31,31,0.65);
    cursor: pointer;
    flex: 0 0 30px;
}

.msg-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.msg-menu {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(0,0,0,0.0);
    border: none;
    color: rgba(255,255,255,0.55);
    z-index: 3;
}

.msg-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
    padding-right: 30px; /* reserved area for menu button */
}

.msg-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.msg-time {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.msg-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    font-size: 0.74rem;
    opacity: 0.95;
}

.msg-delivery {
    position: absolute;
    right: 10px;
    bottom: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.msg-status-pending {
    color: var(--warning);
}

.msg-status-sent {
    color: #7fdcff;
}

.msg-status-read {
    color: #57b6ff;
}

.msg-status-failed {
    color: var(--error);
}

.msg-profile-modal-content {
    width: min(920px, 96vw);
    max-height: 92vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.msg-profile-modal-head {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.msg-profile-body {
    width: 100%;
    min-height: 65vh;
    max-height: 80vh;
    overflow: auto;
    background: #0f0f10;
    padding: 0.75rem;
}

.msg.msg-pending {
    opacity: 0.92;
}

.msg.msg-failed {
    border-color: rgba(255, 82, 82, 0.35);
}

.msg-text {
    color: var(--text-secondary);
    word-break: break-word;
}

.msg-attachments {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.msg-attachment {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.25);
    text-decoration: none;
    color: var(--text-primary);
}

.msg-attachment img {
    width: 240px;
    max-width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

.msg-attachment-file {
    padding: 0.65rem 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.msg-reactions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.msg-react {
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(31,31,31,0.35);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.msg-repost {
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.18);
    border-radius: 12px;
    padding: 0.65rem;
}

.msg-repost-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.msg-repost-user {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.msg-repost-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.10);
}

.msg-repost-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.msg-repost-username {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.msg-repost-content {
    color: var(--text-secondary);
}

.msg-repost-image {
    margin-top: 0.5rem;
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
}

.msg-poll {
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.16);
    border-radius: 12px;
    padding: 0.65rem;
}

.msg-poll-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.msg-poll-question {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.msg-poll-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.msg-poll-option {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(31,31,31,0.35);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.msg-poll-option:hover {
    border-color: rgba(var(--accent-rgb), 0.35);
}

.msg-poll-option.voted {
    background: rgba(var(--accent-rgb), 0.14);
    border-color: rgba(var(--accent-rgb), 0.35);
}

.msg-poll-option-text {
    color: var(--text-secondary);
}

.msg-poll-option-votes {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.chat-members-list {
    max-height: 240px;
    overflow: auto;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 10px;
}

.member-row:hover {
    background: rgba(255,255,255,0.03);
}

.member-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.10);
}

.member-meta {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-username {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.member-role {
    background: rgba(31,31,31,0.55);
    border: 1px solid rgba(255,255,255,0.10);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 0.35rem 0.5rem;
}

.member-role-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.35rem 0.5rem;
}


.card-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-primary);
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(230, 70, 70, 0.4);
}

.btn-primary {
    background: var(--gradient-primary);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
}

.btn-outline:hover {
    background: var(--accent-light);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

/* Формы */
.form-group {
    margin-bottom: 1.2rem;
    position: relative;
}

.form-control {
    width: 100%;
    padding: 0.9rem 1.2rem;
    background: rgba(31, 31, 31, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    backdrop-filter: blur(5px);
}

.form-control:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(230, 70, 70, 0.2);
    background: rgba(31, 31, 31, 0.9);
}

/* Посты */
.post {
    position: relative;
    margin-bottom: 1.5rem;
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.8rem;
}

.post-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
    transition: var(--transition);
}

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

.post-username {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.post-content {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    word-break: break-word;
}

.post-media {
    margin: 1rem 0;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.post-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.post-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.post-gallery .post-image {
    max-height: 280px;
}

.post-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(31,31,31,0.35);
    text-decoration: none;
    color: var(--text-primary);
}

.post-actions {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.post-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.post-action:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-secondary);
}

.post-action.active {
    color: var(--accent-primary);
    background: var(--accent-light);
}

/* Комментарии */
.comments-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.comments-list {
    margin-bottom: 1rem;
}

.comment {
    display: flex;
    padding: 1rem;
    background: rgba(31, 31, 31, 0.5);
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
    position: relative;
    transition: var(--transition);
}

.comment:hover {
    background: rgba(31, 31, 31, 0.7);
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 0.75rem;
    border: 2px solid var(--accent-primary);
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-username {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
}

.comment-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.comment-text {
    font-size: 0.95rem;
    word-break: break-word;
    color: var(--text-secondary);
    line-height: 1.5;
}

.comment-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.comment-attach {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(31,31,31,0.35);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.comment-attach:hover {
    border-color: rgba(230,70,70,0.25);
    color: var(--accent-primary);
}

.comment-attachments {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 0.6rem;
}
.comment-attachments img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    cursor: pointer;
}

.comment-input {
    flex: 1;
    padding: 0.8rem 1rem;
    background: rgba(31, 31, 31, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.comment-input:focus {
    border-color: var(--accent-primary);
    background: rgba(31, 31, 31, 0.9);
}

.comment-submit {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.comment-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.38);
}

/* Уведомления */
.notification-container {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.55);
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    z-index: 1000;
    display: none;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.notification-dropdown.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.notification-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
    cursor: pointer;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notification-item.unread {
    background: var(--accent-light);
}

.notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.view-all {
    display: block;
    text-align: center;
    padding: 1rem;
    color: var(--accent-secondary);
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    text-decoration: none;
}

.view-all:hover {
    color: var(--accent-primary);
    background: rgba(230, 70, 70, 0.05);
}

/* Аудиоплеер */
.audio-player {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    background: rgba(31, 31, 31, 0.5);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.player-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.player-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-primary);
}

.player-track-info {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#player-track-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

#player-track-artist {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.player-progress-container {
    flex: 2;
    min-width: 150px;
}

.player-progress-bar {
    width: 100%;
    height: 4px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.player-time-display {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.player-volume-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100px;
}

.player-volume-icon {
    color: var(--text-primary);
    font-size: 1rem;
}

.player-volume-bar {
    width: 70px;
    height: 4px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

/* Сайдбар */
.user-profile-card {
    background: var(--bg-card);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.user-avatar-container {
    position: relative;
}

.user-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-primary);
    box-shadow: 0 0 20px rgba(230, 70, 70, 0.4);
}

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

.user-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
}

.user-fullname {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.user-meta-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sidebar-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(31, 31, 31, 0.5);
    border-radius: var(--border-radius);
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mobile-bottom-nav {
    display: none;
}

/* ==================== Admin / Support ==================== */
.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1rem;
    align-items: start;
}

.admin-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.admin-header-title {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.admin-sidebar-right {
    position: sticky;
    top: 90px;
    padding: 0.75rem;
}

.admin-sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-sidebar-title {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
}

.admin-nav-link {
    display: block;
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 0.6rem 0.7rem;
    transition: .2s ease;
}

.admin-nav-link:hover {
    color: var(--text-primary);
    border-color: rgba(var(--accent-rgb), 0.35);
}

.admin-nav-link.active {
    color: var(--text-primary);
    border-color: rgba(var(--accent-rgb), 0.45);
    background: rgba(var(--accent-rgb), 0.14);
}

.admin-main .btn,
.admin-sidebar-right .btn {
    border-radius: 10px;
    min-height: 36px;
    font-weight: 600;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.admin-metric-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.admin-metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 0.25rem;
    color: var(--text-primary);
}

.admin-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 140px;
    padding: 0.75rem 0.25rem;
}
.admin-bar {
    flex: 1;
    border-radius: 12px;
    background: rgba(var(--accent-rgb), 0.18);
    border: 1px solid rgba(var(--accent-rgb), 0.26);
    position: relative;
    min-width: 10px;
}
.admin-bar::after {
    content: attr(data-v);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -22px;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.admin-filters .admin-filter-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.admin-filter span {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.admin-table-card { padding: 0; }
.admin-table {
    width: 100%;
    overflow: auto;
}
.admin-table table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th, .admin-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    vertical-align: top;
}

.staff-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(31,31,31,0.35);
}

.staff-role-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.staff-moderation-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.role-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(31,31,31,0.35);
    color: var(--text-primary);
    text-transform: uppercase;
}

/* Role banners (keep same palette, different emphasis) */
.role-pill.role-user { background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)); border-color: rgba(255,255,255,0.12); }

.role-pill.role-helper { background: linear-gradient(135deg, #16a34a, #15803d); border-color: rgba(22, 163, 74, 0.35); color: #fff; }
.role-pill.role-curator { background: linear-gradient(135deg, #0ea5e9, #0284c7); border-color: rgba(14, 165, 233, 0.35); color: #fff; }
.role-pill.role-manager { background: linear-gradient(135deg, #8b5cf6, #6d28d9); border-color: rgba(139, 92, 246, 0.35); color: #fff; }
.role-pill.role-moderator { background: linear-gradient(135deg, #f59e0b, #d97706); border-color: rgba(245, 158, 11, 0.35); color: #111827; }

.role-pill.role-admin { background: linear-gradient(135deg, #2563eb, #1d4ed8); border-color: rgba(37, 99, 235, 0.35); color: #fff; }
.role-pill.role-jdirector { background: linear-gradient(135deg, #ec4899, #be185d); border-color: rgba(236, 72, 153, 0.35); color: #fff; }
.role-pill.role-director { background: linear-gradient(135deg, #22c55e, #0ea5e9); border-color: rgba(34, 197, 94, 0.35); color: #06131a; }
.role-pill.role-owner { background: linear-gradient(135deg, #ef4444, #a855f7); border-color: rgba(239, 68, 68, 0.35); color: #fff; }
.admin-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(0,0,0,0.12);
    position: sticky;
    top: 0;
}

.admin-ticket-actions {
    margin-bottom: 0.75rem;
}

.admin-ticket-actions > .form-control {
    min-width: 180px;
}

@media (max-width: 1024px) {
    .admin-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .admin-sidebar-right {
        position: static;
        top: auto;
    }
}

@media (max-width: 768px) {
    .admin-header {
        margin-bottom: 0.25rem;
    }
    .admin-table th, .admin-table td {
        padding: 0.65rem;
        font-size: 0.9rem;
    }
    .admin-sidebar-right {
        position: static;
        top: auto;
        padding: 0.5rem;
    }
    .admin-layout {
        display: flex;
        flex-direction: column;
    }
    .admin-sidebar-inner {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.45rem;
        padding-bottom: 0.2rem;
    }
    .admin-sidebar-title {
        display: none;
    }
    .admin-nav-link {
        white-space: nowrap;
        padding: 0.5rem 0.65rem;
    }
}

@media (max-width: 520px) {
    .admin-ticket-actions > .btn,
    .admin-ticket-actions > .form-control {
        width: 100%;
    }
    .admin-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .profile-moderation-grid {
        grid-template-columns: 1fr;
    }
}

.support-ticket-row { display: block; text-decoration: none; color: inherit; }
.support-ticket-title { font-weight: 700; margin-bottom: 0.25rem; }
.support-ticket-meta { display: flex; gap: 0.5rem; align-items: center; }
.support-ticket-last { margin-top: 0.5rem; color: var(--text-secondary); }

.support-thread { display: flex; flex-direction: column; gap: 0.75rem; }
.support-msg {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 0.75rem;
    background: rgba(31,31,31,0.25);
}
.support-msg.staff { border-color: rgba(var(--accent-rgb), 0.26); background: rgba(var(--accent-rgb), 0.10); }
.support-msg-head { display: flex; justify-content: space-between; gap: 0.75rem; }
.support-msg-author { font-weight: 700; }
.support-msg-date { color: var(--text-muted); font-size: 0.85rem; }
.support-msg-body { margin-top: 0.5rem; color: var(--text-secondary); }

.profile-moderation-card {
    margin-top: 1rem;
}

.profile-moderation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.profile-mod-row {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.45rem;
    background: rgba(255,255,255,0.03);
}

.profile-mod-main {
    font-weight: 600;
    color: var(--text-primary);
}

.profile-mod-meta {
    margin-top: 0.25rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    position: relative;
}

.menu-item:hover, .menu-item.active {
    color: var(--accent-primary);
    background: var(--accent-light);
}

.menu-item.primary {
    background: var(--gradient-primary);
    color: var(--white);
}

.menu-item.primary:hover {
    background: var(--gradient-secondary);
    transform: translateY(-1px);
}

.menu-badge {
    margin-left: auto;
    background: var(--accent-primary);
    color: var(--white);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Онлайн пользователи */
.online-users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
}

.user-online {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    text-align: center;
}

.user-online:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.user-avatar-small {
    position: relative;
    display: block;
}

.user-avatar-small img {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
    transition: var(--transition);
}

.user-avatar-small:hover img {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(230, 70, 70, 0.4);
}

.user-info {
    text-align: center;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-name:hover {
    color: var(--accent-primary);
}

/* Бейджи */
.admin-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.status-dot.online {
    background-color: #4caf50;
    box-shadow: 0 0 10px #4caf50;
    animation: pulse 2s infinite;
}

.status-dot.away {
    background-color: var(--warning);
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

.status-dot.offline {
    background-color: #757575;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.3rem;
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

/* Unified, colorful role banners */
.role-user { background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)); color: var(--text-primary); }

.role-helper { background: linear-gradient(135deg, #16a34a, #15803d); color: #ffffff; }
.role-curator { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #ffffff; }
.role-manager { background: linear-gradient(135deg, #8b5cf6, #6d28d9); color: #ffffff; }
.role-moderator { background: linear-gradient(135deg, #f59e0b, #d97706); color: #111827; border-color: rgba(245, 158, 11, 0.35); }

.role-admin { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #ffffff; }
.role-jdirector { background: linear-gradient(135deg, #ec4899, #be185d); color: #ffffff; }
.role-director { background: linear-gradient(135deg, #22c55e, #0ea5e9); color: #06131a; border-color: rgba(34, 197, 94, 0.35); }
.role-owner { background: linear-gradient(135deg, #ef4444, #a855f7); color: #ffffff; animation: pulse 2s infinite; }

/* Make icons slightly softer */
.role-badge i { opacity: 0.95; }

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1rem;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-accent);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.pagination-btn:hover {
    background: var(--accent-light);
    color: var(--accent-primary);
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--box-shadow-lg);
}

/* Messenger profile modal: larger than default modal */
#msgProfileModal .msg-profile-modal-content {
    width: min(1100px, 96vw);
    max-width: 96vw;
    height: min(88vh, 900px);
    max-height: 88vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#msgProfileModal .msg-profile-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    padding: 1rem;
}

@media (max-width: 480px) {
    .modal:not(#imageLightbox) {
        align-items: flex-end;
    }
    .modal:not(#imageLightbox) .modal-content {
        width: 100%;
        max-width: none;
        border-radius: 18px 18px 0 0;
        padding: 1.15rem;
        max-height: 86vh;
        overflow: auto;
    }
    .modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    #msgProfileModal .msg-profile-modal-content {
        width: 100%;
        max-width: none;
        height: 90vh;
        max-height: 90vh;
        border-radius: 18px 18px 0 0;
    }
}

/* Lightbox always centered */
#imageLightbox {
    align-items: center;
    justify-content: center;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.notif-post-modal-content {
    width: min(920px, 96vw);
    max-width: 96vw;
    max-height: 86vh;
    overflow: auto;
}

.notif-post-modal-body {
    margin-top: 0.75rem;
}

.notif-post-head {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.6rem;
}

.notif-post-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.12);
}

.notif-post-author {
    font-weight: 700;
}

.notif-post-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notif-post-content {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.notif-post-att {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.notif-post-image {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
}

.notif-post-comments-title {
    margin: 0.25rem 0 0.6rem;
    font-weight: 700;
}

.notif-toast-stack {
    position: fixed;
    top: 82px;
    right: 14px;
    z-index: 2500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(360px, calc(100vw - 20px));
    pointer-events: none;
}

.notif-toast {
    pointer-events: auto;
    display: block;
    text-decoration: none;
    color: var(--text-primary);
    background: rgba(18, 18, 18, 0.93);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.notif-toast:hover {
    border-color: rgba(var(--accent-rgb), 0.35);
    transform: translateY(-1px);
}

.notif-toast.hide {
    opacity: 0;
    transform: translateY(-4px);
}

.notif-toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.2;
}

.notif-toast-text {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.25;
}

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

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-fade {
    animation: fadeIn 0.3s ease-out;
}

.rotating {
    animation: spin 1s linear infinite;
}

.highlight {
    animation: highlight 2s ease;
}

@keyframes highlight {
    0% { background-color: rgba(var(--accent-rgb), 0.35); }
    100% { background-color: transparent; }
}

/* Адаптивность */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        order: -1;
    }
    
    .audio-player {
        display: none;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.7rem 1rem;
        height: 60px;
    }
    
    .logo span {
        display: none;
    }
    
    .nav-menu {
        gap: 0.5rem;
    }

    /* Mobile header: only logout + notifications */
    .nav-menu .nav-link[href="/"],
    .nav-menu .nav-link-messages {
        display: none;
    }

    .nav-link-notifications {
        position: relative;
    }
    .nav-link-notifications .badge {
        position: absolute;
        top: -6px;
        right: -6px;
    }
    
    .nav-link span {
        display: none;
    }
    
    .nav-icon {
        font-size: 1.3rem;
        margin-bottom: 0;
    }
    
    .container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .card {
        padding: 1.2rem;
    }
    
    .post-actions {
        gap: 0.5rem;
    }

    /* Sidebar: оставляем только профиль, кнопки уезжают вниз */
    .sidebar {
        display: none;
    }

    /* Нижняя панель навигации (VK-like) */
    body {
        padding-bottom: 76px;
    }
    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1600;
        display: flex;
        gap: 0.25rem;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
        background: rgba(10, 10, 10, 0.92);
        border-top: 1px solid rgba(230, 70, 70, 0.10);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    .mobile-bottom-nav-item {
        flex: 1;
        min-width: 0;
        text-decoration: none;
        color: var(--text-muted);
        border-radius: 14px;
        padding: 8px 6px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        transition: var(--transition);
    }
    .mobile-bottom-nav-item i {
        font-size: 1.25rem;
    }
    .mobile-bottom-nav-item span {
        font-size: 0.72rem;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .mobile-bottom-nav-item:hover,
    .mobile-bottom-nav-item.active {
        color: var(--accent-primary);
        background: var(--accent-light);
    }

    /* Messenger: mobile heights */
    .messages-page {
        height: auto;
        grid-template-columns: 1fr;
    }

    .messages-chat-list {
        max-height: 45vh;
    }

    .messages-main {
        height: calc(100vh - 140px);
    }

    .notif-toast-stack {
        top: 66px;
        right: 8px;
        left: 8px;
        width: auto;
    }

    /* VK-like messenger: list screen vs chat screen */
    .messages-page.has-active-chat .messages-sidebar {
        display: none;
    }

    .messages-page.has-active-chat .messages-main {
        height: calc(100vh - 60px - 76px - 16px);
    }

    .messages-back {
        display: inline-flex;
    }

    .messages-header {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .messages-header-actions .btn {
        padding: 0.45rem 0.65rem;
    }

    .messages-thread {
        padding: 0.75rem;
        -webkit-overflow-scrolling: touch;
    }

    .messages-composer {
        position: sticky;
        bottom: 0;
        z-index: 3;
        background: rgba(10, 10, 10, 0.35);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255,255,255,0.06);
    }

    .chat-scroll-bottom {
        bottom: 92px;
        right: 12px;
    }

    /* Profile header: username/status bottom-right */
    .profile-header {
        min-height: 240px !important;
    }
    .profile-header .profile-avatar {
        width: 96px !important;
        height: 96px !important;
        bottom: 16px !important;
        left: 16px !important;
    }
    .profile-header .profile-info {
        padding: 16px !important;
    }
    .profile-header .profile-meta-br {
        position: absolute;
        right: 12px;
        bottom: 12px;
        text-align: right;
        color: rgba(255,255,255,0.95);
        z-index: 3;
        max-width: calc(100% - 130px);
    }
    .profile-header .profile-meta-br .profile-username {
        color: rgba(255,255,255,0.86);
        font-weight: 600;
    }
    .profile-header .profile-meta-br .user-status {
        justify-content: flex-end;
        color: rgba(255,255,255,0.80);
        font-size: 0.9rem;
    }
    
    .post-action {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .online-users-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }
    
    .sidebar-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        padding: 0.8rem;
    }
    
    .stat-number {
        font-size: 1rem;
    }
}

.mobile-bottom-nav-item .badge {
    position: absolute;
    top: 4px;
    right: 12px;
}

.mobile-more-trigger {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    cursor: pointer;
}

body.mobile-more-open {
    overflow: hidden;
}

.mobile-more-sheet {
    position: fixed;
    inset: 0;
    z-index: 1800;
    display: none;
}

.mobile-more-sheet.open {
    display: block;
}

.mobile-more-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}

.mobile-more-panel {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    background: rgba(18, 18, 18, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.45);
    padding: 14px;
}

.mobile-more-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.mobile-more-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mobile-more-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.1rem;
}

.mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.mobile-more-tile {
    min-height: 88px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    padding: 12px;
}

.mobile-more-tile i {
    font-size: 1.25rem;
    color: var(--accent-primary);
}

.mobile-more-tile span {
    font-size: 0.9rem;
    font-weight: 600;
}

@media (max-width: 480px) {
    .header {
        padding: 0.5rem;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .post-avatar {
        width: 40px;
        height: 40px;
    }
    
    .post-actions {
        flex-wrap: wrap;
    }

    .post-gallery {
        grid-template-columns: 1fr 1fr;
    }

    /* Post attachments: fit to block width */
    .post-image,
    .post-gallery .post-image {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }

    .msg {
        max-width: 92%;
    }
    
    .comment {
        flex-direction: column;
        text-align: center;
    }
    
    .comment-avatar {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .comment-header {
        justify-content: center;
    }
    
    .pagination {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .notification-dropdown {
        width: 300px;
        right: -50px;
    }

    .mobile-more-panel {
        left: 8px;
        right: 8px;
        bottom: calc(74px + env(safe-area-inset-bottom));
        padding: 12px;
    }

    .mobile-more-grid {
        gap: 8px;
    }

    .mobile-more-tile {
        min-height: 80px;
        border-radius: 14px;
        padding: 10px;
    }
}

/* Утилиты */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.hidden {
    display: none !important;
}

/* Кастомный скроллбар */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dark);
}

/* Анимация для пользователей с медленным соединением */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Стили для кнопки обновления онлайн-пользователей */
.refresh-online {
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    padding: 0.3rem;
    border-radius: 50%;
}

.refresh-online:hover {
    color: var(--accent-primary);
    background: var(--accent-light);
    transform: rotate(90deg);
}

/* Стили для счетчика символов */
.char-counter {
    position: absolute;
    bottom: 0.5rem;
    right: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Стили для превью файлов */
.file-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.file-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-file {
    position: absolute;
    top: 0.2rem;
    right: 0.2rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.video-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(31, 31, 31, 0.7);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
}

/* Стили для выпадающих меню */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    z-index: 10;
    min-width: 150px;
    display: none;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-primary);
}

/* Стили для форм редактирования */
.edit-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.current-image {
    margin-bottom: 1rem;
    text-align: center;
}

.current-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

.remove-image-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* Стили для пустого состояния */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Стили для видео */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.local-video {
    position: relative;
}

.local-video video {
    width: 100%;
    max-height: 500px;
    border-radius: var(--border-radius);
}

.video-download-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-accent);
    color: var(--text-primary);
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    transition: var(--transition);
}

.video-download-link:hover {
    background: var(--accent-light);
    color: var(--accent-primary);
}

/* Стили для комментариев гостей */
.comment-guest {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    background: rgba(31, 31, 31, 0.3);
    border-radius: var(--border-radius);
}

.comment-guest a {
    color: var(--accent-primary);
    text-decoration: none;
}

.comment-guest a:hover {
    text-decoration: underline;
}

/* Стили для полей ввода при редактировании комментариев */
.comment-edit-input {
    width: 100%;
    padding: 0.5rem;
    background: rgba(31, 31, 31, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Анимация вращения для кнопки обновления */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotating {
    animation: rotate 1s linear infinite;
}

/* Стили для действий с файлами в форме создания поста */
.file-actions {
    display: flex;
    gap: 0.5rem;
}

.file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-muted);
    background: rgba(31, 31, 31, 0.5);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.file-btn:hover {
    color: var(--accent-primary);
    background: var(--accent-light);
}

.file-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Стили для кнопки публикации */
.publish-btn {
    margin-left: auto;
}

/* Стили для полосы прокрутки в выпадающих меню */
.dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 768px) {
    .file-previews {
        justify-content: center;
    }
    
    .file-preview {
        width: 80px;
        height: 80px;
    }
    
    .dropdown-menu {
        min-width: 120px;
    }
    
    .dropdown-item {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .current-image img {
        max-height: 200px;
    }
}


/* Добавляем в style.css после существующих стилей для постов */

/* Стили для меню действий поста (троеточие) */
.post-actions-menu {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.menu-toggle {
    background: var(--bg-accent);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}

.menu-toggle:hover {
    background: var(--accent-light);
    color: var(--accent-primary);
    transform: scale(1.05);
}

/* Перемещаем троеточие под дату создания поста */
.post-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 0.8rem;
    position: relative;
    padding-right: 40px; /* место для троеточия */
}

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

.post-header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.3rem;
}

.post-username {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    flex: 1;
}

.post-meta-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.post-actions-menu-alt {
    position: static;
    margin-left: auto;
}

/* Адаптивность для нового расположения */
@media (max-width: 768px) {
    .post-header {
        padding-right: 35px;
    }
    
    .menu-toggle {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .post-meta-container {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .post-actions-menu-alt {
        order: 2;
        margin-left: 0;
    }
    
    .post-meta {
        order: 1;
        flex: 1;
    }
}

@media (max-width: 480px) {
    .post-header {
        padding-right: 30px;
    }
    
    .menu-toggle {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
    }
    
    .post-meta {
        font-size: 0.8rem;
    }
}


/* Для комментариев - аналогичные изменения */
.comment-actions-menu {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    position: relative;
    padding-right: 30px;
}

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

.menu-toggle-comment {
    background: var(--bg-accent);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.menu-toggle-comment:hover {
    background: var(--accent-light);
    color: var(--accent-primary);
    transform: scale(1.05);
}

/* Адаптивность для комментариев */
@media (max-width: 768px) {
    .comment-header {
        padding-right: 25px;
    }
    
    .menu-toggle-comment {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .comment-header {
        padding-right: 20px;
    }
    
    .menu-toggle-comment {
        width: 22px;
        height: 22px;
    }
}

/* Улучшаем выпадающие меню */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--box-shadow-lg);
    backdrop-filter: blur(10px);
}

.dropdown-item {
    color: var(--text-primary);
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--accent-light);
    color: var(--accent-primary);
}

/* Анимации для плавного появления меню */
.dropdown-menu {
    animation: fadeInDown 0.2s ease-out;
}

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

/* Состояния для активных элементов */
.menu-toggle.active {
    background: var(--accent-primary);
    color: white;
}

/* Дополнительные утилиты для текста */
.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.max-width-100 {
    max-width: 100%;
}
/* Enhanced Post Header Styles */
.post-header {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
}

.post-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.post-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
    transition: var(--transition);
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 4px 12px rgba(230, 70, 70, 0.2);
}

.post-avatar:hover {
    transform: scale(1.05);
    border-color: var(--accent-secondary);
    box-shadow: 0 6px 20px rgba(230, 70, 70, 0.3);
}

.post-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.post-username {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
    transition: var(--transition);
    line-height: 1.2;
}

.post-username:hover {
    color: var(--accent-primary);
    transform: translateX(2px);
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.825rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.post-date {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 500;
}

.post-date::before {
    content: "🕒";
    font-size: 0.75rem;
    opacity: 0.7;
}

.post-in-community {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--accent-light);
    color: var(--accent-primary);
    padding: 0.25rem 0.625rem;
    border-radius: 1rem;
    font-weight: 500;
    font-size: 0.8rem;
    transition: var(--transition);
}

.post-in-community:hover {
    background: var(--accent-primary);
    color: var(--white);
    transform: translateY(-1px);
}

.post-in-community i {
    font-size: 0.7rem;
}

/* Community Post Header Variant */
.post-community {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    width: 100%;
}

.community-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(230, 70, 70, 0.2);
}

.community-avatar:hover {
    transform: scale(1.05);
    border-color: var(--accent-secondary);
    box-shadow: 0 6px 20px rgba(230, 70, 70, 0.3);
}

.community-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.community-name {
    font-weight: 700;
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.2;
}

.community-name:hover {
    color: var(--accent-secondary);
    transform: translateX(2px);
}

.community-name::before {
    content: "👥";
    font-size: 0.9rem;
}

/* Admin Badge Enhancement */
.admin-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    box-shadow: 0 2px 8px rgba(230, 70, 70, 0.3);
    transition: var(--transition);
}

.admin-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(230, 70, 70, 0.4);
}

.admin-badge i {
    font-size: 0.65rem;
}

/* Online Status Indicator for Avatar */
.avatar-status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 0 2px var(--accent-primary);
    z-index: 2;
    animation: pulse 2s infinite;
}

/* Enhanced Hover Effects */
.post-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--border-radius);
    z-index: 1;
}

.post-header:hover::before {
    opacity: 0.03;
}

.post-user-info,
.post-community {
    position: relative;
    z-index: 2;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .post-header {
        gap: 0.75rem;
        margin-bottom: 1rem;
        padding: 0.375rem;
    }
    
    .post-avatar,
    .community-avatar {
        width: 46px;
        height: 46px;
    }
    
    .post-username,
    .community-name {
        font-size: 0.95rem;
    }
    
    .post-meta {
        gap: 0.5rem;
        font-size: 0.8rem;
    }
    
    .post-in-community {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .admin-badge {
        padding: 0.15rem 0.5rem;
        font-size: 0.65rem;
    }
    
    .avatar-status-indicator {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .post-header {
        gap: 0.625rem;
        margin-bottom: 0.875rem;
    }
    
    .post-avatar,
    .community-avatar {
        width: 42px;
        height: 42px;
        border-width: 1.5px;
    }
    
    .post-username,
    .community-name {
        font-size: 0.9rem;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .post-in-community {
        font-size: 0.7rem;
    }
    
    .admin-badge {
        font-size: 0.6rem;
        padding: 0.1rem 0.4rem;
    }
}

/* Animation for new posts */
.post-header.new-post {
    animation: highlightSlide 0.6s ease-out;
}

@keyframes highlightSlide {
    0% {
        background: var(--accent-light);
        transform: translateX(-10px);
    }
    100% {
        background: transparent;
        transform: translateX(0);
    }
}

/* Verified Badge */
.verified-badge {
    color: var(--accent-primary);
    font-size: 0.8rem;
    margin-left: 0.2rem;
}

/* Role-specific colors for usernames */
.post-username.role-admin {
    color: var(--text-primary);
}

.post-username.role-moderator {
    color: var(--text-primary);
}

.post-username.role-owner {
    color: var(--text-primary);
}

.post-username.role-vip {
    color: var(--text-primary);
}

/* Force nicknames to white in feeds/profile/comments */
.post-user-info a,
.comment-header a,
.profile-username {
    color: var(--text-primary);
}
.post-user-info a:hover,
.comment-header a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .post-header:hover {
        background: rgba(255, 255, 255, 0.03);
    }
    
    .post-avatar,
    .community-avatar {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .post-avatar,
    .community-avatar {
        border-width: 3px;
    }
    
    .post-username:hover,
    .community-name:hover {
        text-decoration: underline;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .post-header,
    .post-avatar,
    .community-avatar,
    .admin-badge {
        transition: none;
    }
    
    .post-header:hover,
    .post-avatar:hover,
    .community-avatar:hover,
    .admin-badge:hover {
        transform: none;
    }
    
    .avatar-status-indicator {
        animation: none;
    }
}

/* Бейджи (хедер/уведомления) */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--gradient-primary);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 6px;
    line-height: 1;
}

/* Профиль (базовые стили, без PHP внутри CSS) */
.profile-header {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    min-height: 200px;
}

.profile-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #2c2f33;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(10, 10, 10, 0.9);
    position: absolute;
    z-index: 2;
    left: 20px;
    bottom: 20px;
}

.profile-info {
    position: relative;
    z-index: 2;
    padding: 20px 20px 20px 150px;
    color: white;
}

.profile-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.alert-ban {
    margin-top: 10px;
    padding: 10px;
    background-color: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #e57373;
    border-radius: var(--border-radius-sm);
}

.profile-alert {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
}

.profile-alert i {
    margin-right: 0.35rem;
}

.profile-alert-warn {
    background: rgba(250, 204, 21, 0.20);
    border-color: rgba(250, 204, 21, 0.40);
    color: #fde68a;
}

.profile-alert-ban {
    background: rgba(239, 68, 68, 0.20);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fecaca;
}

.posts-system {
    margin-top: 1.5rem;
}
/* ========== Онлайн в сайдбаре ========== */
.online-sidebar-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.online-sidebar-card .online-count {
    background: var(--accent-light);
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(var(--accent-rgb), 0.3);
}

.sidebar-user-online {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.sidebar-user-online:hover {
    background: rgba(255,255,255,0.03);
    transform: translateX(4px);
}

.sidebar-user-online .user-avatar-small {
    position: relative;
    flex-shrink: 0;
}

.sidebar-user-online .user-avatar-small img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
    transition: var(--transition);
}

/* Онлайн-индикатор (зелёная точка) */
.sidebar-user-online .user-avatar-small::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4caf50;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}

.sidebar-user-online .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-online .user-info a {
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.sidebar-user-online .user-info a:hover {
    color: var(--accent-primary);
}

/* Адаптив для планшетов (где сайдбар виден) */
@media (max-width: 992px) and (min-width: 769px) {
    .sidebar-user-online {
        gap: 0.5rem;
    }
    .sidebar-user-online .user-avatar-small img {
        width: 32px;
        height: 32px;
    }
    .sidebar-user-online .user-info a {
        font-size: 0.8rem;
    }
}