/* =============================================
   CHAIN MODE - USER INFO PANEL
   Chain-themed styling with blue/cyan colors
   ============================================= */

/* =====================
   DESKTOP SIDEBAR
   ===================== */

.chain-layout {
  display: flex;
  gap: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
}

.chain-sidebar--left {
  position: sticky;
  top: 80px;
  height: calc(100vh - 100px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  width: 280px;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--chain-accent) rgba(30, 41, 59, 0.3);
}

.chain-sidebar--left::-webkit-scrollbar {
  width: 6px;
}

.chain-sidebar--left::-webkit-scrollbar-track {
  background: rgba(30, 41, 59, 0.3);
  border-radius: 3px;
}

.chain-sidebar--left::-webkit-scrollbar-thumb {
  background: var(--chain-accent);
  border-radius: 3px;
}

/* User Info Card */
.chain-user-info {
  background: rgba(30, 41, 59, 0.8);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  border: 2px solid var(--chain-primary);
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Animated chain-link border at top */
.chain-user-info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--chain-accent), transparent);
  animation: chainFlow 2s linear infinite;
}

@keyframes chainFlow {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Top Row: Position - Avatar - Level */
.chain-user-info__top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Badge Styling (Position and Level) */
.chain-user-info__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  cursor: default;
  flex-shrink: 0;
}

.chain-user-info__badge::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: 300% 300%;
  animation: badge-gradient-shift 4s ease infinite;
  border-radius: inherit;
}

@keyframes badge-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Position Badge - Gold Gradient (leaderboard consistency) */
.chain-user-info__badge--position::before {
  background: linear-gradient(135deg,
    #f7931a 0%,
    #ffcd00 25%,
    #ffd700 50%,
    #daa520 75%,
    #f7931a 100%);
}

/* Level Badge - Chain Blue/Cyan Gradient */
.chain-user-info__badge--level::before {
  background: linear-gradient(135deg,
    var(--chain-primary) 0%,
    var(--chain-accent) 25%,
    #00d4ff 50%,
    var(--chain-secondary) 75%,
    var(--chain-primary) 100%);
}

.chain-user-info__badge-number {
  position: relative;
  z-index: 1;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Badge Tooltips */
.chain-position-tooltip,
.chain-level-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(25, 28, 38, 0.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--chain-accent);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  z-index: 100;
  min-width: 200px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.chain-user-info__badge:hover .chain-position-tooltip,
.chain-user-info__badge:hover .chain-level-tooltip {
  opacity: 1;
  visibility: visible;
  top: calc(100% + 12px);
}

.chain-position-tooltip__title,
.chain-level-tooltip__title {
  font-size: 0.875rem;
  color: var(--chain-accent);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.chain-position-tooltip__ahead,
.chain-position-tooltip__behind,
.chain-level-tooltip__description {
  font-size: 0.75rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.chain-position-tooltip__ahead {
  color: #fbbf24;
}

.chain-position-tooltip__behind {
  color: #10b981;
}

/* Avatar Section */
.chain-user-info__avatar-wrapper {
  margin: 0;
  flex-shrink: 0;
}

.chain-user-info__avatar-container {
  position: relative;
  width: 80px;
  height: 80px;
}

.chain-user-info__avatar {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 3px solid var(--chain-accent);
  object-fit: cover;
  box-shadow:
    0 0 20px rgba(0, 212, 255, 0.3),
    inset 0 0 10px rgba(67, 160, 252, 0.2);
  animation: avatar-glow 3s ease-in-out infinite;
}

@keyframes avatar-glow {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(0, 212, 255, 0.3),
      inset 0 0 10px rgba(67, 160, 252, 0.2);
  }
  50% {
    box-shadow:
      0 0 30px rgba(0, 212, 255, 0.5),
      inset 0 0 15px rgba(67, 160, 252, 0.3);
  }
}

/* Username Overlay with Marquee */
.chain-user-info__avatar-username {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 212, 255, 0.3) 50%, rgba(30, 41, 59, 0.9) 100%);
  padding: 0.25rem 0.5rem;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  overflow: hidden;
}

.chain-user-info__avatar-username .marquee {
  overflow: hidden;
}

.chain-user-info__avatar-username .marquee p {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Stats Section */
.chain-user-info__stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}

.chain-user-info__stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(67, 160, 252, 0.2);
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.chain-user-info__stat:hover {
  background: rgba(0, 212, 255, 0.05);
  border-left-color: var(--chain-accent);
  padding-left: 0.75rem;
}

.chain-user-info__stat:last-child {
  border-bottom: none;
}

.chain-user-info__stat-label {
  font-size: 0.875rem;
  color: #94a3b8;
  font-weight: 500;
  margin: 0;
}

.chain-user-info__stat-value {
  font-size: 1rem;
  color: var(--chain-accent);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
  margin: 0;
}

/* =====================
   TWO-COLUMN STATS LAYOUT
   ===================== */

/* Stats Container - Two Columns */
.chain-user-info__stats-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.chain-user-info__stats-column {
  display: flex;
  flex-direction: column;
}

.chain-stats-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--chain-accent);
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(67, 160, 252, 0.3);
}

/* Adjust stats for narrower columns */
.chain-user-info__stats-column .chain-user-info__stat {
  padding: 0.5rem 0.25rem;
  font-size: 0.8rem;
}

.chain-user-info__stats-column .chain-user-info__stat-label {
  font-size: 0.75rem;
}

.chain-user-info__stats-column .chain-user-info__stat-value {
  font-size: 0.85rem;
}

/* Responsive: Stack on smaller screens */
@media (max-width: 1200px) {
  .chain-user-info__stats-container {
    grid-template-columns: 1fr;
  }
}

/* =====================
   MOBILE STICKY HEADER
   ===================== */

.chain-user-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(30, 41, 59, 0.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--chain-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 60px;
  z-index: 90;
  margin-bottom: 1rem;
}

/* Avatar Section */
.chain-user-header__left {
  position: relative;
  flex-shrink: 0;
}

.chain-user-header__avatar {
  width: 45px;
  height: 45px;
  border-radius: 8px;
  border: 2px solid var(--chain-accent);
  object-fit: cover;
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.chain-user-header__rank-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #f7931a, #ffcd00, #ffd700);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(30, 41, 59, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.rank-badge__number {
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Points Group */
.chain-user-header__points-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.chain-user-header__center,
.chain-user-header__points-today-wrapper {
  display: flex;
  align-items: center;
}

.chain-user-header__points,
.chain-user-header__points-today,
.chain-user-header__rank {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--chain-accent);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.chain-user-header__points span,
.chain-user-header__points-today span,
.chain-user-header__rank span {
  color: #fff;
  font-weight: 700;
}

/* Ranks Group */
.chain-user-header__ranks-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* =====================
   RESPONSIVE
   ===================== */

/* Desktop - Show sidebar, hide mobile header */
@media (min-width: 1024px) {
  .desktop-only {
    display: block !important;
  }
  .mobile-only {
    display: none !important;
  }
}

/* Mobile/Tablet - Hide sidebar, show mobile header */
@media (max-width: 1023px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: flex !important;
  }

  .chain-layout {
    flex-direction: column;
  }

  .mode-container {
    width: 100%;
  }
}

/* Tablet (768px - 1023px) - Show more stats */
@media (min-width: 768px) and (max-width: 1023px) {
  .chain-user-header {
    gap: 1.5rem;
  }

  .chain-user-header__points-today-wrapper {
    display: flex;
  }
}

/* Mobile (below 768px) - Compact layout */
@media (max-width: 767px) {
  .chain-user-header {
    padding: 0.5rem 0.75rem;
    gap: 0.75rem;
  }

  .chain-user-header__avatar {
    width: 32px;
    height: 32px;
  }

  .chain-user-header__rank-badge {
    width: 20px;
    height: 20px;
  }

  .rank-badge__number {
    font-size: 0.6rem;
  }

  .chain-user-header__points,
  .chain-user-header__points-today,
  .chain-user-header__rank {
    font-size: 0.75rem;
  }

  .chain-user-header__points-today-wrapper {
    display: none; /* Hide today's points on small mobile */
  }
}

/* Very small mobile (below 360px) */
@media (max-width: 359px) {
  .chain-user-header {
    font-size: 0.7rem;
  }

  .chain-user-header__points-group {
    gap: 0;
  }
}
