/* ── PSOCIAL — Twitter-inspired theme ─────────────────────────── */
:root {
  --s-bg:       #000000;
  --s-bg2:      #16181c;
  --s-bg3:      #1d1f23;
  --s-border:   #2f3336;
  --s-text:     #e7e9ea;
  --s-muted:    #71767b;
  --s-blue:     #1d9bf0;
  --s-blue-hov: #1a8cd8;
  --s-green:    #00ba7c;
  --s-red:      #f4212e;
  --s-gold:     #ffd400;
  --s-radius:   16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.psocial {
  background: var(--s-bg);
  color: var(--s-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* Layout */
.s-wrap {
  display: grid;
  grid-template-columns: 300px 600px 350px;
  gap: 0;
  max-width: 1265px;
  margin: 0 auto;
  min-height: 100vh;
  align-items: start;
}

.s-left  { position: sticky; top: 0; height: 100vh; padding: 0 12px; border-right: 1px solid var(--s-border); }
.s-main  { border-right: 1px solid var(--s-border); min-height: 100vh; }
.s-right { position: sticky; top: 0; height: 100vh; padding: 0 16px; overflow-y: auto; }

/* Header */
.s-header {
  position: sticky;
  top: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--s-border);
  padding: 14px 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.s-header h2 { font-size: 1.1rem; font-weight: 700; color: var(--s-text); }

/* Feed tabs */
.s-tabs {
  display: flex;
  border-bottom: 1px solid var(--s-border);
}
.s-tab {
  flex: 1;
  padding: 16px;
  text-align: center;
  color: var(--s-muted);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: all .2s;
  text-decoration: none;
  display: block;
}
.s-tab:hover { background: rgba(255,255,255,0.03); color: var(--s-text); }
.s-tab.active { color: var(--s-text); border-bottom-color: var(--s-blue); font-weight: 700; }

/* Composer */
.s-composer {
  padding: 12px 16px;
  border-bottom: 1px solid var(--s-border);
  display: flex;
  gap: 12px;
}
.s-composer textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--s-text);
  font-size: 1.1rem;
  resize: none;
  min-height: 80px;
  font-family: inherit;
}
.s-composer textarea::placeholder { color: var(--s-muted); }
.s-composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--s-border);
  margin-top: 8px;
}
.s-composer-icons { display: flex; gap: 4px; }
.s-composer-icons button {
  background: none;
  border: none;
  color: var(--s-blue);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  font-size: 1rem;
  transition: background .2s;
}
.s-composer-icons button:hover { background: rgba(29,155,240,0.1); }

/* Post button */
.s-btn {
  background: var(--s-blue);
  color: #fff;
  border: none;
  border-radius: 9999px;
  padding: 8px 20px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background .2s;
}
.s-btn:hover { background: var(--s-blue-hov); }
.s-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Post card */
.s-post {
  border-bottom: 1px solid var(--s-border);
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  transition: background .15s;
  cursor: pointer;
}
.s-post:hover { background: rgba(255,255,255,0.02); }

.s-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.s-avatar-init {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--s-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.s-post-body { flex: 1; min-width: 0; }
.s-post-header { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; flex-wrap: wrap; }
.s-post-name { font-weight: 700; color: var(--s-text); font-size: 0.95rem; }
.s-post-username { color: var(--s-muted); font-size: 0.88rem; }
.s-post-time { color: var(--s-muted); font-size: 0.88rem; }
.s-post-text { color: var(--s-text); margin: 4px 0 10px; line-height: 1.6; word-break: break-word; }
.s-post-text a { color: var(--s-blue); text-decoration: none; }
.s-post-text a:hover { text-decoration: underline; }

/* Post media */
.s-post-media { border-radius: 14px; overflow: hidden; border: 1px solid var(--s-border); margin-bottom: 10px; }
.s-post-media img { width: 100%; max-height: 400px; object-fit: cover; display: block; }
.s-post-media video { width: 100%; max-height: 400px; display: block; }

/* Post actions */
.s-actions { display: flex; justify-content: space-between; max-width: 400px; margin-top: 4px; }
.s-action {
  display: flex; align-items: center; gap: 6px;
  color: var(--s-muted); font-size: 0.82rem;
  background: none; border: none; cursor: pointer;
  padding: 6px 8px; border-radius: 9999px;
  transition: all .2s;
}
.s-action:hover.reply   { color: var(--s-blue);  background: rgba(29,155,240,0.1);  }
.s-action:hover.reshare { color: var(--s-green); background: rgba(0,186,124,0.1);  }
.s-action:hover.like    { color: var(--s-red);   background: rgba(244,33,46,0.1);   }
.s-action:hover.bookmark{ color: var(--s-blue);  background: rgba(29,155,240,0.1);  }
.s-action:hover.share   { color: var(--s-blue);  background: rgba(29,155,240,0.1);  }
.s-action.liked   { color: var(--s-red);   }
.s-action.reshared{ color: var(--s-green); }
.s-action.saved   { color: var(--s-blue);  }

/* Reshare embed */
.s-reshare-embed {
  border: 1px solid var(--s-border);
  border-radius: 14px;
  padding: 12px;
  margin: 8px 0;
}
.s-reshare-embed .s-post-name { font-size: 0.88rem; }

/* Comment box */
.s-comment-box {
  display: none;
  border-top: 1px solid var(--s-border);
  padding: 12px 0 0;
  margin-top: 8px;
}
.s-comment-box.open { display: block; }
.s-comment-list { margin-bottom: 10px; }
.s-comment-item {
  display: flex; gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(47,51,54,0.5);
}
.s-comment-input {
  width: 100%;
  background: var(--s-bg3);
  border: 1px solid var(--s-border);
  border-radius: 9999px;
  padding: 10px 16px;
  color: var(--s-text);
  font-size: 0.9rem;
  outline: none;
}
.s-comment-input:focus { border-color: var(--s-blue); }

/* Hashtag highlight */
.s-hashtag { color: var(--s-blue); cursor: pointer; }
.s-hashtag:hover { text-decoration: underline; }
.s-mention  { color: var(--s-blue); cursor: pointer; }

/* Reshare modal */
.s-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.s-modal-overlay.open { display: flex; }
.s-modal {
  background: var(--s-bg);
  border-radius: var(--s-radius);
  width: 100%;
  max-width: 560px;
  padding: 20px;
  border: 1px solid var(--s-border);
}
.s-modal h3 { font-size: 1.1rem; margin-bottom: 16px; }
.s-modal textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--s-text);
  font-size: 1rem;
  resize: none;
  min-height: 80px;
  font-family: inherit;
}

/* Right sidebar — What's happening */
.s-widget {
  background: var(--s-bg2);
  border-radius: var(--s-radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.s-widget-title {
  font-size: 1.1rem;
  font-weight: 800;
  padding: 14px 16px;
  color: var(--s-text);
}
.s-trend-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background .15s;
  border-top: 1px solid var(--s-border);
}
.s-trend-item:hover { background: rgba(255,255,255,0.03); }
.s-trend-cat  { font-size: 0.72rem; color: var(--s-muted); }
.s-trend-tag  { font-weight: 700; color: var(--s-text); font-size: 0.95rem; margin: 2px 0; }
.s-trend-count{ font-size: 0.75rem; color: var(--s-muted); }

/* Who to follow */
.s-follow-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--s-border);
  transition: background .15s;
}
.s-follow-item:hover { background: rgba(255,255,255,0.03); }
.s-follow-btn {
  margin-left: auto;
  background: var(--s-text);
  color: var(--s-bg);
  border: none;
  border-radius: 9999px;
  padding: 6px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}
.s-follow-btn:hover { background: #d7dbdc; }
.s-follow-btn.following {
  background: transparent;
  color: var(--s-text);
  border: 1px solid var(--s-border);
}
.s-follow-btn.following:hover { background: rgba(244,33,46,0.1); color: var(--s-red); border-color: var(--s-red); }

/* PCoin badge */
.s-pcoin {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,212,0,0.15);
  border: 1px solid rgba(255,212,0,0.3);
  color: var(--s-gold);
  border-radius: 9999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Toast */
.s-toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--s-blue);
  color: #fff;
  padding: 10px 24px;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 9999;
  pointer-events: none;
  animation: toastIn .3s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(10px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* Login wall */
.s-login-wall {
  background: var(--s-bg2);
  border: 1px solid var(--s-border);
  border-radius: var(--s-radius);
  padding: 20px;
  text-align: center;
  margin: 16px;
}
.s-login-wall h3 { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.s-login-wall p  { color: var(--s-muted); font-size: 0.9rem; margin-bottom: 16px; }
.s-btn-outline {
  background: transparent;
  color: var(--s-blue);
  border: 1px solid var(--s-blue);
  border-radius: 9999px;
  padding: 8px 20px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background .2s;
}
.s-btn-outline:hover { background: rgba(29,155,240,0.1); }

/* Notification dot */
.s-notif-dot {
  width: 8px; height: 8px;
  background: var(--s-blue);
  border-radius: 50%;
  display: inline-block;
  margin-left: 4px;
}

/* Search bar */
.s-search {
  position: sticky; top: 0;
  padding: 8px 0 16px;
  background: var(--s-bg);
  z-index: 5;
}
.s-search input {
  width: 100%;
  background: var(--s-bg2);
  border: 1px solid transparent;
  border-radius: 9999px;
  padding: 10px 16px 10px 40px;
  color: var(--s-text);
  font-size: 0.9rem;
  outline: none;
}
.s-search input:focus { border-color: var(--s-blue); background: var(--s-bg); }
.s-search-wrap { position: relative; }
.s-search-wrap i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--s-muted); }

/* Profile stats */
.s-stats { display: flex; gap: 20px; margin: 8px 0; }
.s-stat-val { font-weight: 700; color: var(--s-text); }
.s-stat-lbl { color: var(--s-muted); font-size: 0.82rem; }

/* Responsive */
@media (max-width: 1100px) { .s-wrap { grid-template-columns: 80px 1fr 300px; } .s-left { padding: 0; } }
@media (max-width: 768px)  { .s-wrap { grid-template-columns: 1fr; } .s-left, .s-right { display: none; } }

/* ── MOBILE BOTTOM NAV (Twitter-style) ─────────────────────── */
.s-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--s-bg);
  border-top: 1px solid var(--s-border);
  z-index: 100;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
}
.s-mobile-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 500px;
  margin: 0 auto;
}
.s-mobile-nav a, .s-mobile-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--s-muted);
  text-decoration: none;
  font-size: 1.3rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color .2s;
  position: relative;
}
.s-mobile-nav a:hover, .s-mobile-nav button:hover { color: var(--s-text); }
.s-mobile-nav a.active { color: var(--s-blue); }
.s-mobile-notif-dot {
  position: absolute;
  top: 4px; right: 8px;
  width: 8px; height: 8px;
  background: var(--s-blue);
  border-radius: 50%;
}

/* Mobile composer button */
.s-fab {
  display: none;
  position: fixed;
  bottom: 72px; right: 16px;
  width: 52px; height: 52px;
  background: var(--s-blue);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(29,155,240,0.4);
  z-index: 99;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.s-fab:hover { background: var(--s-blue-hov); }

/* Mobile composer modal */
.s-mobile-composer {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--s-bg);
  z-index: 200;
  flex-direction: column;
  padding: 16px;
}
.s-mobile-composer.open { display: flex; }
.s-mobile-composer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  body.psocial { padding-bottom: 60px; }
  .s-wrap { grid-template-columns: 1fr !important; }
  .s-left  { display: none !important; }
  .s-right { display: none !important; }
  .s-main  { border: none; min-height: calc(100vh - 60px); }
  .s-mobile-nav { display: block; }
  .s-fab { display: flex; }
  .s-composer { display: none; }
  .s-post { padding: 12px 12px; }
  .s-actions { max-width: 100%; }
  .s-header { padding: 10px 12px; }
}

@media (max-width: 480px) {
  .s-post-name { font-size: 0.88rem; }
  .s-post-text { font-size: 0.95rem; }
  .s-action { padding: 4px 6px; font-size: 0.8rem; }
}
