/* =========================================================
   THE NODE PLATFORM POLISH
   Brand-safe interface layer for community + marketplace UX
   ========================================================= */
:root {
  --node-ink: #0f172a;
  --node-soft: #f8fafc;
  --node-card: rgba(255,255,255,.86);
  --node-ring: rgba(79,70,229,.22);
  --node-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 52%, #10b981 100%);
  --node-gradient-dark: linear-gradient(135deg, #0f172a 0%, #172554 48%, #134e4a 100%);
  --node-glow: 0 24px 70px rgba(37, 99, 235, .16);
  --node-surface-shadow: 0 18px 50px rgba(15, 23, 42, .08);
  --node-fast: 160ms cubic-bezier(.2,.8,.2,1);
  --node-smooth: 320ms cubic-bezier(.2,.8,.2,1);
}

html { scroll-padding-top: 92px; }
body.node-ambient-bg { background:
    radial-gradient(circle at 12% 0%, rgba(79, 70, 229, .08), transparent 28%),
    radial-gradient(circle at 92% 10%, rgba(6, 182, 212, .08), transparent 28%),
    var(--bg-secondary, #f8fafc);
}
body.node-ambient-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(15,23,42,.032) 1px, transparent 1px), linear-gradient(90deg, rgba(15,23,42,.032) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.65), transparent 70%);
  z-index: -1;
}

/* Page entrance rhythm (layout dimensions are owned by page-system.css). */
.main-wrapper > .container:first-child,
.dashboard-container .container,
.marketplace-page .container { animation: nodePageIn .42s ease both; }
@keyframes nodePageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Navigation styling is isolated in navigation.css. */

/* Cards and surfaces */
body:not(.admin-body):not(.social-suite-page) :is(.card, .market-card, .stat-card, .job-card-mini, .application-item, .event-item-mini, .task-item-mini, .team-card-mini, .platform-card) {
  border: 1px solid rgba(226,232,240,.95);
  background: var(--node-card);
  box-shadow: var(--node-surface-shadow);
  backdrop-filter: blur(12px);
}
body:not(.admin-body):not(.social-suite-page) :is(.card, .platform-card) { border-radius: 22px; overflow: hidden; }
body:not(.admin-body):not(.social-suite-page) .card-header {
  background: linear-gradient(180deg, rgba(248,250,252,.82), rgba(255,255,255,.72));
  border-bottom: 1px solid rgba(226,232,240,.72);
}
body:not(.admin-body):not(.social-suite-page) :is(.card, .platform-card):hover { box-shadow: 0 22px 65px rgba(15,23,42,.11); }

/* Hero and page shells */
.node-page-hero, .page-header.page-header--hero {
  position: relative;
  isolation: isolate;
  padding: clamp(2rem, 5vw, 4rem);
  margin: 1.5rem 0 1rem;
  border-radius: 30px;
  color: #fff;
  background: var(--node-gradient-dark);
  overflow: hidden;
  box-shadow: var(--node-glow);
}
.node-page-hero::before, .page-header.page-header--hero::before, .market-hero::before, .dashboard-welcome::before {
  content: '';
  position: absolute;
  inset: -1px;
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.22), transparent 22%),
    radial-gradient(circle at 88% 10%, rgba(6,182,212,.32), transparent 24%),
    radial-gradient(circle at 70% 100%, rgba(16,185,129,.20), transparent 22%);
  z-index: -1;
}
.node-page-hero h1, .page-header.page-header--hero h1, .node-page-hero p, .page-header.page-header--hero p { color: #fff; }
body:not(.admin-body):not(.social-suite-page) .lead { font-size: clamp(1rem, 2vw, 1.2rem); max-width: 780px; }

/* Marketplace experience */
.market-hero {
  box-shadow: 0 30px 90px rgba(15,23,42,.25);
  border: 1px solid rgba(255,255,255,.12);
}
.market-card { position: relative; overflow: hidden; }
.market-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--node-gradient);
  opacity: .85;
}
.market-card h3 a { color: var(--text-primary, #0f172a); }
.market-card h3 a:hover { color: var(--primary, #4f46e5); }
.market-filter { box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 18px 45px rgba(15,23,42,.06); }
.market-form input:focus, .market-form textarea:focus, .market-form select:focus, .market-filter input:focus, .market-filter select:focus {
  outline: none;
  border-color: var(--primary, #4f46e5);
  box-shadow: 0 0 0 4px var(--node-ring);
}
body:not(.admin-body):not(.social-suite-page) :is(.market-empty, .empty-state, .empty-state-small) {
  border: 1px dashed rgba(148,163,184,.7);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(248,250,252,.85), rgba(255,255,255,.72));
}

/* Dashboard command center */
.dashboard-welcome {
  position: relative;
  isolation: isolate;
  border-radius: 30px;
  background: var(--node-gradient-dark);
  overflow: hidden;
}
.dashboard-welcome h1, .dashboard-welcome p { color: #fff; }
body:not(.admin-body):not(.social-suite-page) .stats-grid { align-items: stretch; }
body:not(.admin-body):not(.social-suite-page) .stat-card { border-radius: 20px; }
body:not(.admin-body):not(.social-suite-page) .stat-card::after {
  content: '';
  position: absolute;
  right: -32px;
  bottom: -32px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(79,70,229,.07);
  pointer-events: none;
}
body:not(.admin-body):not(.social-suite-page) .stat-icon { box-shadow: inset 0 0 0 1px rgba(255,255,255,.5); }
body:not(.admin-body):not(.social-suite-page) .dashboard-tabs { scrollbar-width: thin; }
body:not(.admin-body):not(.social-suite-page) .tab-btn { border-radius: 14px 14px 0 0; }
body:not(.admin-body):not(.social-suite-page) .tab-btn.active { background: rgba(79,70,229,.08); }
body:not(.admin-body):not(.social-suite-page) .quick-links { gap: .75rem; }
body:not(.admin-body):not(.social-suite-page) .quick-link {
  border: 1px solid rgba(226,232,240,.82);
  border-radius: 16px;
  padding: .85rem;
  background: linear-gradient(180deg, #fff, #f8fafc);
  transition: transform var(--node-fast), border-color var(--node-fast), box-shadow var(--node-fast);
}
body:not(.admin-body):not(.social-suite-page) .quick-link:hover { transform: translateX(3px); border-color: rgba(79,70,229,.28); box-shadow: 0 12px 30px rgba(15,23,42,.08); }

/* Forms */
body:not(.admin-body):not(.social-suite-page) :is(input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], input[type="number"], textarea, select) {
  transition: border-color var(--node-fast), box-shadow var(--node-fast), background var(--node-fast);
}
body:not(.admin-body):not(.social-suite-page) :is(input, textarea, select):focus {
  outline: none;
  border-color: var(--primary, #4f46e5);
  box-shadow: 0 0 0 4px var(--node-ring);
}
body:not(.admin-body):not(.social-suite-page) textarea[data-autosize] { resize: vertical; min-height: 120px; }

/* Command palette */
.node-command-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 9vh 16px 32px;
  background: rgba(15,23,42,.48);
  backdrop-filter: blur(8px);
  z-index: 20000;
}
.node-command-overlay.active { display: flex; animation: nodeFadeIn .18s ease both; }
.node-command-palette {
  width: min(720px, 100%);
  border-radius: 24px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(226,232,240,.95);
  box-shadow: 0 30px 90px rgba(15,23,42,.28);
  overflow: hidden;
}
.node-command-search { display:flex; align-items:center; gap:.8rem; padding: 1rem 1.1rem; border-bottom: 1px solid rgba(226,232,240,.9); }
.node-command-search i { color: var(--text-muted, #64748b); }
.node-command-search input { border: 0; box-shadow: none; padding: .45rem 0; font-size: 1.02rem; width: 100%; }
.node-command-list { max-height: 430px; overflow:auto; padding: .5rem; }
.node-command-item {
  display:flex; align-items:center; gap:.85rem; width:100%; padding:.85rem; border:0; border-radius:16px; background:transparent; text-align:left; cursor:pointer; color:var(--text-primary,#0f172a);
}
.node-command-item:hover, .node-command-item.active { background: linear-gradient(135deg, #eef2ff, #ecfeff); }
.node-command-item i { width: 22px; color: var(--primary,#4f46e5); }
.node-command-item span { display:block; font-weight:800; }
.node-command-item small { display:block; color:var(--text-muted,#64748b); margin-top:.1rem; }
.node-command-footer { display:flex; justify-content:space-between; gap:1rem; padding:.7rem 1rem; background:#f8fafc; color:#64748b; font-size:.82rem; }
kbd { background:#e2e8f0; border:1px solid #cbd5e1; border-radius:7px; padding:.1rem .35rem; font-size:.78em; }
@keyframes nodeFadeIn { from { opacity:0; } to { opacity:1; } }

/* Toasts and loading */
.node-toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 21000; display: grid; gap: .65rem; width: min(380px, calc(100vw - 36px)); }
.node-toast { display:flex; gap:.8rem; align-items:flex-start; padding: .9rem 1rem; background:#fff; border:1px solid #e2e8f0; border-radius:18px; box-shadow: 0 20px 50px rgba(15,23,42,.16); animation: nodeToastIn .24s ease both; }
.node-toast strong { display:block; color:#0f172a; margin-bottom:.1rem; }
.node-toast span { color:#64748b; line-height:1.45; }
.node-toast i { color:var(--primary,#4f46e5); margin-top:.15rem; }
.node-toast.success i { color:var(--success,#10b981); }
.node-toast.error i { color:var(--danger,#ef4444); }
@keyframes nodeToastIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: none; } }

/* Reveal animation */
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* Admin polish */
html[data-theme="admin"] body { background: #f8fafc; }
html[data-theme="admin"] .admin-main { animation: nodePageIn .38s ease both; }
html[data-theme="admin"] .admin-header, html[data-theme="admin"] .admin-card, html[data-theme="admin"] .stat-card { border-radius: 22px; }
html[data-theme="admin"] .admin-sidebar { box-shadow: 16px 0 44px rgba(15,23,42,.06); }

/* Mobile */
@media (max-width: 968px) {
  .dashboard-welcome { flex-direction: column; align-items: flex-start; gap: 1rem; padding: 1.4rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .market-section-head { gap:.5rem; }
}
@media (max-width: 640px) {
  .node-page-hero, .page-header.page-header--hero, .market-hero { border-radius: 22px; padding: 1.4rem; }
  .market-hero h1, .page-header.page-header--hero h1 { font-size: clamp(1.8rem, 12vw, 2.5rem); }
  .stat-card { padding: 1rem; }
  .footer-content { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
