/* ============ X clone — design tokens & shared layout ============ */
:root {
  --text-2-elev: #8b8f93; /* muted text on --bg-input surfaces (AA contrast) */
  --bg: #000000;
  --bg-elev: #16181c;        /* hover cards, search dropdown */
  --bg-input: #202327;       /* search bar */
  --text: #e7e9ea;
  --text-2: #71767b;
  --border: #2f3336;
  --blue: #1d9bf0;
  --blue-hover: #1a8cd8;
  --pink: #f91880;
  --green: #00ba7c;
  --hover: rgba(231, 233, 234, 0.1);
  --hover-faint: rgba(255, 255, 255, 0.03);
  --blue-a: rgba(29, 155, 240, 0.1);
  --pink-a: rgba(249, 24, 128, 0.1);
  --green-a: rgba(0, 186, 124, 0.1);
  --overlay: rgba(91, 112, 131, 0.4);
  --white-btn: #eff3f4;
  --white-btn-hover: #d7dbdc;
  --font: "TwitterChirp", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scrollbar-color: #3e4144 transparent; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 20px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
}
::selection { background: rgba(29, 155, 240, 0.4); }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font-family: inherit; color: var(--text); background: transparent; border: none; outline: none; }
img { display: block; max-width: 100%; }
svg { display: block; fill: currentColor; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 0; border-radius: 4px; }

/* ---------- App shell: centered 3-column layout ---------- */
.app { display: flex; justify-content: center; width: 100%; min-height: 100vh; }
.sidebar-col { width: 275px; flex-shrink: 0; }
.main-col {
  width: 600px; max-width: 600px; flex-shrink: 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: 100vh;
}
.right-col { width: 350px; margin-left: 24px; flex-shrink: 0; }

@media (max-width: 1300px) { .right-col { width: 290px; margin-left: 12px; } }
@media (max-width: 1280px) { .sidebar-col { width: 88px; } }
@media (max-width: 1080px) { .right-col { display: none; } }
@media (max-width: 704px) {
  .sidebar-col { display: none; }
  .main-col { width: 100%; max-width: 100%; border: none; padding-bottom: 54px; }
}

/* ---------- Sticky page headers ---------- */
.page-head {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.65);
}
.page-head-bar {
  display: flex; align-items: center; gap: 20px;
  height: 53px; padding: 0 16px;
}
.page-head-title { font-size: 20px; font-weight: 800; }
.page-head-sub { font-size: 13px; color: var(--text-2); line-height: 16px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; height: 53px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-weight: 500; font-size: 15px;
  position: relative; cursor: pointer; white-space: nowrap;
  transition: background-color 0.2s;
}
.tab:hover { background: var(--hover); }
.tab.active { color: var(--text); font-weight: 700; }
/* X's active indicator hugs the label's text width */
.tab-inner {
  position: relative;
  display: flex; align-items: center;
  height: 100%;
}
.tab.active .tab-inner::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0;
  height: 4px; border-radius: 9999px;
  background: var(--blue);
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: 9999px; font-weight: 700; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 0.2s; user-select: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-white { background: var(--white-btn); color: #0f1419; }
.btn-white:hover:not(:disabled) { background: var(--white-btn-hover); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover:not(:disabled) { background: var(--blue-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border-2); color: var(--text); }
.btn-outline:hover { background: var(--hover); }
.btn-outline-danger:hover { background: rgba(244, 33, 46, 0.1); border-color: #67070f; color: #f4212e; }
.btn-sm { height: 32px; padding: 0 16px; font-size: 14px; }
.btn-md { height: 36px; padding: 0 16px; font-size: 15px; }
.btn-lg { height: 52px; padding: 0 32px; font-size: 17px; }

/* ---------- Avatars ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 9999px;
  flex: none; cursor: pointer; object-fit: cover;
  transition: opacity 0.2s;
}
.avatar:hover { opacity: 0.9; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 48px; height: 48px; }

/* ---------- Icon buttons ---------- */
.icon-btn {
  width: 34px; height: 34px; border-radius: 9999px;
  display: grid; place-items: center; flex: none;
  color: inherit; transition: background-color 0.2s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn-blue:hover { background: var(--blue-a); color: var(--blue); }

/* ---------- Links inside text ---------- */
.t-link { color: var(--blue); cursor: pointer; }
.t-link:hover { text-decoration: underline; }

/* ---------- Modal / overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--overlay);
  display: flex; justify-content: center; align-items: flex-start;
}
.modal {
  margin-top: 5vh; background: var(--bg); border-radius: 16px;
  width: 600px; max-width: calc(100vw - 24px); max-height: 90vh;
  overflow-y: auto; animation: modal-in 0.15s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
@media (max-width: 704px) {
  .modal { margin-top: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
  z-index: 300; background: var(--blue); color: #fff;
  padding: 12px 20px; border-radius: 6px; font-size: 15px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.2s ease-out;
  max-width: calc(100vw - 32px);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Spinner ---------- */
.spinner {
  width: 26px; height: 26px; margin: 24px auto;
  border: 3px solid var(--blue-a); border-top-color: var(--blue);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Empty states ---------- */
.empty-state { max-width: 400px; margin: 32px auto; padding: 0 32px; }
.empty-state h2 { font-size: 31px; font-weight: 800; line-height: 36px; margin-bottom: 8px; }
.empty-state p { color: var(--text-2); font-size: 15px; }

/* ---------- Perf: skip offscreen rendering work ---------- */
.cv { content-visibility: auto; contain-intrinsic-size: auto 140px; }

/* ---------- Generic list cell (trends, users, notifications) ---------- */
.cell { display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; transition: background-color 0.2s; }
.cell:hover { background: var(--hover-faint); }

.muted { color: var(--text-2); }
.bold { font-weight: 700; }
.hidden { display: none !important; }

/* ---------- Skip link (keyboard users) ---------- */
.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 500;
  background: var(--blue); color: #fff;
  padding: 10px 16px; border-radius: 9999px; font-weight: 700;
  transition: top 0.15s;
}
.skip-link:focus-visible { top: 12px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* cashtag tickers pop slightly */
.t-cashtag { font-weight: 600; }
