/* NAJHIN Network - Facebook-like clean blue & white theme */
:root {
  --blue: #1877F2;
  --blue-dark: #166FE5;
  --bg: #F0F2F5;
  --card: #FFFFFF;
  --text: #050505;
  --muted: #65676B;
  --border: #E4E6EB;
  --hover: #F2F2F2;
  --header-h: 56px;
}
html { scroll-behavior: smooth; }
body { font-family: 'Cairo', 'Inter', sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
html.ltr body { font-family: 'Inter', 'Cairo', sans-serif; }
a { color: inherit; }
* { box-sizing: border-box; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #BCC0C4; border-radius: 8px; }

/* ---------- Header ---------- */
.nj-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.nj-header-inner { max-width: 1280px; margin: 0 auto; height: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; gap: 12px; }
.nj-logo { display: flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.nj-logo-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; box-shadow: 0 2px 8px rgba(24,119,242,.35); }
.nj-logo-text { font-weight: 800; font-size: 20px; color: var(--blue); line-height: 1; }
.nj-logo-sub { font-size: 10px; color: var(--muted); letter-spacing: .08em; font-weight: 600; }
.nj-search { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 999px; padding: 0 14px; height: 40px; width: 240px; color: var(--muted); }
.nj-search input { background: transparent; border: 0; outline: 0; width: 100%; font-size: 15px; color: var(--text); }
.nj-nav { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; }
.nj-nav-item { position: relative; height: 48px; min-width: 96px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); font-size: 22px; cursor: pointer; transition: background .15s; }
.nj-nav-item:hover { background: var(--hover); }
.nj-nav-item.active { color: var(--blue); }
.nj-nav-item.active::after { content: ''; position: absolute; bottom: -4px; left: 0; right: 0; height: 3px; background: var(--blue); border-radius: 2px 2px 0 0; }
.nj-badge { position: absolute; top: 6px; inset-inline-end: 22px; background: #E41E3F; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 6px; min-width: 18px; text-align: center; line-height: 16px; }
.nj-actions { display: flex; align-items: center; gap: 8px; }
.nj-icon-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--border); display: grid; place-items: center; color: var(--text); cursor: pointer; border: 0; font-size: 16px; position: relative; transition: background .15s; }
.nj-icon-btn:hover { background: #D8DADF; }

/* ---------- Layout ---------- */
.nj-layout { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 16px; padding: 16px; align-items: start; }
.nj-sidebar { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; }
.nj-card { background: var(--card); border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.nj-side-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 15px; transition: background .15s; }
.nj-side-item:hover { background: var(--hover); }
.nj-side-item.active { background: var(--hover); color: var(--blue); }
.nj-side-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 16px; background: var(--blue); flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; padding: 9px 16px; font-weight: 600; font-size: 15px; cursor: pointer; border: 0; transition: filter .15s, background .15s; white-space: nowrap; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-light { background: var(--border); color: var(--text); }
.btn-light:hover { background: #D8DADF; }
.btn-soft { background: #E7F0FF; color: var(--blue); }
.btn-soft:hover { background: #D6E7FF; }
.btn-danger { background: #FDECEF; color: #E41E3F; }
.btn-danger:hover { background: #F9D4DA; }
.btn-success { background: #42B72A; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

/* ---------- Inputs ---------- */
.inp { width: 100%; border: 1px solid #CCD0D5; border-radius: 8px; padding: 11px 14px; font-size: 15px; outline: none; background: #fff; transition: border .15s, box-shadow .15s; font-family: inherit; }
.inp:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(24,119,242,.2); }
textarea.inp { resize: vertical; min-height: 90px; }
.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

/* ---------- Avatars / protection ---------- */
.protected-avatar { position: relative; display: inline-block; border-radius: 50%; background-size: cover; background-position: center; overflow: hidden; flex-shrink: 0; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; pointer-events: auto; vertical-align: middle; }
.protected-avatar .shield-overlay { position: absolute; inset: 0; background: transparent; z-index: 2; cursor: default; }
.protected-avatar.avatar-fallback { display: inline-grid; place-items: center; color: #fff; font-weight: 800; }
.protected-avatar .avatar-initial { font-size: .5em; line-height: 1; }
.protected-avatar.w-10 .avatar-initial { font-size: 16px; }
.protected-avatar.w-8 .avatar-initial { font-size: 13px; }
.protected-avatar.w-9 .avatar-initial { font-size: 14px; }
.protected-avatar.w-14 .avatar-initial { font-size: 22px; }
.protected-avatar.w-24 .avatar-initial { font-size: 36px; }
.protected-avatar.w-36 .avatar-initial { font-size: 52px; }
.protected-avatar.shield-blur { filter: blur(12px); transition: filter .1s; }
.protected-avatar.shield-flash::after { content: '🛡️'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(24,119,242,.75); color: #fff; font-size: 1.4em; z-index: 3; animation: pop .6s ease; }
@keyframes pop { from { transform: scale(.6); opacity: 0 } 30% { transform: scale(1.05); opacity: 1 } to { opacity: 1 } }
img { -webkit-user-drag: none; user-drag: none; }

.verified-badge { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 9px; margin-inline-start: 4px; vertical-align: middle; flex-shrink: 0; }
.verified-badge.lg { width: 22px; height: 22px; font-size: 12px; }
.pioneer-chip { display: inline-flex; align-items: center; gap: 4px; background: linear-gradient(135deg,#FFD700,#FFA500); color: #5a3a00; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }

/* ---------- Posts ---------- */
.post-card { background: var(--card); border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.1); margin-bottom: 16px; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
.post-content { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.6; }
.post-code { direction: ltr; text-align: left; background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-x: auto; white-space: pre; }
.post-link { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); background: #F7F8FA; border-radius: 8px; padding: 12px; text-decoration: none; transition: background .15s; }
.post-link:hover { background: #EDEFF2; }
.cat-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.cat-technology { background: #E7F0FF; color: #1259B8; }
.cat-programming { background: #EAF7EC; color: #1E7B34; }
.cat-entrepreneurship { background: #FFF2E5; color: #B45309; }
.cat-design { background: #F8E8FF; color: #7E22CE; }
.cat-science { background: #E6FAF8; color: #0F766E; }
.react-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; border-radius: 6px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; border: 0; background: transparent; transition: background .15s; }
.react-btn:hover { background: var(--hover); }
.react-btn.active-useful { color: #B45309; background: #FFF7E6; }
.react-btn.active-inspiring { color: #1259B8; background: #E7F0FF; }
.react-btn.active-creative { color: #7E22CE; background: #F8E8FF; }
.react-pill { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; color: var(--muted); }

/* ---------- Ads ---------- */
.ad-slot { position: relative; background: var(--card); border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.1); overflow: hidden; }
.ad-label { position: absolute; top: 6px; inset-inline-end: 8px; font-size: 10px; color: var(--muted); background: rgba(255,255,255,.85); padding: 1px 6px; border-radius: 4px; z-index: 1; text-transform: uppercase; letter-spacing: .05em; }
.ad-placeholder .ad-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #9CA3AF; font-size: 13px; border: 2px dashed #D1D5DB; border-radius: 8px; margin: 10px; background: repeating-linear-gradient(45deg,#FAFAFA,#FAFAFA 10px,#F3F4F6 10px,#F3F4F6 20px); }
.ad-placeholder .ad-inner i { font-size: 22px; }
.ad-placeholder .ad-inner small { font-size: 10px; }
.ad-leaderboard { margin-bottom: 16px; }
.ad-leaderboard .ad-inner { min-height: 90px; }
.ad-sidebar .ad-inner { min-height: 250px; }
.ad-infeed { margin-bottom: 16px; }
.ad-infeed .ad-inner { min-height: 120px; }

/* ---------- Modal / Toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal { background: var(--card); border-radius: 12px; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.25); animation: fadeUp .2s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 18px; }
.modal-body { padding: 18px; }
#toast-container { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1c1e21; color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.25); animation: fadeUp .2s ease; max-width: 360px; }
.toast.success { background: #1E7B34; }
.toast.error { background: #E41E3F; }
.toast.info { background: var(--blue); }

/* ---------- Dropdown ---------- */
.dropdown { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; background: var(--card); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.2); min-width: 240px; z-index: 60; padding: 8px; animation: fadeUp .15s ease; }
.dropdown-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 15px; }
.dropdown-item:hover { background: var(--hover); }
.dropdown-item.active { color: var(--blue); background: #E7F0FF; }

/* ---------- Auth / landing ---------- */
.landing { min-height: 100vh; background: linear-gradient(160deg,#F0F2F5 0%, #E7F0FF 60%, #fff 100%); }
.landing-grid { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr 420px; gap: 48px; padding: 72px 24px; align-items: center; }
.auth-card { background: var(--card); border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,.1), 0 8px 16px rgba(0,0,0,.1); padding: 20px; }
.feature-row { display: flex; gap: 12px; align-items: flex-start; }
.feature-ico { width: 40px; height: 40px; border-radius: 10px; background: #fff; color: var(--blue); display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.1); flex-shrink: 0; }

/* ---------- Cover ---------- */
.cover { height: 220px; border-radius: 10px 10px 0 0; background: linear-gradient(135deg, var(--c1, #1877F2), var(--c2, #0B3A7A)); position: relative; }
.cover-sm { height: 120px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 8px; overflow-x: auto; }
.tab { padding: 14px 16px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ---------- Admin ---------- */
.admin-layout { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; padding: 16px; }
.stat-card { background: var(--card); border-radius: 10px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.1); display: flex; align-items: center; gap: 14px; }
.stat-ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: #FAFBFC; }
.bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue); border-radius: 4px; }

/* ---------- Mobile bottom nav ---------- */
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--border); z-index: 50; height: 56px; }
.mobile-nav .nj-nav-item { min-width: 0; flex: 1; height: 56px; border-radius: 0; font-size: 20px; }
.mobile-nav .nj-nav-item.active::after { bottom: auto; top: 0; }

.skeleton { background: linear-gradient(90deg,#f0f0f0 25%,#e6e6e6 37%,#f0f0f0 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: -100% 0 } }

.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .nj-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .nj-right { display: none; }
}
@media (max-width: 860px) {
  .nj-layout { grid-template-columns: minmax(0, 1fr); padding: 12px; padding-bottom: 72px; }
  .nj-left { display: none; }
  .nj-nav { display: none; }
  .nj-search { width: 40px; padding: 0; justify-content: center; }
  .nj-search input { display: none; }
  .mobile-nav { display: flex; }
  .landing-grid { grid-template-columns: 1fr; padding: 32px 16px; gap: 24px; }
  .admin-layout { grid-template-columns: 1fr; padding-bottom: 72px; }
  .cover { height: 150px; }
}
