/* =============================================
   Forum — base.css
   CSS variables, reset, typography, layout
   ============================================= */

/* ── Variables ── */
:root {
  /* Colors — Twitter/X dark theme */
  --bg:          #000000;
  --bg-2:        #000000;
  --bg-3:        #202327;
  --border:      #2f3336;
  --border-hover:#3d4144;

  --text:        #e7e9ea;
  --text-muted:  #71767b;
  --text-dim:    #3e4144;

  --accent:      #1d9bf0;
  --accent-glow: rgba(29, 155, 240, 0.20);
  --accent-hover:#1a8cd8;
  --accent-light: rgba(29, 155, 240, 0.10);

  --danger:      #f4212e;
  --success:     #00ba7c;
  --warning:     #ffd400;

  --roblox:      #00b4ff;

  /* Typography — system font stack like X */
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Spacing */
  --radius:      12px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  /* Layout */
  --sidebar-w:   275px;
  --feed-w:      600px;
  --panel-w:     350px;

  /* Transitions */
  --ease:        cubic-bezier(0.22, 1, 0.36, 1);
  --dur:         200ms;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Mention dropdown ── */
.mention-item.active {
  background: rgba(29, 155, 240, 0.12);
}
.mention-item:hover {
  background: rgba(255,255,255,0.05);
}

/* ── App Shell ── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--feed-w) var(--panel-w);
  grid-template-areas: "sidebar feed panel";
  min-height: 100vh;
  max-width: calc(var(--sidebar-w) + var(--feed-w) + var(--panel-w));
  margin: 0 auto;
}

.sidebar     { grid-area: sidebar; }
.feed        { grid-area: feed; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.right-panel { grid-area: panel; }

/* ── Typography ── */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

.text-muted   { color: var(--text-muted); }
.text-dim     { color: var(--text-dim); }
.text-accent  { color: var(--accent); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Auth/Centered Layout ── */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}

.auth-box {
  width: 100%;
  max-width: 400px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
  .app-layout {
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-areas: "sidebar feed";
  }
  .right-panel { display: none; }
}

/* Compact icon-only sidebar below 1000px */
@media (max-width: 1000px) {
  :root { --sidebar-w: 68px; }

  .sidebar-logo .logo-text    { display: none; }
  .nav-link .nav-label        { display: none; }
  .sidebar-user .user-info    { display: none; }
  .sidebar-post-btn .post-label { display: none; }
  .sidebar-post-btn {
    width: 50px !important;
    height: 50px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    min-width: 0 !important;
  }
  .sidebar         { padding: 0.75rem 0.5rem; align-items: center; }
  .sidebar-logo    { justify-content: center; padding: 0.75rem; }
  .nav-link        { justify-content: center; padding: 0.8rem; }
  .sidebar-user    { justify-content: center; padding: 0.8rem; }
}

/* ── Mobile top header ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 53px;
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  /* sits below modals (z-index 1000) but above content */
  z-index: 199;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

/* ── Mobile (phone) ── */
@media (max-width: 599px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "feed";
  }

  /* Nuke both panels so they never ghost-render */
  .sidebar,
  .right-panel { display: none !important; }

  /* Remove side borders — full-bleed on mobile */
  .feed { border-left: none !important; border-right: none !important; }

  /* Bottom padding clears the bottom nav */
  .feed { padding-bottom: 70px; }

  /* "Home" placeholder header — hidden, logo mobile-header takes its place */
  .feed-header-home { display: none; }

  /* Every other page's feed-header becomes the sticky mobile top bar */
  .feed-header:not(.feed-header-home) {
    position: sticky;
    top: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 199;
    border-bottom: 1px solid var(--border);
    min-height: 53px;
    padding: 0 0.75rem;
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
  }

  /* Sticky feed/profile tabs just below the 53 px top bar */
  .feed-tabs {
    position: sticky;
    top: 53px;
    background: var(--bg);
    z-index: 100;
  }

  /* Show the logo mobile header (index.html + auth pages) */
  .mobile-header { display: flex; }

  /* Auth pages — remove excessive padding on small screens */
  .auth-layout {
    padding: 1.5rem 1rem;
    align-items: flex-start;
    padding-top: 3rem;
  }
  .auth-box {
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius);
  }
}

/* Feed top-padding only when the logo header is injected (index.html / no back-button pages) */
body.has-mobile-logo-header .feed {
  padding-top: 53px;
}

/* ── Mobile bottom nav ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 200;
  /* iPhone notch / home-bar safe area */
  padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 599px) {
  .mobile-nav { display: flex; align-items: center; }
}

/* Nav icon links */
.mobile-nav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.25rem;
  color: var(--text-muted);
  transition: color var(--dur);
  position: relative;
  text-decoration: none;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-link:active { opacity: 0.6; }
.mobile-nav-link.active { color: var(--text); }
/* Active: swap to filled icon */
.mobile-nav-link.active svg { stroke-width: 2.5; }
.mobile-nav-link svg { width: 26px; height: 26px; flex-shrink: 0; }

/* Centre compose FAB — slightly larger, rounder */
.mobile-compose-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 50px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background var(--dur), opacity var(--dur);
  margin: 0 4px;
  -webkit-tap-highlight-color: transparent;
}
.mobile-compose-btn:active { opacity: 0.75; background: var(--accent-hover); }
.mobile-compose-btn svg { width: 20px; height: 20px; }

/* Notification badge on mobile nav */
.mobile-nav-badge {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(6px);
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  pointer-events: none;
  border: 1.5px solid var(--bg);
}

/* ── Utility ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0);
}
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.w-full  { width: 100%; }
.mt-1    { margin-top: 0.25rem; }
.mt-2    { margin-top: 0.5rem; }
.mt-4    { margin-top: 1rem; }
.mb-2    { margin-bottom: 0.5rem; }
.p-4     { padding: 1rem; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
