/* ══════════════════════════════════════════════
   03-layout.css
   Sidebar, Navigation & Main Layout
   ══════════════════════════════════════════════ */

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-icon {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--accent);
  background: var(--accent-glow);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-accent);
  flex-shrink: 0;
  letter-spacing: -1px;
}
.brand-title { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.brand-sub { font-size: 0.65rem; color: var(--text-secondary); line-height: 1.3; margin-top: 1px; }

/* Progress overview */
.progress-overview {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.71rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.progress-track {
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* Badge row */
.badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  min-height: 22px;
}
.badge-icon {
  font-size: 1.05rem;
  filter: grayscale(1) opacity(0.35);
  transition: filter 0.4s ease, transform 0.3s ease;
  cursor: default;
  position: relative;
  display: inline-block;
}
.badge-icon.earned {
  filter: grayscale(0) opacity(1);
  animation: badgeEarn 0.5s ease;
}
@keyframes badgeEarn {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}
/* Tooltip */
.badge-icon::after {
  content: attr(title);
  position: absolute;
  bottom: 130%; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.62rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 99;
  color: var(--text-primary);
  font-family: var(--font-main);
}
.badge-icon:hover::after { opacity: 1; }

/* Nav list */
.nav-list { list-style: none; padding: 8px 0; flex: 1; }
.nav-list li { padding: 2px 8px; }

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.81rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition);
  text-align: left;
  position: relative;
}
.nav-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}
.nav-btn.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--border-accent);
}
.nav-icon { font-size: 0.95rem; flex-shrink: 0; width: 18px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #000;
  font-size: 0.58rem;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
}
.nav-badge.show { display: flex; }

/* Sidebar divider */
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 16px;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reset-btn {
  width: 100%;
  padding: 7px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.73rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.reset-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(255,77,109,0.06);
}

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 40px;
  max-width: calc(100% - var(--sidebar-w));
  position: relative;
  z-index: 1;
}

/* Tab sections */
.tab-section {
  display: none;
  animation: fadeIn 0.3s ease;
}
.tab-section.active { display: block; }

/* Bab header */
.bab-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.bab-chip {
  display: inline-block;
  padding: 3px 10px;
  background: var(--accent2-glow);
  border: 1px solid rgba(124,111,255,0.3);
  border-radius: 99px;
  color: var(--accent2);
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}
.bab-header h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.bab-header p { color: var(--text-secondary); font-size: 0.88rem; line-height: 1.65; }

/* ── HAMBURGER / MOBILE ── */
.hamburger {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  width: 38px; height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.hamburger:hover { border-color: var(--accent); color: var(--accent); }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 90;
  backdrop-filter: blur(2px);
}

/* ── TOAST NOTIFICATION ── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.84rem;
  color: var(--accent);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 9500;
  max-width: 300px;
  line-height: 1.4;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ── PARTICLE CANVAS ── */
#particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.3;
  mix-blend-mode: screen;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: flex; }
  .overlay.show { display: block; }

  .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 20px 16px;
    padding-top: 60px;
  }

  .toast { bottom: 16px; right: 16px; left: 16px; max-width: none; }
}

@media (max-width: 480px) {
  .main-content { padding: 16px 12px; padding-top: 56px; }
  .bab-header h2 { font-size: 1.25rem; }
}
