/* ==============================================================================
   NAIJAPLANET — App Shell Styles (feed, jobs, market, chat, etc.)
   Mobile-first • Green #0B7A4B • Orange #FF6B2C
   ============================================================================== */

:root {
  --np-green: #0B7A4B;
  --np-green-dark: #064E3B;
  --np-orange: #FF6B2C;
  --np-bg: #f1f5f9;
  --np-surface: #ffffff;
  --np-surface-subtle: #f8fafc;
  --np-border: #e2e8f0;
  --np-text-primary: #0f172a;
  --np-text-secondary: #334155;
  --np-text-muted: #64748b;
  --np-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --np-radius: 14px;
  --np-nav-height: 58px;
  --np-bottom-nav-height: 64px;
}

[data-theme="dark"] {
  --np-bg: #0B1220;
  --np-surface: #111827;
  --np-surface-subtle: #1e293b;
  --np-border: #1e293b;
  --np-text-primary: #f8fafc;
  --np-text-secondary: #cbd5e1;
  --np-text-muted: #94a3b8;
  --np-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

.app-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--np-bg);
  color: var(--np-text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--np-bottom-nav-height) + 12px);
}

@media (min-width: 900px) {
  .app-body { padding-bottom: 24px; }
}

/* ---------- Buttons / inputs fallbacks ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--np-green), #096b42);
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(11, 122, 75, 0.3);
}
.btn-secondary {
  background: var(--np-surface);
  color: var(--np-text-primary) !important;
  border: 1.5px solid var(--np-border);
}
.btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn-lg { padding: 14px 22px; font-size: 1rem; }
.btn-icon {
  background: transparent;
  border: none;
  color: var(--np-text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--np-surface-subtle); }
.w-full { width: 100%; }

.card {
  background: var(--np-surface);
  border: 1px solid var(--np-border);
  border-radius: var(--np-radius);
  box-shadow: var(--np-shadow);
}

.skeleton {
  background: linear-gradient(90deg, var(--np-surface-subtle) 25%, var(--np-border) 50%, var(--np-surface-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.text-center { text-align: center; }
.relative { position: relative; }

/* ---------- Toast container ---------- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

/* ---------- Top Nav ---------- */
.top-nav-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--np-nav-height);
  background: color-mix(in srgb, var(--np-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--np-border);
}

.top-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-nav-brand { flex-shrink: 0; }
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--np-text-primary);
}
.brand-logo-circle {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--np-green), var(--np-green-dark));
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.brand-title .text-accent { color: var(--np-orange); }

@media (max-width: 640px) {
  .brand-title { display: none; }
}

.top-nav-search {
  flex: 1;
  max-width: 420px;
  margin: 0 auto;
}
.search-input-wrap {
  position: relative;
  width: 100%;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--np-text-muted);
  pointer-events: none;
}
#global-search-input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border-radius: 999px;
  border: 1.5px solid var(--np-border);
  background: var(--np-surface-subtle);
  color: var(--np-text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#global-search-input:focus {
  border-color: var(--np-green);
  box-shadow: 0 0 0 3px rgba(11, 122, 75, 0.15);
  background: var(--np-surface);
}

.top-nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.nav-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--np-text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-icon-btn:hover {
  background: var(--np-surface-subtle);
  color: var(--np-green);
}

.badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--np-orange);
  border: 2px solid var(--np-surface);
}

.user-profile-pill {
  display: none;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--np-text-primary);
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--np-border);
  background: var(--np-surface);
  margin-left: 4px;
}
.user-profile-pill img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--np-surface-subtle);
}
.nav-username {
  font-size: 0.82rem;
  font-weight: 700;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 720px) {
  .user-profile-pill { display: inline-flex; }
}

/* ---------- App layout grid ---------- */
.app-layout-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 900px) {
  .app-layout-container {
    grid-template-columns: 220px minmax(0, 1fr);
    padding: 20px 16px;
  }
}
@media (min-width: 1100px) {
  .app-layout-container {
    grid-template-columns: 240px minmax(0, 1fr) 280px;
  }
}

/* ---------- Left sidebar ---------- */
.app-left-sidebar {
  display: none;
  position: sticky;
  top: calc(var(--np-nav-height) + 16px);
}
@media (min-width: 900px) {
  .app-left-sidebar { display: block; }
}

.sidebar-nav-menu {
  background: var(--np-surface);
  border: 1px solid var(--np-border);
  border-radius: var(--np-radius);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--np-shadow);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--np-text-secondary);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-item:hover {
  background: var(--np-surface-subtle);
  color: var(--np-text-primary);
}
.sidebar-item.active {
  background: rgba(11, 122, 75, 0.12);
  color: var(--np-green);
}
.sidebar-item svg { flex-shrink: 0; }

.sidebar-pro-card {
  margin-top: 14px;
  background: linear-gradient(160deg, #0B7A4B, #064E3B);
  color: #fff;
  border-radius: var(--np-radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.sidebar-pro-card h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}
.sidebar-pro-card p {
  margin: 0 0 12px;
  font-size: 0.8rem;
  opacity: 0.9;
  line-height: 1.45;
}
.pro-card-badge {
  display: inline-block;
  background: var(--np-orange);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}
.sidebar-pro-card .btn-primary {
  background: #fff;
  color: var(--np-green) !important;
  box-shadow: none;
}

/* ---------- Main content ---------- */
.app-main-content {
  min-width: 0;
  min-height: 60vh;
}

.app-view {
  display: none;
  animation: viewIn 0.25s ease both;
}
.app-view.active {
  display: block;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Stories rail ---------- */
.stories-scroll-container {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  margin-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.stories-scroll-container::-webkit-scrollbar { display: none; }

.story-add-card,
.stories-track {
  display: flex;
  align-items: center;
  gap: 10px;
}
.story-add-card {
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--np-text-muted);
  text-align: center;
  width: 68px;
}
.story-add-avatar {
  position: relative;
  width: 58px;
  height: 58px;
}
.story-add-avatar img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--np-border);
  background: var(--np-surface-subtle);
}
.story-plus-icon {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--np-green);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--np-surface);
}

/* ---------- Composer ---------- */
.composer-card {
  padding: 14px;
  margin-bottom: 12px;
}
.composer-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.composer-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--np-surface-subtle);
  flex-shrink: 0;
}
.composer-input {
  flex: 1;
  border: none;
  resize: none;
  background: transparent;
  color: var(--np-text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  outline: none;
  min-height: 48px;
  padding: 8px 0;
}
.composer-preview-area {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--np-border);
}
.composer-tools-left {
  display: flex;
  gap: 4px;
}
.tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--np-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tool-btn:hover {
  background: var(--np-surface-subtle);
  color: var(--np-green);
}

/* ---------- Feed tabs ---------- */
.feed-tabs-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  background: var(--np-surface);
  border: 1px solid var(--np-border);
  border-radius: 999px;
  padding: 4px;
}
.feed-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--np-text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 8px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.feed-tab.active {
  background: rgba(11, 122, 75, 0.12);
  color: var(--np-green);
}

.feed-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-card {
  padding: 16px;
}

/* ---------- Generic module mounts (jobs/market/etc) ---------- */
#jobs-mount,
#market-mount,
#events-mount,
#groups-mount,
#pages-mount,
#chat-mount,
#video-feed-mount,
#notifications-mount,
#search-mount,
#saved-mount {
  min-height: 50vh;
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.module-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--np-text-primary);
}
.module-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.module-search,
.module-select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--np-border);
  background: var(--np-surface);
  color: var(--np-text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}
.module-search:focus,
.module-select:focus {
  border-color: var(--np-green);
  box-shadow: 0 0 0 3px rgba(11, 122, 75, 0.12);
}
.module-search { flex: 1; min-width: 160px; }

.jobs-list,
.market-grid,
.events-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.job-card,
.listing-card,
.event-card,
.empty-state-card {
  background: var(--np-surface);
  border: 1px solid var(--np-border);
  border-radius: var(--np-radius);
  padding: 16px;
  box-shadow: var(--np-shadow);
}

.job-card h3,
.listing-card h3,
.event-card h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--np-text-primary);
}
.job-card p,
.listing-card p,
.event-card p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--np-text-muted);
  line-height: 1.45;
}
.job-meta,
.listing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--np-text-muted);
  margin-bottom: 12px;
}
.job-meta span,
.listing-meta span {
  background: var(--np-surface-subtle);
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.featured-pill {
  background: rgba(255, 107, 44, 0.15) !important;
  color: var(--np-orange) !important;
}

.empty-state-card {
  text-align: center;
  padding: 40px 20px;
  color: var(--np-text-muted);
}
.empty-state-card h3 {
  color: var(--np-text-primary);
  margin: 0 0 8px;
}

/* ---------- Right sidebar ---------- */
.app-right-sidebar {
  display: none;
  position: sticky;
  top: calc(var(--np-nav-height) + 16px);
}
@media (min-width: 1100px) {
  .app-right-sidebar { display: block; }
}
.right-card {
  padding: 16px;
  margin-bottom: 14px;
}
.right-card-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 800;
}
.trending-list,
.suggested-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.desktop-footer-links {
  font-size: 0.75rem;
  color: var(--np-text-muted);
  padding: 8px 4px;
  line-height: 1.7;
}
.desktop-footer-links a {
  color: var(--np-text-muted);
  text-decoration: none;
}
.desktop-footer-links a:hover { color: var(--np-green); }

/* ---------- Mobile bottom nav ---------- */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  height: var(--np-bottom-nav-height);
  background: color-mix(in srgb, var(--np-surface) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--np-border);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@media (min-width: 900px) {
  .mobile-bottom-nav { display: none; }
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--np-text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 10px;
  margin: 6px 2px;
  transition: color 0.15s ease, background 0.15s ease;
}
.bottom-nav-item.active {
  color: var(--np-green);
  background: rgba(11, 122, 75, 0.1);
}
.bottom-nav-item svg { flex-shrink: 0; }

/* ---------- Post cards (basic) ---------- */
.post-card {
  padding: 14px;
}
.post-card + .post-card { margin-top: 0; }

/* ---------- Modal fallback ---------- */
.np-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.np-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.np-modal-card {
  background: var(--np-surface);
  color: var(--np-text-primary);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

/* ---------- Chat layout basics ---------- */
.chat-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  background: var(--np-surface);
  border: 1px solid var(--np-border);
  border-radius: var(--np-radius);
  overflow: hidden;
  min-height: 70vh;
}
@media (min-width: 720px) {
  .chat-layout { grid-template-columns: 300px 1fr; }
}

/* ---------- Utility ---------- */
.text-orange { color: var(--np-orange) !important; }
.text-green { color: var(--np-green) !important; }

@media (prefers-reduced-motion: reduce) {
  .app-view, .btn, .sidebar-item, .skeleton {
    animation: none !important;
    transition: none !important;
  }
}