/* ===== Общие ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0e17;
  --surface: #1a1928;
  --surface-light: #232136;
  --surface-hover: #2a2840;
  --text: #fffffe;
  --text-muted: #a7a9be;
  --accent: #ff8906;
  --accent2: #e53170;
  --accent3: #7f5af0;
  --accent4: #2cb67d;
  --danger: #ef4565;
  --gradient: linear-gradient(135deg, #7f5af0, #e53170, #ff8906);
  --radius: 14px;
  --radius-sm: 10px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ===== Навбар ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem 1.5rem;
  background: rgba(15, 14, 23, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(127, 90, 240, .12);
  gap: 1rem;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 900;
  white-space: nowrap;
}
.nav-logo .accent { color: var(--accent3); }

.nav-center { flex: 1; max-width: 420px; margin: 0 auto; }

.search-input {
  width: 100%;
  padding: .6rem 1rem;
  border-radius: 50px;
  border: 1px solid rgba(127, 90, 240, .2);
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
  outline: none;
  transition: border-color .25s;
}
.search-input:focus { border-color: var(--accent3); }
.search-input::placeholder { color: var(--text-muted); }

.nav-right {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.nav-icon {
  position: relative;
  font-size: 1.2rem;
  cursor: pointer;
  padding: .3rem;
}

.notif-badge {
  position: absolute;
  top: -2px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.current-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--accent3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
}

/* ===== Основной layout ===== */
.main-layout {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 4.5rem auto 2rem;
  padding: 0 1rem;
}

/* ===== Левая панель ===== */
.sidebar-left {
  position: sticky;
  top: 5rem;
  align-self: start;
}

.profile-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  border: 1px solid rgba(127, 90, 240, .1);
  margin-bottom: 1rem;
}

.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  margin: 0 auto .75rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  border: 3px solid rgba(255,255,255,.15);
}

.profile-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.profile-bio {
  font-size: .82rem;
  color: var(--text-muted);
  margin: .35rem 0 .75rem;
  line-height: 1.4;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat strong {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent3);
}

.stat span {
  font-size: .72rem;
  color: var(--text-muted);
}

.sidebar-nav {
  background: var(--surface);
  border-radius: var(--radius);
  padding: .75rem 0;
  border: 1px solid rgba(127, 90, 240, .1);
}

.sidebar-link {
  display: block;
  padding: .65rem 1.25rem;
  font-size: .9rem;
  color: var(--text-muted);
  transition: background .2s, color .2s;
}

.sidebar-link:hover, .sidebar-link.active {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-link.active {
  border-left: 3px solid var(--accent3);
  color: var(--accent3);
  font-weight: 600;
}

/* ===== Feed ===== */
.feed {
  min-width: 0;
}

/* Создать пост */
.create-post {
  display: flex;
  gap: .75rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(127, 90, 240, .1);
}

.create-post-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
}

.create-post-input-wrap { flex: 1; min-width: 0; }

.create-post-input {
  width: 100%;
  background: var(--surface-light);
  border: 1px solid rgba(127, 90, 240, .15);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  color: var(--text);
  font-size: .92rem;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 44px;
  transition: border-color .2s;
}
.create-post-input:focus { border-color: var(--accent3); }
.create-post-input::placeholder { color: var(--text-muted); }

.create-post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .6rem;
}

.create-post-tools {
  display: flex;
  gap: .5rem;
}

.tool-btn {
  padding: .3rem .6rem;
  border-radius: 6px;
  background: var(--surface-light);
  font-size: .8rem;
  cursor: pointer;
  transition: background .2s;
  user-select: none;
}
.tool-btn:hover { background: var(--surface-hover); }

.post-btn {
  padding: .5rem 1.25rem;
  border-radius: 50px;
  background: var(--gradient);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  border: none;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.post-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(127, 90, 240, .35);
}

/* Пост */
.post-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(127, 90, 240, .1);
  margin-bottom: 1rem;
  overflow: hidden;
  animation: fadeIn .4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.post-header {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1rem 1.25rem .5rem;
}

.post-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
  flex-shrink: 0;
}

.post-user-info { flex: 1; }

.post-user-name {
  font-weight: 700;
  font-size: .92rem;
}

.post-time {
  font-size: .75rem;
  color: var(--text-muted);
}

.post-menu {
  font-size: 1.2rem;
  cursor: pointer;
  opacity: .5;
  transition: opacity .2s;
}
.post-menu:hover { opacity: 1; }

.post-content {
  padding: .25rem 1.25rem .75rem;
  font-size: .92rem;
  line-height: 1.55;
}

.post-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
}

.post-actions {
  display: flex;
  border-top: 1px solid rgba(127, 90, 240, .08);
  padding: .4rem 0;
}

.post-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 0;
  font-size: .85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .2s, color .2s;
  border: none;
  background: none;
  font-family: inherit;
}

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

.post-action-btn.liked {
  color: var(--danger);
}

.post-action-btn .count {
  font-weight: 600;
}

.post-comments-preview {
  padding: .5rem 1.25rem .75rem;
  border-top: 1px solid rgba(127, 90, 240, .08);
}

.show-comments-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .82rem;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: color .2s;
}
.show-comments-btn:hover { color: var(--accent3); }

/* ===== Правая панель ===== */
.sidebar-right {
  position: sticky;
  top: 5rem;
  align-self: start;
}

.sidebar-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(127, 90, 240, .1);
}

.sidebar-heading {
  font-size: .88rem;
  font-weight: 700;
  margin-bottom: .75rem;
  color: var(--text-muted);
}

.online-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .4rem 0;
}

.online-dot {
  width: 8px; height: 8px;
  background: var(--accent4);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(44, 182, 125, .5);
}

.online-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .72rem;
  color: #fff;
  flex-shrink: 0;
}

.online-user-name {
  font-size: .85rem;
  font-weight: 500;
}

.trending-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.tag {
  padding: .3rem .7rem;
  background: var(--surface-light);
  border-radius: 50px;
  font-size: .78rem;
  color: var(--accent3);
  cursor: pointer;
  transition: background .2s;
}
.tag:hover { background: var(--surface-hover); }

.suggested-user {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .4rem 0;
}

.suggested-info { flex: 1; }

.suggested-name {
  font-size: .85rem;
  font-weight: 600;
}

.suggested-bio {
  font-size: .72rem;
  color: var(--text-muted);
}

.follow-btn {
  padding: .3rem .8rem;
  border-radius: 50px;
  border: 1.5px solid var(--accent3);
  background: none;
  color: var(--accent3);
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s;
  font-family: inherit;
  white-space: nowrap;
}
.follow-btn:hover {
  background: var(--accent3);
  color: #fff;
}

/* ===== Модалка комментариев ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(127, 90, 240, .15);
  animation: modalIn .25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(127, 90, 240, .1);
}

.modal-header h3 { font-size: 1rem; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: .2rem .5rem;
  border-radius: 6px;
  transition: background .2s;
}
.modal-close:hover { background: var(--surface-hover); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.comment-item {
  display: flex;
  gap: .6rem;
  margin-bottom: .75rem;
}

.comment-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .7rem;
  color: #fff;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
}

.comment-author {
  font-weight: 600;
  font-size: .82rem;
}

.comment-text {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

.comment-time {
  font-size: .7rem;
  color: var(--text-muted);
  opacity: .6;
  margin-top: .15rem;
}

.modal-footer {
  display: flex;
  gap: .5rem;
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(127, 90, 240, .1);
}

.comment-input {
  flex: 1;
  padding: .6rem 1rem;
  border-radius: 50px;
  border: 1px solid rgba(127, 90, 240, .2);
  background: var(--surface-light);
  color: var(--text);
  font-size: .88rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.comment-input:focus { border-color: var(--accent3); }

.comment-send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-size: 1.1rem;
  border: none;
  cursor: pointer;
  transition: transform .2s;
}
.comment-send-btn:hover { transform: scale(1.08); }

/* ===== Адаптив ===== */
@media (max-width: 1024px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar-left, .sidebar-right { display: none; }
  .main-layout { margin-top: 4rem; }
}
