/* ==================== 
   1. ДИЗАЙН-СИСТЕМА (ЗМІННІ)
   ==================== */
:root {
    --bg-deep: #070404;         
    --bg-card: #120A0A;         
    --bg-hover: #1C0F0F;
    --accent-main: #C81E1E;     
    --accent-dark: #841010;     
    --accent-glow: rgba(200, 30, 30, 0.25);
    --text-main: #F9FAFB;
    --text-muted: #8B8080;      
    --border-color: #261616;    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 9999px;
    --font-main: 'Inter', system-ui, sans-serif;
    --transition: 0.2s ease-in-out;
}

/* ==================== 
   2. БАЗА ТА СІТКА
   ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-main);
    background-color: var(--bg-deep);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Фікс стрибків сайту на ПК (завжди показуємо смугу прокрутки) */
@media (min-width: 1025px) {
    body { overflow-y: scroll; }
}

a { text-decoration: none; color: inherit; }
button, input { font-family: inherit; border: none; background: none; outline: none; }

.app-layout {
    max-width: 1140px; 
    margin: 0 auto;
    display: grid;
    grid-template-columns: 240px 1fr 300px; 
    gap: 28px;
    padding: 24px 16px;
    min-height: 100vh;
}

/* ==================== 
   3. ГЛОБАЛЬНІ КОМПОНЕНТИ (Аватари, Лого, Іконки)
   ==================== */
.ns-emblem {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--accent-main) 0%, var(--accent-dark) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow), inset 0 2px 4px rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.avatar {
    border-radius: 50%;
    object-fit: cover;
    background-color: #16161A;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
    background-position: center; background-repeat: no-repeat; background-size: 50%;
    border: 1px solid var(--border-color); flex-shrink: 0;
}
.avatar-sm { width: 36px; height: 36px; }
.avatar-md { width: 44px; height: 44px; }
.avatar-lg { width: 56px; height: 56px; }

.icon-svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 1.8; fill: none; transition: var(--transition); }

/* ==================== 
   4. ЛІВИЙ САЙДБАР ТА НАВІГАЦІЯ
   ==================== */
.sidebar-sticky { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 24px; height: calc(100vh - 48px); padding-left: 8px; }

.global-search { display: flex; align-items: center; gap: 12px; background: var(--bg-card); padding: 12px 16px; border-radius: var(--radius-pill); border: 1px solid var(--border-color); transition: var(--transition); }
.global-search:focus-within { border-color: var(--accent-main); box-shadow: 0 0 0 2px var(--accent-glow); }
.global-search svg { width: 18px; height: 18px; color: var(--text-muted); }
.global-search input { flex: 1; color: var(--text-main); font-size: 15px; }
.global-search input::placeholder { color: var(--text-muted); }

.main-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: var(--radius-md); font-size: 17px; font-weight: 500; transition: var(--transition); color: var(--text-muted); }
.nav-item:hover { color: var(--text-main); }
.nav-item.active { color: var(--accent-main); font-weight: 700; }
.nav-item.active .icon-svg { stroke: var(--accent-main); stroke-width: 2.5; filter: drop-shadow(0 0 8px var(--accent-glow)); }
.badge-count { margin-left: auto; background: var(--accent-main); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill); }

.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; transition: var(--transition); cursor: pointer; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); }
.sidebar-user:hover { background: var(--bg-hover); }
.user-meta { display: flex; flex-direction: column; }
.user-meta strong { font-size: 15px; color: #fff; }
.user-meta span { font-size: 13px; color: var(--text-muted); }

/* ==================== 
   5. КНОПКИ
   ==================== */
.btn-primary { background: linear-gradient(90deg, var(--accent-main), var(--accent-dark)); color: #fff; font-size: 16px; font-weight: 600; padding: 16px; border-radius: var(--radius-pill); text-align: center; cursor: pointer; transition: var(--transition); border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 4px 15px var(--accent-glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(200, 30, 30, 0.4); }
.btn-follow { background: rgba(200, 30, 30, 0.1); color: var(--accent-main); border: 1px solid var(--accent-main); font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: var(--radius-pill); transition: var(--transition); }
.btn-follow:hover { background: var(--accent-main); color: #fff; }

/* ==================== 
   6. ПРАВА КОЛОНКА (Віджети)
   ==================== */
.widget { background: transparent; border: none; padding: 0; margin-bottom: 24px; }
.widget-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; color: var(--text-main); }
.trend-item { margin-bottom: 20px; display: flex; flex-direction: column; gap: 4px; }
.trend-category, .trend-stats { font-size: 13px; color: var(--text-muted); }
.trend-tag { font-size: 15px; color: var(--text-main); margin-top: 2px; }
.show-more { color: var(--accent-main); font-size: 14px; font-weight: 600; }

.suggest-user { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.suggest-meta { flex: 1; display: flex; flex-direction: column; }
.suggest-meta strong { font-size: 14px; display: flex; align-items: center; gap: 4px; }
.suggest-meta strong span { color: var(--accent-main); font-size: 12px; }
.suggest-meta span { font-size: 13px; color: var(--text-muted); }

.sidebar-footer { font-size: 13px; color: #6B7280; line-height: 1.8; margin-top: 30px; }
.sidebar-footer a { color: var(--text-muted); transition: var(--transition); }
.sidebar-footer a:hover { color: var(--accent-main); }

/* ==================== 
   7. Мобільна версія (Glassmorphism)
   ==================== */
@media (max-width: 1024px) {
    body { -ms-overflow-style: none; scrollbar-width: none; }
    body::-webkit-scrollbar { display: none; }
    .app-layout { grid-template-columns: 1fr; padding: 70px 0 90px 0; gap: 0; }
    .feed-container { padding: 0 16px; }
    .sidebar-pc { display: none !important; }
}

.mobile-header {
    display: none; position: fixed; top: 0; left: 0; right: 0; height: 60px;
    background: rgba(7, 4, 4, 0.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    z-index: 100; border-bottom: 1px solid rgba(255,255,255,0.05); padding: 0 16px; align-items: center; justify-content: space-between;
}

.mobile-tabbar {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; height: 70px;
    background: rgba(18, 10, 10, 0.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    z-index: 100; border-top: 1px solid rgba(255,255,255,0.05); padding-bottom: env(safe-area-inset-bottom); justify-content: space-around; align-items: center;
}

.tab-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); transition: var(--transition); width: 60px; height: 100%; }
.tab-item.active { color: var(--accent-main); }
.tab-item.active .icon-svg { stroke-width: 2.5; filter: drop-shadow(0 0 8px var(--accent-glow)); }

.tab-create-btn {
    width: 48px; height: 48px; background: linear-gradient(135deg, var(--accent-main), var(--accent-dark));
    border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #fff;
    transform: translateY(-12px); box-shadow: 0 4px 15px var(--accent-glow); border: 1px solid rgba(255,255,255,0.2);
}

@media (max-width: 1024px) {
    .mobile-header { display: flex; }
    .mobile-tabbar { display: flex; }
}