/* ================================================================
   mySNS — Design System & Global Styles
   ================================================================ */

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --brand-primary: #667eea;
  --brand-secondary: #764ba2;
  --brand-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  /* Neutrals */
  --bg-base: #0f0e17;
  --bg-surface: #1a1929;
  --bg-card: #201e33;
  --bg-card-hover: #252340;
  --bg-input: #2a2845;
  --bg-overlay: rgba(15, 14, 23, 0.85);

  /* Text */
  --text-primary: #efefef;
  --text-secondary: #9b9bb4;
  --text-muted: #6b6b88;
  --text-inverse: #0f0e17;

  /* Borders */
  --border: rgba(255,255,255,0.07);
  --border-focus: rgba(102,126,234,0.5);

  /* Semantic Colors */
  --color-success: #4ade80;
  --color-warning: #fbbf24;
  --color-error: #f87171;
  --color-info: #60a5fa;

  /* Reactions */
  --reaction-like: #f87171;
  --reaction-love: #ec4899;
  --reaction-haha: #fbbf24;
  --reaction-wow: #fb923c;
  --reaction-sad: #60a5fa;
  --reaction-angry: #ef4444;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-brand: 0 4px 20px rgba(102,126,234,0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Nav height */
  --nav-height: 60px;
  --sidebar-width: 260px;
}

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans KR', 'Outfit', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Utilities ──────────────────────────────────────────────────── */
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--brand-gradient);
  color: white;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 24px rgba(102,126,234,0.5); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--brand-primary); color: var(--brand-primary); background: rgba(102,126,234,0.08); }

.btn-ghost {
  background: var(--bg-input);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 8px 16px;
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--color-error);
  color: white;
}
.btn-danger:hover { opacity: 0.85; }

.btn-demo {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}
.btn-demo:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-full { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-xs { padding: 4px 10px; font-size: 0.75rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-full); width: 36px; height: 36px; }

.btn-spinner { animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Form Elements ─────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-md); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
.form-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
.form-input::placeholder { color: var(--text-muted); }

.input-wrapper {
  position: relative;
}
.input-wrapper .form-input { padding-left: 40px; }
.input-wrapper .input-toggle { padding-right: 40px; }
.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  pointer-events: none;
}
.input-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.6;
  font-size: 0.85rem;
  padding: 4px;
}
.input-toggle:hover { opacity: 1; }

.form-error {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  color: var(--color-error);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: var(--space-md);
}
.form-success {
  background: rgba(74,222,128,0.1);
  border: 1px solid rgba(74,222,128,0.3);
  color: var(--color-success);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: var(--space-md);
}

/* ── Auth Screen ─────────────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: var(--space-md);
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(102,126,234,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(118,75,162,0.15) 0%, transparent 60%),
              var(--bg-base);
}

.auth-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 8s ease-in-out infinite;
}
.orb1 { width: 500px; height: 500px; background: rgba(102,126,234,0.12); top: -100px; left: -100px; }
.orb2 { width: 400px; height: 400px; background: rgba(118,75,162,0.12); bottom: -80px; right: -80px; animation-delay: -3s; }
.orb3 { width: 300px; height: 300px; background: rgba(240,147,251,0.08); top: 50%; left: 50%; animation-delay: -6s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}

.auth-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  max-width: 1000px;
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-brand {
  background: var(--brand-gradient);
  padding: var(--space-2xl);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-lg);
}

.brand-logo {
  animation: logoFloat 4s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.02em;
}

.brand-tagline {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.7;
}

.brand-features { display: flex; flex-direction: column; gap: var(--space-sm); }
.brand-feature {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: rgba(255,255,255,0.9);
  font-size: 0.9rem;
}
.feature-icon { font-size: 1.1rem; }

/* Auth Form */
.auth-form-container {
  padding: var(--space-2xl);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  max-height: 100vh;
}

.auth-form { display: none; flex-direction: column; gap: 0; }
.auth-form-active { display: flex; }

.auth-form-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}
.auth-form-sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: var(--space-lg); }

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.link-btn {
  color: var(--brand-primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { opacity: 0.8; }

.auth-divider {
  text-align: center;
  margin: var(--space-md) 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  position: relative;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 30px);
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.auth-switch {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--space-md);
}

.back-btn {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: var(--space-md);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.back-btn:hover { color: var(--text-primary); }

/* ── Navbar ──────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(26,25,41,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  z-index: 1000;
  gap: var(--space-md);
}

.nav-left { display: flex; align-items: center; gap: var(--space-md); flex: 1; min-width: 0; }
.nav-center { display: flex; align-items: center; gap: 4px; }
.nav-right { display: flex; align-items: center; gap: var(--space-sm); flex: 1; justify-content: flex-end; }

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-search {
  position: relative;
  flex: 1;
  max-width: 280px;
}
.nav-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.5;
  pointer-events: none;
}
.nav-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 14px 8px 36px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast);
}
.nav-search-input:focus { border-color: var(--brand-primary); }
.nav-search-input::placeholder { color: var(--text-muted); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 1100;
  max-height: 360px;
  overflow-y: auto;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-item .avatar { width: 36px; height: 36px; }

.nav-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 48px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  position: relative;
  transition: all var(--transition-fast);
}
.nav-tab:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-tab-active { color: var(--brand-primary); }
.nav-tab-active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--brand-gradient);
  border-radius: var(--radius-full);
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: 10px;
  background: var(--color-error);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-surface);
}

.nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-secondary);
  position: relative;
  transition: all var(--transition-fast);
}
.nav-icon-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.nav-avatar-menu { position: relative; }
.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient);
  border: 2px solid transparent;
  transition: border-color var(--transition-fast);
}
.nav-avatar:hover { border-color: var(--brand-primary); }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback {
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 1100;
  overflow: hidden;
  animation: dropIn 0.2s ease;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.user-menu-profile {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
}
.user-menu-profile img { width: 44px; height: 44px; border-radius: var(--radius-full); object-fit: cover; }
.user-menu-name { font-weight: 600; font-size: 0.9rem; }
.user-menu-email { font-size: 0.75rem; color: var(--text-muted); }

.menu-divider { border-color: var(--border); margin: 4px 0; }
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 10px var(--space-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: left;
  transition: all var(--transition-fast);
}
.menu-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.menu-item-danger:hover { background: rgba(248,113,113,0.1); color: var(--color-error); }

/* ── Notification Panel ──────────────────────────────────────────── */
.notification-panel {
  position: fixed;
  top: var(--nav-height);
  right: var(--space-md);
  width: 360px;
  max-height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: dropIn 0.2s ease;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-header h3 { font-size: 1rem; font-weight: 700; }

.notification-list { overflow-y: auto; flex: 1; }
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border);
}
.notification-item:hover { background: var(--bg-card-hover); }
.notification-item.unread { background: rgba(102,126,234,0.05); }
.notification-item .avatar { width: 42px; height: 42px; flex-shrink: 0; }
.notif-content { flex: 1; }
.notif-text { font-size: 0.85rem; line-height: 1.4; }
.notif-text strong { color: var(--text-primary); }
.notif-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand-primary);
  flex-shrink: 0;
  margin-top: 6px;
}

.panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 990;
}

/* ── Main Content Layout ─────────────────────────────────────────── */
.app { min-height: 100vh; }
.main-content {
  padding-top: var(--nav-height);
  min-height: 100vh;
}

/* Three Column Layout */
.layout-three-col {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr 260px;
  gap: var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md);
  align-items: start;
}
.layout-two-col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-md);
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-md);
  align-items: start;
}
.layout-full {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-md);
}
.layout-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-md);
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-md));
}
.sidebar-section {
  margin-bottom: var(--space-md);
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  text-align: left;
}
.sidebar-nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.sidebar-nav-item.active { background: var(--bg-card); color: var(--brand-primary); font-weight: 600; }
.sidebar-nav-item .icon { font-size: 1.1rem; width: 24px; text-align: center; }

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 12px 4px;
}

/* ── Card ─────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}
.card:hover { border-color: rgba(255,255,255,0.12); }
.card-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 700; }
.card-body { padding: var(--space-md); }
.card-footer { padding: var(--space-md); border-top: 1px solid var(--border); }

/* ── Avatar ───────────────────────────────────────────────────────── */
.avatar {
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  background: var(--brand-gradient);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-md { width: 42px; height: 42px; font-size: 0.9rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.5rem; }
.avatar-2xl { width: 120px; height: 120px; font-size: 2rem; }
.avatar-online { position: relative; }
.avatar-online::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-success);
  border: 2px solid var(--bg-card);
}

/* ── Story Bar ────────────────────────────────────────────────────── */
.story-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  overflow: hidden;
}
.story-bar-inner {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.story-bar-inner::-webkit-scrollbar { display: none; }

.story-item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.story-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 2px;
  background: var(--brand-gradient);
  position: relative;
}
.story-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--bg-card);
}
.story-ring-inner img { width: 100%; height: 100%; object-fit: cover; }
.story-ring-inner.fallback { background: var(--bg-input); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.story-ring.add-story { background: var(--bg-input); }
.story-ring.add-story .story-ring-inner { background: var(--bg-card-hover); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.story-ring.viewed { background: var(--border); }
.story-add-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  border: 2px solid var(--bg-card);
}
.story-name { font-size: 0.7rem; color: var(--text-secondary); text-align: center; max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Story Composer */
.story-mode-tabs { display: flex; gap: 8px; margin-bottom: var(--space-md); }
.story-mode-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.story-mode-tab.active { background: var(--brand-gradient); color: white; }
.story-text-preview {
  width: 100%;
  aspect-ratio: 9 / 14;
  max-height: 420px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  text-align: center;
  color: white;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.5;
  word-break: break-word;
  margin-bottom: var(--space-md);
  transition: background var(--transition-fast);
}
.story-color-picker { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: var(--space-md); }
.story-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
}
.story-color-swatch.active { border-color: white; box-shadow: 0 0 0 2px var(--brand-primary); }
.story-image-preview {
  width: 100%;
  max-height: 420px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-md);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-image-preview img { width: 100%; max-height: 420px; object-fit: contain; }
.story-upload-placeholder {
  width: 100%;
  padding: var(--space-2xl) var(--space-lg);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: var(--space-md);
}
.story-upload-placeholder:hover { border-color: var(--brand-primary); color: var(--brand-primary); }

/* Story Viewer (full screen) */
.story-viewer-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.story-viewer-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 100%;
  max-height: 100vh;
  background: #15131f;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.story-progress-row {
  display: flex;
  gap: 4px;
  padding: 10px 10px 0;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
}
.story-progress-track { flex: 1; height: 3px; background: rgba(255,255,255,0.3); border-radius: var(--radius-full); overflow: hidden; }
.story-progress-fill { height: 100%; width: 0%; background: white; }
.story-progress-track.done .story-progress-fill { width: 100%; transition: none; }
.story-progress-track.active .story-progress-fill { transition: width linear; }

.story-viewer-header {
  position: absolute;
  top: 22px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}
.story-viewer-header .avatar { border: 2px solid white; cursor: pointer; }
.story-viewer-name { color: white; font-weight: 700; font-size: 0.9rem; cursor: pointer; }
.story-viewer-time { color: rgba(255,255,255,0.7); font-size: 0.75rem; }
.story-viewer-header-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.story-viewer-icon-btn {
  color: white;
  font-size: 1.1rem;
  background: rgba(0,0,0,0.25);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-viewer-body { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.story-viewer-body img { width: 100%; height: 100%; object-fit: contain; }
.story-viewer-text-bg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  color: white;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.5;
  word-break: break-word;
}
.story-nav-zone { position: absolute; top: 0; bottom: 0; width: 33%; z-index: 4; }
.story-nav-zone.left { left: 0; }
.story-nav-zone.right { right: 0; }
.story-viewer-seen-list {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-md);
  z-index: 5;
  color: rgba(255,255,255,0.85);
  font-size: 0.78rem;
  text-align: center;
}

/* ── Post Composer ────────────────────────────────────────────────── */
.post-composer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}
.composer-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.composer-input-btn {
  flex: 1;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}
.composer-input-btn:hover { background: var(--bg-card-hover); border-color: rgba(255,255,255,0.15); color: var(--text-secondary); }
.composer-actions {
  display: flex;
  gap: 4px;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  margin-top: var(--space-sm);
}
.composer-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  flex: 1;
  justify-content: center;
}
.composer-action-btn:hover { background: var(--bg-input); color: var(--text-primary); }

/* Post Composer Modal */
.composer-modal {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: var(--space-md);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.composer-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.composer-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}
.composer-modal-header h3 { font-size: 1rem; font-weight: 700; flex: 1; text-align: center; }

.composer-modal-body { padding: var(--space-md); }

.composer-user-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.composer-user-info { display: flex; flex-direction: column; }
.composer-user-name { font-size: 0.9rem; font-weight: 600; }
.visibility-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  cursor: pointer;
}

.composer-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-primary);
  font-size: 1rem;
  min-height: 100px;
  line-height: 1.6;
}
.composer-textarea::placeholder { color: var(--text-muted); }

.composer-media-preview {
  display: grid;
  gap: 4px;
  margin-top: var(--space-sm);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.composer-media-preview.grid-1 { grid-template-columns: 1fr; }
.composer-media-preview.grid-2 { grid-template-columns: 1fr 1fr; }
.composer-media-preview.grid-3 { grid-template-columns: 1fr 1fr; }
.composer-media-preview.grid-3 .preview-item:first-child { grid-row: span 2; }
.composer-media-preview.grid-4 { grid-template-columns: 1fr 1fr; }

.preview-item {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 1;
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-remove:hover { background: rgba(248,113,113,0.8); }

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}
.toolbar-actions { display: flex; gap: 4px; }
.toolbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.toolbar-btn:hover { background: var(--bg-input); color: var(--text-primary); }

.toolbar-btn-wrap { position: relative; }
.composer-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-sm);
  z-index: 50;
  animation: dropIn 0.15s ease;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  width: 272px;
  max-height: 180px;
  overflow-y: auto;
}
.emoji-picker-grid span {
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.emoji-picker-grid span:hover { background: var(--bg-input); }

.friend-tag-picker { width: 220px; max-height: 220px; overflow-y: auto; }
.friend-tag-picker-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
}
.friend-tag-picker-item:hover { background: var(--bg-input); }
.friend-tag-picker-item.selected { background: rgba(102,126,234,0.15); color: var(--brand-primary); font-weight: 600; }
.friend-tag-picker-check { margin-left: auto; color: var(--brand-primary); }
.friend-tag-picker-empty { padding: var(--space-md); text-align: center; color: var(--text-muted); font-size: 0.8rem; width: 200px; }

.composer-tagged-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-sm); }
.composer-tagged-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  padding: 3px 10px 3px 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.composer-tagged-chip .avatar { width: 20px; height: 20px; }
.composer-tagged-chip .remove-x { cursor: pointer; color: var(--text-muted); }
.composer-tagged-chip .remove-x:hover { color: var(--color-error); }

.post-tagged-note { font-size: 0.78rem; color: var(--text-secondary); }
.post-tagged-note b { color: var(--text-primary); font-weight: 600; }

/* ── Post Card ────────────────────────────────────────────────────── */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  overflow: hidden;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
  animation: postAppear 0.3s ease both;
}
@keyframes postAppear { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.post-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md) 0;
}
.post-author {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.post-author-info { display: flex; flex-direction: column; }
.post-author-name { font-size: 0.9rem; font-weight: 700; cursor: pointer; }
.post-author-name:hover { color: var(--brand-primary); }
.post-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

.post-options-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  position: relative;
}
.post-options-btn:hover { background: var(--bg-input); color: var(--text-primary); }

.post-options-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 180px;
  z-index: 100;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: dropIn 0.15s ease;
}
.options-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.options-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.options-item.danger:hover { color: var(--color-error); }

.post-content {
  padding: var(--space-sm) var(--space-md) var(--space-md);
}
.post-text {
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.post-text.large { font-size: 1.4rem; line-height: 1.5; }
.post-hashtag { color: var(--brand-primary); cursor: pointer; }
.post-hashtag:hover { text-decoration: underline; }
.post-mention { color: var(--brand-primary); cursor: pointer; font-weight: 600; }

/* Post Media */
.post-media {
  display: grid;
  gap: 2px;
  overflow: hidden;
  cursor: pointer;
}
.post-media.media-1 { grid-template-columns: 1fr; }
.post-media.media-2 { grid-template-columns: 1fr 1fr; }
.post-media.media-3 { grid-template-columns: 1fr 1fr; }
.post-media.media-3 .media-item:first-child { grid-row: span 2; }
.post-media.media-4 { grid-template-columns: 1fr 1fr; }
.post-media.media-more .media-item:last-child { position: relative; }
.media-more-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
}

.media-item { overflow: hidden; aspect-ratio: 1; }
.media-item img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-base); }
.media-item:hover img { transform: scale(1.03); }

/* Post Reactions Row */
.post-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px var(--space-md);
  border-top: 1px solid var(--border);
}
.post-stats-left { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--text-muted); }
.reaction-icons { display: flex; }
.reaction-icons span { font-size: 0.9rem; margin-right: -4px; }
.post-stats-right { font-size: 0.8rem; color: var(--text-muted); cursor: pointer; }
.post-stats-right:hover { text-decoration: underline; }

/* Post Actions */
.post-actions {
  display: flex;
  padding: 4px var(--space-sm);
}
.post-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.post-action-btn:hover { background: var(--bg-input); color: var(--text-primary); }
.post-action-btn.liked { color: var(--reaction-like); }
.post-action-btn .icon { font-size: 1rem; }

/* Reaction Picker */
.reaction-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  animation: popIn 0.2s ease;
  white-space: nowrap;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.8) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.reaction-btn {
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.15s ease;
  border-radius: 50%;
  padding: 2px;
}
.reaction-btn:hover { transform: scale(1.4) translateY(-4px); }

/* Comments */
.post-comments {
  padding: 0 var(--space-md) var(--space-md);
  border-top: 1px solid var(--border);
}
.comment-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}
.comment-input {
  flex: 1;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast);
}
.comment-input:focus { border-color: var(--brand-primary); }
.comment-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.comment-send-btn:hover { transform: scale(1.1); opacity: 0.9; }
.comment-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: 8px 0;
  animation: postAppear 0.2s ease both;
}
.comment-bubble {
  background: var(--bg-input);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  padding: 8px 12px;
  flex: 1;
}
.comment-author { font-size: 0.8rem; font-weight: 700; color: var(--text-primary); cursor: pointer; }
.comment-author:hover { color: var(--brand-primary); }
.comment-text { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; margin-top: 2px; word-break: break-word; }
.comment-actions-row { display: flex; gap: var(--space-sm); margin-top: 4px; }
.comment-action { font-size: 0.75rem; color: var(--text-muted); cursor: pointer; font-weight: 600; }
.comment-action:hover { color: var(--brand-primary); }
.comment-action.liked { color: var(--reaction-like); }

.replies-section { margin-left: 50px; margin-top: 4px; }
.load-more-btn {
  display: block;
  text-align: center;
  padding: 8px;
  font-size: 0.8rem;
  color: var(--brand-primary);
  cursor: pointer;
  font-weight: 600;
}
.load-more-btn:hover { text-decoration: underline; }

/* ── Profile Page ────────────────────────────────────────────────── */
.profile-cover {
  height: 280px;
  background: var(--brand-gradient);
  position: relative;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-cover-change {
  position: absolute;
  bottom: var(--space-md);
  right: var(--space-md);
  background: rgba(0,0,0,0.6);
  color: white;
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.profile-cover-change:hover { background: rgba(0,0,0,0.8); }

.profile-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 var(--space-lg) var(--space-lg);
  position: relative;
  margin-bottom: var(--space-md);
}
.profile-avatar-wrap {
  position: absolute;
  top: -60px;
  left: var(--space-lg);
}
.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--bg-card);
  object-fit: cover;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
  font-weight: 700;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-info-top {
  padding-top: 70px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}
.profile-name { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.profile-username { color: var(--text-muted); font-size: 0.9rem; }
.profile-bio { color: var(--text-secondary); font-size: 0.9rem; margin-top: var(--space-sm); }

.profile-stats {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-sm);
}
.profile-stat { display: flex; flex-direction: column; align-items: center; }
.stat-num { font-size: 1.1rem; font-weight: 700; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); }

.profile-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-top: var(--space-md);
  overflow-x: auto;
}
.profile-tab {
  padding: 10px var(--space-md);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.profile-tab:hover { color: var(--text-primary); }
.profile-tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

.profile-info-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.profile-info-item { display: flex; align-items: center; gap: var(--space-sm); font-size: 0.875rem; color: var(--text-secondary); }
.profile-info-item .icon { font-size: 1rem; opacity: 0.7; }

/* ── Friends Page ────────────────────────────────────────────────── */
.friends-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}
.friends-tab {
  padding: 8px var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.friends-tab:hover { background: var(--bg-card); color: var(--text-primary); }
.friends-tab.active { background: var(--bg-card); color: var(--brand-primary); }

.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-md);
}
.friend-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: center;
  transition: all var(--transition-fast);
}
.friend-card:hover { border-color: rgba(255,255,255,0.15); transform: translateY(-2px); }

.friend-card-cover {
  height: 80px;
  background: var(--brand-gradient);
  position: relative;
}
.friend-card-avatar {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--bg-card);
  object-fit: cover;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  overflow: hidden;
}
.friend-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.friend-card-body { padding: 36px var(--space-sm) var(--space-sm); }
.friend-card-name { font-size: 0.875rem; font-weight: 700; margin-bottom: 4px; }
.friend-card-mutual { font-size: 0.75rem; color: var(--text-muted); margin-bottom: var(--space-sm); }
.friend-card-actions { display: flex; flex-direction: column; gap: 6px; }

/* Friend request cards */
.request-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  transition: border-color var(--transition-fast);
  margin-bottom: var(--space-sm);
}
.request-card:hover { border-color: rgba(255,255,255,0.15); }
.request-info { flex: 1 }
.request-name { font-weight: 700; font-size: 0.9rem; cursor: pointer; }
.request-name:hover { color: var(--brand-primary); }
.request-mutual { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.request-actions { display: flex; gap: var(--space-sm); }

/* ── Messages Page ────────────────────────────────────────────────── */
.messages-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - var(--nav-height));
  gap: 0;
  max-width: 1000px;
  margin: 0 auto;
}

.chat-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-list-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-list-header h3 { font-size: 1rem; font-weight: 700; }
.chat-search {
  margin: var(--space-sm) var(--space-md);
}
.chat-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 7px 14px;
  color: var(--text-primary);
  font-size: 0.8rem;
  outline: none;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}
.chat-item:hover { background: var(--bg-card-hover); }
.chat-item.active { background: rgba(102,126,234,0.1); }
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-name { font-size: 0.875rem; font-weight: 600; }
.chat-item-preview { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.chat-item-time { font-size: 0.7rem; color: var(--text-muted); }
.chat-unread {
  background: var(--brand-primary);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Chat Window */
.chat-window {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-window-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-window-name { font-weight: 700; font-size: 0.95rem; }
.chat-window-status { font-size: 0.75rem; color: var(--color-success); }
.chat-window-actions { margin-left: auto; display: flex; gap: 4px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.chat-date-divider {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: var(--space-sm) 0;
  position: relative;
}
.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 60px);
  height: 1px;
  background: var(--border);
}
.chat-date-divider::before { left: 0; }
.chat-date-divider::after { right: 0; }

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  animation: postAppear 0.2s ease both;
}
.message-row.mine { flex-direction: row-reverse; }
.message-row.mine .message-avatar { display: none; }

.message-bubble {
  max-width: 68%;
  padding: 9px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}
.message-row.mine .message-bubble {
  background: var(--brand-gradient);
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}
.message-row:not(.mine) .message-bubble {
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
}

.message-bubble img { max-width: 200px; border-radius: var(--radius-sm); cursor: pointer; }
.message-time { font-size: 0.68rem; color: var(--text-muted); flex-shrink: 0; margin-bottom: 4px; }
.message-row.mine .message-time { text-align: right; }

.chat-input-area {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 9px 16px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast);
  resize: none;
  max-height: 100px;
  overflow-y: auto;
}
.chat-input:focus { border-color: var(--brand-primary); }
.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}
.chat-send-btn:hover { transform: scale(1.1); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: var(--space-sm);
}
.chat-empty .empty-icon { font-size: 3rem; opacity: 0.4; }

/* ── Groups Page ─────────────────────────────────────────────────── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md);
}
.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.group-card:hover { border-color: rgba(255,255,255,0.15); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.group-card-cover {
  height: 100px;
  background: var(--brand-gradient);
  position: relative;
}
.group-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.group-card-body { padding: var(--space-md); }
.group-card-name { font-size: 0.95rem; font-weight: 700; margin-bottom: 4px; }
.group-card-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: var(--space-sm); }
.group-privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

/* Group Detail */
.group-detail-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-md);
}
.group-detail-cover {
  height: 200px;
  background: var(--brand-gradient);
  position: relative;
}
.group-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.group-detail-info { padding: var(--space-lg); }
.group-detail-name { font-size: 1.5rem; font-weight: 800; margin-bottom: var(--space-sm); }

/* ── Search Page ─────────────────────────────────────────────────── */
.search-page-input-wrap {
  position: relative;
  margin-bottom: var(--space-lg);
}
.search-page-input {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 14px 20px 14px 50px;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition-fast);
}
.search-page-input:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(102,126,234,0.15); }
.search-page-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  opacity: 0.5;
  pointer-events: none;
}
.search-filter-tabs { display: flex; gap: var(--space-sm); margin-bottom: var(--space-lg); flex-wrap: wrap; }
.search-filter-tab {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1.5px solid var(--border);
  transition: all var(--transition-fast);
}
.search-filter-tab:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.search-filter-tab.active { background: var(--brand-gradient); color: white; border-color: transparent; }

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}
.search-user-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  text-align: center;
  transition: all var(--transition-fast);
}
.search-user-card:hover { border-color: rgba(255,255,255,0.15); transform: translateY(-2px); }
.search-user-card .avatar { margin: 0 auto var(--space-sm); }
.search-user-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.search-user-mutual { font-size: 0.75rem; color: var(--text-muted); margin-bottom: var(--space-sm); }

/* ── Settings Page ───────────────────────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-lg);
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-md);
}
.settings-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  position: sticky;
  top: calc(var(--nav-height) + var(--space-md));
  height: fit-content;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.settings-nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.settings-nav-item.active { background: rgba(102,126,234,0.1); color: var(--brand-primary); }

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  overflow: hidden;
}
.settings-section-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}
.settings-section-title { font-size: 1rem; font-weight: 700; }
.settings-section-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.settings-section-body { padding: var(--space-md); }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 0.9rem; font-weight: 500; }
.settings-row-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
}
.toggle-switch input:checked + .toggle-slider { background: var(--brand-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Empty States ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: var(--space-md); opacity: 0.5; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-sm); }
.empty-state p { font-size: 0.85rem; }

/* ── Loading Skeleton ─────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-card-hover) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skeleton-post {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}
.skeleton-row { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-md); }
.skeleton-circle { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; }
.skeleton-line { height: 12px; border-radius: var(--radius-sm); }
.skeleton-block { height: 200px; border-radius: var(--radius-md); }

/* ── Toast ────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  min-width: 240px;
  max-width: 360px;
  animation: slideInRight 0.3s ease;
}
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-error); }
.toast.info { border-left: 3px solid var(--color-info); }
.toast.warning { border-left: 3px solid var(--color-warning); }
.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-text { flex: 1; }
.toast-close { opacity: 0.5; cursor: pointer; font-size: 0.8rem; flex-shrink: 0; }
.toast-close:hover { opacity: 1; }
.toast.removing { animation: slideOutRight 0.3s ease forwards; }
@keyframes slideOutRight { to { opacity: 0; transform: translateX(40px); } }

/* ── Modals ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: var(--space-md);
  backdrop-filter: blur(4px);
}
.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal-close:hover { background: rgba(0,0,0,0.7); }

.image-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  animation: slideUp 0.2s ease;
}
.image-modal-content img { max-height: 90vh; border-radius: var(--radius-lg); object-fit: contain; }

.post-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.2s ease;
}

.confirm-dialog-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 400px;
  width: 100%;
  text-align: center;
  animation: slideUp 0.2s ease;
}
.confirm-dialog-content h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: var(--space-sm); }
.confirm-dialog-content p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: var(--space-lg); }
.confirm-actions { display: flex; gap: var(--space-sm); justify-content: center; }

/* ── Right Sidebar Widgets ────────────────────────────────────────── */
.widget-suggestion-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 0;
}
.widget-suggestion-info { flex: 1; min-width: 0; }
.widget-suggestion-name { font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.widget-suggestion-name:hover { color: var(--brand-primary); }
.widget-suggestion-sub { font-size: 0.75rem; color: var(--text-muted); }

.online-friends-list { display: flex; flex-direction: column; }
.online-friend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 0;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  transition: background var(--transition-fast);
}
.online-friend-item:hover { background: var(--bg-card-hover); }
.online-friend-name { font-size: 0.85rem; font-weight: 500; }

/* ── Page/Section Titles ─────────────────────────────────────────── */
.page-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: var(--space-md);
}
.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

/* ── Media Query — Tablet & Mobile ──────────────────────────────── */
@media (max-width: 1100px) {
  .layout-three-col {
    grid-template-columns: 1fr;
  }
  .sidebar { display: none; }
}

@media (max-width: 768px) {
  :root { --nav-height: 56px; }

  .auth-container { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-container { padding: var(--space-lg); }

  .nav-logo-text { display: none; }
  .nav-search { max-width: 160px; }
  .nav-tab { width: 48px; }

  .layout-two-col { grid-template-columns: 1fr; }
  .layout-two-col > *:last-child { display: none; }

  .messages-layout { grid-template-columns: 1fr; }
  .chat-list { border-radius: var(--radius-lg); border-right: 1px solid var(--border); display: none; }
  .chat-list.mobile-active { display: flex; position: fixed; inset: var(--nav-height) 0 0; z-index: 100; }
  .chat-window { border-radius: var(--radius-lg); }

  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; }

  .notification-panel { width: calc(100vw - 32px); right: 16px; }

  .friends-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
  .groups-grid { grid-template-columns: 1fr 1fr; }

  .toast-container { left: var(--space-md); right: var(--space-md); }
  .toast { min-width: unset; max-width: 100%; }
}

@media (max-width: 480px) {
  .groups-grid { grid-template-columns: 1fr; }
  .friends-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .nav-search { display: none; }
}

/* ── Utility Animations ──────────────────────────────────────────── */
.fade-in { animation: fadeIn 0.3s ease; }
.slide-up { animation: slideUp 0.3s ease; }

/* ── Scrollable feed ─────────────────────────────────────────────── */
.feed-column { min-width: 0; }

/* ── Hashtag chips ───────────────────────────────────────────────── */
.hashtag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(102,126,234,0.1);
  border: 1px solid rgba(102,126,234,0.2);
  color: var(--brand-primary);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.hashtag-chip:hover { background: rgba(102,126,234,0.2); }

/* ── Like count animation ────────────────────────────────────────── */
@keyframes likeHeart {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.heart-animate { animation: likeHeart 0.4s ease; }
