/* Custom Styling beyond Tailwind */

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */
.custom-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ─── Base ─────────────────────────────────────────────────────────────────── */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── CSS Masonry Columns ──────────────────────────────────────────────────── */
.columns-2 { column-count: 2; }
.columns-3 { column-count: 3; }
.columns-4 { column-count: 4; }
.columns-5 { column-count: 5; }
.gap-4 { column-gap: 1rem; }
.gap-5 { column-gap: 1.25rem; }
.gap-6 { column-gap: 1.5rem; }
.break-inside-avoid { break-inside: avoid; margin-bottom: 1rem; }

/* ─── Gallery ──────────────────────────────────────────────────────────────── */
.gallery-item img {
  transform-origin: center;
  will-change: transform;
  display: block;
}

/* ─── Tooltip ──────────────────────────────────────────────────────────────── */
.tooltip-trigger { position: relative; }
.tooltip-trigger:hover::after {
  content: attr(title);
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.1);
}

/* ─── Modal Transitions ────────────────────────────────────────────────────── */
.modal-overlay {
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal-overlay.modal-visible {
  opacity: 1;
}
.modal-overlay > div {
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0;
}
.modal-overlay.modal-visible > div {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ─── Animations ───────────────────────────────────────────────────────────── */
@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-slide-up {
  animation: slideUpFade 0.35s ease-out forwards;
}

@keyframes shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.5s infinite;
}

/* ─── Version Tree indent lines ────────────────────────────────────────────── */
.version-tree-indent {
  border-left: 2px solid rgba(255,255,255,0.1);
  margin-left: 12px;
  padding-left: 12px;
}

/* ─── Notification badge pulse ─────────────────────────────────────────────── */
#notif-badge {
  animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ─── Gallery loading skeleton ─────────────────────────────────────────────── */
.gallery-skeleton {
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.04) 100%);
  border-radius: 1rem;
  animation: shimmer 1.8s infinite;
}

/* ─── Detail sidebar mobile handle ────────────────────────────────────────── */
#detail-sidebar .handle-bar {
  width: 48px;
  height: 5px;
  background: rgba(255,255,255,0.2);
  border-radius: 9999px;
  margin: 12px auto 0;
}

/* ─── Upvote button active state ───────────────────────────────────────────── */
.upvote-btn.active i,
.upvote-btn[data-voted="1"] i {
  color: #ef4444;
}

/* ─── AI loading spinner glow ──────────────────────────────────────────────── */
#ai-loading .spin-ring {
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

/* ─── Responsive: Hide sidebar on mobile ───────────────────────────────────── */
@media (max-width: 767px) {
  #sidebar {
    position: fixed;
    z-index: 40;
  }
}
