/* ============================================================
   Гомон — основной стиль
   Тёмная и светлая темы через CSS-переменные и [data-theme]
   ============================================================ */

:root {
    --font: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar-w: 260px;
    --rightbar-w: 320px;
    --content-w: 640px;
    --transition: 0.18s ease;
}

/* Тёмная тема (по умолчанию) */
:root, [data-theme="dark"] {
    --bg: #0f1419;
    --bg-soft: #1a222c;
    --card: #1a222c;
    --card-hover: #212b36;
    --border: #2b3a47;
    --text: #e7e9ea;
    --text-muted: #8b98a5;
    --primary: #1d9bf0;
    --primary-hover: #1a8cd8;
    --primary-soft: rgba(29, 155, 240, 0.12);
    --danger: #f4212e;
    --success: #00ba7c;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --input-bg: #0f1419;
}

/* Светлая тема */
[data-theme="light"] {
    --bg: #f5f7f9;
    --bg-soft: #ffffff;
    --card: #ffffff;
    --card-hover: #f0f3f5;
    --border: #e1e8ed;
    --text: #0f1419;
    --text-muted: #536471;
    --primary: #1d9bf0;
    --primary-hover: #1a8cd8;
    --primary-soft: rgba(29, 155, 240, 0.1);
    --danger: #f4212e;
    --success: #00ba7c;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --input-bg: #f5f7f9;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.muted { color: var(--text-muted); }
.verified { color: var(--primary); font-size: 0.9em; }

/* ---------- Каркас ---------- */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, var(--content-w)) var(--rightbar-w);
    gap: 24px;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 16px;
}

.app-shell.no-rightbar {
    grid-template-columns: var(--sidebar-w) minmax(0, var(--content-w));
    justify-content: center;
}

/* ---------- Левый сайдбар ---------- */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 800;
    padding: 10px 14px;
    color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo-icon { font-size: 1.7rem; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    border-radius: 999px;
    color: var(--text);
    font-size: 1.05rem;
    transition: background var(--transition);
    position: relative;
}
.nav-link:hover { background: var(--card-hover); text-decoration: none; }
.nav-link.active { font-weight: 700; }
.nav-link i {
    width: 24px;
    text-align: center;
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nav-link span { line-height: 1; }

.badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}
.nav-link .badge { margin-left: auto; }
.badge-primary { background: var(--primary); }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

/* Кнопка смены темы — компактная, не на всю ширину */
.theme-toggle {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
    position: relative;
    overflow: hidden;
}
.theme-toggle:hover { background: var(--card-hover); border-color: var(--primary); transform: scale(1.05); }
.theme-toggle:active { transform: scale(0.95); }
.theme-toggle .fa-sun, .theme-toggle .fa-moon {
    position: absolute;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
[data-theme="dark"] .theme-toggle .fa-sun { opacity: 1; transform: rotate(0deg) scale(1); }
[data-theme="dark"] .theme-toggle .fa-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="light"] .theme-toggle .fa-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
[data-theme="light"] .theme-toggle .fa-moon { opacity: 1; transform: rotate(0deg) scale(1); }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 999px;
    transition: background var(--transition);
}
.user-chip:hover { background: var(--card-hover); }
.user-chip-info { flex: 1; min-width: 0; }
.user-chip-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-username { color: var(--text-muted); font-size: 0.85rem; }

.auth-links { display: flex; flex-direction: column; gap: 8px; padding: 8px; }

/* ---------- Центральная колонка ---------- */
.main { padding: 16px 0 80px; min-width: 0; }

.page-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 4px 16px;
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
    z-index: 10;
}
.page-header h1 { font-size: 1.3rem; }

/* ---------- Правый сайдбар ---------- */
.rightbar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rightbar-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
}
.rightbar-card h3 { margin-bottom: 12px; font-size: 1.05rem; }

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.suggestion-info { flex: 1; min-width: 0; }
.suggestion-name { font-weight: 700; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggestion-username { color: var(--text-muted); font-size: 0.82rem; }

/* ---------- Карточки ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

/* ---------- Аватары ---------- */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-soft);
}
.avatar-xs { width: 28px; height: 28px; }
.avatar-sm { width: 36px; height: 36px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 120px; height: 120px; }

.online-dot {
    width: 12px;
    height: 12px;
    background: var(--success);
    border: 2px solid var(--card);
    border-radius: 50%;
    display: inline-block;
}
.conv-avatar-wrap { position: relative; flex-shrink: 0; }
.conv-avatar-wrap .online-dot { position: absolute; bottom: 0; right: 0; }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { border-color: var(--border); color: var(--text); background: transparent; }
.btn-outline:hover { background: var(--card-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px 12px; border-radius: 50%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background var(--transition);
}
.icon-btn:hover { background: var(--card-hover); text-decoration: none; }

/* ---------- Формы ---------- */
.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field small { color: var(--text-muted); font-size: 0.8rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="search"], input[type="number"],
textarea, select, .input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color var(--transition);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}
textarea { resize: vertical; }

input[type="file"] {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.checkbox { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; cursor: pointer; font-size: 0.9rem; }

/* ---------- Флеш-сообщения ---------- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.92rem;
    animation: slideDown 0.3s ease;
}
.alert-success { background: rgba(0, 186, 124, 0.12); color: var(--success); border: 1px solid rgba(0, 186, 124, 0.3); }
.alert-error { background: rgba(244, 33, 46, 0.1); color: var(--danger); border: 1px solid rgba(244, 33, 46, 0.3); }

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

/* ---------- Композер (форма поста) ---------- */
.composer { margin-bottom: 16px; }
.composer-top { display: flex; gap: 12px; }
.composer-top textarea {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    padding: 8px 0;
    min-height: 60px;
}
.composer-top textarea:focus { border: none; }

.composer-preview {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.composer-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.composer-images img { border-radius: var(--radius-sm); aspect-ratio: 1; object-fit: cover; }

.composer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.composer-counter { margin-left: auto; color: var(--text-muted); font-size: 0.85rem; }
.composer-counter.over { color: var(--danger); font-weight: 700; }

/* ---------- Посты ---------- */
.feed { display: flex; flex-direction: column; gap: 12px; }

.post { transition: background var(--transition); }
.post:hover { background: var(--card-hover); }

.post-header { display: flex; gap: 12px; }
.post-author { flex: 1; min-width: 0; }
.post-author-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post-author-name { font-weight: 700; color: var(--text); }
.post-author-name:hover { text-decoration: underline; }
.post-meta { color: var(--text-muted); font-size: 0.88rem; }

.post-content { margin: 10px 0; font-size: 0.98rem; word-wrap: break-word; }
.post-content p { margin-bottom: 8px; }
.post-content pre {
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 8px 0;
}
.post-content code { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 0.88em; }
.post-content blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    color: var(--text-muted);
    margin: 8px 0;
}
.post-content img { border-radius: var(--radius-sm); }

.post-images { display: grid; gap: 6px; margin: 10px 0; border-radius: var(--radius); overflow: hidden; }
.post-images-1 { grid-template-columns: 1fr; }
.post-images-2 { grid-template-columns: 1fr 1fr; }
.post-images-3, .post-images-4 { grid-template-columns: 1fr 1fr; }
.post-images a { display: block; }
.post-images img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16/10; transition: opacity var(--transition); }
.post-images img:hover { opacity: 0.9; }

.post-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.post-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    cursor: pointer;
    transition: all var(--transition);
}
.post-action:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.post-action.active { color: var(--primary); }
.post-action.danger:hover { background: rgba(244, 33, 46, 0.1); color: var(--danger); }
.post-views { margin-left: auto; color: var(--text-muted); font-size: 0.82rem; display: flex; align-items: center; gap: 5px; }

/* ---------- Реакции ---------- */
.reaction-picker-wrap { position: relative; display: inline-block; }
.reaction-picker {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 8px;
    display: flex;
    gap: 2px;
    box-shadow: var(--shadow);
    z-index: 50;
    animation: popIn 0.15s ease;
}
.reaction-picker[hidden] { display: none; }
.reaction-option {
    font-size: 1.35rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 50%;
    transition: transform var(--transition);
    line-height: 1;
}
.reaction-option:hover { transform: scale(1.3); }
.reaction-option.selected { background: var(--primary-soft); }

@keyframes popIn {
    from { opacity: 0; transform: translateY(6px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Комментарии ---------- */
.comments-section { margin-top: 20px; }
.section-title { font-size: 1.05rem; margin-bottom: 14px; }

.comment-form { margin-bottom: 16px; }
.comment-form-actions { display: flex; justify-content: flex-end; margin-top: 10px; }

.comment {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    margin-left: calc(var(--depth, 0) * 36px);
    border-left: 2px solid transparent;
}
.comment[data-depth="0"] { border-bottom: 1px solid var(--border); }
.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.9rem; }
.comment-content { margin: 4px 0; font-size: 0.93rem; }
.comment-actions { display: flex; gap: 4px; align-items: center; }
.comment-actions .post-action { padding: 4px 10px; font-size: 0.82rem; }
.comment-reply-form { margin-top: 10px; }
.comment-replies { margin-top: 4px; }

/* ---------- Профиль ---------- */
.profile-banner {
    height: 200px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(135deg, var(--primary), #7856ff);
    background-size: cover;
    background-position: center;
}
.profile-head { border-radius: 0 0 var(--radius) var(--radius); border-top: none; position: relative; padding-top: 0; }
.profile-avatar { margin-top: -60px; border: 4px solid var(--card); }
.profile-actions { position: absolute; top: 16px; right: 16px; display: flex; gap: 8px; }
.profile-name { font-size: 1.4rem; margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.profile-username { color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.friend-badge {
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 999px;
}
.profile-bio { margin: 12px 0; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 12px; }
.profile-meta a { color: var(--primary); }
.profile-stats { display: flex; gap: 18px; font-size: 0.92rem; }
.profile-stats a { color: var(--text-muted); }
.profile-stats strong { color: var(--text); }
.profile .feed { margin-top: 16px; }

/* ---------- Списки пользователей ---------- */
.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-item { display: flex; align-items: center; gap: 12px; }
.user-item-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: var(--text); }
.user-item-main:hover { text-decoration: none; }
.user-bio { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }

/* ---------- Вкладки ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
    padding: 12px 18px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition);
}
.tab:hover { color: var(--text); text-decoration: none; background: var(--card-hover); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Мессенджер ---------- */
.conversations { display: flex; flex-direction: column; gap: 8px; }
.conversation-item { display: flex; align-items: center; gap: 12px; color: var(--text); transition: background var(--transition); }
.conversation-item:hover { background: var(--card-hover); text-decoration: none; }
.conv-info { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conv-time { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }
.conv-preview {
    color: var(--text-muted);
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conv-you { color: var(--text); }

.new-chat-panel { margin-bottom: 12px; }
.chat-user-results { margin-top: 8px; max-height: 300px; overflow-y: auto; }
.chat-user-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text);
}
.chat-user-result:hover { background: var(--card-hover); text-decoration: none; }

/* Чат */
.chat-page { display: flex; flex-direction: column; height: calc(100vh - 32px); }
.chat-header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 8px; }
.chat-peer { display: flex; align-items: center; gap: 10px; color: var(--text); }
.chat-peer:hover { text-decoration: none; }
.chat-status { font-size: 0.8rem; color: var(--text-muted); }
.online-text { color: var(--success); }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 4px;
}

.message { display: flex; gap: 8px; align-items: flex-end; max-width: 78%; }
.message-mine { align-self: flex-end; flex-direction: row-reverse; }
.message-theirs { align-self: flex-start; }

.message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}
.message-mine .message-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.message-theirs .message-bubble {
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}
.message-text { font-size: 0.93rem; }
.message-image { border-radius: 12px; max-width: 280px; margin-bottom: 6px; }
.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    margin-top: 4px;
    opacity: 0.75;
}
.message-status .read { color: #7ee2ff; }
.message-theirs .message-meta { color: var(--text-muted); }

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots span {
    width: 6px; height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

.chat-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; margin-top: 8px; }
.chat-input-wrap { flex: 1; }
.chat-composer textarea {
    border: none;
    background: transparent;
    resize: none;
    max-height: 120px;
    padding: 8px 4px;
}
.chat-composer textarea:focus { border: none; }
#chat-attachment-preview { margin-bottom: 6px; }
#chat-attachment-preview img { max-height: 80px; border-radius: 8px; }

/* ---------- Уведомления ---------- */
.notifications { display: flex; flex-direction: column; gap: 8px; }
.notification-item { display: flex; align-items: flex-start; gap: 12px; color: var(--text); }
.notification-item:hover { background: var(--card-hover); text-decoration: none; }
.notification-item.unread { border-left: 3px solid var(--primary); background: var(--primary-soft); }
.notification-icon { font-size: 1.3rem; }
.notification-body { flex: 1; min-width: 0; font-size: 0.92rem; }
.notification-excerpt { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.notification-time { color: var(--text-muted); font-size: 0.78rem; margin-top: 4px; }

/* ---------- Поиск ---------- */
.search-form { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 16px; }
.search-form i { color: var(--text-muted); }
.search-input { border: none !important; background: transparent !important; padding: 4px 0; }
.search-comment { display: block; margin-bottom: 10px; color: var(--text); }
.search-comment:hover { background: var(--card-hover); text-decoration: none; }

/* ---------- Настройки ---------- */
.settings-grid { display: flex; flex-direction: column; gap: 16px; }
.settings-section h2 { font-size: 1.05rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }

.sessions-list { display: flex; flex-direction: column; gap: 10px; }
.session-item { display: flex; align-items: center; gap: 14px; }
.session-icon { font-size: 1.5rem; color: var(--text-muted); width: 40px; text-align: center; }
.session-info { flex: 1; min-width: 0; }

/* ---------- Авторизация ---------- */
.auth-page {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}
.auth-card { width: 100%; max-width: 420px; padding: 32px; }
.auth-logo { font-size: 3rem; text-align: center; margin-bottom: 8px; }
.auth-card h1 { text-align: center; font-size: 1.5rem; }
.auth-sub { text-align: center; color: var(--text-muted); margin-bottom: 24px; }
.auth-form { margin-bottom: 16px; }
.auth-links-row { display: flex; justify-content: space-between; font-size: 0.9rem; }

/* ---------- Пустые состояния / ошибки ---------- */
.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty-icon { font-size: 3rem; display: block; margin-bottom: 12px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

.error-page { text-align: center; padding: 80px 16px; }
.error-code {
    font-size: 6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #7856ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.error-page h1 { margin-bottom: 8px; }
.error-page .btn { margin-top: 20px; }
.error-detail {
    text-align: left;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 20px auto;
    max-width: 700px;
    overflow-x: auto;
    font-size: 0.8rem;
    color: var(--danger);
}

/* ---------- Пагинация ---------- */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 24px; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.9rem;
}
.pagination a:hover { background: var(--card-hover); text-decoration: none; }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Гостевой баннер ---------- */
.guest-banner {
    background: linear-gradient(135deg, var(--primary), #7856ff);
    color: #fff;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.guest-banner h2 { margin-bottom: 4px; }
.guest-banner .btn { background: #fff; color: var(--primary); }

/* ---------- Мобильная навигация ---------- */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 8px 0;
    z-index: 100;
    justify-content: space-around;
}
.mobile-nav a {
    color: var(--text-muted);
    font-size: 1.25rem;
    padding: 8px 16px;
    position: relative;
}
.mobile-nav a.active { color: var(--primary); }
.mobile-nav .badge { position: absolute; top: 0; right: 6px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 80px minmax(0, 1fr); }
    .rightbar { display: none; }
    .nav-link span, .logo span, .user-chip-info { display: none; }
    .nav-link { justify-content: center; }
    .nav-link .badge { position: absolute; top: 4px; right: 8px; margin: 0; }
    .logo { justify-content: center; }
    .theme-toggle { align-self: center; }
}

@media (max-width: 640px) {
    .app-shell { grid-template-columns: 1fr; padding: 0 10px; }
    .sidebar { display: none; }
    .mobile-nav { display: flex; }
    .main { padding-bottom: 90px; }
    .message { max-width: 92%; }
    .field-row { grid-template-columns: 1fr; }
    .profile-banner { height: 120px; }
    .profile-avatar { width: 84px; height: 84px; margin-top: -42px; }
    .chat-page { height: calc(100vh - 140px); }
}

/* ---------- Скроллбар ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Выделение ---------- */
::selection { background: var(--primary); color: #fff; }
