/* ==========================================================================
   Cherry — Design tokens
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root{
  --ink:        #111111;
  --blue:       #000000;
  --blue-dark:  #000000;
  --blue-light: #4D4D4D;
  --tint-1:     #F0F0F0;
  --tint-2:     #FAFAFA;
  --white:      #FFFFFF;
  --slate:      #595959;
  --slate-light:#8C8C8C;
  --border:     #E0E0E0;
  --success:    #1A1A1A;
  --success-tint:#F0F0F0;
  --danger:     #000000;
  --danger-tint:#F0F0F0;
  --warn:       #333333;
  --warn-tint:  #F0F0F0;

  --radius-lg: 16px;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow:    0 8px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.14);

  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body:    'Inter', 'Segoe UI', sans-serif;

  --sidebar-w: 248px;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font-body);
  color:var(--ink);
  background:var(--tint-2);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{ font-family:var(--font-display); margin:0; letter-spacing:-0.01em; }
p{ margin:0; }
a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; }
img{ max-width:100%; display:block; }
:focus-visible{ outline:2px solid var(--blue); outline-offset:2px; }

/* ==========================================================================
   Logo
   ========================================================================== */
.logo{ display:flex; align-items:center; gap:10px; }
.logo svg{ width:30px; height:30px; flex-shrink:0; }
.logo-word{ font-family:var(--font-display); font-weight:700; font-size:20px; letter-spacing:-0.02em; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-family:var(--font-body); font-weight:600; font-size:14px;
  padding:10px 18px; border-radius:999px; border:1px solid transparent;
  cursor:pointer; transition:transform .12s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
  white-space:nowrap;
}
.btn:active{ transform:scale(0.97); }
.btn-primary{ background:var(--blue); color:var(--white); box-shadow:0 6px 16px rgba(0,0,0,0.22); }
.btn-primary:hover{ background:var(--blue-dark); }
.btn-secondary{ background:var(--white); color:var(--blue); border-color:var(--border); }
.btn-secondary:hover{ border-color:var(--blue); }
.btn-ghost{ background:transparent; color:var(--slate); }
.btn-ghost:hover{ background:var(--tint-1); color:var(--ink); }
.btn-danger{ background:var(--white); color:var(--danger); border-color:var(--border); }
.btn-danger:hover{ background:var(--danger-tint); }
.btn-danger-solid{ background:var(--danger); color:var(--white); }
.btn-danger-solid:hover{ background:#333333; }
.btn-sm{ padding:7px 14px; font-size:13px; }
.btn-block{ width:100%; }
.btn:disabled{ opacity:.55; cursor:not-allowed; }
.btn-icon{ width:38px; height:38px; padding:0; border-radius:50%; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field{ margin-bottom:16px; }
.field label{ display:block; font-size:13px; font-weight:600; color:var(--slate); margin-bottom:6px; }
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=search],
.field textarea,
.field select{
  width:100%; padding:12px 14px; border-radius:var(--radius-sm);
  border:1.5px solid var(--border); background:var(--white);
  font-size:14px; color:var(--ink); font-family:var(--font-body);
  transition:border-color .15s ease, box-shadow .15s ease;
}
.field textarea{ resize:vertical; min-height:90px; }
.field input:focus, .field textarea:focus, .field select:focus{
  border-color:var(--blue); box-shadow:0 0 0 4px rgba(0,0,0,0.12); outline:none;
}
.field-hint{ font-size:12px; color:var(--slate-light); margin-top:5px; }
.field-error{ font-size:12px; color:var(--danger); margin-top:5px; display:none; }
.field.has-error input, .field.has-error textarea{ border-color:var(--danger); }
.field.has-error .field-error{ display:block; }

.file-drop{
  border:1.5px dashed var(--border); border-radius:var(--radius); padding:18px;
  text-align:center; cursor:pointer; background:var(--tint-2); transition:border-color .15s ease, background .15s ease;
}
.file-drop:hover{ border-color:var(--blue); background:var(--tint-1); }
.file-drop input{ display:none; }
.file-drop-text{ font-size:13px; color:var(--slate); }

/* ==========================================================================
   Auth screens
   ========================================================================== */
.auth-shell{ min-height:100vh; display:grid; grid-template-columns:1fr 1fr; }
.auth-brand{
  background:linear-gradient(160deg, var(--blue) 0%, var(--blue-dark) 100%);
  color:var(--white); display:flex; flex-direction:column; justify-content:space-between;
  padding:48px; position:relative; overflow:hidden;
}
.auth-brand::before{
  content:""; position:absolute; width:520px; height:520px; border-radius:50%;
  background:rgba(255,255,255,0.06); right:-180px; bottom:-200px;
}
.auth-brand::after{
  content:""; position:absolute; width:280px; height:280px; border-radius:50%;
  background:rgba(255,255,255,0.05); left:-100px; top:-80px;
}
.auth-brand .logo-word{ color:var(--white); font-size:22px; }
.auth-brand-copy{ position:relative; z-index:1; max-width:380px; }
.auth-brand-copy h1{ font-size:34px; line-height:1.15; margin-bottom:14px; }
.auth-brand-copy p{ font-size:15px; opacity:.85; line-height:1.6; }
.auth-brand-foot{ position:relative; z-index:1; font-size:13px; opacity:.7; }
.auth-form-wrap{ display:flex; align-items:center; justify-content:center; padding:40px; }
.auth-form{ width:100%; max-width:380px; }
.auth-form h2{ font-size:26px; margin-bottom:6px; }
.auth-form .sub{ color:var(--slate); font-size:14px; margin-bottom:28px; display:block; }
.auth-switch{ margin-top:22px; font-size:14px; color:var(--slate); text-align:center; }
.auth-switch a{ color:var(--blue); font-weight:600; }

@media (max-width:820px){
  .auth-shell{ grid-template-columns:1fr; }
  .auth-brand{ display:none; }
}

/* ==========================================================================
   App shell (post-login)
   ========================================================================== */
.app-shell{ display:flex; min-height:100vh; }
.sidebar{
  width:var(--sidebar-w); flex-shrink:0; background:var(--white);
  border-right:1px solid var(--border); display:flex; flex-direction:column;
  padding:22px 16px; position:sticky; top:0; height:100vh;
}
.sidebar .logo{ padding:6px 10px 26px; }
.nav-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:2px; flex:1; }
.nav-link{
  display:flex; align-items:center; gap:12px; padding:11px 14px; border-radius:var(--radius-sm);
  color:var(--slate); font-weight:600; font-size:14.5px; transition:background .15s ease, color .15s ease;
  position:relative;
}
.nav-link svg{ width:20px; height:20px; flex-shrink:0; }
.nav-link:hover{ background:var(--tint-1); color:var(--blue); }
.nav-link.active{ background:var(--tint-1); color:var(--blue); }
.nav-link .badge-count{
  margin-left:auto; background:var(--blue); color:var(--white); font-size:11px; font-weight:700;
  min-width:18px; height:18px; border-radius:9px; display:flex; align-items:center; justify-content:center; padding:0 5px;
}
.global-search-btn{ margin-bottom:14px; display:flex; align-items:center; gap:8px; transition:border-color .15s ease, background .15s ease; }
.global-search-btn:hover{ border-color:var(--slate-light); background:var(--white); }
.gs-row{
  display:flex; align-items:center; gap:10px; padding:8px 6px; cursor:pointer; border-radius:var(--radius-sm);
}
.gs-row:hover{ background:var(--tint-1); }
.gs-row-title{ font-size:13.5px; font-weight:700; color:var(--ink); }
.sidebar-foot{ border-top:1px solid var(--border); padding-top:14px; margin-top:10px; }
.sidebar-user{ display:flex; align-items:center; gap:10px; padding:8px 6px; border-radius:var(--radius-sm); }
.sidebar-user:hover{ background:var(--tint-1); cursor:pointer; }
.sidebar-user-name{ font-size:13.5px; font-weight:700; line-height:1.2; }
.sidebar-user-handle{ font-size:12px; color:var(--slate-light); }

.main{ flex:1; min-width:0; display:flex; justify-content:center; }
.main-inner{ width:100%; max-width:680px; padding:28px 24px 80px; }
.main-wide .main-inner{ max-width:920px; }

.page-head{ display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
.page-head h1{ font-size:24px; }
.page-head .sub{ color:var(--slate); font-size:14px; margin-top:4px; display:block; }

.tabs{ display:flex; gap:4px; border-bottom:1px solid var(--border); margin-bottom:20px; }
.tab{ padding:10px 16px; font-size:14px; font-weight:600; color:var(--slate); border-bottom:2px solid transparent; cursor:pointer; }
.tab:hover{ color:var(--blue); }
.tab.active{ color:var(--blue); border-color:var(--blue); }

/* mobile topbar */
.topbar{ display:none; }
@media (max-width:900px){
  .sidebar{ position:fixed; left:0; top:0; z-index:60; transform:translateX(-100%); transition:transform .2s ease; box-shadow:var(--shadow-lg); }
  .sidebar.open{ transform:translateX(0); }
  .app-shell{ flex-direction:column; }
  .topbar{
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    padding:14px 18px; background:var(--white); border-bottom:1px solid var(--border);
    position:sticky; top:0; z-index:40;
  }
  .sidebar-overlay{ display:none; position:fixed; inset:0; background:rgba(0,0,0,0.35); z-index:50; }
  .sidebar-overlay.open{ display:block; }
  .main-inner{ padding:20px 16px 70px; }
}

/* ==========================================================================
   Avatars
   ========================================================================== */
.avatar{
  border-radius:50%; object-fit:cover; background:var(--tint-1); color:var(--blue);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-family:var(--font-display);
  flex-shrink:0; overflow:hidden;
}
.avatar-28{ width:28px; height:28px; font-size:12px; }
.avatar-36{ width:36px; height:36px; font-size:13px; }
.avatar-44{ width:44px; height:44px; font-size:15px; }
.avatar-72{ width:72px; height:72px; font-size:22px; }
.avatar-96{ width:96px; height:96px; font-size:28px; }

/* ==========================================================================
   Cards / Post
   ========================================================================== */
.card{ background:var(--white); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-sm); }
.card-pad{ padding:20px; }

.composer{ padding:18px 20px; margin-bottom:18px; }
.composer-row{ display:flex; gap:12px; }
.composer textarea{
  flex:1; border:none; resize:none; font-size:15px; font-family:var(--font-body); min-height:56px;
  outline:none; background:transparent; color:var(--ink);
}
.composer-foot{ display:flex; align-items:center; justify-content:space-between; margin-top:10px; padding-top:12px; border-top:1px solid var(--border); }
.composer-actions{ display:flex; align-items:center; gap:10px; }
.icon-btn{
  width:34px; height:34px; border-radius:50%; border:none; background:transparent; color:var(--blue);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.icon-btn:hover{ background:var(--tint-1); }
.icon-btn svg{ width:19px; height:19px; }
.composer-preview{ position:relative; margin-top:10px; border-radius:var(--radius-sm); overflow:hidden; max-width:220px; display:none; }
.composer-preview img{ width:100%; }
.composer-preview .remove-img{
  position:absolute; top:6px; right:6px; width:24px; height:24px; border-radius:50%; background:rgba(0,0,0,0.65);
  color:var(--white); border:none; cursor:pointer; display:flex; align-items:center; justify-content:center;
}

.post-card{ padding:18px 20px; margin-bottom:14px; }
.post-head{ display:flex; gap:12px; }
.post-head-meta{ flex:1; min-width:0; }
.post-author-row{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.post-author{ font-weight:700; font-size:14.5px; }
.post-username{ color:var(--slate-light); font-size:13.5px; }
.post-time{ color:var(--slate-light); font-size:13px; }
.post-dot::before{ content:"·"; margin:0 2px; color:var(--slate-light); }
.post-title{ font-size:16px; font-weight:700; margin:10px 0 4px; }
.post-content{ font-size:14.5px; line-height:1.6; color:var(--ink); white-space:pre-wrap; }
.post-image{ margin-top:12px; border-radius:var(--radius); overflow:hidden; border:1px solid var(--border); max-height:420px; }
.post-image img{ width:100%; object-fit:cover; }
.post-actions{ display:flex; align-items:center; gap:6px; margin-top:14px; }
.action-btn{
  display:flex; align-items:center; gap:6px; border:none; background:transparent; color:var(--slate);
  font-size:13px; font-weight:600; padding:7px 11px; border-radius:999px; cursor:pointer; transition:background .15s ease,color .15s ease;
}
.action-btn svg{ width:17px; height:17px; }
.action-btn:hover{ background:var(--tint-1); color:var(--blue); }
.action-btn.liked{ color:var(--danger); }
.action-btn.liked:hover{ background:var(--danger-tint); }
.action-btn.saved{ color:var(--blue); }
.action-menu-wrap{ margin-left:auto; position:relative; }

.dropdown{
  position:absolute; right:0; top:calc(100% + 6px); background:var(--white); border:1px solid var(--border);
  border-radius:var(--radius-sm); box-shadow:var(--shadow); min-width:170px; z-index:30; overflow:hidden; display:none;
}
.dropdown.open{ display:block; }
.dropdown-item{ display:flex; align-items:center; gap:9px; padding:10px 14px; font-size:13.5px; font-weight:500; color:var(--ink); cursor:pointer; }
.dropdown-item:hover{ background:var(--tint-1); }
.dropdown-item.danger{ color:var(--danger); }
.dropdown-item.danger:hover{ background:var(--danger-tint); }

/* ==========================================================================
   Lists (users, followers, comments, notifications)
   ========================================================================== */
.list-row{ display:flex; align-items:center; gap:12px; padding:13px 4px; border-bottom:1px solid var(--border); }
.list-row:last-child{ border-bottom:none; }
.list-row-main{ flex:1; min-width:0; }
.list-row-title{ font-weight:700; font-size:14.5px; }
.list-row-sub{ font-size:13px; color:var(--slate-light); margin-top:1px; }

.comment-row{ display:flex; gap:10px; padding:12px 0; border-bottom:1px solid var(--border); }
.comment-row:last-child{ border-bottom:none; }
.comment-bubble{ background:var(--tint-2); border-radius:var(--radius); padding:9px 13px; flex:1; }
.comment-author{ font-size:13px; font-weight:700; margin-bottom:2px; }
.comment-text{ font-size:13.5px; line-height:1.5; }
.comment-actions{ display:flex; gap:12px; margin-top:5px; padding-left:2px; }
.comment-actions button{ background:none; border:none; color:var(--slate-light); font-size:12px; font-weight:600; cursor:pointer; padding:0; }
.comment-actions button:hover{ color:var(--blue); }

.notif-row{ display:flex; gap:12px; padding:14px 6px; border-bottom:1px solid var(--border); }
.notif-row.unread{ background:var(--tint-2); border-radius:var(--radius-sm); }
.notif-icon{
  width:38px; height:38px; border-radius:50%; background:var(--tint-1); color:var(--blue);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.notif-icon svg{ width:18px; height:18px; }

/* ==========================================================================
   Profile
   ========================================================================== */
.profile-cover{ height:120px; border-radius:var(--radius-lg) var(--radius-lg) 0 0; background:linear-gradient(120deg,var(--blue),var(--blue-light)); position:relative; }
.profile-card{ padding:0 0 20px; overflow:hidden; }
.profile-head{ padding:0 22px; margin-top:-40px; display:flex; align-items:flex-end; justify-content:space-between; gap:14px; flex-wrap:wrap; }
.profile-avatar-wrap{ position:relative; }
.profile-avatar-wrap .avatar{ border:4px solid var(--white); }
.avatar-edit-btn{
  position:absolute; bottom:2px; right:2px; width:26px; height:26px; border-radius:50%; background:var(--blue);
  color:var(--white); border:2px solid var(--white); display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.avatar-edit-btn svg{ width:12px; height:12px; }
.profile-body{ padding:16px 22px 0; }
.profile-name{ font-size:20px; }
.profile-username{ color:var(--slate-light); font-size:14px; margin-top:2px; }
.profile-bio{ margin-top:12px; font-size:14px; line-height:1.6; color:var(--ink); }
.profile-stats{ display:flex; gap:22px; margin-top:16px; }
.profile-stat{ font-size:13.5px; color:var(--slate); }
.profile-stat b{ color:var(--ink); font-weight:700; }

/* ==========================================================================
   Misc: empty state, spinner, skeleton, badge, toast, modal
   ========================================================================== */
.empty-state{ text-align:center; padding:60px 20px; color:var(--slate); }
.empty-state svg{ width:46px; height:46px; color:var(--slate-light); margin-bottom:14px; }
.empty-state h3{ font-size:16px; color:var(--ink); margin-bottom:6px; }
.empty-state p{ font-size:13.5px; }

.spinner{
  width:22px; height:22px; border-radius:50%; border:2.5px solid var(--tint-1); border-top-color:var(--blue);
  animation:spin .7s linear infinite; margin:0 auto;
}
@keyframes spin{ to{ transform:rotate(360deg); } }
.spinner-wrap{ display:flex; justify-content:center; padding:40px 0; }

.skel{ background:linear-gradient(90deg,var(--tint-1) 25%,var(--tint-2) 37%,var(--tint-1) 63%); background-size:400% 100%; animation:skel 1.4s ease infinite; border-radius:var(--radius-sm); }
@keyframes skel{ 0%{background-position:100% 50%;} 100%{background-position:0 50%;} }

.badge{ display:inline-flex; align-items:center; gap:5px; font-size:11.5px; font-weight:700; padding:3px 9px; border-radius:999px; }
.badge-blue{ background:var(--tint-1); color:var(--blue); }
.badge-success{ background:var(--success-tint); color:var(--success); }
.badge-danger{ background:var(--danger-tint); color:var(--danger); }
.badge-warn{ background:var(--warn-tint); color:var(--warn); }

.toast-stack{ position:fixed; top:20px; right:20px; z-index:200; display:flex; flex-direction:column; gap:10px; max-width:320px; }
.toast{
  background:var(--ink); color:var(--white); padding:13px 16px; border-radius:var(--radius-sm); font-size:13.5px; font-weight:500;
  box-shadow:var(--shadow-lg); display:flex; align-items:center; gap:10px; animation:toast-in .2s ease;
}
.toast svg{ width:17px; height:17px; flex-shrink:0; }
.toast.success{ background:#1A1A1A; }
.toast.error{ background:#000000; }
@keyframes toast-in{ from{ opacity:0; transform:translateY(-8px);} to{opacity:1; transform:translateY(0);} }

.modal-overlay{
  position:fixed; inset:0; background:rgba(0,0,0,0.45); display:none; align-items:center; justify-content:center;
  z-index:150; padding:20px;
}
.modal-overlay.open{ display:flex; }
.modal{ background:var(--white); border-radius:var(--radius-lg); width:100%; max-width:420px; box-shadow:var(--shadow-lg); padding:26px; animation:modal-in .16s ease; }
.modal-wide{ max-width:560px; }
@keyframes modal-in{ from{ opacity:0; transform:translateY(6px) scale(.98);} to{ opacity:1; transform:translateY(0) scale(1);} }
.modal h3{ font-size:18px; margin-bottom:8px; }
.modal p{ font-size:14px; color:var(--slate); line-height:1.55; }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:22px; }
.modal-close{ position:absolute; }

.search-box{ position:relative; }
.search-box svg{ position:absolute; left:14px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--slate-light); pointer-events:none; }
.search-box input{
  padding-left:38px !important;
  border-radius:999px !important;
  background:var(--tint-2);
  border:1.5px solid var(--border) !important;
  height:40px;
  transition:border-color .15s ease, background .15s ease;
}
.search-box input:hover{ border-color:var(--slate-light) !important; }
.search-box input:focus{
  background:var(--white);
  border-color:var(--ink) !important;
  box-shadow:0 0 0 3px rgba(0,0,0,0.06);
}

.container-narrow{ max-width:680px; margin:0 auto; }

.divider{ height:1px; background:var(--border); border:none; margin:18px 0; }

.text-muted{ color:var(--slate); }
.text-sm{ font-size:13px; }
.mt-0{margin-top:0;} .mt-1{margin-top:8px;} .mt-2{margin-top:16px;} .mt-3{margin-top:24px;}
