/*
 * 5E Intel — Project Surface Styles (Phase 3G/3H)
 *
 * Applies the Archival Warmth token system to all project-facing pages:
 * sidebar, home workspace, project list, project dashboard, public share.
 *
 * Depends on: _tokens.css (must be loaded first)
 * Does NOT touch: admin pages, Twins, core survey interface.
 */

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

nav.sidebar {
  background: var(--theme-sidebar-bg, #FFFFFF) !important;
  border-right: 1px solid var(--theme-rule, #e2e8f0);
}

nav.sidebar .sidebar-header {
  border-bottom: 1px solid var(--theme-rule, #e2e8f0);
}

nav.sidebar .nav-section-title {
  color: var(--theme-ink-mute, #64748b);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 16px;
}

nav.sidebar .nav-link {
  color: var(--theme-ink-mute, #64748b);
  font-size: 13.5px;
  border-radius: var(--radius, 6px);
  margin: 1px 8px;
  padding: 7px 10px;
  transition: background var(--dur-fast, 160ms), color var(--dur-fast, 160ms);
}

nav.sidebar .nav-link:hover {
  background: var(--theme-paper-sunk, #f3f4f6);
  color: var(--theme-ink, #1a202c);
}

nav.sidebar .nav-link.active {
  background: var(--theme-accent-light, #E8F5F0);
  color: var(--theme-accent, #0F513D);
  font-weight: 600;
}

nav.sidebar .nav-link.active i {
  color: var(--theme-accent, #0F513D);
}

/* New project button wrapper */
nav.sidebar .nav-item-new-project {
  padding: 12px 12px 8px;
  margin: 0;
}

nav.sidebar.collapsed .nav-item-new-project {
  padding: 12px 0 8px;
  display: flex;
  justify-content: center;
}

/* New project button in sidebar */
nav.sidebar .sidebar-new-project-btn {
  display: flex;
  align-items: center;
  gap: var(--s-2, 8px);
  background: var(--theme-accent, #0F513D);
  color: #fff !important;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-md, 10px);
  padding: 9px 14px;
  text-decoration: none;
  transition: background var(--dur-fast, 160ms), transform var(--dur-fast, 160ms);
  white-space: nowrap;
}

nav.sidebar .sidebar-new-project-btn:hover {
  background: var(--theme-accent-hover, #0A3D2E);
  transform: translateY(-1px);
}

nav.sidebar .sidebar-new-project-btn i {
  font-size: 12px;
}

/* Collapsed: icon-only square button */
nav.sidebar.collapsed .sidebar-new-project-btn {
  padding: 0;
  width: 36px;
  height: 36px;
  justify-content: center;
  gap: 0;
}

nav.sidebar.collapsed .sidebar-new-project-btn span {
  display: none;
}

nav.sidebar.collapsed .sidebar-new-project-btn i {
  font-size: 13px;
}

/* Credits badge wrapper */
nav.sidebar .nav-item-credits {
  padding: 16px 12px 8px;
  margin: 0;
}

nav.sidebar.collapsed .nav-item-credits {
  padding: 16px 0 8px;
  display: flex;
  justify-content: center;
}

/* Credits badge in sidebar */
nav.sidebar .sidebar-credits-badge {
  display: flex;
  align-items: center;
  gap: var(--s-2, 8px);
  background: var(--theme-accent-light, #E8F5F0);
  border-left: 3px solid var(--theme-accent, #0F513D);
  border-radius: 0 var(--radius, 6px) var(--radius, 6px) 0;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--theme-accent, #0F513D);
  text-decoration: none;
  transition: background var(--dur-fast, 160ms);
  white-space: nowrap;
}

nav.sidebar .sidebar-credits-badge:hover {
  background: var(--theme-accent-light, #E8F5F0);
  filter: brightness(0.97);
}

/* Collapsed: icon-only credit badge */
nav.sidebar.collapsed .sidebar-credits-badge {
  width: 36px;
  height: 36px;
  padding: 0;
  gap: 0;
  border-left: none;
  border-radius: var(--radius, 6px);
  justify-content: center;
}

nav.sidebar.collapsed .sidebar-credits-badge .credits-text {
  display: none;
}

/* Collapsed: project list items render with inline padding/flex from JS;
   override here so icons sit centered under the "+" button instead of
   shifted left under the original 16px padding. */
nav.sidebar.collapsed #sidebarProjectsList .nav-link {
  padding: 7px 0 !important;
  margin: 1px 8px !important;
  justify-content: center !important;
  gap: 0 !important;
}
nav.sidebar.collapsed #sidebarProjectsList .nav-link span {
  display: none !important;
}
nav.sidebar.collapsed #sidebarProjectsList .nav-link i {
  font-size: 14px !important;
  width: auto !important;
  margin: 0 !important;
}
/* Section titles (My Projects / Shared with me) and their wrapper rows
   become noise when there's only a column of icons. */
nav.sidebar.collapsed .nav-section-header,
nav.sidebar.collapsed .sidebar-empty-projects {
  display: none;
}

/* ── Page backgrounds ─────────────────────────────────────────────────────── */

.workspace-page {
  background: var(--paper);
  min-height: 100vh;
}

.workspace-canvas {
  padding: var(--s-5) var(--s-6);
}

@media (max-width: 768px) {
  .workspace-canvas { padding: var(--s-4) var(--s-4); }
}

/* ── Project cards ────────────────────────────────────────────────────────── */

.project-card-warm {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--s-4);
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  text-decoration: none;
  display: block;
  color: var(--ink);
  min-height: 110px;
}

.project-card-warm:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--ink);
}

.project-card-warm .pc-type-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  margin-bottom: var(--s-3);
  flex-shrink: 0;
}

.project-card-warm .pc-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: var(--s-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-card-warm .pc-meta {
  font-size: 11px;
  color: var(--ink-mute);
}

.project-card-warm .pc-status {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  font-size: 11px;
  font-weight: 600;
}

/* ── Activity feed ────────────────────────────────────────────────────────── */

.feed-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--s-3) var(--s-4);
  overflow-y: auto;
}

.feed-entry {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--rule);
}

.feed-entry:last-child { border-bottom: none; }

.feed-entry-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
}

/* ── Section headers ──────────────────────────────────────────────────────── */

.section-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: var(--s-3);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background var(--dur-fast), transform var(--dur-fast);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.btn-accent:hover {
  background: #9A3509;
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
}

.btn-warm-outline {
  background: transparent;
  color: var(--ink-mute);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 13px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.btn-warm-outline:hover {
  background: var(--paper-sunk);
  color: var(--ink);
  border-color: var(--ink-mute);
  text-decoration: none;
}

/* ── Empty states ─────────────────────────────────────────────────────────── */

.empty-state {
  border: 2px dashed var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-raised);
  padding: var(--s-7) var(--s-5);
  text-align: center;
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: var(--s-4); }

.empty-state h5 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--s-3);
}

.empty-state p {
  color: var(--ink-mute);
  font-size: 14px;
  max-width: 360px;
  margin: 0 auto var(--s-4);
  line-height: 1.6;
}

/* ── Template gallery cards ───────────────────────────────────────────────── */

.template-card {
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--paper-raised);
  padding: var(--s-4);
  cursor: pointer;
  transition: box-shadow var(--dur-fast), transform var(--dur-fast);
  text-decoration: none;
  color: var(--ink);
  display: block;
}

.template-card:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--ink);
}

.template-card .tc-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--s-2);
}

.template-card .tc-desc {
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.55;
  margin: 0;
}

/* ── Quote cards (results, insights) ─────────────────────────────────────── */

.quote-card-warm {
  background: var(--paper-sunk);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--s-4);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}

/* ── Stats strip ──────────────────────────────────────────────────────────── */

.stat-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 2px;
}

.stat-card .stat-label {
  font-size: 11px;
  color: var(--ink-mute);
}

/* ── Wave timeline marker ─────────────────────────────────────────────────── */

.wave-marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.wave-marker.sent     { background: var(--accent); }
.wave-marker.scheduled { border: 2px solid var(--ink-mute); background: transparent; }
.wave-marker.sending  {
  border: 2px solid var(--accent);
  background: transparent;
  animation: pulse-ring 1.2s ease infinite;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180,65,14,0.4); }
  50%       { box-shadow: 0 0 0 4px rgba(180,65,14,0); }
}

/* ── Badge (postage-stamp style) ──────────────────────────────────────────── */

.badge-stamp {
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-sunk);
  padding: var(--s-3);
  text-align: center;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.badge-stamp.earned {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: var(--shadow-card);
}

/* ── Loading skeletons ────────────────────────────────────────────────────── */

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--paper-sunk) 25%, var(--rule) 50%, var(--paper-sunk) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius);
}

/* ── Misc ─────────────────────────────────────────────────────────────────── */

.divider-warm {
  border: none;
  border-top: 1px solid var(--rule);
  margin: var(--s-5) 0;
}

/* Main content area when on project pages */
.main-content.project-surface {
  background: var(--paper);
}
