/* ===========================================
   Layout — Violet Theme
   =========================================== */

/* ── HERO BANNER ── */
.hero-banner {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  overflow: hidden;
  animation: hero-fadein 0.6s ease-out;
}

.hero-banner.hero-exit {
  animation: hero-fadeout 0.5s ease-in forwards;
  pointer-events: none;
}

@keyframes hero-fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes hero-fadeout {
  to { opacity: 0; }
}

/* Animated grid background */
.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  inset: -50%;
  background-image:
    linear-gradient(rgba(155, 138, 245, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 138, 245, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: hero-grid-drift 20s linear infinite;
}

@keyframes hero-grid-drift {
  to { transform: translate(60px, 60px); }
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
}

.hero-orb--1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  top: 10%;
  left: 15%;
  animation: hero-float-1 8s ease-in-out infinite;
}

.hero-orb--2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
  bottom: 10%;
  right: 15%;
  animation: hero-float-2 10s ease-in-out infinite;
}

@keyframes hero-float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.1); }
}

@keyframes hero-float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 20px) scale(1.15); }
}

.hero-scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.15;
  animation: hero-scan 4s ease-in-out infinite;
}

@keyframes hero-scan {
  0% { top: 0%; }
  100% { top: 100%; }
}

/* Content */
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 680px;
  padding: 0 32px;
  animation: hero-content-up 0.8s ease-out 0.2s both;
}

@keyframes hero-content-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(155, 138, 245, 0.08);
  border: 1px solid rgba(155, 138, 245, 0.2);
  border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
  animation: hero-dot-pulse 1.5s ease-in-out infinite;
}

@keyframes hero-dot-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #22c55e; }
  50% { opacity: 0.6; box-shadow: 0 0 12px #22c55e; }
}

.hero-headline {
  font-family: 'DM Sans', sans-serif;
  font-size: 42px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -1px;
  margin: 0 0 20px;
}

.hero-accent {
  background: linear-gradient(135deg, var(--gold) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 17px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 36px;
}

.hero-sub em {
  color: var(--text-secondary);
  font-style: normal;
  font-weight: 600;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--accent) 0%, #7b6ad8 100%);
  border: none;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 0 30px rgba(155, 138, 245, 0.25), 0 4px 15px rgba(0,0,0,0.3);
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(155, 138, 245, 0.4), 0 8px 25px rgba(0,0,0,0.4);
}

.hero-cta svg {
  transition: transform 0.25s ease;
}

.hero-cta:hover svg {
  transform: translateX(4px);
}

/* Bottom stats row */
.hero-stats-row {
  position: absolute;
  bottom: 48px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 64px;
  z-index: 1;
  animation: hero-content-up 0.8s ease-out 0.5s both;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hero-stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.hero-stat-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* When hero is hidden */
.hero-banner[hidden] {
  display: none;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--header-height);
  background: linear-gradient(90deg, rgba(8, 10, 16, .96) 0%, rgba(13, 16, 23, .94) 50%, rgba(8, 10, 16, .96) 100%);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 60;
  overflow: hidden;
}

.topbar-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--accent) 20%,
    var(--gold) 50%,
    var(--accent) 80%,
    transparent 100%
  );
  opacity: 0.6;
  animation: topbar-shimmer 4s ease-in-out infinite;
}

@keyframes topbar-shimmer {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* Logo group */
.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo-mark {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.logo-mark img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 12px rgba(155, 138, 245, 0.25);
}

.logo-pulse {
  position: absolute;
  inset: -3px;
  border-radius: 13px;
  background: conic-gradient(from 0deg, var(--accent), var(--gold), var(--accent));
  opacity: 0.35;
  z-index: 0;
  animation: logo-rotate 6s linear infinite;
  filter: blur(4px);
}

@keyframes logo-rotate {
  to { transform: rotate(360deg); }
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.logo-name {
  font-family: 'DM Sans', sans-serif;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--gold) 0%, #f0d860 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

/* Right section */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.stat-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.stat-chip span {
  color: var(--text-secondary);
  font-weight: 600;
}

.niche-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: border-color var(--transition-fast);
}

.niche-toggle:hover {
  border-color: var(--accent);
}

.niche-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent);
  animation: niche-pulse 2s ease-in-out infinite;
}

@keyframes niche-pulse {
  0%, 100% { box-shadow: 0 0 4px var(--accent); }
  50% { box-shadow: 0 0 10px var(--accent); }
}

.sign-out-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sign-out-btn:hover {
  color: var(--red);
  border-color: rgba(245, 82, 82, 0.3);
  background: rgba(245, 82, 82, 0.06);
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #10131c 0%, #0b0e15 40%, #0d1017 100%);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  overflow-y: auto;
  position: relative;
  z-index: 0;
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 120px;
  background: radial-gradient(ellipse 80% 100% at 50% -20%, rgba(155, 138, 245, .06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar::-webkit-scrollbar {
  width: 0;
}

.sb-section {
  padding: 0 12px;
  margin-bottom: 20px;
}

.sb-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-primary);
  padding: 0 8px;
  margin-bottom: 6px;
  opacity: .7;
  transition: opacity .2s ease;
}

.sb-section:hover .sb-section-label {
  opacity: .9;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s ease, box-shadow .2s ease, transform .1s ease;
  position: relative;
  margin-bottom: 2px;
}

.sb-item:hover {
  background: rgba(255, 255, 255, .035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}

.sb-item:active {
  transform: scale(.98);
}

.sb-item.active {
  background: linear-gradient(135deg, rgba(155, 138, 245, .14) 0%, rgba(26, 32, 48, .9) 100%);
  box-shadow: inset 0 0 0 1px rgba(155, 138, 245, .2), 0 0 12px rgba(155, 138, 245, .08);
}

.sb-item.active:hover {
  background: linear-gradient(135deg, rgba(155, 138, 245, .18) 0%, rgba(26, 32, 48, 1) 100%);
  box-shadow: inset 0 0 0 1px rgba(155, 138, 245, .25), 0 0 16px rgba(155, 138, 245, .1);
}

.sb-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: linear-gradient(180deg, var(--accent) 0%, #b8a8ff 100%);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px rgba(155, 138, 245, .5), 0 0 24px rgba(155, 138, 245, .2);
}

.sb-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: rgba(26, 32, 48, .6);
  border: 1px solid rgba(255, 255, 255, .04);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.sb-item:hover .sb-icon {
  background: rgba(26, 32, 48, .8);
}

.sb-item.active .sb-icon {
  background: rgba(155, 138, 245, .15);
  border-color: rgba(155, 138, 245, .25);
  box-shadow: 0 0 12px rgba(155, 138, 245, .12);
}

.sb-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .2px;
  transition: color .2s ease;
}

.sb-item.active .sb-label {
  color: var(--text-primary);
}

.sb-item:hover .sb-label {
  color: var(--text-secondary);
}

.sb-sublabel {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  transition: color .2s ease;
}

.sb-item:hover .sb-sublabel {
  color: var(--text-secondary);
}

.sb-item.active .sb-sublabel {
  color: var(--text-secondary);
}

.sb-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border) 20%, var(--border) 80%, transparent 100%);
  margin: 8px 20px;
}

.sb-niche-card {
  margin: 0 12px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(17, 21, 32, .8) 0%, rgba(13, 16, 23, .9) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  transition: border-color .25s ease, box-shadow .25s ease;
}

.sb-niche-card:hover {
  border-color: rgba(155, 138, 245, .12);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
}

.sb-nc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.sb-nc-label {
  font-size: 12px;
  color: var(--text-primary);
}

.sb-nc-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 700;
}

/* Niche Health — Cluster Power Matrix */
.sb-nh-header {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.sb-nh-baseline-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.sb-nh-baseline-row {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

.sb-nh-baseline-row strong {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--text-primary);
  margin-left: 2px;
}

.sb-nh-clusters {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sb-nh-cluster {
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.sb-nh-cl-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.sb-nh-cl-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.sb-nh-cl-count {
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  background: var(--bg-sunken);
  padding: 1px 5px;
  border-radius: 4px;
}

.sb-nh-cl-metrics {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.sb-nh-metric {
  font-size: 9px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
}

.sb-nh-metric.above {
  color: var(--sweet);
  background: rgba(76, 217, 100, .1);
}

.sb-nh-metric.below {
  color: var(--miss);
  background: rgba(255, 69, 58, .1);
}

.sb-nh-metric.at {
  color: var(--text-muted);
  background: var(--bg-sunken);
}

.sb-nh-cl-diag {
  font-size: 10px;
  font-weight: 600;
}

.sb-nc-bar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.sb-nc-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, #b8a8ff 100%);
  box-shadow: 0 0 8px rgba(155, 138, 245, .35);
  transition: width .5s cubic-bezier(.34, 1.56, .64, 1);
}

.sb-bottom {
  margin-top: auto;
  padding: 12px 20px;
  position: relative;
}

.sb-bottom::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border) 30%, var(--border) 70%, transparent 100%);
}

.sb-bottom-text {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  opacity: .6;
  transition: opacity .25s ease;
}

.sidebar:hover .sb-bottom-text {
  opacity: .85;
}

/* ── BODY LAYOUT ── */
.body-layout {
  display: flex;
  height: calc(100vh - var(--header-height));
}

.main-area {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.main-scroll {
  height: 100%;
  overflow-y: auto;
  position: relative;
  background-image:
    radial-gradient(circle, rgba(155, 138, 245, .07) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 12px 12px;
}

/* Faint violet glow along left edge where sidebar meets content */
.main-scroll::before {
  content: '';
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  width: 120px;
  height: 100%;
  background: radial-gradient(ellipse at left center, rgba(155, 138, 245, .04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px 80px;
}

/* ── SECTIONS ── */
.content-section {
  display: block;
}

.content-section.hidden {
  display: none;
}

@keyframes section-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.content-section.section-enter {
  animation: section-enter 200ms ease-out both;
}

/* ── FULL-SCREEN DETAIL VIEW ── */
.detail-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-deep);
  background-image:
    radial-gradient(circle, rgba(155, 138, 245, .07) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 12px 12px;
  z-index: 50;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all .35s cubic-bezier(.22, 1, .36, 1);
}

.detail-view.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.detail-view::-webkit-scrollbar {
  width: 5px;
}

.detail-view::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
