/* Сброс и базовые настройки */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 20px rgba(0, 0, 0, 0.04);
    --radius: 16px;
    --radius-sm: 10px;
    --header-height: 64px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Ширина меню */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* Шапка */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.header__left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header__logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.header__search {
    flex: 1;
    max-width: 400px;
    margin: 0 24px;
    position: relative;
}

.header__search input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-body);
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}

.header__search input:focus {
    background: var(--bg-card);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.header__search svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header__icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.header__icon-btn:hover {
    background: var(--bg-body);
    color: var(--accent);
}

.header__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
}

/* Основной контейнер — центрирован и независим */
.main-container {
    max-width: 1200px;
    margin: calc(var(--header-height) + 24px) auto 24px;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    position: relative;
}

/* Левая боковая панель — ФИКСИРОВАННАЯ, не влияет на центрирование */
.sidebar-left {
    position: fixed;
    top: calc(var(--header-height) + 24px);
    left: 24px;
    width: var(--sidebar-width);
    height: fit-content;
    max-height: calc(100vh - var(--header-height) - 48px);
    overflow-y: auto;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.nav-menu {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
    overflow: hidden;
}

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

.nav-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.nav-item span {
    white-space: nowrap;
    opacity: 1;
    max-width: 200px;
    transition: opacity 0.2s ease, max-width 0.3s ease, margin 0.3s ease;
}

/* === СОСТОЯНИЕ СВЕРНУТОГО МЕНЮ === */
body.sidebar-collapsed .sidebar-left {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
}

body.sidebar-collapsed .nav-item span {
    opacity: 0;
    max-width: 0;
    margin: 0;
}

/* Центральная лента */
.feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.create-post {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.create-post__top {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.create-post__input {
    flex: 1;
    border: none;
    background: var(--bg-body);
    border-radius: 999px;
    padding: 12px 20px;
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}

.create-post__input:focus {
    background: #e5e7eb;
}

.create-post__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.post-action-btn:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 8px 24px;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* Карточка поста */
.post-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.post-card:hover {
    box-shadow: var(--shadow-hover);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.post-author {
    display: flex;
    gap: 12px;
}

.post-author__info h4 {
    font-size: 15px;
    font-weight: 600;
}

.post-author__info span {
    font-size: 13px;
    color: var(--text-secondary);
}

.post-content {
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.6;
}

.post-image {
    width: 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    background: linear-gradient(135deg, #e0e7ff 0%, #fae8ff 100%);
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-weight: 500;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.post-footer-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.post-footer-btn:hover {
    background: var(--bg-body);
    color: var(--accent);
}

/* Правая боковая панель */
.sidebar-right {
    position: sticky;
    top: calc(var(--header-height) + 24px);
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.widget {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.widget__title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.trend-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.trend-item:last-child { border-bottom: none; }
.trend-item:hover { color: var(--accent); }

.trend-item__category {
    font-size: 12px;
    color: var(--text-secondary);
}

.trend-item__name {
    font-weight: 600;
    font-size: 14px;
    margin: 2px 0;
}

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.suggestion-item__info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.suggestion-item__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #d1d5db;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr 260px;
    }
}

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    .sidebar-right { display: none; }
    .header__search { display: none; }
}

@media (max-width: 768px) {
    .main-container {
        padding: 0 16px;
    }
    .sidebar-left { display: none; }
}