:root {
    --primary: #4f46e5;
    --bg: #f3f4f6;
    --card: #fff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
}

body {
    background: linear-gradient(135deg, #eef2ff 0%, #fdf2f8 50%, #f0f9ff 100%);
    background-attachment: fixed;
    min-height: 100vh;
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    margin: 0;
}

/* ============================================================
   ХЕДЕР
   ============================================================ */
.site-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.6);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 20px rgba(79, 70, 229, 0.04);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
}
.main-nav ul { display: flex; gap: 16px; list-style: none; margin: 0; padding: 0; }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.logo {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

/* ============================================================
   БАЗОВЫЕ КОНТЕЙНЕРЫ
   ============================================================ */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.feed-layout {
    display: grid;
    grid-template-columns: 260px 1fr 280px;
    gap: 24px;
    padding: 24px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================================
   КНОПКИ
   ============================================================ */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
    transform: translateY(-2px);
}
.btn-block { display: block; text-align: center; width: 100%; }
.btn-lg { padding: 13px 20px; font-size: 16px; font-weight: 600; }

.btn-sent {
    background: #d1fae5 !important;
    color: #065f46 !important;
    border-color: #a7f3d0 !important;
    cursor: default;
}

/* ============================================================
   КАРТОЧКИ
   ============================================================ */
.post-card, .profile-card, .post-composer, .widget {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid rgba(229, 231, 235, 0.5);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
    margin-bottom: 16px;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.post-card:hover {
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

/* ============================================================
   ПОСТЫ
   ============================================================ */
.post-header { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.post-header img { border-radius: 50%; }
.author-name { font-weight: 600; color: var(--text); text-decoration: none; }
.post-meta time { display: block; font-size: 12px; color: var(--muted); }

.post-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
}
.post-actions button, .post-actions a {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}
.post-actions button:hover, .post-actions a:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}
.post-actions .action-like:hover {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.08);
}

.post-actions .action-delete {
    margin-left: auto;
    color: #dc2626;
    font-weight: 500;
}
.post-actions .action-delete:hover {
    background: #fef2f2;
    color: #991b1b;
}
.post-actions .action-delete:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.post-content { line-height: 1.5; }

.post-thumbnail {
    margin: 12px -16px -16px;
    overflow: hidden;
    border-radius: 0 0 16px 16px;
}
.post-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

/* ============================================================
   КАРТОЧКА ПРОФИЛЯ В ЛЕНТЕ
   ============================================================ */
.profile-card {
    text-align: center;
    padding: 20px 16px;
    font-size: 14px;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-card-avatar {
    margin-bottom: 12px;
}
.profile-card-avatar a { display: block; }
.profile-card-avatar img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: block;
    margin: 0 auto;
    object-fit: cover;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.12);
    transition: transform 0.2s ease;
}
.profile-card-avatar img:hover {
    transform: scale(1.05);
}

.profile-card-name {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.profile-card-status {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 12px;
    font-style: italic;
    line-height: 1.3;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    list-style: none;
    padding: 12px 0;
    margin: 0 0 16px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    width: 100%;
}
.profile-stats li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.2;
}
.profile-stats li strong {
    color: var(--text);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
}
.profile-stats li span {
    font-size: 12px;
    font-weight: 400;
}

.profile-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.profile-card-actions .btn {
    width: 100%;
    text-align: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    line-height: 1.4;
}

/* ============================================================
   СТРАНИЦА ПРОФИЛЯ
   ============================================================ */
.profile-page { padding-bottom: 40px; }

.profile-cover {
    height: 240px;
    position: relative;
    overflow: hidden;
}
.profile-cover-gradient {
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 45%, #ec4899 100%);
    position: relative;
    overflow: hidden;
}
.profile-cover-gradient::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.2) 0%, transparent 45%),
        radial-gradient(circle at 80% 30%, rgba(255,255,255,0.12) 0%, transparent 40%);
    pointer-events: none;
}

.profile-header {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    margin-top: -80px;
    position: relative;
    z-index: 2;
    flex-wrap: wrap;
}

.profile-avatar-big img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 6px solid #fff;
    background: #fff;
    box-shadow: 0 8px 32px rgba(79, 70, 229, 0.18), 0 0 0 6px #fff;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.profile-avatar-big img:hover { transform: scale(1.03); }

.profile-info {
    flex: 1;
    min-width: 200px;
    padding-top: 90px;
}
.profile-info h1 { margin: 0 0 6px; font-size: 28px; }
.profile-status { color: var(--muted); margin: 4px 0; }
.profile-city { color: var(--muted); margin: 4px 0; font-size: 14px; }

.profile-stats-inline {
    display: flex;
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    font-size: 14px;
    color: var(--muted);
}
.profile-stats-inline strong { color: var(--text); font-size: 16px; }

.profile-actions {
    display: flex;
    gap: 10px;
    padding-top: 90px;
    flex-wrap: wrap;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    margin-top: 32px;
}
.profile-main h2 { margin-top: 0; font-size: 20px; }

.profile-meta {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
}
.profile-meta li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.profile-meta li:last-child { border-bottom: none; }

.empty-state {
    color: var(--muted);
    padding: 40px 0;
    text-align: center;
}

/* Кнопка возврата */
.profile-back-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px 0;
    position: relative;
    z-index: 10;
}
.profile-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    text-decoration: none;
    font-size: 20px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.15s;
    backdrop-filter: blur(8px);
}
.profile-back:hover {
    background: #fff;
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.user-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
}
.user-link img {
    width: 40px; height: 40px;
    border-radius: 50%;
}

/* ============================================================
   СТРАНИЦА ДРУЗЕЙ
   ============================================================ */
.friends-page h1 { margin-top: 0; }

.friends-tabs {
    display: flex;
    gap: 8px;
    margin: 20px 0 24px;
    border-bottom: 1px solid var(--border);
}
.friends-tabs a {
    padding: 10px 16px;
    text-decoration: none;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.friends-tabs a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.friends-tabs .badge {
    background: var(--bg);
    color: var(--muted);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}
.friends-tabs a.active .badge {
    background: var(--primary);
    color: #fff;
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.friend-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(229, 231, 235, 0.5);
}
.friend-avatar img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: block;
}
.friend-info { flex: 1; min-width: 0; }
.friend-name {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    display: block;
    font-size: 16px;
}
.friend-name:hover { color: var(--primary); }
.friend-meta {
    color: var(--muted);
    font-size: 13px;
    margin: 4px 0 0;
}
.friend-actions {
    display: flex;
    gap: 8px;
}
.friend-actions .btn { padding: 6px 12px; font-size: 13px; }

@media (max-width: 600px) {
    .friend-card { flex-wrap: wrap; }
    .friend-actions { width: 100%; }
    .friend-actions .btn { flex: 1; }
}

/* ============================================================
   ИКОНКИ В ШАПКЕ
   ============================================================ */
.header-friends, .header-messages {
    position: relative;
    font-size: 20px;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 8px;
    transition: transform 0.2s ease, background 0.15s;
    color: var(--text);
}
.header-friends:hover, .header-messages:hover {
    background: var(--bg);
    transform: scale(1.1);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 5px;
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.1); }
}

/* ============================================================
   ФОРМА СОЗДАНИЯ ПОСТА
   ============================================================ */
.post-composer textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}
.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 10px;
}
.composer-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--muted);
    background: #fff;
    transition: all .15s;
    user-select: none;
}
.composer-file-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f5f3ff;
}
.composer-preview {
    position: relative;
    margin-top: 12px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg);
    max-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.composer-preview img {
    max-width: 100%;
    max-height: 400px;
    display: block;
}
.composer-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}
.composer-preview-remove:hover { background: rgba(0,0,0,.85); }



.search-users-page h1 { margin-top: 0; margin-bottom: 20px; }
.search-form-main {
    display: flex;
    gap: 8px;
    margin: 0 0 32px;
    max-width: 640px;
    flex-wrap: wrap;
}
.search-form-main input[type="search"] {
    flex: 1;
    min-width: 200px;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
}
.search-form-main input[type="search"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.search-results-count {
    color: var(--muted);
    font-size: 15px;
    margin: 0 0 20px;
}
.search-results-count strong { color: var(--text); font-size: 18px; }
.search-empty {
    background: var(--card);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.search-empty p { margin: 0 0 12px; color: var(--text); }
.search-empty p.muted { color: var(--muted); font-size: 14px; }

/* ============================================================
   СООБЩЕНИЯ
   ============================================================ */
.messages-page h1 { margin-top: 0; margin-bottom: 20px; }
.messages-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    overflow: hidden;
    min-height: 600px;
}
.dialogs-list {
    border-right: 1px solid var(--border);
    overflow-y: auto;
    max-height: 700px;
}
.dialogs-list .empty-state {
    padding: 30px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}
.dialogs-list .empty-state a { color: var(--primary); text-decoration: none; }

.dialog-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: background .15s;
    align-items: center;
}
.dialog-item:hover { background: var(--bg); }
.dialog-item.active { background: #eef2ff; border-left: 3px solid var(--primary); }
.dialog-item.unread .dialog-name { font-weight: 700; }
.dialog-item.unread .dialog-preview { color: var(--text); font-weight: 500; }

.dialog-avatar { position: relative; flex-shrink: 0; }
.dialog-avatar img { width: 48px; height: 48px; border-radius: 50%; display: block; }
.dialog-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 5px;
}
.dialog-info { flex: 1; min-width: 0; }
.dialog-name { font-weight: 500; font-size: 15px; margin-bottom: 2px; }
.dialog-preview {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-window {
    display: flex;
    flex-direction: column;
    height: 700px;
    max-height: 80vh;
}
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    gap: 16px;
    padding: 40px;
    text-align: center;
}
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}
.chat-header img { width: 40px; height: 40px; border-radius: 50%; }
.chat-name {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    display: block;
}
.chat-name:hover { color: var(--primary); }
.chat-status { font-size: 12px; color: #10b981; }

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chat-start {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin: auto;
}
.chat-message { display: flex; flex-direction: column; max-width: 70%; }
.chat-message.mine { align-self: flex-end; align-items: flex-end; }
.chat-message.theirs { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.chat-message.mine .chat-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-message.theirs .chat-bubble { border-bottom-left-radius: 4px; }
.chat-time { font-size: 11px; color: var(--muted); margin-top: 3px; padding: 0 4px; }

.chat-form {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--card);
    align-items: flex-end;
}
.chat-form textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    box-sizing: border-box;
}
.chat-form textarea:focus { outline: none; border-color: var(--primary); }

/* ============================================================
   ФАЙЛЫ В ЧАТЕ
   ============================================================ */
.chat-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.15s;
    flex-shrink: 0;
    user-select: none;
    box-sizing: border-box;
}
.chat-file-btn:hover {
    border-color: var(--primary);
    background: #f5f3ff;
}

.chat-file-preview {
    position: absolute;
    bottom: 70px;
    left: 20px;
    width: 72px;
    height: 72px;
    max-width: 72px;
    max-height: 72px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border: 2px solid #fff;
    background: var(--bg);
    z-index: 100;
    display: block;
}

.chat-file-preview img,
#chat-file-preview-img {
    width: 72px;
    height: 72px;
    max-width: 72px;
    max-height: 72px;
    object-fit: cover;
    display: block;
    border-radius: 8px;
    margin: 0;
    padding: 0;
}

.chat-file-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    z-index: 101;
}
.chat-file-remove:hover {
    background: rgba(0, 0, 0, 0.9);
}

.chat-image {
    display: block;
    max-width: 260px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s;
}
.chat-image:hover { transform: scale(1.02); }
.chat-image img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.chat-message .chat-bubble:last-child { margin-bottom: 0; }
.chat-message { max-width: 280px; }

/* ============================================================
   ФАЙЛЫ В СООБЩЕНИЯХ (не картинки)
   ============================================================ */
.chat-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 4px;
    max-width: 260px;
    transition: transform 0.15s;
}
.chat-file:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.chat-message.mine .chat-file {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}
.chat-file-icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
}
.chat-file-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.chat-file-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.chat-file-size {
    font-size: 11px;
    opacity: 0.7;
}
.chat-file-preview .chat-file-name {
    font-size: 10px;
    padding: 4px;
    text-align: center;
    word-break: break-all;
    line-height: 1.1;
    color: var(--text);
}

/* ============================================================
   ВИДЕО И АУДИО В ЧАТЕ
   ============================================================ */
.chat-video {
    max-width: 320px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 4px;
    background: #000;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.chat-video video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 400px;
    border-radius: 12px;
    background: #000;
}
.chat-audio {
    max-width: 320px;
    padding: 8px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.chat-audio audio {
    display: block;
    width: 100%;
}
.chat-message.mine .chat-audio {
    background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 600px) {
    .chat-video { max-width: 240px; }
    .chat-video video { max-height: 300px; }
    .chat-audio { max-width: 240px; }
}

/* ============================================================
   КНОПКА УДАЛЕНИЯ СООБЩЕНИЯ
   ============================================================ */
.chat-message {
    position: relative;
}
.chat-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    z-index: 5;
    transition: all 0.15s;
}
.chat-message:hover .chat-delete {
    display: flex;
}
.chat-delete:hover {
    background: #dc2626;
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.5);
}
.chat-message.theirs .chat-delete {
    display: none !important;
}
@media (hover: none) {
    .chat-message.mine .chat-delete {
        display: flex;
        opacity: 0.6;
    }
}

/* ============================================================
   КНОПКА ОЧИСТКИ ЧАТА
   ============================================================ */
.chat-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    background: #fff;
    color: #dc2626;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    font-family: inherit;
}
.chat-clear-btn:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}
.chat-clear-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
@media (max-width: 600px) {
    .chat-clear-btn {
        padding: 5px 8px;
        font-size: 12px;
    }
}

/* ============================================================
   ГОСТЕВОЙ ЭКРАН
   ============================================================ */
.guest-hero {
    text-align: center;
    padding: 100px 20px 80px;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    animation: heroFadeIn 0.7s ease-out;
}
@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.guest-hero h1 {
    font-size: 52px;
    line-height: 1.15;
    margin: 0 0 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 50%, #ec4899 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.guest-hero p {
    color: var(--muted);
    font-size: 18px;
    line-height: 1.6;
    margin: 0 0 40px;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}
.guest-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}
.guest-actions .btn {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
}

/* ============================================================
   РЕДАКТИРОВАНИЕ ПРОФИЛЯ
   ============================================================ */
.edit-profile-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}
.edit-profile-page h1 { margin: 0 0 24px; }
.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
}
.flash.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.edit-profile-form {
    background: var(--card);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.edit-avatar-block {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.edit-avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg);
}
.edit-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.edit-avatar-controls { display: flex; flex-direction: column; gap: 8px; }
.edit-avatar-controls .btn { cursor: pointer; text-align: center; }

.edit-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.edit-field label { font-size: 14px; font-weight: 500; color: var(--text); }
.edit-field input[type="text"],
.edit-field input[type="password"],
.edit-field textarea {
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
}
.edit-field input:focus,
.edit-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.edit-field textarea { resize: vertical; min-height: 100px; }
.edit-field small { color: var(--muted); font-size: 12px; }
.edit-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.edit-actions .btn { padding: 11px 24px; font-size: 15px; }

/* ============================================================
   ФУТЕР
   ============================================================ */
.site-footer {
    background: rgba(255, 255, 255, 0.85);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    color: var(--muted);
    margin-top: 40px;
    font-size: 14px;
}

/* ============================================================
   ОБЩИЕ УЛУЧШЕНИЯ
   ============================================================ */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.4); }

html { scroll-behavior: smooth; }

.site-main, .container { animation: contentFade 0.4s ease-out; }
@keyframes contentFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 900px) {
    .feed-layout { grid-template-columns: 1fr; }
    .feed-sidebar-left, .feed-sidebar-right { display: none; }
}
@media (max-width: 768px) {
    .profile-cover { height: 160px; }
    .profile-header { flex-direction: column; align-items: center; text-align: center; }
    .profile-info { padding-top: 0; }
    .profile-actions { padding-top: 0; width: 100%; justify-content: center; }
    .profile-content { grid-template-columns: 1fr; }
    .profile-avatar-big img { width: 120px; height: 120px; }
    .messages-layout { grid-template-columns: 1fr; }
    .dialogs-list {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 300px;
    }
    .chat-window { height: auto; min-height: 400px; }
}
@media (max-width: 500px) {
    .auth-card { padding: 28px 20px; }
    .auth-title { font-size: 22px; }
    .edit-avatar-block { flex-direction: column; text-align: center; }
    .edit-actions { flex-direction: column; }
    .edit-actions .btn { width: 100%; text-align: center; }
}
@media (max-width: 600px) {
    .chat-form {
        display: grid !important;
        grid-template-columns: 42px 1fr auto;
        grid-template-areas: "file text send";
        gap: 6px;
        padding: 10px 12px;
        align-items: end;
    }
    .chat-file-btn {
        grid-area: file;
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    .chat-form textarea {
        grid-area: text;
        font-size: 14px;
        padding: 9px 12px;
        max-height: 100px;
        min-width: 0;
    }
    .chat-form button[type="submit"] {
        grid-area: send;
        padding: 9px 14px;
        font-size: 13px;
        white-space: nowrap;
    }
    .chat-file-preview {
        left: 10px !important;
        bottom: 60px !important;
        width: 60px !important;
        height: 60px !important;
        max-width: 60px !important;
        max-height: 60px !important;
    }
    .chat-file-preview img,
    #chat-file-preview-img {
        width: 60px !important;
        height: 60px !important;
        max-width: 60px !important;
        max-height: 60px !important;
    }
}

/* ============================================================
   КРАСИВЫЙ ФОН И ГЛУБИНА
   ============================================================ */
html body {
    background:
        radial-gradient(circle at 10% 10%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(236, 72, 153, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        linear-gradient(135deg, #eef2ff 0%, #fdf2f8 50%, #f0f9ff 100%) !important;
    background-attachment: fixed !important;
    background-size: cover !important;
    min-height: 100vh;
}
html body .site-main,
html body .container,
html body main,
html body .profile-page,
html body .profile-content {
    background: transparent !important;
}
html body .post-card,
html body .profile-card,
html body .post-composer,
html body .widget,
html body .member-card,
html body .friend-card,
html body .auth-card,
html body .edit-profile-form,
html body .messages-layout,
html body .profile-meta {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow:
        0 8px 32px rgba(79, 70, 229, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}
html body .profile-info h1,
html body .profile-main h2,
html body .messages-page h1,
html body .friends-page h1,
html body .members-header h1 {
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 50%, #ec4899 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: -0.02em;
}
html body .profile-cover-gradient {
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 45%, #ec4899 100%) !important;
    position: relative;
    overflow: hidden;
}
html body .profile-cover {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    border-radius: 0;
}
html body .profile-cover-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.25) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.15) 0%, transparent 40%);
    animation: shine 8s ease-in-out infinite;
    pointer-events: none;
}
@keyframes shine {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-2%, -2%); }
}
html body .profile-avatar-big img {
    box-shadow:
        0 12px 40px rgba(79, 70, 229, 0.25),
        0 0 0 6px #fff,
        0 0 0 10px rgba(139, 92, 246, 0.1) !important;
}
html body .btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35) !important;
}
html body .btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5) !important;
    transform: translateY(-2px);
}
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
}
body::before {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #818cf8 0%, transparent 70%);
    top: -200px;
    left: -200px;
    animation: float1 20s ease-in-out infinite;
}
body::after {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #f0abfc 0%, transparent 70%);
    bottom: -250px;
    right: -250px;
    animation: float2 25s ease-in-out infinite;
}
@keyframes float1 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(80px, 80px); }
}
@keyframes float2 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-80px, -80px); }
}
html body .post-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
html body .post-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 20px 60px rgba(79, 70, 229, 0.15),
        0 8px 16px rgba(0, 0, 0, 0.06) !important;
}
html body .notif-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
}
html body .profile-main h2,
html body .widget-title {
    font-size: 20px;
    margin-bottom: 16px;
}
html body .site-footer {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    color: var(--muted);
}
html body .site-header {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    box-shadow: 0 1px 30px rgba(79, 70, 229, 0.06) !important;
}
.profile-empty {
    padding: 60px 20px;
    text-align: center;
}
.profile-empty .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.4;
    filter: grayscale(0.3);
}
.profile-empty p {
    font-size: 16px;
    color: var(--muted);
    margin: 0 0 20px;
}
.mini-friends {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.mini-friends a {
    display: block;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    transition: transform 0.2s ease;
}
.mini-friends a:hover {
    transform: scale(1.08);
}
.mini-friends img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}
html body .profile-main h2 {
    position: relative;
    padding-left: 14px;
}
html body .profile-main h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, #6366f1 0%, #ec4899 100%);
}

/* ============================================================
   ГАЛЕРЕЯ
   ============================================================ */
.gallery-page h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 28px;
}
.gallery-count {
    font-size: 14px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.gallery-actions {
    display: flex;
    gap: 10px;
}
.gallery-upload-progress {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.gallery-progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 4px;
    overflow: hidden;
}
.gallery-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    width: 0;
    transition: width 0.2s ease;
    border-radius: 4px;
}
.gallery-progress-text {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    min-width: 120px;
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.gallery-item-wrap {
    position: relative;
    aspect-ratio: 1;
}
.gallery-item {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}
.gallery-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.18);
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.gallery-item:hover img {
    transform: scale(1.08);
}
.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}
.gallery-item-zoom {
    color: #fff;
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.gallery-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s;
    z-index: 5;
    padding: 0;
    line-height: 1;
    backdrop-filter: blur(6px);
}
.gallery-item-wrap:hover .gallery-delete {
    opacity: 1;
}
.gallery-delete:hover {
    background: #dc2626;
    transform: scale(1.1);
}
.gallery-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.gallery-empty {
    text-align: center;
    padding: 80px 20px;
}
.gallery-empty .empty-icon {
    font-size: 72px;
    opacity: 0.4;
    margin-bottom: 16px;
}
.gallery-empty p {
    font-size: 16px;
    color: var(--muted);
    margin: 0 0 24px;
}

/* ============================================================
   ЛАЙТБОКС
   ============================================================ */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.lightbox-info {
    color: rgba(255, 255, 255, 0.7);
    margin-top: 12px;
    font-size: 14px;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    backdrop-filter: blur(10px);
    z-index: 10;
}
.lightbox-close { top: 20px; right: 20px; font-size: 20px; }
.lightbox-prev  { left: 20px;  top: 50%; transform: translateY(-50%); font-size: 36px; line-height: 1; }
.lightbox-next  { right: 20px; top: 50%; transform: translateY(-50%); font-size: 36px; line-height: 1; }
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}
.lightbox-close:hover { transform: scale(1.1); }
.lightbox-prev:hover,
.lightbox-next:hover  { transform: translateY(-50%) scale(1.1); }

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .gallery-delete {
        opacity: 1;
        width: 26px;
        height: 26px;
        font-size: 12px;
        top: 4px;
        right: 4px;
    }
    .lightbox { padding: 12px; }
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next { width: 40px; height: 40px; }
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
}

/* ============================================================
   ВИДЕО-ГАЛЕРЕЯ
   ============================================================ */
.videos-page h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 28px;
}
.videos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.videos-actions {
    display: flex;
    gap: 10px;
}
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.video-item-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
}
.video-item {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}
.video-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.18);
}
.video-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
.video-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.5) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease;
}
.video-item:hover .video-item-overlay {
    background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.6) 100%);
}
.video-item-play {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #4f46e5;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 5px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.25s ease;
}
.video-item:hover .video-item-play {
    transform: scale(1.1);
    background: #fff;
}
.video-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.7) 100%);
    color: #fff;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.video-item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}
.video-item-size {
    opacity: 0.8;
    font-size: 11px;
    flex-shrink: 0;
}
.videos-empty {
    text-align: center;
    padding: 80px 20px;
}
.videos-empty .empty-icon {
    font-size: 72px;
    opacity: 0.4;
    margin-bottom: 16px;
}
.videos-empty p {
    font-size: 16px;
    color: var(--muted);
    margin: 0 0 24px;
}
.video-lightbox .lightbox-content {
    max-width: 95vw;
    max-height: 90vh;
}
.video-lightbox video {
    max-width: 95vw;
    max-height: 80vh;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
.video-lightbox .lightbox-info {
    display: flex;
    gap: 16px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-top: 12px;
}
@media (max-width: 600px) {
    .videos-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .video-item-play {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
}

/* ============================================================
   БЛОК ЗАГРУЗКИ С ПОДСКАЗКОЙ
   ============================================================ */
.videos-upload-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.videos-hint {
    margin: 0;
    font-size: 12px;
    color: #6b7280;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    padding: 6px 12px;
    border-radius: 8px;
    max-width: 300px;
    text-align: right;
    line-height: 1.4;
}
.videos-hint strong {
    color: #d97706;
    font-weight: 700;
}
@media (max-width: 600px) {
    .videos-upload-block {
        align-items: center;
        width: 100%;
    }
    .videos-hint {
        max-width: 100%;
        text-align: center;
        font-size: 11px;
    }
}

/* ============================================================
   КНОПКА УДАЛЕНИЯ ВИДЕО
   ============================================================ */
.video-item-wrap .gallery-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s;
    z-index: 5;
    padding: 0;
    line-height: 1;
    backdrop-filter: blur(6px);
}
.video-item-wrap:hover .gallery-delete { opacity: 1; }
.video-item-wrap .gallery-delete:hover {
    background: #dc2626;
    transform: scale(1.1);
}
.video-item-wrap .gallery-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
@media (hover: none) {
    .video-item-wrap .gallery-delete {
        opacity: 1;
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* ============================================================
   ПРОГРЕСС ЗАГРУЗКИ (общий для фото/видео/музыки)
   ============================================================ */
.videos-progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInOverlay 0.2s ease;
}
@keyframes fadeInOverlay {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.videos-progress-card {
    width: 100%;
    max-width: 380px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 24px;
    box-shadow:
        0 24px 60px rgba(79, 70, 229, 0.25),
        0 8px 24px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: slideUpCard 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes slideUpCard {
    from { transform: translateY(30px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
.videos-progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.videos-progress-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.videos-progress-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.videos-progress-filename {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 16px;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.videos-progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.videos-progress-bar {
    flex: 1;
    height: 10px;
    background: rgba(99, 102, 241, 0.12);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}
.videos-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    background-size: 200% 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
    animation: shimmerBar 2s linear infinite;
    position: relative;
}
@keyframes shimmerBar {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
.videos-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    animation: shimmerLight 1.5s ease-in-out infinite;
}
@keyframes shimmerLight {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.videos-progress-percent {
    font-size: 15px;
    font-weight: 700;
    color: #4f46e5;
    min-width: 44px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.videos-progress-status {
    font-size: 13px;
    text-align: center;
    min-height: 18px;
    font-weight: 500;
    transition: color 0.2s;
}
.videos-progress-status.success { color: #059669; }
.videos-progress-status.error { color: #dc2626; }

@media (max-width: 500px) {
    .videos-progress-card {
        max-width: 320px;
        padding: 20px;
    }
    .videos-progress-title { font-size: 15px; }
    .videos-progress-filename { font-size: 12px; }
}

/* ============================================================
   КРАСИВАЯ КНОПКА ВОЗВРАТА НА ГЛАВНУЮ
   ============================================================ */
.profile-back-floating {
    position: fixed;
    top: 90px;
    left: 30px;
    z-index: 999;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 10px 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 30px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    box-shadow:
        0 4px 20px rgba(79, 70, 229, 0.15),
        0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.8);
}
.profile-back-floating:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    transform: translateX(-4px);
    box-shadow:
        0 8px 30px rgba(99, 102, 241, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.1);
    padding-right: 20px;
}
.profile-back-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    transition: transform 0.3s ease;
}
.profile-back-floating:hover .profile-back-icon {
    transform: translateX(-2px);
}
.profile-back-label {
    white-space: nowrap;
    transition: opacity 0.3s ease;
}
@media (max-width: 768px) {
    .profile-back-floating {
        top: 70px;
        left: 12px;
        padding: 8px;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
    }
    .profile-back-floating:hover { padding: 8px; }
    .profile-back-label { display: none; }
}

/* ============================================================
   КЛИКАБЕЛЬНЫЕ СЧЁТЧИКИ В ПРОФИЛЕ
   ============================================================ */
.friends-page h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 20px;
    font-size: 28px;
}
.profile-info .profile-stats-inline {
    display: flex !important;
    gap: 12px !important;
    margin: 16px 0 0 !important;
    padding: 0 !important;
    list-style: none !important;
}
.profile-info .profile-stats-inline li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
.profile-info .profile-stats-inline .stat-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-decoration: none !important;
    color: #6b7280 !important;
    background: rgba(99, 102, 241, 0.08) !important;
    border: 1px solid rgba(99, 102, 241, 0.15) !important;
    padding: 8px 16px !important;
    border-radius: 12px !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}
.profile-info .profile-stats-inline .stat-link strong {
    color: #4f46e5 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    transition: color 0.2s ease !important;
}
.profile-info .profile-stats-inline .stat-link:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35) !important;
}
.profile-info .profile-stats-inline .stat-link:hover strong {
    color: #ffffff !important;
}

/* ============================================================
   КЛИКАБЕЛЬНАЯ КАРТОЧКА ДРУЗЕЙ В ПРОФИЛЕ
   ============================================================ */
.widget-clickable-friends { transition: all 0.25s ease; }
.widget-clickable-friends .widget-friends-link {
    display: block;
    text-decoration: none;
    color: inherit;
    margin: -16px -16px 12px -16px;
    padding: 16px 16px 0 16px;
    border-radius: 16px 16px 0 0;
    transition: background 0.2s ease;
}
.widget-clickable-friends .widget-friends-link:hover {
    background: rgba(99, 102, 241, 0.06);
}
.widget-clickable-friends .widget-friends-link .widget-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 12px;
    cursor: pointer;
    color: var(--text);
    transition: color 0.2s ease;
}
.widget-clickable-friends .widget-friends-link:hover .widget-title {
    color: var(--primary);
}
.widget-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    transition: all 0.25s ease;
    flex-shrink: 0;
}
.widget-clickable-friends .widget-friends-link:hover .widget-arrow {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
.widget-clickable-friends:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 32px rgba(79, 70, 229, 0.12),
        0 4px 8px rgba(0, 0, 0, 0.04) !important;
}
.widget-clickable-friends .widget-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, #6366f1 0%, #9333ea 100%);
}
.widget-clickable-friends .widget-title {
    position: relative;
    padding-left: 12px;
}

/* ============================================================
   МУЗЫКА — INLINE-ПЛЕЕР (АКТУАЛЬНАЯ ВЕРСИЯ)
   ============================================================ */
.music-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.music-item-wrap {
    position: relative;
    min-width: 0;
}
.music-item {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    border: 1px solid rgba(229, 231, 235, 0.5);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
    overflow: hidden;
    box-sizing: border-box;
}
.music-item:hover {
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}
.music-item-main {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}
.music-item-icon {
    font-size: 20px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    line-height: 1;
}
.music-item-info { flex: 1; min-width: 0; overflow: hidden; }
.music-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    line-height: 1.3;
}
.music-item-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.3;
}
.music-item-play {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transition: transform 0.2s ease;
    padding: 0;
    cursor: pointer;
    position: relative;
}
.music-item-play::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 7px 0 7px 11px;
    border-color: transparent transparent transparent #ffffff;
    margin-left: 3px;
}
.music-item-play:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}
.music-inline-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 14px;
    border-top: 1px solid rgba(229, 231, 235, 0.5);
    background: rgba(99, 102, 241, 0.03);
}
.music-inline-player .cap-play {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
    padding-left: 2px;
}
.music-inline-player .cap-play:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}
.music-inline-player .cap-play.playing { padding-left: 0; }
.music-inline-player .cap-time {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    min-width: 34px;
    text-align: center;
    flex-shrink: 0;
}
.music-inline-player .cap-progress {
    flex: 1;
    height: 6px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    min-width: 60px;
}
.music-inline-player .cap-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    background-size: 200% 100%;
    border-radius: 3px;
    transition: width 0.1s linear;
    animation: shimmerBar 2s linear infinite;
}
.music-inline-player .cap-volume {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.music-inline-player .cap-volume:hover {
    background: rgba(99, 102, 241, 0.15);
}
.music-inline-audio { display: none !important; }
.music-lightbox { display: none !important; }
.music-item-wrap .gallery-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.15s;
    z-index: 5;
    padding: 0;
    line-height: 1;
}
.music-item-wrap:hover .gallery-delete { opacity: 1; }
.music-item-wrap .gallery-delete:hover {
    background: #dc2626;
    transform: scale(1.1);
}

@media (max-width: 600px) {
    .music-list { grid-template-columns: 1fr; }
    .music-item-wrap .gallery-delete { opacity: 1; }
    .music-item-main { padding: 12px 14px; gap: 12px; }
    .music-inline-player { padding: 8px 12px 12px; gap: 6px; }
    .music-inline-player .cap-play { width: 32px; height: 32px; min-width: 32px; }
    .music-inline-player .cap-time { font-size: 10px; min-width: 28px; }
    .music-inline-player .cap-volume { font-size: 14px; }
}

/* ============================================================
   ТЁМНАЯ ТЕМА
   ============================================================ */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--bg);
    transform: scale(1.08);
    border-color: var(--primary);
}
.theme-toggle .theme-icon-light,
.theme-toggle .theme-icon-dark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.theme-toggle .theme-icon-dark {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(180deg);
}
html.theme-dark .theme-toggle .theme-icon-light {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-180deg);
}
html.theme-dark .theme-toggle .theme-icon-dark {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0);
}

html.theme-dark {
    --primary: #818cf8;
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
}
html.theme-dark body {
    background:
        radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.18) 0%, transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(236, 72, 153, 0.12) 0%, transparent 45%),
        linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%) !important;
    color: var(--text);
}
html.theme-dark .site-header {
    background: rgba(15, 23, 42, 0.75) !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1) !important;
    box-shadow: 0 1px 30px rgba(0, 0, 0, 0.3) !important;
}
html.theme-dark .post-card,
html.theme-dark .profile-card,
html.theme-dark .post-composer,
html.theme-dark .widget,
html.theme-dark .member-card,
html.theme-dark .friend-card,
html.theme-dark .auth-card,
html.theme-dark .edit-profile-form,
html.theme-dark .messages-layout,
html.theme-dark .profile-meta {
    background: rgba(30, 41, 59, 0.75) !important;
    border: 1px solid rgba(148, 163, 184, 0.15) !important;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
}
html.theme-dark .btn {
    background: rgba(30, 41, 59, 0.9);
    color: var(--text);
    border-color: var(--border);
}
html.theme-dark .btn:hover { background: rgba(51, 65, 85, 0.9); }
html.theme-dark input[type="text"],
html.theme-dark input[type="email"],
html.theme-dark input[type="password"],
html.theme-dark input[type="search"],
html.theme-dark textarea {
    background: rgba(15, 23, 42, 0.6) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
html.theme-dark input::placeholder,
html.theme-dark textarea::placeholder { color: #64748b; }
html.theme-dark .header-friends,
html.theme-dark .header-messages,
html.theme-dark .user-link { color: var(--text); }
html.theme-dark .header-friends:hover,
html.theme-dark .header-messages:hover {
    background: rgba(51, 65, 85, 0.5);
}
html.theme-dark .author-name,
html.theme-dark .profile-card-name,
html.theme-dark .friend-name,
html.theme-dark .member-name a,
html.theme-dark .dialog-name { color: var(--text); }
html.theme-dark .post-meta time,
html.theme-dark .profile-stats-inline,
html.theme-dark .friend-meta,
html.theme-dark .dialog-preview,
html.theme-dark .search-results-count { color: var(--muted); }
html.theme-dark .chat-bubble {
    background: #334155;
    color: var(--text);
}
html.theme-dark .chat-message.mine .chat-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
}
html.theme-dark .chat-body { background: rgba(15, 23, 42, 0.4); }
html.theme-dark .chat-header,
html.theme-dark .chat-form {
    background: rgba(30, 41, 59, 0.7);
    border-color: var(--border);
}
html.theme-dark .dialog-item:hover { background: rgba(51, 65, 85, 0.5); }
html.theme-dark .dialog-item.active {
    background: rgba(99, 102, 241, 0.15);
    border-left-color: var(--primary);
}
html.theme-dark .chat-file {
    background: #334155;
    color: var(--text);
}
html.theme-dark .chat-message.mine .chat-file {
    background: rgba(255, 255, 255, 0.15);
}
html.theme-dark .site-footer {
    background: rgba(15, 23, 42, 0.7) !important;
    border-top-color: var(--border);
    color: var(--muted);
}
html.theme-dark .gallery-item { background: #1e293b; }
html.theme-dark .gallery-empty,
html.theme-dark .videos-empty { color: var(--muted); }
html.theme-dark a { color: inherit; }
html.theme-dark .auth-alt a,
html.theme-dark .friend-name:hover,
html.theme-dark .dialog-item:hover .dialog-name { color: var(--primary); }
html.theme-dark .profile-meta li { border-bottom-color: var(--border); }
html.theme-dark .profile-back-floating {
    background: rgba(30, 41, 59, 0.95);
    color: var(--text);
    border-color: rgba(148, 163, 184, 0.2);
}
html.theme-dark .videos-progress-card {
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(148, 163, 184, 0.2);
}
html.theme-dark .videos-progress-filename {
    background: rgba(99, 102, 241, 0.15);
    color: var(--muted);
}
html.theme-dark .videos-progress-title {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
html.theme-dark .lightbox { background: rgba(0, 0, 0, 0.96); }
html.theme-dark .action-delete,
html.theme-dark .chat-delete,
html.theme-dark .gallery-delete { color: #f87171; }
html.theme-dark .music-item {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(148, 163, 184, 0.15);
}
html.theme-dark .music-inline-player {
    background: rgba(99, 102, 241, 0.08);
    border-top-color: rgba(148, 163, 184, 0.15);
}

html, body, .site-header, .post-card, .btn, input, textarea {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.header-notifications {
    position: relative;
    font-size: 20px;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 8px;
    transition: transform 0.2s ease, background 0.15s;
    color: var(--text);
}
.header-notifications:hover {
    background: var(--bg);
    transform: scale(1.1);
}
/* ============================================================
   УВЕДОМЛЕНИЯ
   ============================================================ */
.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.notifications-header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 28px;
}
.notif-count-header {
    font-size: 14px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    padding: 3px 12px;
    border-radius: 12px;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notif-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.notif-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    border: 1px solid rgba(229, 231, 235, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
    position: relative;
    animation: notifSlideIn 0.3s ease-out;
}
@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.notif-item:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
}
.notif-item.unread {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(139, 92, 246, 0.04) 100%);
    border-color: rgba(99, 102, 241, 0.2);
}

.notif-avatar {
    position: relative;
    flex-shrink: 0;
}
.notif-avatar img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: block;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.notif-type-icon {
    position: absolute;
    bottom: -2px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.notif-content {
    flex: 1;
    min-width: 0;
}
.notif-text {
    font-size: 14px;
    line-height: 1.4;
    color: var(--text);
    margin-bottom: 3px;
}
.notif-text strong {
    color: var(--primary);
}
.notif-time {
    font-size: 12px;
    color: var(--muted);
}

.notif-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    flex-shrink: 0;
    animation: pulseDot 2s infinite;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
}
@keyframes pulseDot {
    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Тёмная тема */
html.theme-dark .notif-item {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(148, 163, 184, 0.15);
}
html.theme-dark .notif-item.unread {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.08) 100%);
}
html.theme-dark .notif-type-icon {
    background: #1e293b;
}
html.theme-dark .notif-avatar img {
    border-color: #1e293b;
}

/* Мобильная */
@media (max-width: 600px) {
    .notifications-header h1 { font-size: 22px; }
    .notif-item {
        padding: 12px 14px;
        gap: 12px;
    }
    .notif-avatar img {
        width: 44px;
        height: 44px;
    }
    .notif-text { font-size: 13px; }
    .notif-time { font-size: 11px; }
}
/* ============================================================
   КНОПКИ УВЕДОМЛЕНИЙ
   ============================================================ */
.notifications-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-danger {
    background: #fff;
    color: #dc2626;
    border: 1px solid #fecaca;
    transition: all 0.15s ease;
}
.btn-danger:hover {
    background: #fef2f2;
    color: #991b1b;
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}
.btn-danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Тёмная тема */
html.theme-dark .btn-danger {
    background: rgba(30, 41, 59, 0.9);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}
html.theme-dark .btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: #ef4444;
}

/* Мобильная версия */
@media (max-width: 600px) {
    .notifications-actions {
        width: 100%;
    }
    .notifications-actions .btn {
        flex: 1;
        text-align: center;
        padding: 8px 12px;
        font-size: 13px;
    }
}
/* ============================================================
   КОММЕНТАРИИ
   ============================================================ */
.comments-area {
    margin-top: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(229, 231, 235, 0.5);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

html.theme-dark .comments-area {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(148, 163, 184, 0.15);
}

.comments-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    margin: 0 0 20px;
    color: var(--text);
}

.comments-count {
    font-size: 14px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 700;
}

/* Список комментариев */
.comment-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}

.comment-list .children {
    list-style: none;
    padding-left: 32px;
    margin-top: 16px;
    border-left: 2px solid rgba(99, 102, 241, 0.15);
}

.comment-item {
    margin-bottom: 16px;
}

.comment-body {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: rgba(99, 102, 241, 0.03);
    border-radius: 12px;
    transition: background 0.15s;
}

html.theme-dark .comment-body {
    background: rgba(99, 102, 241, 0.08);
}

.comment-body:hover {
    background: rgba(99, 102, 241, 0.06);
}

.comment-avatar {
    flex-shrink: 0;
}
.comment-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: block;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
html.theme-dark .comment-avatar img {
    border-color: #334155;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.comment-author {
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}
.comment-author a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s;
}
.comment-author a:hover {
    color: var(--primary);
}

.comment-date {
    font-size: 12px;
    color: var(--muted);
}

.comment-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    word-wrap: break-word;
}
.comment-text p {
    margin: 0 0 8px;
}
.comment-text p:last-child {
    margin-bottom: 0;
}

.comment-awaiting {
    font-size: 13px;
    color: #d97706;
    background: #fef3c7;
    padding: 6px 12px;
    border-radius: 8px;
    margin: 8px 0 0;
}

.comment-actions {
    margin-top: 8px;
    display: flex;
    gap: 12px;
}
.comment-actions .comment-reply-link {
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 8px;
    transition: all 0.15s;
}
.comment-actions .comment-reply-link:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

/* Форма комментария */
.comment-respond {
    margin-top: 24px;
}

.comment-reply-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.comment-reply-title small {
    font-size: 13px;
    font-weight: 400;
}
.comment-reply-title small a {
    color: var(--muted);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 8px;
    transition: all 0.15s;
}
.comment-reply-title small a:hover {
    color: #dc2626;
    background: #fef2f2;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.comment-form-field textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
    background: #fff;
    transition: all 0.15s;
    box-sizing: border-box;
}
html.theme-dark .comment-form-field textarea {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text);
    border-color: var(--border);
}

.comment-form-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.comment-form .form-submit {
    margin: 0;
}
.comment-form .btn-primary {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.comment-form .btn-primary:hover {
    transform: translateY(-2px);
}

.must-log-in {
    padding: 16px;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 12px;
    color: var(--muted);
    font-size: 14px;
}
.must-log-in a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.must-log-in a:hover {
    text-decoration: underline;
}

/* Скрываем стандартные поля WP (автор, email, url) */
.comment-form-author,
.comment-form-email,
.comment-form-url,
.comment-form-cookies-consent {
    display: none;
}

/* Аватар + имя в форме */
.comment-form .logged-in-as {
    display: none;
}

/* Пагинация комментариев */
.comments-area .pagination,
.comments-area .page-numbers {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}
.comments-area .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--border);
    font-weight: 500;
    transition: all 0.15s;
}
.comments-area .page-numbers.current {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-color: transparent;
}
.comments-area .page-numbers:hover:not(.current) {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

/* Мобильная версия */
@media (max-width: 600px) {
    .comments-area {
        padding: 16px;
        border-radius: 12px;
    }
    .comment-body {
        padding: 12px;
        gap: 10px;
    }
    .comment-avatar img {
        width: 40px;
        height: 40px;
    }
    .comment-list .children {
        padding-left: 20px;
    }
    .comments-title {
        font-size: 18px;
    }
}
/* ============================================================
   КНОПКА "ПОДЕЛИТЬСЯ"
   ============================================================ */
.action-share.shared {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #059669 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

.action-share:disabled {
    cursor: default;
    opacity: 0.9;
}
/* ============================================================
   ЛАЙК — активное состояние
   ============================================================ */
.action-like {
    position: relative;
    transition: all 0.15s ease;
}

.action-like.liked {
    color: #dc2626 !important;
    font-weight: 600;
}

.action-like.liked .like-count {
    color: #dc2626;
}

.action-like.liked:hover {
    background: rgba(239, 68, 68, 0.12) !important;
}

/* Пульс при клике */
.action-like.pulse {
    animation: likePulse 0.3s ease;
}
@keyframes likePulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.action-like.loading {
    opacity: 0.6;
    pointer-events: none;
}

.action-like.loading::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinLike 0.6s linear infinite;
    top: 50%;
    right: -2px;
    transform: translateY(-50%);
}
@keyframes spinLike {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Тёмная тема */
html.theme-dark .action-like.liked {
    color: #f87171 !important;
}
html.theme-dark .action-like.liked .like-count {
    color: #f87171;
}
/* ============================================================
   РЕДАКТИРОВАНИЕ ПОСТА
   ============================================================ */
.action-edit {
    color: var(--muted);
    font-weight: 500;
    transition: all 0.15s;
}
.action-edit:hover {
    color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.08) !important;
}

/* Форма редактирования */
.post-content .edit-post-form {
    margin-top: 12px;
}

.edit-post-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    background: #fff;
    color: var(--text);
    box-sizing: border-box;
    transition: all 0.15s;
    outline: none;
}

.edit-post-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.edit-post-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.edit-post-actions .btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.edit-post-actions .btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
}
.edit-post-actions .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}
.edit-post-actions .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Анимация после сохранения */
.post-card.edited {
    animation: editSuccess 1.5s ease;
}
@keyframes editSuccess {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    50%  { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Тёмная тема */
html.theme-dark .edit-post-textarea {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text);
    border-color: var(--border);
}
html.theme-dark .action-edit:hover {
    background: rgba(99, 102, 241, 0.15) !important;
    color: #818cf8 !important;
}

/* Мобильная версия */
@media (max-width: 600px) {
    .edit-post-actions {
        flex-direction: column;
    }
    .edit-post-actions .btn {
        width: 100%;
        text-align: center;
    }
}
/* ============================================================
   ПОИСК ЛЮДЕЙ — раскрывающийся
   ============================================================ */
.header-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 4px;
}

.header-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.header-search-toggle:hover {
    background: var(--bg);
    border-color: var(--border);
    transform: scale(1.08);
}

.header-search-wrap.open .header-search-toggle {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* Скрытая форма — раскрывается ВПРАВО */
.header-search-wrap .header-search {
    position: absolute;
    top: 50%;
    left: 50px;                    /* ← вправо от иконки */
    transform: translateY(-50%) scale(0.85);
    opacity: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 5px 6px 5px 16px;
    box-shadow: 0 12px 40px rgba(79, 70, 229, 0.18);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 320px;
    z-index: 20;
    transform-origin: left center;   /* ← растёт от левого края */
}

.header-search-wrap.open .header-search {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
}

.header-search-wrap .header-search input[type="search"] {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    padding: 8px 4px;
    outline: none;
    min-width: 0;
    color: var(--text);
}

.header-search-wrap .header-search input[type="search"]::placeholder {
    color: var(--muted);
}

.header-search-wrap .header-search input[type="search"]::-webkit-search-cancel-button {
    display: none;
}

.header-search-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.header-search-close:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    transform: rotate(90deg);
}

/* Тёмная тема */
html.theme-dark .header-search-wrap .header-search {
    background: rgba(30, 41, 59, 0.98);
    border-color: var(--border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

html.theme-dark .header-search-wrap.open .header-search-toggle {
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
}

/* ============================================================
   ПОИСК — адаптив
   ============================================================ */

/* Планшет */
@media (max-width: 1100px) {
    .header-search-wrap .header-search {
        width: 260px;
    }
}

/* Мобильная версия */
@media (max-width: 600px) {
    .header-search-wrap {
        position: static !important;
    }

    .header-search-wrap .header-search {
        position: fixed;
        top: 72px;
        left: 12px;
        right: 12px;
        width: auto;
        transform: translateY(-20px) scale(0.95);
        transform-origin: center;
        border-radius: 16px;
        padding: 8px 8px 8px 18px;
        z-index: 999;
    }

    .header-search-wrap.open .header-search {
        transform: translateY(0) scale(1);
    }

    .header-search-wrap .header-search input[type="search"] {
        font-size: 15px;
    }
}
/* ============================================================
   СКРЫТЬ ГАЛЕРЕЮ/ВИДЕО/МУЗЫКУ НА МОБИЛЬНОМ
   ============================================================ */
@media (max-width: 768px) {
    .header-user .header-friends[href*="/gallery/"],
    .header-user .header-friends[href*="/videos/"],
    .header-user .header-friends[href*="/music/"] {
        display: none !important;
    }
}
/* ============================================================
   СКРЫТЬ СТРЕЛКУ "НА ГЛАВНУЮ" НА МОБИЛЬНОМ
   ============================================================ */
@media (max-width: 768px) {
    .profile-back-floating {
        display: none !important;
    }
}
/* ============================================================
   КОММЕНТАРИИ В ЛЕНТЕ
   ============================================================ */
.post-comments {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.post-comments-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 12px;
    padding-right: 4px;
}

.post-comments-list::-webkit-scrollbar { width: 6px; }
.post-comments-list::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 3px;
}

.post-comments-loading {
    text-align: center;
    padding: 20px;
}
.post-comments-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.post-comments-empty {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 16px 0;
    margin: 0;
}

/* Один комментарий */
.post-comment {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: rgba(99, 102, 241, 0.03);
    border-radius: 12px;
    transition: background 0.3s ease;
}
.post-comment.highlight {
    animation: newCommentHighlight 2s ease;
}
@keyframes newCommentHighlight {
    0%   { background: rgba(16, 185, 129, 0.2); }
    100% { background: rgba(99, 102, 241, 0.03); }
}

.post-comment-avatar {
    flex-shrink: 0;
}
.post-comment-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: block;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.post-comment-body {
    flex: 1;
    min-width: 0;
}

.post-comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.post-comment-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}
.post-comment-time {
    font-size: 11px;
    color: var(--muted);
}

.post-comment-text {
    font-size: 14px;
    line-height: 1.4;
    color: var(--text);
    word-wrap: break-word;
}
.post-comment-text p {
    margin: 0 0 4px;
}
.post-comment-text p:last-child {
    margin-bottom: 0;
}

/* Форма отправки */
.post-comments-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-top: 8px;
}

.post-comments-form-avatar {
    flex-shrink: 0;
}
.post-comments-form-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: block;
}

.post-comments-form textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    background: var(--bg);
    transition: all 0.15s;
    box-sizing: border-box;
}
.post-comments-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.post-comments-form .btn {
    padding: 10px 18px;
    font-size: 14px;
    border-radius: 20px;
    flex-shrink: 0;
}

.post-comments-login {
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    padding: 12px 0 0;
    margin: 0;
}
.post-comments-login a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.post-comments-login a:hover {
    text-decoration: underline;
}

/* Кнопка "Комментарии" — активное состояние */
.action-comment.active {
    color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.08) !important;
}

/* Тёмная тема */
html.theme-dark .post-comment {
    background: rgba(99, 102, 241, 0.08);
}
html.theme-dark .post-comment-avatar img {
    border-color: #334155;
}
html.theme-dark .post-comments-form textarea {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text);
    border-color: var(--border);
}
html.theme-dark .post-comments-form textarea:focus {
    background: rgba(15, 23, 42, 0.9);
}

/* Мобильная версия */
@media (max-width: 600px) {
    .post-comments-list {
        max-height: 300px;
    }
    .post-comment {
        padding: 8px 10px;
        gap: 8px;
    }
    .post-comment-avatar img {
        width: 34px;
        height: 34px;
    }
    .post-comment-form-avatar {
        display: none;
    }
    .post-comments-form .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}
/* ============================================================
   СТРАНИЦЫ ВХОДА И РЕГИСТРАЦИИ
   ============================================================ */
.auth-page {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #eef2ff 0%, #fdf2f8 100%);
}
.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.08);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}
.auth-title {
    margin: 0 0 6px;
    font-size: 26px;
    text-align: center;
}
.auth-subtitle {
    text-align: center;
    color: var(--muted);
    margin: 0 0 28px;
    font-size: 14px;
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.auth-field label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}
.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"] {
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}
.auth-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.auth-remember label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
}
.auth-message {
    padding: 0;
    border-radius: 8px;
    font-size: 14px;
    min-height: 0;
    transition: all .2s;
}
.auth-message:not(:empty) { padding: 10px 14px; }
.auth-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.auth-message.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.btn-lg {
    padding: 13px 20px;
    font-size: 16px;
    font-weight: 600;
}
.auth-alt {
    text-align: center;
    margin: 20px 0 0;
    font-size: 14px;
    color: var(--muted);
}
.auth-alt a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.auth-alt a:hover {
    text-decoration: underline;
}
/* ============================================================
   ТЁМНАЯ ТЕМА — ВХОД И РЕГИСТРАЦИЯ
   ============================================================ */
html.theme-dark .auth-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%) !important;
}
html.theme-dark .auth-card {
    background: rgba(30, 41, 59, 0.95) !important;
    border: 1px solid rgba(148, 163, 184, 0.15) !important;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}
html.theme-dark .auth-title {
    color: var(--text) !important;
}
html.theme-dark .auth-subtitle {
    color: var(--muted) !important;
}
html.theme-dark .auth-field label {
    color: var(--text) !important;
}
html.theme-dark .auth-field input[type="text"],
html.theme-dark .auth-field input[type="email"],
html.theme-dark .auth-field input[type="password"] {
    background: rgba(15, 23, 42, 0.6) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
html.theme-dark .auth-field input::placeholder {
    color: #64748b !important;
}
html.theme-dark .auth-remember label {
    color: var(--muted) !important;
}
html.theme-dark .auth-alt {
    color: var(--muted) !important;
}
html.theme-dark .auth-alt a {
    color: var(--primary) !important;
}
html.theme-dark .auth-message.error {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}
html.theme-dark .auth-message.success {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}
/* ============================================================
   СТРАНИЦА 404 — ЗМЕЙКА
   ============================================================ */
.error-404-page {
    min-height: calc(100vh - 250px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.error-404-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 20px 60px rgba(79, 70, 229, 0.15),
        0 8px 20px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    padding: 60px 40px;
    max-width: 640px;
    width: 100%;
    text-align: center;
    animation: notFoundFadeIn 0.5s ease-out;
}

@keyframes notFoundFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- ЦИФРЫ 404 — ЗМЕЙКА ---------- */
.error-404-number {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 120px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 24px;
    letter-spacing: -0.05em;
    height: 160px;
}

.error-404-number span {
    display: inline-block;
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 50%, #ec4899 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: snakeRoll 1.8s ease-in-out infinite;
}

/* Задержка — эффект ползущей змейки */
.error-404-number span:nth-child(1) { animation-delay: 0s;    }
.error-404-number span:nth-child(2) { animation-delay: 0.2s;  }
.error-404-number span:nth-child(3) { animation-delay: 0.4s;  }

@keyframes snakeRoll {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    25% {
        transform: translate(0, -25px) rotate(15deg) scale(1.08);
    }
    50% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    75% {
        transform: translate(0, 25px) rotate(-15deg) scale(0.92);
    }
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
}

/* ---------- АЛЬТЕРНАТИВНЫЕ АНИМАЦИИ ---------- */
/* Раскомментируйте одну из них И закомментируйте snakeRoll выше,
   чтобы попробовать другой эффект */

/* Вариант 2. Волна — цифры подпрыгивают по очереди */
/*
.error-404-number span {
    animation: snakeWave 1.5s ease-in-out infinite;
}
@keyframes snakeWave {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25%      { transform: translateY(-20px) rotate(-8deg); }
    50%      { transform: translateY(0) rotate(0deg); }
    75%      { transform: translateY(20px) rotate(8deg); }
}
*/

/* Вариант 3. Мягкая змейка — плавное покачивание */
/*
.error-404-number span {
    animation: snakeSoft 2.4s ease-in-out infinite;
}
@keyframes snakeSoft {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33%      { transform: translate(0, -18px) rotate(8deg); }
    66%      { transform: translate(0, 18px) rotate(-8deg); }
}
*/

/* ---------- ЗАГОЛОВОК ---------- */
.error-404-title {
    font-size: 28px;
    margin: 0 0 12px;
    font-weight: 800;
    color: var(--text);
    background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.error-404-text {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 32px;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- КНОПКИ ---------- */
.error-404-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.error-404-actions .btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
}

/* ---------- ПОИСК ---------- */
.error-404-search {
    display: flex;
    gap: 8px;
    max-width: 420px;
    margin: 0 auto 24px;
}

.error-404-search input[type="search"] {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    transition: all 0.15s;
    box-sizing: border-box;
    min-width: 0;
}

.error-404-search input[type="search"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.error-404-search .btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---------- ПРИВЕТСТВИЕ ---------- */
.error-404-user {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
    padding-top: 20px;
    border-top: 1px solid rgba(229, 231, 235, 0.5);
}

.error-404-user strong {
    color: var(--primary);
    font-weight: 700;
}

.error-404-user a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.error-404-user a:hover {
    text-decoration: underline;
}

/* ---------- ТЁМНАЯ ТЕМА ---------- */
html.theme-dark .error-404-card {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(148, 163, 184, 0.15);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 8px 20px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

html.theme-dark .error-404-search input[type="search"] {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text);
    border-color: var(--border);
}

html.theme-dark .error-404-search input[type="search"]::placeholder {
    color: #64748b;
}

html.theme-dark .error-404-user {
    border-top-color: rgba(148, 163, 184, 0.15);
}

/* ---------- МОБИЛЬНАЯ ВЕРСИЯ ---------- */
@media (max-width: 600px) {
    .error-404-card {
        padding: 40px 20px;
        border-radius: 20px;
    }
    .error-404-number {
        font-size: 80px;
        height: 120px;
    }
    .error-404-title {
        font-size: 22px;
    }
    .error-404-text {
        font-size: 14px;
    }
    .error-404-actions {
        flex-direction: column;
    }
    .error-404-actions .btn {
        width: 100%;
        text-align: center;
    }
    .error-404-search {
        flex-direction: column;
    }
    .error-404-search .btn {
        width: 100%;
    }
}

/* ---------- УВАЖЕНИЕ К ПОЛЬЗОВАТЕЛЮ (accessibility) ---------- */
@media (prefers-reduced-motion: reduce) {
    .error-404-number span,
    .error-404-card {
        animation: none !important;
    }
}
/* ============================================================
   ФОНОВАЯ КАРТИНКА САЙТА
   ============================================================ */
.site-custom-bg {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    z-index: -2;
    opacity: 0.85;                    /* ← было 0.35, стало 0.85 */
    filter: blur(0) saturate(1.1);    /* ← убрал размытие */
    pointer-events: none;
}
/* Затемнение поверх фона для читаемости */
.site-custom-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.15) 0%,   /* ← было 0.4, стало 0.15 */
        rgba(255, 255, 255, 0.35) 100%  /* ← было 0.7, стало 0.35 */
    );
}

html.theme-dark .site-custom-bg {
    opacity: 0.25;
}
html.theme-dark .site-custom-bg::after {
    background: linear-gradient(
        180deg,
        rgba(15, 23, 42, 0.5) 0%,
        rgba(15, 23, 42, 0.8) 100%
    );
}

/* Превью фона в edit-profile */
.edit-bg-block {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 8px;
}

.edit-bg-preview {
    width: 200px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg);
    border: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 12px;
}
.edit-bg-preview::before {
    content: 'Фон не выбран';
}
.edit-bg-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.edit-bg-preview img + * {
    display: none;
}
.edit-bg-preview:has(img)::before {
    display: none;
}

.edit-bg-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 600px) {
    .edit-bg-block {
        flex-direction: column;
        align-items: stretch;
    }
    .edit-bg-preview {
        width: 100%;
        height: 160px;
    }
}
/* ============================================================
   ТЕКСТ ПОВЕРХ ФОНОВОЙ КАРТИНКИ
   ============================================================ */
.profile-info h1,
.profile-status,
.profile-city,
.profile-stats-inline,
.profile-stats-inline a,
.profile-main h2 {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* На светлой теме — светлая тень (для контраста) */
html.theme-light .profile-info h1,
html.theme-light .profile-status,
html.theme-light .profile-city,
html.theme-light .profile-stats-inline,
html.theme-light .profile-main h2 {
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.6);
}
/* ============================================================
   ДЕНЬ РОЖДЕНИЯ И ПОЛ В ПРОФИЛЕ
   ============================================================ */
.profile-birthday,
.profile-gender {
    color: var(--muted);
    margin: 4px 0;
    font-size: 14px;
}

.profile-age {
    color: var(--muted);
    font-size: 13px;
    opacity: 0.85;
}

.profile-card-birthday,
.profile-card-gender {
    color: var(--muted);
    font-size: 12px;
    margin: 2px 0;
    text-align: center;
}

/* Поле select в edit-profile */
.edit-field select {
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    box-sizing: border-box;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.15s;
}
.edit-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.edit-field input[type="date"] {
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
}
.edit-field input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Тёмная тема */
html.theme-dark .edit-field select,
html.theme-dark .edit-field input[type="date"] {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text);
    border-color: var(--border);
}
/* =========================================================
   SocialNet — оформление раздела «Группы»
   Добавьте этот блок В КОНЕЦ assets/css/main.css
   ========================================================= */

.groups-page {
    --groups-accent: #6558f5;
    --groups-accent-dark: #4f43d8;
    --groups-ink: #25223d;
    --groups-muted: #7a7792;
    --groups-surface: rgba(255, 255, 255, .72);
    --groups-border: rgba(104, 93, 199, .13);
    max-width: 1080px;
    margin: 0 auto;
    padding: 42px 24px 68px;
}

.groups-page *,
.groups-page *::before,
.groups-page *::after {
    box-sizing: border-box;
}

.groups-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.groups-header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: var(--groups-ink);
    font-size: clamp(30px, 4vw, 40px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.035em;
}

.groups-header h1::before {
    content: '♟';
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #786cff 0%, #5145dc 100%);
    box-shadow: 0 10px 24px rgba(88, 73, 219, .28);
    color: #fff;
    font-size: 25px;
    transform: rotate(180deg);
}

.groups-header .count {
    display: inline-flex;
    min-width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(101, 88, 245, .11);
    color: var(--groups-accent-dark);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
}

.groups-search {
    display: flex;
    align-items: center;
    width: min(100%, 420px);
    gap: 8px;
    padding: 5px;
    border: 1px solid var(--groups-border);
    border-radius: 15px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 8px 24px rgba(47, 38, 112, .06);
}

.groups-search::before {
    content: '⌕';
    padding-left: 8px;
    color: #817da0;
    font-size: 28px;
    line-height: 1;
}

.groups-search input {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 4px;
    border: 0 !important;
    outline: 0;
    background: transparent !important;
    color: var(--groups-ink);
    font-size: 14px;
}

.groups-search input::placeholder {
    color: #a4a0b5;
}

.groups-page .btn,
.groups-page button {
    border: 0;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.groups-page .btn:hover,
.groups-page button:hover {
    transform: translateY(-1px);
}

.groups-page .btn-primary,
.groups-search .btn-primary {
    background: linear-gradient(135deg, #7568ff, #5848e7) !important;
    box-shadow: 0 8px 16px rgba(83, 67, 224, .24);
    color: #fff !important;
}

.groups-search .btn-primary {
    height: 40px;
    padding: 0 17px;
    white-space: nowrap;
}

.groups-tabs {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 0 24px;
    padding: 5px;
    border: 1px solid var(--groups-border);
    border-radius: 15px;
    background: rgba(255, 255, 255, .5);
}

.groups-tabs a {
    padding: 9px 15px;
    border-radius: 10px;
    color: #68637f;
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
    transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}

.groups-tabs a:hover {
    color: var(--groups-accent-dark);
    background: rgba(101, 88, 245, .08);
}

.groups-tabs a.active {
    background: linear-gradient(135deg, #776bff, #5848e7) !important;
    box-shadow: 0 5px 13px rgba(83, 67, 224, .26);
    color: #fff !important;
}

.group-create {
    position: relative;
    display: grid;
    grid-template-columns: minmax(230px, 1fr) minmax(280px, 1.7fr) auto;
    gap: 12px;
    align-items: end;
    overflow: hidden;
    margin: 0 0 28px;
    padding: 22px;
    border: 1px solid var(--groups-border);
    border-radius: 20px;
    background: linear-gradient(120deg, rgba(255,255,255,.85), rgba(246,244,255,.78));
    box-shadow: 0 15px 35px rgba(69, 55, 151, .07);
}

.group-create::before {
    content: '';
    position: absolute;
    top: -70px;
    right: -35px;
    width: 210px;
    height: 210px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(123, 106, 255, .16), transparent 67%);
    pointer-events: none;
}

.group-create-title {
    grid-column: 1 / -1;
    margin: 0 0 2px !important;
    color: var(--groups-ink);
    font-size: 17px;
    font-weight: 800;
}

.group-create-title::before {
    content: '+';
    display: inline-flex;
    width: 23px;
    height: 23px;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    border-radius: 8px;
    background: rgba(101, 88, 245, .12);
    color: var(--groups-accent-dark);
}

.group-create input[type='text'],
.group-create textarea {
    position: relative;
    width: 100%;
    margin: 0 !important;
    padding: 12px 13px;
    border: 1px solid rgba(104, 93, 199, .16) !important;
    border-radius: 12px;
    outline: none;
    background: rgba(255, 255, 255, .85) !important;
    color: var(--groups-ink);
    font: inherit;
    font-size: 14px;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.group-create input[type='text'] {
    height: 45px;
}

.group-create textarea {
    min-height: 45px;
    max-height: 88px;
    resize: vertical;
}

.group-create input[type='text']:focus,
.group-create textarea:focus {
    border-color: rgba(101, 88, 245, .65) !important;
    box-shadow: 0 0 0 4px rgba(101, 88, 245, .10);
}

.group-create input[type='file'] {
    grid-column: 1 / 3;
    max-width: 290px;
    color: #78738e;
    font-size: 13px;
}

.group-create input[type='file']::file-selector-button {
    margin-right: 10px;
    padding: 9px 12px;
    border: 1px solid rgba(101, 88, 245, .2);
    border-radius: 9px;
    background: #f0edff;
    color: #5144cc;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.group-create button {
    min-height: 41px;
    padding: 0 18px;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.group-card {
    position: relative;
    display: flex;
    min-height: 285px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--groups-border);
    border-radius: 20px;
    background: var(--groups-surface) !important;
    box-shadow: 0 12px 26px rgba(61, 49, 130, .08);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.group-card:hover {
    z-index: 1;
    border-color: rgba(101, 88, 245, .27);
    box-shadow: 0 20px 40px rgba(60, 47, 139, .16);
    transform: translateY(-5px);
}

.group-cover {
    position: relative;
    height: 112px;
    flex: 0 0 112px;
    background: linear-gradient(130deg, #766aff, #5b4ae5) !important;
}

.group-cover::before,
.group-cover::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
}

.group-cover::before {
    top: 16px;
    right: 25px;
    width: 68px;
    height: 68px;
}

.group-cover::after {
    right: 0;
    bottom: -38px;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, .11);
}

.group-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 9px;
    padding: 18px !important;
}

.group-card h3 {
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 0 !important;
    color: var(--groups-ink);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.015em;
}

.group-card h3::before {
    content: '●';
    flex: 0 0 auto;
    margin-right: 8px;
    color: #6b5cf2;
    font-size: 10px;
}

.group-card h3 a {
    overflow: hidden;
    color: inherit !important;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-card .group-meta {
    min-height: 18px;
    margin: 0 !important;
    color: var(--groups-muted) !important;
    font-size: 13px;
    line-height: 1.45;
}

.group-card .member-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
}

.group-card .member-actions .btn {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border: 1px solid rgba(101, 88, 245, .15);
    background: rgba(101, 88, 245, .07);
    color: #5144cc;
    font-size: 13px;
    text-decoration: none;
}

.group-card .member-actions .btn-primary {
    border-color: transparent;
    color: #fff;
}

.groups-page .empty-state {
    display: grid;
    min-height: 190px;
    place-items: center;
    margin: 0;
    border: 1px dashed rgba(101, 88, 245, .26);
    border-radius: 20px;
    background: rgba(255, 255, 255, .35);
    color: #858198;
    font-size: 15px;
}

.groups-page .empty-state::before {
    content: '✦';
    display: block;
    margin-right: 9px;
    color: #6b5cf2;
    font-size: 21px;
}

.group-page {
    --groups-accent: #6558f5;
    --groups-ink: #25223d;
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 24px 65px;
}

.group-page > p:first-child a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6256db;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.group-hero {
    overflow: hidden;
    border: 1px solid rgba(104, 93, 199, .14);
    border-radius: 22px !important;
    background: rgba(255,255,255,.72) !important;
    box-shadow: 0 18px 40px rgba(56, 46, 122, .09);
}

.group-hero-cover {
    position: relative;
    height: 210px !important;
    background: linear-gradient(130deg, #776aff, #5143d9) !important;
}

.group-hero-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 78% 25%, rgba(255,255,255,.26), transparent 26%), radial-gradient(circle at 88% 90%, rgba(255,255,255,.16), transparent 37%);
}

.group-hero-body {
    padding: 24px !important;
}

.group-hero h1 {
    margin: 0 0 8px !important;
    color: var(--groups-ink);
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -.03em;
}

.group-hero-meta {
    color: #79758d !important;
    font-size: 14px;
}

.group-hero-meta a {
    color: #5d50df;
    font-weight: 700;
    text-decoration: none;
}

.group-hero-actions {
    margin-top: 18px;
}

.group-page .group-hero-actions .btn,
.group-page .group-hero-actions button,
.group-page .group-composer .btn {
    min-height: 40px;
    padding: 0 15px;
    border: 0;
    border-radius: 11px;
    background: #eeecff;
    color: #5648d4;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
}

.group-page .group-hero-actions .btn-primary,
.group-page .group-composer .btn-primary {
    background: linear-gradient(135deg, #7568ff, #5848e7) !important;
    box-shadow: 0 8px 16px rgba(83, 67, 224, .24);
    color: #fff !important;
}

.group-members {
    padding-top: 15px;
}

.group-members a {
    display: block;
    margin-right: -4px;
    transition: transform .18s ease;
}

.group-members a:hover {
    z-index: 1;
    transform: translateY(-4px);
}

.group-members img {
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(43, 35, 102, .15);
}

.group-composer {
    margin: 20px 0;
    padding: 18px;
    border: 1px solid rgba(104, 93, 199, .14);
    border-radius: 18px;
    background: rgba(255,255,255,.7);
}

.group-composer textarea {
    min-height: 95px !important;
    padding: 13px;
    border: 1px solid rgba(104, 93, 199, .16) !important;
    border-radius: 12px;
    outline: none;
    background: rgba(255,255,255,.8);
    font: inherit;
    resize: vertical;
}

.group-composer textarea:focus {
    border-color: rgba(101, 88, 245, .6) !important;
    box-shadow: 0 0 0 4px rgba(101, 88, 245, .1);
}

.group-composer .btn {
    margin-top: 8px;
}

.group-wall {
    margin-top: 24px !important;
}

.group-post {
    margin-bottom: 14px !important;
    padding: 17px 19px !important;
    border: 1px solid rgba(104, 93, 199, .12);
    border-radius: 17px !important;
    background: rgba(255,255,255,.72) !important;
    box-shadow: 0 7px 18px rgba(56, 46, 122, .05);
}

.group-post-meta {
    color: #858198 !important;
}

.group-post-meta a {
    color: #5144cc;
    font-weight: 750;
    text-decoration: none;
}

@media (max-width: 820px) {
    .groups-header {
        align-items: stretch;
        flex-direction: column;
    }
    .groups-search { width: 100%; }
    .group-create { grid-template-columns: 1fr; }
    .group-create input[type='file'] { grid-column: auto; }
    .groups-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
    .groups-page, .group-page { padding-right: 14px; padding-left: 14px; }
    .groups-header h1 { font-size: 30px; }
    .groups-header h1::before { width: 42px; height: 42px; }
    .groups-search { gap: 4px; }
    .groups-search .btn-primary { padding: 0 12px; }
    .groups-tabs { display: flex; width: 100%; }
    .groups-tabs a { flex: 1; padding-right: 7px; padding-left: 7px; text-align: center; }
    .groups-grid { grid-template-columns: 1fr; }
    .group-create { padding: 16px; }
    .group-hero-cover { height: 150px !important; }
    .group-hero-body { padding: 18px !important; }
    .group-hero h1 { font-size: 26px; }
}

html.theme-dark .groups-page,
html.theme-dark .group-page {
    --groups-ink: #f2f0ff;
    --groups-muted: #aaa6bd;
    --groups-surface: rgba(31, 28, 55, .86);
    --groups-border: rgba(177, 166, 255, .17);
}

html.theme-dark .groups-search,
html.theme-dark .groups-tabs,
html.theme-dark .group-create,
html.theme-dark .group-hero,
html.theme-dark .group-composer,
html.theme-dark .group-post {
    background: rgba(31, 28, 55, .84) !important;
}

html.theme-dark .groups-search input,
html.theme-dark .group-create input[type='text'],
html.theme-dark .group-create textarea,
html.theme-dark .group-composer textarea {
    background: rgba(17, 15, 34, .72) !important;
    color: #f1effa;
}

html.theme-dark .group-members img { border-color: #24213f; }
