/*
 * Diaspora Flows — Dashboard
 * Sidebar + main content layout. Works for both creator and listener.
 * P0-04.3: Design language retrofit — atmospheric depth, statement type, staggered entry.
 */

.dashboard {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: var(--theme-bg);
}

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

.dash-sidebar {
  background: var(--theme-bg-2);
  border-right: 1px solid var(--theme-border);
  display: flex; flex-direction: column;
  padding: 2rem 1.5rem;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  overflow: hidden;
}

/* Subtle top glow on the sidebar */
.dash-sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: radial-gradient(
    ellipse 80% 50% at 50% 0%,
    rgba(201, 168, 76, 0.06) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

.dash-nav {
  flex: 1; display: flex; flex-direction: column;
  gap: 2px; margin-top: 2.5rem;
  position: relative; z-index: 1;
}

.dash-nav-item {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.75rem 1rem;
  font-family: var(--df-font-body); font-size: 0.88rem;
  font-weight: 300; color: var(--theme-text-mid);
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.dash-nav-item:hover {
  color: var(--theme-text);
  border-left: 2px solid rgba(201, 168, 76, 0.3);
  background: transparent;
}
.dash-nav-item.active {
  color: var(--df-gold);
  border-left: 2px solid var(--df-gold);
  background: rgba(201, 168, 76, 0.05);
}
.dash-nav-icon { font-size: 1rem; flex-shrink: 0; }

.dash-user {
  display: flex; align-items: center; gap: 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--theme-border-s);
  margin-top: auto;
  position: relative; z-index: 1;
}
.dash-avatar {
  border-radius: 50%; object-fit: cover;
  border: 1px solid var(--theme-border);
}
.dash-user-info { flex: 1; min-width: 0; }
.dash-user-name {
  font-family: var(--df-font-body); font-size: 0.85rem;
  font-weight: 400; color: var(--theme-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-user-role {
  font-family: var(--df-font-mono); font-size: 0.72rem;
  color: var(--df-gold); letter-spacing: 0.1em; text-transform: uppercase;
  margin-top: 0.15rem;
}
.dash-sign-out {
  font-family: var(--df-font-mono); font-size: 0.72rem;
  color: var(--theme-text-mid); letter-spacing: 0.06em;
  text-transform: uppercase; text-decoration: none; flex-shrink: 0;
  transition: color 0.2s;
  background: none; border: 1px solid var(--theme-border);
  padding: 0.35rem 0.75rem; cursor: pointer;
}
.dash-sign-out:hover { color: var(--df-gold); border-color: var(--df-gold); }

/* ── Main content area ─────────────────────────────── */

.dash-main {
  padding: 2.5rem 3rem;
  overflow-y: auto;
  position: relative;
  overflow: hidden;
}

/* Atmosphere layer */
.db-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.db-glow {
  position: absolute;
  top: -10%;
  left: -5%;
  width: 60%;
  height: 70%;
  background: radial-gradient(
    ellipse 55% 55% at 20% 20%,
    rgba(201, 168, 76, 0.055) 0%,
    transparent 65%
  );
}

.db-bg-word {
  position: absolute;
  right: -3rem;
  bottom: -2rem;
  font-family: var(--df-font-sans);
  font-size: clamp(16rem, 28vw, 26rem);
  font-weight: 800;
  color: rgba(201, 168, 76, 0.028);
  letter-spacing: -0.05em;
  line-height: 1;
  user-select: none;
  white-space: nowrap;
}

/* All dashboard content sits above atmosphere */
.db-content {
  position: relative;
  z-index: 1;
}

/* ── Header ────────────────────────────────────────── */

.dash-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 3rem;
  flex-wrap: wrap; gap: 1rem;
}
.dash-header-actions {
  display: flex; align-items: center; gap: 1rem;
}

/* Statement-scale greeting */
.db-greeting {
  font-family: var(--df-font-serif);
  font-size: clamp(2.8rem, 5vw, 5rem);
  font-weight: 300;
  font-style: italic;
  letter-spacing: -0.025em;
  line-height: 0.95;
  color: var(--df-cream);
  margin-bottom: 0.25rem;
  opacity: 0;
  transform: translateY(20px);
  animation: db-reveal 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.05s;
}

.db-greeting-sub {
  font-family: var(--df-font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--df-gold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  opacity: 0;
  transform: translateY(16px);
  animation: db-reveal 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.11s;
}

.db-greeting-sub::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--df-gold);
  opacity: 0.5;
  flex-shrink: 0;
}

/* ── Empty state ───────────────────────────────────── */

.db-empty-state {
  max-width: 680px;
  padding: 4rem 0 3rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

.db-empty-cowrie {
  margin-bottom: 2.5rem;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.db-empty-headline {
  font-family: var(--df-font-serif);
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  font-weight: 300;
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--df-cream);
  margin-bottom: 0.75rem;
  opacity: 0;
  transform: translateY(16px);
  animation: db-reveal 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.17s;
}

.db-empty-sub {
  font-size: 0.95rem;
  color: var(--theme-text-mid);
  line-height: 1.85;
  max-width: 460px;
  margin-bottom: 3rem;
  opacity: 0;
  transform: translateY(16px);
  animation: db-reveal 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.23s;
}

/* Stats row — the numbers are the argument */
.db-stats-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 3rem;
  border: 1px solid var(--theme-border);
  width: 100%;
  max-width: 480px;
  opacity: 0;
  transform: translateY(16px);
  animation: db-reveal 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.29s;
}

.db-stat {
  flex: 1;
  padding: 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.db-stat-num {
  font-family: var(--df-font-mono);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 400;
  color: var(--df-gold);
  line-height: 1;
}

.db-stat-label {
  font-family: var(--df-font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--theme-text-low);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.db-stat-divider {
  width: 1px;
  background: var(--theme-border);
  flex-shrink: 0;
}

/* CTA */
.db-empty-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  opacity: 0;
  transform: translateY(16px);
  animation: db-reveal 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.35s;
}

/* Percussive button press */
.db-upload-btn {
  transition: background 0.15s ease, transform 0.12s cubic-bezier(0.4, 0, 0.2, 1);
}
.db-upload-btn:active {
  transform: scale(0.96);
}

.db-empty-phase-note {
  font-family: var(--df-font-mono);
  font-size: 0.72rem;
  color: var(--theme-text-low);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
}

/* ── Staggered entry keyframes ─────────────────────── */

@keyframes db-reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .db-greeting, .db-greeting-sub, .db-empty-headline,
  .db-empty-sub, .db-stats-row, .db-empty-actions {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ── Responsive ────────────────────────────────────── */

@media (max-width: 768px) {
  .dashboard { grid-template-columns: 1fr; }
  .dash-sidebar { height: auto; position: relative; padding: 1.5rem; }
  .dash-nav { flex-direction: row; flex-wrap: wrap; margin-top: 1.5rem; }
  .dash-main { padding: 1.5rem; }
  .db-stats-row { flex-direction: column; max-width: 100%; }
  .db-stat-divider { width: 100%; height: 1px; }
  .db-stat { padding: 1.25rem 1.5rem; }
}
