/* --- ПЕРЕМЕННЫЕ (CLEAN DIGITAL GREY & BLUE UI) --- */
:root {
    /* Базовые цвета: чистый белый, благородный арктический серый */
    --bg-main: #f4f6f9; 
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-mute: #f8fafc;
    
    /* Контрастный цифровой синий и графит */
    --accent-blue: #2563eb;       /* Насыщенный современный синий */
    --accent-blue-dark: #1d4ed8;  /* Глубокий синий */
    --accent-dark: #0f172a;       /* Замена черному — дорогой темный сланец */
    --link-color: #2563eb;
    
    /* Текст с идеальной читаемостью */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Границы без мыла — четкие и аккуратные */
    --border-light: #e2e8f0;
    
    /* Геометричные радиусы (скруглено, но строго) */
    --radius-full: 9999px;
    --radius-lg: 16px; 
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --container-width: 840px;
    --sidebar-width: 250px;
    --gap: 16px;

    --font-size-base: 14px;
}

/* --- RESET & BASE --- */
* { 
    box-sizing: border-box; 
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 72px 0 40px;
    color: var(--text-main);
    line-height: 1.5;
    font-size: var(--font-size-base);
    -webkit-font-smoothing: antialiased;
}

.container { 
    width: 100%;
    max-width: var(--container-width); 
    margin: 0 auto; 
    padding: 0 var(--gap);
}

a { 
    color: var(--link-color); 
    text-decoration: none; 
}

/* --- GRID SYSTEM --- */
.main-layout { 
    display: flex; 
    gap: var(--gap); 
    flex-direction: row-reverse; 
    align-items: flex-start; 
}

.sidebar { 
    width: var(--sidebar-width); 
    flex-shrink: 0; 
}

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

/* --- HEADER --- */
.main-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-light); 
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    height: 56px; display: flex; align-items: center;
}

.header-inner { 
    width: 100%;
    max-width: var(--container-width); 
    margin: 0 auto; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 var(--gap);
}

.logo { 
    font-weight: 800; 
    font-size: 20px; 
    color: var(--accent-dark); 
    display: flex; 
    align-items: center; 
    letter-spacing: -0.75px; 
}

.logo span {
    color: var(--accent-blue);
}

.nav-links { 
    display: flex; 
    align-items: center; 
    background: var(--bg-mute); 
    padding: 4px; 
    border-radius: var(--radius-full); 
    border: 1px solid var(--border-light); 
}

.nav-links a { 
    font-size: 13px; 
    color: var(--text-muted); 
    padding: 6px 16px;
    font-weight: 600; 
    display: inline-block;
    line-height: 1; 
    border-radius: var(--radius-full);
}

.nav-links a.active { 
    background: #fff; 
    color: var(--accent-blue); 
}

/* --- COMPONENTS: CARDS --- */
.card { 
    background: var(--bg-card); 
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light); 
    margin-bottom: 16px; 
    overflow: hidden;
}

.card-content { 
    padding: 20px; 
}

.feed-header { 
    padding: 14px 20px; 
    border-bottom: 1px solid var(--border-light); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: var(--bg-mute); 
}

.feed-header h3 { 
    margin: 0; 
    font-size: 13px; 
    font-weight: 700; 
    color: var(--accent-dark); 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

/* --- PROFILE CARD & COVERS --- */
.profile-card {
    padding: 0 !important;
}

.profile-cover-box {
    position: relative;
    width: 100%;
    height: 245px;
    background: #cbd5e1;
}

.profile-cover-box .cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-cover-box .cover-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 160px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.9) 0%, rgba(15, 23, 42, 0.4) 50%, rgba(15, 23, 42, 0) 100%);
    z-index: 1;
}

.profile-cover-content {
    position: absolute;
    bottom: 25px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    display: flex;
    gap: 18px;
    align-items: flex-end;
    z-index: 2;
}

.avatar-on-cover {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: #fff;
    object-fit: cover;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
}

.info-on-cover {
    flex: 1;
    color: #fff;
    min-width: 0;
}

.info-on-cover h2 {
    margin: 0;
    font-size: 22px;
    color: #fff;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-on-cover p {
    margin: 3px 0 8px 0;
    color: #94a3b8;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge-cover {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions-on-cover {
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.actions-on-cover .action-btn {
    background: #ffffff !important;
    color: var(--accent-dark) !important;
    border: 1px solid var(--border-light) !important;
    font-weight: 700;
    margin-bottom: 0;
    width: 100%;
    border-radius: var(--radius-sm);
}

.actions-on-cover .action-btn.msg-btn {
    background: var(--accent-blue) !important;
    color: #fff !important;
    border: none !important;
}

.profile-bottom-panel {
    padding: 20px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stats-below-cover {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
}

.stats-below-cover .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stats-below-cover .stat-value {
    font-weight: 700;
    color: var(--accent-dark);
}

.profile-bio-text {
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.5;
}

.profile-stats {
    background: var(--bg-mute);
    padding: 14px; border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    min-width: 140px; display: flex; flex-direction: column; gap: 6px;
}

.profile-stats .stat-item { font-size: 13px; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; }
.profile-stats .stat-value { font-weight: 700; color: var(--accent-blue); background: #fff; padding: 2px 8px; border-radius: var(--radius-full); border: 1px solid var(--border-light); font-size: 12px; }

/* --- NODES (POSTS) --- */
.node { 
    padding: 16px 20px; 
    border-bottom: 1px solid var(--border-light); 
    display: flex; 
    gap: 16px; 
}

.node:last-child {
    border-bottom: none;
}

/* Строго круглые аватарки на главной */
.node-avatar img { 
    width: 44px; 
    height: 44px; 
    border-radius: 50%; 
    object-fit: cover;
    aspect-ratio: 1 / 1;
    display: block;
    border: 1px solid var(--border-light); 
}

.node-meta-box {
    flex-grow: 1;
    min-width: 0;
}

.author-name { 
    font-weight: 700; 
    font-size: var(--font-size-base); 
    color: var(--accent-dark); 
}

.node-text { 
    font-size: var(--font-size-base); 
    word-wrap: break-word; 
    color: var(--text-main); 
    line-height: 1.5; 
}

.node-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.node-time { 
    color: var(--text-light); 
    font-size: 12px; 
    font-weight: 500; 
    padding-top: 10px;
}

.node-share {
    font-size: 11px;
    color: var(--accent-blue);
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- MESSENGER & DIALOGS --- */
.messenger-card { 
    padding: 0 !important; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    height: 600px; 
}

.dialog-row { 
    display: flex; 
    align-items: center; 
    padding: 14px 20px; 
    gap: 16px; 
    text-decoration: none; 
    color: var(--text-main); 
    border-bottom: 1px solid var(--border-light); 
    background: #fff; 
}

.dialog-row img, .group-icon-mini { 
    width: 44px; 
    height: 44px; 
    border-radius: 50%; 
    object-fit: cover; 
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
}

.group-icon-mini { 
    background: var(--bg-mute); 
    color: var(--text-muted); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 700; 
    border: 1px solid var(--border-light); 
}

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

.dialog-name-box {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.dialog-name { 
    font-weight: 700; 
    color: var(--accent-dark); 
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dialog-meta { 
    font-size: 12px; 
    color: var(--text-light); 
    flex-shrink: 0;
}

/* --- CHAT VIEW --- */
.chat-view { 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
}

.chat-nav { 
    padding: 12px 20px; 
    border-bottom: 1px solid var(--border-light); 
    display: flex; 
    align-items: center; 
    background: var(--bg-mute); 
    gap: 16px; 
}

.back-link { 
    text-decoration: none; 
    color: var(--text-muted); 
    font-weight: 700; 
    font-size: 20px; 
    padding: 4px; 
    line-height: 1; 
}

.chat-user-info { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    flex: 1; 
    min-width: 0;
}

.chat-user-info img { 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    object-fit: cover; 
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
}

.chat-user-meta {
    min-width: 0;
}

.chat-user-name { 
    font-weight: 700; 
    color: var(--accent-dark); 
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.chat-user-sub { 
    font-size: 12px; 
    color: var(--text-light); 
    font-weight: 500; 
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.chat-body { 
    flex: 1; 
    padding: 20px; 
    overflow-y: auto; 
    background: #fff; 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
}

/* --- MESSAGES --- */
.msg { 
    max-width: 75%; 
    padding: 10px 16px; 
    border-radius: var(--radius-md); 
    position: relative; 
    word-break: break-word; 
    font-size: var(--font-size-base); 
    line-height: 1.5;
}

.msg-my { 
    align-self: flex-end; 
    background: var(--accent-blue); 
    color: #fff; 
    border-bottom-right-radius: 2px; 
}

.msg-target { 
    align-self: flex-start; 
    background: var(--bg-mute); 
    color: var(--text-main); 
    border-bottom-left-radius: 2px; 
    border: 1px solid var(--border-light); 
}

.msg-date { 
    font-size: 10px; 
    opacity: 0.6; 
    display: block; 
    margin-top: 4px; 
    text-align: right; 
    font-weight: 500; 
}

.sender-name { 
    font-weight: 700; 
    font-size: 12px; 
    display: block; 
    margin-bottom: 4px; 
    color: var(--accent-blue); 
}

.chat-form { 
    padding: 14px 20px; 
    border-top: 1px solid var(--border-light); 
    background: var(--bg-mute); 
}

.chat-form form { 
    display: flex; 
    gap: 12px; 
}

.group-sidebar-info { 
    padding: 12px 16px; 
    border-bottom: 1px solid var(--border-light); 
    background: #f1f5f9; 
    font-size: 13px; 
    line-height: 1.5; 
    color: var(--text-main); 
    border-left: 4px solid var(--accent-blue); 
}

.owner-badge { 
    background: #e2e8f0; 
    color: var(--accent-dark); 
    font-size: 10px; 
    padding: 2px 6px; 
    border-radius: var(--radius-full); 
    margin-left: 6px; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

/* --- FORMS & INPUTS --- */
input[type="text"], input[type="email"], input[type="password"], select, textarea {
    width: 100%; 
    padding: 10px 16px; 
    border: 1px solid var(--border-light); 
    border-radius: var(--radius-sm); 
    font-size: var(--font-size-base);
    background: var(--bg-card); 
    color: var(--text-main); 
    outline: none;
    -webkit-appearance: none;
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
    border-color: var(--accent-blue);
}

.form-group { 
    margin-bottom: 16px; 
}

.form-group label { 
    display: block; 
    font-weight: 700; 
    font-size: 12px; 
    margin-bottom: 6px; 
    color: var(--text-muted); 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

/* --- TABS --- */
.settings-tabs, .tabs-header { 
    display: flex; 
    background: var(--bg-mute); 
    border-bottom: 1px solid var(--border-light); 
    padding: 4px; 
    gap: 4px; 
    border-radius: var(--radius-md); 
    margin-bottom: 4px; 
    overflow-x: auto;
}

.tab-btn, .tab-link {
    flex: 1; 
    padding: 8px 16px; 
    cursor: pointer; 
    font-size: var(--font-size-base); 
    font-weight: 600;
    color: var(--text-muted); 
    border: none; 
    background: none; 
    outline: none; 
    text-align: center; 
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.tab-btn.active, .tab-link.active { 
    color: var(--accent-blue); 
    background: #fff; 
}

/* --- BUTTONS & NAV --- */
.action-btn {
    display: block; 
    text-align: center; 
    padding: 8px 16px; 
    margin-bottom: 8px;
    background: #fff; 
    border: 1px solid var(--border-light); 
    border-radius: var(--radius-sm);
    font-size: 13px; 
    font-weight: 700; 
    color: var(--text-muted);
    cursor: pointer;
}

.write-btn { 
    background: var(--accent-blue); 
    border: none; 
    padding: 6px 16px; 
    border-radius: var(--radius-full); 
    font-size: 12px; 
    font-weight: 700; 
    color: #fff; 
    cursor: pointer; 
}

.btn-yellow { 
    width: 100%; 
    padding: 12px; 
    font-weight: 700; 
    cursor: pointer;
    border-radius: var(--radius-sm); 
    border: none;
    background: var(--accent-blue); 
    color: #fff;
    font-size: var(--font-size-base);
}

.nav-item-btn { 
    display: block; 
    padding: 10px 14px; 
    font-size: var(--font-size-base); 
    border-radius: var(--radius-sm); 
    color: var(--text-muted); 
    font-weight: 600; 
    margin-bottom: 2px; 
}

.nav-item-btn.active { 
    background: var(--bg-mute); 
    color: var(--accent-blue); 
    font-weight: 700; 
}

/* --- MODALS --- */
.sidebar-modal, .modal {
    display: none; 
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(15, 23, 42, 0.6); 
    z-index: 10000; 
    align-items: center; 
    justify-content: center;
    padding: var(--gap);
}

.modal-window { 
    background: #fff; 
    width: 100%;
    max-width: 400px; 
    border-radius: var(--radius-lg); 
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-mute);
}

.modal-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-dark);
}

.close-modal {
    cursor: pointer;
    font-weight: bold;
    color: var(--text-light);
    font-size: 18px;
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}

.user-row img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.btn-send-share {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.user-select-list { 
    max-height: 150px; 
    overflow-y: auto; 
    border: 1px solid var(--border-light); 
    padding: 10px; 
    margin: 12px 0; 
    background: var(--bg-mute); 
    border-radius: var(--radius-md); 
}

/* --- SIDEBAR COMPONENTS --- */
.msg-badge {
    background: var(--accent-blue); color: #fff; font-size: 11px; font-weight: 700;
    padding: 2px 6px; border-radius: var(--radius-full); margin-left: 6px;
    display: inline-block; vertical-align: middle; line-height: 1;
}

.invite-box { 
    background: var(--bg-mute); border: 1px dashed var(--border-light); padding: 10px; 
    font-family: monospace; font-size: 14px; color: var(--text-main); display: inline-block; border-radius: var(--radius-sm);
}

.sidebar-user-card { 
    text-align: center; 
    background: var(--bg-mute); 
    border-bottom: 1px solid var(--border-light); 
    padding: 16px 0; 
}

.sidebar-user-card img { 
    width: 64px; 
    height: 64px; 
    border-radius: 50%; 
    margin-bottom: 8px; 
    object-fit: cover; 
    aspect-ratio: 1 / 1;
    border: 2px solid #fff; 
}

/* --- FAQ & ALERTS --- */
.faq-item { 
    margin-bottom: 12px; 
    border: 1px solid var(--border-light); 
    border-radius: var(--radius-md); 
    overflow: hidden; 
}

.faq-question {
    padding: 14px 16px; background: #fff; cursor: pointer; font-weight: 600;
    display: flex; justify-content: space-between; color: var(--text-main);
}

.faq-answer { 
    padding: 0 16px; 
    max-height: 0; 
    overflow: hidden; 
    background: #fff; 
    color: var(--text-muted); 
}

.faq-item.active .faq-answer { 
    padding: 14px 16px; 
    max-height: 500px; 
    border-top: 1px solid var(--border-light);
}

.alert { 
    padding: 12px 16px; 
    border-radius: var(--radius-sm); 
    margin-bottom: 16px; 
    border: 1px solid var(--border-light); 
}

.alert-error { background: #fff1f2; color: #991b1b; border-color: #fecdd3; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }

.crypto-card-banner { 
    display: none; 
    margin-bottom: 16px; 
    background: var(--bg-mute); 
    border: 1px dashed var(--border-light); 
    border-radius: var(--radius-md); 
}

/* --- КЛАСС ПЕРВОГО ФУТЕРА (ПОЛНОСТЬЮ ВОЗВРАЩЕН) --- */
.main-footer {
    margin-top: var(--gap);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 20px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--gap);
}

.footer-inner p {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: var(--gap);
}

.footer-links a {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

/* --- PAGINATION --- */
.pagination {
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 6px; 
    padding: 14px;
    background: var(--bg-mute); 
}

.page-link {
    padding: 6px 16px; 
    background: #fff; 
    border: 1px solid var(--border-light); 
    border-radius: var(--radius-full);
    font-size: var(--font-size-base); 
    font-weight: 600; 
    color: var(--text-muted);
}

.page-link.active { 
    background: var(--accent-blue); 
    color: #fff; 
    border-color: var(--accent-blue); 
}

/* --- ADAPTIVITY --- */
@media (max-width: 872px) {
    body { padding-top: 68px; }
    .main-layout { flex-direction: column; align-items: stretch; }
    .sidebar { width: 100%; }
    .profile-cover-box { height: 200px; }
}

@media (max-width: 576px) {
    .header-inner { padding: 0 12px; }
    .nav-links a { padding: 6px 10px; font-size: 12px; }
    .profile-cover-content { position: relative; bottom: 0; padding: 16px; flex-direction: column; align-items: center; text-align: center; background: var(--accent-dark); }
    .avatar-on-cover { margin-top: -50px; z-index: 5; }
    .actions-on-cover { width: 100%; flex-direction: row; }
    .actions-on-cover .action-btn { flex: 1; }
    .footer-inner { flex-direction: column; text-align: center; gap: 12px; }
    .footer-links { justify-content: center; }
}