/* ═══════════════════════════════════════════════════════════════
   BreachBoard — Cyber-Noir UI Widgets & Effects
   Compatible with existing :root CSS variables in styles.css
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. SIDEBAR WIDGETS ─────────────────────────────────────── */

/* --- 1.1 Forum Statistics Widget (enhanced) --- */
.bb-stats-widget {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-panel), 0 0 0 1px rgba(52, 152, 219, 0.08);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.bb-stats-widget:hover {
  border-color: rgba(52, 152, 219, 0.35);
  box-shadow: var(--shadow-panel), 0 0 24px rgba(52, 152, 219, 0.12);
}

.bb-stats-header {
  padding: 10px 12px;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--header-gradient);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-inset);
}
.bb-stats-header i {
  font-size: 12px;
  opacity: 0.95;
  color: var(--accent2);
}

.bb-stats-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.bb-stat-cell {
  padding: 10px 8px;
  text-align: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.bb-stat-cell:nth-child(3n) { border-right: 0; }
.bb-stat-cell:nth-last-child(-n+3) { border-bottom: 0; }

.bb-stat-cell .bb-stat-number {
  display: block;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent2);
  line-height: 1.2;
  text-shadow: 0 0 10px rgba(52, 152, 219, 0.25);
}
.bb-stat-cell .bb-stat-label {
  display: block;
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}

/* --- 1.2 Crypto Ticker Widget --- */
.bb-ticker-widget {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-panel);
  margin-top: 10px;
}
.bb-ticker-widget:hover {
  border-color: rgba(52, 152, 219, 0.3);
  box-shadow: var(--shadow-panel), 0 0 18px rgba(52, 152, 219, 0.1);
}

.bb-ticker-header {
  padding: 10px 12px;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--header-gradient);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-inset);
}
.bb-ticker-header .bb-ticker-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bb-ticker-header .bb-live-dot {
  width: 6px;
  height: 6px;
  background: var(--green-bright);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green-bright);
  animation: bb-pulse-dot 2s ease-in-out infinite;
}

.bb-ticker-body {
  padding: 8px 12px;
}

.bb-ticker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.bb-ticker-row:last-child { border-bottom: 0; }

.bb-ticker-pair {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-bright);
}
.bb-ticker-pair .bb-ticker-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}
.bb-ticker-icon.btc {
  background: rgba(247, 147, 26, 0.15);
  color: #f7931a;
  border: 1px solid rgba(247, 147, 26, 0.3);
}
.bb-ticker-icon.xmr {
  background: rgba(255, 102, 0, 0.12);
  color: #ff6600;
  border: 1px solid rgba(255, 102, 0, 0.25);
}

.bb-ticker-price {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.02em;
}

.bb-ticker-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.bb-ticker-change.up {
  color: var(--green-bright);
  background: rgba(39, 174, 96, 0.12);
}
.bb-ticker-change.down {
  color: var(--red-bright);
  background: rgba(231, 76, 60, 0.12);
}
.bb-ticker-change i {
  font-size: 9px;
}

/* --- 1.3 Server Status Widget --- */
.bb-status-widget {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-panel);
  margin-top: 10px;
}
.bb-status-widget:hover {
  border-color: rgba(52, 152, 219, 0.3);
}

.bb-status-header {
  padding: 10px 12px;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--header-gradient);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-inset);
}

.bb-status-body {
  padding: 8px 12px;
}

.bb-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.bb-status-row:last-child { border-bottom: 0; }

.bb-status-label {
  font-size: 11px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.bb-status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.bb-status-indicator.online {
  background: var(--green-bright);
  box-shadow: 0 0 6px var(--green-bright), 0 0 12px rgba(39, 174, 96, 0.35);
  animation: bb-pulse-dot 2.2s ease-in-out infinite;
}
.bb-status-indicator.offline {
  background: var(--red);
  box-shadow: 0 0 4px var(--red);
}
.bb-status-indicator.warning {
  background: var(--orange);
  box-shadow: 0 0 4px var(--orange);
  animation: bb-pulse-dot 1.5s ease-in-out infinite;
}

.bb-status-text {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.bb-status-text.online { color: var(--green-bright); }
.bb-status-text.offline { color: var(--red-bright); }
.bb-status-text.warning { color: var(--orange); }

.bb-status-ping {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* ── 1.4 Sidebar media ─────────────────────────────────────── */
#sidebar .sidebar-box img:not(.avatar-photo):not(.avatar--xs):not(.avatar--sm):not(.avatar--md) {
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: cover;
}

#sidebar .avatar-photo,
#sidebar .avatar--xs,
#sidebar .avatar--sm,
#sidebar .avatar--md {
  max-width: 100%;
  object-fit: cover;
  overflow: hidden;
}

/* ── 2. DATABASE SEARCH BAR ─────────────────────────────────── */

.bb-db-search-wrap {
  position: relative;
  margin-bottom: 14px;
}

.bb-db-search {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-bright);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  outline: none;
  box-shadow: var(--shadow-inset), 0 2px 8px rgba(0,0,0,0.2);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.bb-db-search::placeholder {
  color: var(--text-dim);
  opacity: 0.7;
}
.bb-db-search:hover {
  border-color: rgba(52, 152, 219, 0.3);
}
.bb-db-search:focus {
  border-color: var(--accent2);
  background: var(--surface2);
  box-shadow:
    var(--shadow-inset),
    0 0 0 1px rgba(52, 152, 219, 0.25),
    0 0 20px rgba(52, 152, 219, 0.15),
    0 0 40px rgba(52, 152, 219, 0.06);
}

.bb-db-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 13px;
  pointer-events: none;
  transition: color 0.25s ease;
}
.bb-db-search-wrap:focus-within .bb-db-search-icon {
  color: var(--accent2);
}

/* ── 3. GLITCH HOVER EFFECT ─────────────────────────────────── */

.bb-glitch {
  position: relative;
  display: inline-block;
}
.bb-glitch::before,
.bb-glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}
.bb-glitch::before {
  color: var(--red-bright);
  clip-path: inset(0 0 85% 0);
}
.bb-glitch::after {
  color: var(--accent2);
  clip-path: inset(85% 0 0 0);
}

.bb-glitch:hover::before,
.bb-glitch:hover::after {
  opacity: 0.8;
  animation: bb-glitch-anim 0.35s ease-in-out forwards;
}
.bb-glitch:hover::after {
  animation-delay: 0.05s;
}

/* Glitch for images (logo banner) */
.bb-glitch-img {
  position: relative;
  display: inline-block;
  overflow: hidden;
}
.bb-glitch-img::before,
.bb-glitch-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  background-size: cover;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.bb-glitch-img::before {
  background-color: rgba(231, 76, 60, 0.25);
}
.bb-glitch-img::after {
  background-color: rgba(52, 152, 219, 0.25);
}
.bb-glitch-img:hover::before {
  opacity: 1;
  animation: bb-glitch-slice 0.4s steps(4) forwards;
}
.bb-glitch-img:hover::after {
  opacity: 1;
  animation: bb-glitch-slice 0.4s steps(4) 0.08s forwards reverse;
}

/* ── 4. AVATAR ROLE GLOW EFFECTS ────────────────────────────── */

.bb-avatar-glow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.bb-avatar-glow:hover {
  transform: scale(1.08);
}

/* Admin = soft red neon glow */
.bb-avatar-glow.admin {
  box-shadow:
    0 0 6px rgba(231, 76, 60, 0.4),
    0 0 14px rgba(231, 76, 60, 0.25),
    0 0 24px rgba(231, 76, 60, 0.12);
  border: 1.5px solid rgba(236, 112, 99, 0.5);
}
.bb-avatar-glow.admin:hover {
  box-shadow:
    0 0 8px rgba(231, 76, 60, 0.6),
    0 0 18px rgba(231, 76, 60, 0.35),
    0 0 32px rgba(231, 76, 60, 0.18);
}

/* Moderator = soft green neon glow */
.bb-avatar-glow.moderator {
  box-shadow:
    0 0 6px rgba(39, 174, 96, 0.4),
    0 0 14px rgba(39, 174, 96, 0.25),
    0 0 24px rgba(39, 174, 96, 0.12);
  border: 1.5px solid rgba(62, 224, 143, 0.5);
}
.bb-avatar-glow.moderator:hover {
  box-shadow:
    0 0 8px rgba(39, 174, 96, 0.6),
    0 0 18px rgba(39, 174, 96, 0.35),
    0 0 32px rgba(39, 174, 96, 0.18);
}

/* VIP / MVP variants (optional) */
.bb-avatar-glow.vip {
  box-shadow:
    0 0 6px rgba(244, 208, 63, 0.35),
    0 0 14px rgba(244, 208, 63, 0.2),
    0 0 24px rgba(244, 208, 63, 0.1);
  border: 1.5px solid rgba(255, 214, 102, 0.45);
}

/* ── 5. ACP / MOD BUTTON GLITCH VARIANTS ────────────────────── */

.bb-btn-glitch {
  position: relative;
  overflow: hidden;
  transition: color 0.2s ease;
}
.bb-btn-glitch::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transition: left 0.4s ease;
}
.bb-btn-glitch:hover::before {
  left: 100%;
}

.bb-btn-glitch.admin:hover {
  text-shadow:
    2px 0 var(--red),
    -2px 0 var(--accent2);
  animation: bb-glitch-text 0.3s ease-in-out;
}
.bb-btn-glitch.mod:hover {
  text-shadow:
    2px 0 var(--green),
    -2px 0 var(--accent2);
  animation: bb-glitch-text 0.3s ease-in-out;
}

/* ── KEYFRAMES ──────────────────────────────────────────────── */

@keyframes bb-pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.85);
  }
}

@keyframes bb-glitch-anim {
  0% { transform: translate(0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, 1px); }
  80% { transform: translate(2px, -1px); }
  100% { transform: translate(0); opacity: 0; }
}

@keyframes bb-glitch-slice {
  0% { clip-path: inset(0 0 100% 0); transform: translateX(-4px); }
  25% { clip-path: inset(30% 0 50% 0); transform: translateX(4px); }
  50% { clip-path: inset(60% 0 20% 0); transform: translateX(-3px); }
  75% { clip-path: inset(10% 0 70% 0); transform: translateX(2px); }
  100% { clip-path: inset(0 0 0 0); transform: translateX(0); opacity: 0; }
}

@keyframes bb-glitch-text {
  0% { text-shadow: 2px 0 var(--red), -2px 0 var(--accent2); }
  25% { text-shadow: -2px 0 var(--red), 2px 0 var(--accent2); }
  50% { text-shadow: 1px 0 var(--red), -1px 0 var(--accent2); }
  75% { text-shadow: -1px 0 var(--red), 1px 0 var(--accent2); }
  100% { text-shadow: none; }
}

/* ═══════════════════════════════════════════════════════════════
   EPHEMERAL PM — Countdown & Text-Dissolve Effects
   ═══════════════════════════════════════════════════════════════ */

.pm-ephemeral-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(231, 76, 60, 0.12);
  color: var(--red-bright);
  border: 1px solid rgba(231, 76, 60, 0.25);
  margin-left: 6px;
  vertical-align: middle;
}
.pm-ephemeral-badge i {
  font-size: 8px;
}

.pm-countdown {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--red-bright);
  letter-spacing: 0.04em;
  margin-left: 4px;
  animation: bb-pulse-dot 2s ease-in-out infinite;
}

.pm-bubble--ephemeral {
  position: relative;
}

/* Text-dissolving animation for messages nearing expiration */
.pm-dissolve {
  animation: bb-text-dissolve 0.6s ease-in forwards;
}

@keyframes bb-text-dissolve {
  0% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
  50% {
    opacity: 0.5;
    filter: blur(2px);
    transform: translateY(-2px) scale(0.98);
  }
  100% {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(-6px) scale(0.92);
  }
}

.pm-ephemeral-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.pm-ephemeral-selector select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  outline: none;
}
.pm-ephemeral-selector select:focus {
  border-color: var(--accent2);
}

/* ═══════════════════════════════════════════════════════════════
   REPUTATION LOCK — Blur / Glow Overlay for Hidden Content
   ═══════════════════════════════════════════════════════════════ */

.bb-hidden-content-wrap {
  position: relative;
  margin: 8px 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.bb-hidden-content-blur {
  position: relative;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(12, 15, 20, 0.95), rgba(20, 25, 35, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 48px;
}

.bb-hidden-content-blur .bb-hidden-blur-layer {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: rgba(10, 12, 16, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 2;
  border-radius: var(--radius);
  transition: opacity 0.3s ease;
}

.bb-hidden-content-blur.unlocked .bb-hidden-blur-layer {
  opacity: 0;
  pointer-events: none;
}

.bb-hidden-glow-text {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent2);
  text-shadow: 0 0 8px rgba(52, 152, 219, 0.4), 0 0 18px rgba(52, 152, 219, 0.2);
}

.bb-hidden-reveal-btn {
  background: none;
  border: 1px solid rgba(52, 152, 219, 0.4);
  color: var(--accent2);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.bb-hidden-reveal-btn:hover {
  background: rgba(52, 152, 219, 0.12);
  box-shadow: 0 0 8px rgba(52, 152, 219, 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   SECURE CODE SNIPPETS — Syntax Highlighting & Copy Button
   ═══════════════════════════════════════════════════════════════ */

pre.bb-code-block {
  position: relative;
  background: #1d1f21;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 10px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  box-shadow: var(--shadow-panel);
}

pre.bb-code-block code {
  font-family: var(--font-mono);
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  line-height: inherit;
}

.bb-code-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}
pre.bb-code-block:hover .bb-code-copy-btn {
  opacity: 1;
}
.bb-code-copy-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.bb-code-copy-btn.copied {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

/* Inline code */
code.bb-inline-code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--accent2);
}

/* ═══════════════════════════════════════════════════════════════
   ERROR BOUNDARY — Cyber-Noir Crash Card
   ═══════════════════════════════════════════════════════════════ */

.bb-err-boundary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 24px;
}

.bb-err-card {
  max-width: 480px;
  width: 100%;
  background: linear-gradient(145deg, rgba(12, 15, 20, 0.98), rgba(20, 25, 35, 0.99));
  border: 1px solid rgba(231, 76, 60, 0.35);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 0 24px rgba(231, 76, 60, 0.12), var(--shadow-panel);
  animation: bb-err-fade-in 0.35s ease-out;
}

@keyframes bb-err-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bb-err-icon {
  font-size: 36px;
  color: var(--red-bright);
  margin-bottom: 14px;
  text-shadow: 0 0 14px rgba(231, 76, 60, 0.35);
}

.bb-err-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}

.bb-err-body {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0 0 18px;
}

.bb-err-code {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--red-bright);
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.25);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}

.bb-err-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
