/* =====================================================================
   SIDEBAR ENHANCED v2 — Full Animation & Visual Upgrade
   Đặt SAU style.css trong <head>
   ===================================================================== */

/* ═══════════════════════════════════════════════
   KEYFRAMES
   ═══════════════════════════════════════════════ */

@keyframes sb-fadeSlideDown {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes sb-fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes sb-scaleIn {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes sb-avatarRing {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

@keyframes sb-glowPulse {
  0%   { opacity: 0.22; transform: scale(0.9); }
  100% { opacity: 0.6;  transform: scale(1.12); }
}

@keyframes sb-statusBlink {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.7); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

@keyframes sb-badgeFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(-2px); }
}

@keyframes sb-scanline {
  0%   { top: -8%; }
  100% { top: 110%; }
}

@keyframes sb-navStagger {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes sb-socialPop {
  0%   { opacity: 0; transform: scale(0.5) translateY(8px); }
  70%  { transform: scale(1.15) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes sb-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes sb-discordSlide {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════
   PROFILE CARD
   ═══════════════════════════════════════════════ */

.profile-card {
  background:
    linear-gradient(160deg,
      rgba(16, 24, 38, 0.97) 0%,
      rgba(8, 12, 22, 0.99) 100%
    );
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 26px;
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.06),
    0 24px 64px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(34, 197, 94, 0.04);
  overflow: hidden;
  animation: sb-fadeSlideDown 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
}

/* Hero banner strip */
.profile-card::before {
  content: '';
  display: block;
  height: 78px;
  background:
    linear-gradient(135deg,
      rgba(34, 197, 94, 0.22) 0%,
      rgba(16, 185, 129, 0.14) 45%,
      rgba(37, 99, 235, 0.1) 100%
    );
  border-bottom: 1px solid rgba(34, 197, 94, 0.12);
  margin-bottom: -38px;
  flex-shrink: 0;
  position: relative;
}

/* Scanline shimmer trên banner */
.profile-card::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: -8%;
  height: 30px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(34, 197, 94, 0.07) 50%,
    transparent 100%
  );
  animation: sb-scanline 4s linear infinite;
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════════ */

.avatar-container {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 1.1rem;
  z-index: 2;
  animation: sb-scaleIn 0.5s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid rgba(34, 197, 94, 0.65);
  position: relative;
  z-index: 2;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.3s ease,
              box-shadow 0.3s ease;
  animation: sb-avatarRing 2.5s ease-out 0.8s;
}

.avatar:hover {
  transform: scale(1.07) rotate(-2deg);
  border-color: rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.4), 0 0 50px rgba(34, 197, 94, 0.15);
}

.avatar-glow {
  position: absolute;
  inset: -10px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.55), transparent 65%);
  filter: blur(14px);
  opacity: 0.3;
  border-radius: 50%;
  animation: sb-glowPulse 3s ease-in-out infinite alternate;
}

/* ═══════════════════════════════════════════════
   STATUS BADGE
   ═══════════════════════════════════════════════ */

.status-badge {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.45);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 3;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.2);
  animation: sb-badgeFloat 3s ease-in-out infinite;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.status-badge:hover {
  background: rgba(34, 197, 94, 0.18);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.3);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 6px #22c55e;
  animation: sb-statusBlink 2s ease infinite;
}

/* ═══════════════════════════════════════════════
   NAME & ROLE
   ═══════════════════════════════════════════════ */

.name {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
  padding: 0 1.5rem;
  animation: sb-fadeSlideUp 0.5s 0.35s ease both;
  /* Shimmer effect on name */
  background: linear-gradient(
    90deg,
    var(--text-main) 20%,
    rgba(34, 197, 94, 0.85) 50%,
    var(--text-main) 80%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: sb-fadeSlideUp 0.5s 0.35s ease both,
             sb-shimmer 5s linear 1.2s infinite;
}

.role {
  font-size: 0.65rem;
  color: var(--primary-color);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.75rem;
  padding: 0 1.5rem;
  opacity: 0.85;
  animation: sb-fadeSlideUp 0.5s 0.45s ease both;
}

/* ═══════════════════════════════════════════════
   BIO
   ═══════════════════════════════════════════════ */

.bio {
  font-size: 0.79rem;
  color: var(--text-muted);
  line-height: 1.65;
  padding: 0 1.5rem;
  margin-bottom: 0.9rem;
  animation: sb-fadeSlideUp 0.5s 0.55s ease both;
}

/* ═══════════════════════════════════════════════
   DISCORD WIDGET
   ═══════════════════════════════════════════════ */

.discord-widget {
  margin: 0 1rem 0.75rem;
  border-radius: 14px;
  background: rgba(88, 101, 242, 0.06);
  border: 1px solid rgba(88, 101, 242, 0.18);
  padding: 0.65rem 0.85rem;
  gap: 0.7rem;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
  animation: sb-discordSlide 0.5s 0.6s ease both;
}

.discord-widget:hover {
  background: rgba(88, 101, 242, 0.1);
  border-color: rgba(88, 101, 242, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.12);
}

/* ═══════════════════════════════════════════════
   NAV MENU
   ═══════════════════════════════════════════════ */

.nav-menu {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
  padding: 0 0.75rem;
  position: relative;
}

/* Label "NAVIGATION" */
.nav-menu::before {
  content: 'NAVIGATION';
  display: block;
  font-size: 0.6rem;
  letter-spacing: 2.8px;
  color: rgba(148, 163, 184, 0.3);
  font-family: var(--font-mono);
  padding: 0.6rem 0.6rem 0.35rem;
}

/* Staggered entry animation cho từng nav-link */
.nav-link:nth-child(2) { animation: sb-navStagger 0.4s 0.65s ease both; }
.nav-link:nth-child(3) { animation: sb-navStagger 0.4s 0.73s ease both; }
.nav-link:nth-child(4) { animation: sb-navStagger 0.4s 0.81s ease both; }
.nav-link:nth-child(5) { animation: sb-navStagger 0.4s 0.89s ease both; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.58rem 0.85rem;
  border-radius: 11px;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(148, 163, 184, 0.72);
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  transition:
    color 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease,
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.22s ease;
}

/* Ripple/shimmer layer trên hover */
.nav-link::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(34,197,94,0.07), transparent);
  transform: translateX(-100%);
  transition: transform 0.45s ease;
  pointer-events: none;
}

.nav-link:hover::after { transform: translateX(100%); }

.nav-link i {
  font-size: 0.88rem;
  width: 20px;
  text-align: center;
  opacity: 0.65;
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
  flex-shrink: 0;
}

.nav-link:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.06);
  transform: translateX(5px);
}

.nav-link:hover i {
  opacity: 1;
  color: var(--primary-color);
  transform: scale(1.2) rotate(-5deg);
}

/* Active state */
.nav-link.active {
  color: #d1fae5;
  background: linear-gradient(
    90deg,
    rgba(34, 197, 94, 0.13) 0%,
    rgba(34, 197, 94, 0.04) 100%
  );
  border-color: rgba(34, 197, 94, 0.22);
  transform: translateX(5px);
  box-shadow:
    0 2px 12px rgba(34, 197, 94, 0.08),
    inset 0 1px 0 rgba(34, 197, 94, 0.07);
}

/* Glowing left bar on active */
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #22c55e, #10b981);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7), 0 0 20px rgba(34, 197, 94, 0.3);
}

.nav-link.active i {
  color: var(--primary-color);
  opacity: 1;
  animation: bounce-small 2s infinite;
}

/* ═══════════════════════════════════════════════
   SOCIAL LINKS
   ═══════════════════════════════════════════════ */

.social-links {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  padding: 0.7rem 1rem 0.1rem;
  margin-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.social-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  position: relative;
  overflow: hidden;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease,
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s ease;
}

/* Staggered pop-in */
.social-links .social-btn:nth-child(1) { animation: sb-socialPop 0.4s 0.95s cubic-bezier(0.34,1.56,0.64,1) both; }
.social-links .social-btn:nth-child(2) { animation: sb-socialPop 0.4s 1.05s cubic-bezier(0.34,1.56,0.64,1) both; }
.social-links .social-btn:nth-child(3) { animation: sb-socialPop 0.4s 1.15s cubic-bezier(0.34,1.56,0.64,1) both; }

/* Glow sweep on hover */
.social-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(34,197,94,0.25), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.social-btn:hover::before { opacity: 1; }

.social-btn:hover {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--primary-color);
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.22);
}

.social-btn:active {
  transform: translateY(-1px) scale(0.97);
}

/* ═══════════════════════════════════════════════
   LIGHT THEME
   ═══════════════════════════════════════════════ */

body.light-theme .profile-card {
  background: linear-gradient(160deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(238, 248, 242, 0.94) 100%
  );
  border-color: rgba(5, 150, 105, 0.22);
  box-shadow:
    0 0 0 1px rgba(5, 150, 105, 0.07),
    0 24px 64px rgba(0, 0, 0, 0.1);
}

body.light-theme .profile-card::before {
  background: linear-gradient(135deg,
    rgba(5, 150, 105, 0.14) 0%,
    rgba(16, 185, 129, 0.08) 45%,
    rgba(59, 130, 246, 0.06) 100%
  );
}

body.light-theme .name {
  background: linear-gradient(90deg, #0f172a 20%, #059669 50%, #0f172a 80%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.light-theme .discord-widget {
  background: rgba(88, 101, 242, 0.05);
  border-color: rgba(88, 101, 242, 0.15);
}

body.light-theme .nav-link { color: #475569; }

body.light-theme .nav-link:hover {
  background: rgba(5, 150, 105, 0.07);
  color: #1e293b;
  border-color: rgba(5, 150, 105, 0.12);
}

body.light-theme .nav-link.active {
  color: #065f46;
  background: linear-gradient(90deg,
    rgba(5, 150, 105, 0.12) 0%,
    rgba(5, 150, 105, 0.03) 100%
  );
  border-color: rgba(5, 150, 105, 0.25);
  box-shadow: 0 2px 12px rgba(5, 150, 105, 0.08);
}

body.light-theme .nav-link.active::before {
  background: linear-gradient(180deg, #059669, #10b981);
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.6);
}

body.light-theme .nav-menu::before { color: rgba(100, 116, 139, 0.4); }

body.light-theme .social-links { border-top-color: rgba(0, 0, 0, 0.07); }

body.light-theme .social-btn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #64748b;
}

body.light-theme .social-btn:hover {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.35);
  color: #059669;
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.18);
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .profile-card::before { height: 64px; margin-bottom: -30px; }
}

@media (max-width: 768px) {
  .name  { padding: 0 1.2rem; }
  .role  { padding: 0 1.2rem; }
  .bio   { padding: 0 1.2rem; }
}