/* ─── Reset & base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #fff; color: #0f1419; line-height: 1.5; font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: #1d9bf0; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ─── Top nav ────────────────────────────────────── */
.top-nav {
  border-bottom: 1px solid #eff3f4; background: #fff; position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1000px; margin: 0 auto; display: flex; align-items: center;
  padding: 0 16px; height: 53px;
}
.nav-logo svg { fill: #1d9bf0; display: block; }
.nav-links { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.nav-link {
  padding: 8px 16px; border-radius: 9999px; color: #0f1419;
  font-weight: 500; font-size: 14px; transition: background 0.15s;
}
.nav-link:hover { background: #eff3f4; text-decoration: none; }
.badge {
  display: inline-block; background: #1d9bf0; color: #fff;
  font-size: 11px; padding: 1px 6px; border-radius: 9999px;
  margin-left: 4px; font-weight: 700;
}

/* ─── Container ──────────────────────────────────── */
.container { max-width: 1000px; margin: 0 auto; }

/* ─── Layout (sidebar + main) ────────────────────── */
.layout { display: flex; min-height: calc(100vh - 53px); }
.sidebar {
  width: 260px; padding: 16px; flex-shrink: 0; position: sticky;
  top: 53px; height: calc(100vh - 53px); overflow-y: auto;
}
.main-col { flex: 1; max-width: 600px; border-left: 1px solid #eff3f4; border-right: 1px solid #eff3f4; }

/* ─── Sidebar ────────────────────────────────────── */
.sidebar-user { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; }
.sidebar-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.sidebar-edit { font-size: 13px; color: #536471; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: block; padding: 12px 16px; border-radius: 9999px;
  color: #0f1419; font-size: 17px; transition: background 0.15s;
}
.sidebar-link:hover { background: #eff3f4; text-decoration: none; }
.sidebar-link.active { font-weight: 700; }

/* ─── Auth pages ─────────────────────────────────── */
.auth-page { display: flex; justify-content: center; padding: 60px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; margin-bottom: 24px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: #536471; }

/* ─── Forms ──────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 14px; color: #0f1419; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px; border: 1px solid #cfd9de;
  border-radius: 4px; font-size: 15px; outline: none; background: #fff; color: #0f1419;
}
.form-group input:focus, .form-group textarea:focus { border-color: #1d9bf0; }

/* ─── Buttons ────────────────────────────────────── */
.btn {
  display: inline-block; padding: 8px 20px; border-radius: 9999px;
  font-weight: 700; font-size: 15px; cursor: pointer; border: 1px solid transparent;
  transition: background 0.15s, opacity 0.15s; text-align: center;
}
.btn-primary { background: #1d9bf0; color: #fff; border-color: #1d9bf0; }
.btn-primary:hover { background: #1a8cd8; }
.btn-outline { background: transparent; color: #1d9bf0; border-color: #cfd9de; }
.btn-outline:hover { background: rgba(29,155,240,0.1); }
.btn-block { display: block; width: 100%; }
.btn-icon {
  background: none; border: none; font-size: 24px; cursor: pointer;
  padding: 4px 8px; border-radius: 9999px; color: #536471;
}
.btn-icon:hover { background: #eff3f4; }

/* ─── Alerts ─────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: rgba(224,36,94,0.1); color: #e0245e; }
.alert-success { background: rgba(0,186,124,0.1); color: #00ba7c; }

/* ─── Feed header ────────────────────────────────── */
.feed-header { padding: 12px 16px; border-bottom: 1px solid #eff3f4; }
.feed-header h2 { font-size: 20px; margin-bottom: 12px; }
.feed-tabs { display: flex; }
.feed-tabs a {
  flex: 1; text-align: center; padding: 12px; color: #536471; font-weight: 500;
  border-bottom: 2px solid transparent; transition: 0.15s;
}
.feed-tabs a:hover { background: #eff3f4; text-decoration: none; }
.feed-tabs a.active { color: #0f1419; border-bottom-color: #1d9bf0; font-weight: 700; }

.content-header {
  display: flex; align-items: center; gap: 16px; padding: 12px 16px;
  border-bottom: 1px solid #eff3f4;
}
.content-header h2 { font-size: 20px; }
.back-link { color: #0f1419; font-size: 18px; }
.back-link:hover { text-decoration: none; }

/* ─── Compose box ────────────────────────────────── */
.compose-box {
  display: flex; gap: 12px; padding: 16px; border-bottom: 1px solid #eff3f4;
}
.compose-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.compose-form { flex: 1; }
.compose-form textarea {
  width: 100%; border: none; resize: none; font-size: 20px; line-height: 1.4;
  min-height: 60px; outline: none; background: transparent; color: #0f1419;
}
.compose-footer {
  display: flex; align-items: center; gap: 12px; padding-top: 12px;
  border-top: 1px solid #eff3f4; margin-top: 8px;
}
.upload-btn { cursor: pointer; color: #1d9bf0; padding: 8px; border-radius: 9999px; display: flex; transition: 0.15s; }
.upload-btn:hover { background: rgba(29,155,240,0.1); }
.upload-btn svg { fill: currentColor; }
.char-count { font-size: 13px; color: #536471; margin-left: auto; }

/* ─── Tweet ──────────────────────────────────────── */
.tweet-link { display: block; color: inherit; }
.tweet-link:hover { text-decoration: none; }

.tweet {
  display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #eff3f4;
  transition: background 0.1s;
}
.tweet:hover { background: #f7f9f9; }
.tweet-avatar { flex-shrink: 0; }
.tweet-avatar img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.tweet-body { flex: 1; min-width: 0; }
.tweet-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tweet-name { color: #0f1419; font-weight: 700; font-size: 15px; }
.tweet-name:hover { text-decoration: underline; }
.tweet-time { color: #536471; font-size: 14px; margin-left: auto; white-space: nowrap; }
.tweet-text { font-size: 15px; line-height: 1.5; word-wrap: break-word; margin-bottom: 8px; }
.tweet-text .mention { color: #1d9bf0; }
.tweet-img {
  border-radius: 16px; margin-top: 4px; max-height: 400px; width: 100%;
  object-fit: cover; border: 1px solid #eff3f4;
}
.tweet-actions {
  display: flex; gap: 40px; margin-top: 8px; max-width: 400px;
}
.action-btn {
  display: flex; align-items: center; gap: 4px; background: none; border: none;
  color: #536471; cursor: pointer; font-size: 13px; padding: 4px 0;
  transition: color 0.15s;
}
.action-btn svg { fill: currentColor; width: 18px; height: 18px; }
.action-btn:hover { color: #1d9bf0; }
.like-btn.active { color: #e0245e; }
.like-btn.active svg { fill: #e0245e; }
.bookmark-btn.active svg { fill: #1d9bf0; }
.delete-btn:hover { color: #e0245e; }
.empty-state { text-align: center; padding: 60px 20px; color: #536471; }

/* ─── Profile ────────────────────────────────────── */
.profile-header { padding: 16px; border-bottom: 1px solid #eff3f4; }
.profile-avatar { margin-bottom: 12px; }
.profile-avatar img { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; }
.profile-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.profile-top h2 { font-size: 20px; }
.profile-bio { margin-bottom: 8px; color: #0f1419; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 14px; color: #536471; margin-bottom: 12px; }
.profile-stats { display: flex; gap: 20px; font-size: 14px; color: #536471; }
.profile-stats strong { color: #0f1419; font-weight: 700; }

/* ─── User cards ─────────────────────────────────── */
.user-list { }
.user-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #eff3f4; }
.user-card-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.user-card div { flex: 1; min-width: 0; }
.user-card p { font-size: 13px; color: #536471; }

/* ─── Notifications ──────────────────────────────── */
.notif-list { }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #eff3f4; align-items: center; }
.notif-item.unread { background: rgba(29,155,240,0.05); }
.notif-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.notif-body { flex: 1; font-size: 14px; }
.notif-user { font-weight: 700; }
.notif-time { color: #536471; font-size: 13px; display: block; margin-top: 2px; }

/* ─── Edit profile ───────────────────────────────── */
.edit-form { padding: 16px; max-width: 500px; }
.avatar-preview { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; display: block; margin-bottom: 8px; }

/* ─── Modals ─────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 200; align-items: flex-start; justify-content: center; padding-top: 10vh;
}
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 500px; padding: 20px; }
.modal-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-header h3 { font-size: 18px; }
.modal textarea {
  width: 100%; min-height: 100px; border: 1px solid #cfd9de; border-radius: 12px;
  padding: 12px; resize: none; font-size: 16px; outline: none; margin-bottom: 12px;
}
.modal textarea:focus { border-color: #1d9bf0; }
.modal hr { border: none; border-top: 1px solid #eff3f4; margin: 12px 0; }

/* ─── Tweet detail page ──────────────────────────── */
.tweet-detail .tweet { cursor: default; border-bottom: none; }
.tweet-detail .tweet:hover { background: transparent; }
.reply-box { padding: 16px; border-bottom: 1px solid #eff3f4; }
.reply-box form { }
.reply-box textarea {
  width: 100%; min-height: 80px; border: 1px solid #cfd9de; border-radius: 12px;
  padding: 12px; resize: none; font-size: 16px; outline: none; margin-bottom: 8px;
}
.reply-box textarea:focus { border-color: #1d9bf0; }
.replies-section { }
.replies-section h3 { padding: 16px; font-size: 18px; border-bottom: 1px solid #eff3f4; }

/* ─── Load more ──────────────────────────────────── */
.load-more { text-align: center; padding: 20px; }
.spinner {
  width: 28px; height: 28px; border: 3px solid #eff3f4; border-top-color: #1d9bf0;
  border-radius: 50%; animation: spin 0.6s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 800px) {
  .sidebar { display: none; }
  .main-col { border: none; max-width: 100%; }
}
@media (max-width: 500px) {
  .tweet-actions { gap: 20px; }
  .profile-stats { flex-wrap: wrap; gap: 12px; }
  .profile-avatar img { width: 80px; height: 80px; }
  .compose-form textarea { font-size: 16px; }
}
