:root {
  /* Glimapp brand palette (references/color-palette-mockup.png) */
  --agate-green: #00bfa5;
  --electric-violet: #6200ea;
  --deep-slate: #0f172a;
  --light-cloud: #f4f6f8;
  --soft-border: #e2e8f0;
  --muted-sky: #94a3bb;

  --bg: var(--light-cloud);
  --surface: #ffffff;
  --border: var(--soft-border);
  --text: var(--deep-slate);
  --text-muted: var(--muted-sky);
  --primary: var(--electric-violet);
  --primary-dark: #4f00ba;
  --accent: var(--agate-green);
  --like-color: #f0272c;
  --radius: 10px;
  --header-h: 56px;
  --mobile-nav-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 22%;
  display: block;
  object-fit: contain;
}

.brand-name {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--primary);
  display: none;
}

@media (min-width: 480px) {
  .brand-name { display: inline; }
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.search-input {
  width: 100%;
  height: 38px;
  border-radius: 20px;
  border: none;
  background: var(--bg);
  padding: 0 16px;
  font-size: 16px;
  outline: none;
}

.search-input:focus {
  box-shadow: 0 0 0 2px var(--primary);
}

.search-results {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}

.search-results.hidden { display: none; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}

.search-result-item:hover { background: var(--bg); }

.search-result-name { font-weight: 600; font-size: 14px; }
.search-result-handle { font-size: 12px; color: var(--text-muted); }

.search-empty {
  padding: 14px 10px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

.search-empty strong { color: var(--text); }

.topbar-actions {
  margin-left: auto;
  flex-shrink: 0;
}

/* ---------- Avatars ---------- */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}

.avatar-self { width: 34px; height: 34px; background: var(--primary); font-size: 14px; }

/* ---------- Layout ---------- */
.layout {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px 8px calc(var(--mobile-nav-h) + 16px);
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 220px minmax(0, 600px) 260px;
    justify-content: center;
    padding: 20px 16px;
  }
}

.sidebar { display: none; }

@media (min-width: 900px) {
  .sidebar { display: block; }
}

.sidebar-left { position: sticky; top: calc(var(--header-h) + 16px); align-self: start; }
.sidebar-right { position: sticky; top: calc(var(--header-h) + 16px); align-self: start; }

.nav-list { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.nav-item:hover, .nav-item.active { background: var(--surface); }

.sidebar-title { font-size: 15px; color: var(--text-muted); margin: 4px 0 10px; }

.suggestions-list { display: flex; flex-direction: column; gap: 12px; }

.suggestion-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.suggestion-name { font-size: 14px; font-weight: 600; }
.suggestion-handle { font-size: 12px; color: var(--text-muted); }

/* ---------- Feed / Posts ---------- */
.feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.post {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}

.post-author { font-weight: 600; font-size: 15px; }
.post-meta { font-size: 12px; color: var(--text-muted); }

.post-text {
  padding: 0 14px 10px;
  font-size: 15px;
  line-height: 1.4;
}

.post-media { width: 100%; background: #000; max-height: 520px; }
.post-media video { width: 100%; max-height: 520px; display: block; }

.post-stats {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.post-actions {
  display: flex;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 0 8px;
}

.post-action {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.post-action:hover { background: var(--bg); }

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

.like-icon { transition: transform 0.2s ease; display: inline-block; }
.like-icon.pulse { animation: like-pulse 0.35s ease; }

@keyframes like-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.like-count.bump { animation: count-bump 0.3s ease; }

@keyframes count-bump {
  0% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(-4px); opacity: 0.7; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ---------- Comments ---------- */
.comments {
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.comment-bubble {
  background: var(--bg);
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 14px;
}

.comment-author { font-weight: 600; margin-right: 6px; }

.comment-form {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.comment-input {
  flex: 1;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 8px 14px;
  font-size: 16px;
  outline: none;
}

.comment-input:focus { box-shadow: 0 0 0 2px var(--primary); }

.comment-submit {
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 18px;
  padding: 0 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.comment-submit:hover { background: var(--primary-dark); }

/* ---------- Mobile bottom nav ---------- */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
}

@media (min-width: 900px) {
  .mobile-nav { display: none; }
}

.mobile-nav a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.mobile-nav a.active { color: var(--primary); }
