/* ============================================================================
   OpenMintArt Dopamine UI — Phase 9
   Glassmorphism, animated counters, status pills, confetti, notif bell.
   Loaded AFTER main.css / wallet.css so cascade order is clean.
   ============================================================================ */

:root {
  --dp-gold: #f6c453;
  --dp-gold-deep: #f0a830;
  --dp-cyan: #5ad1ff;
  --dp-cyan-deep: #3aa8d6;
  --dp-violet: #b08bff;
  --dp-mint: #5ce4b6;
  --dp-rose: #ff6b8a;
  --dp-amber: #ffb648;
  --dp-red: #ff5470;
  --dp-green: #4ade80;
  --dp-gray: #8a93a6;

  --dp-glass-bg: rgba(255, 255, 255, 0.06);
  --dp-glass-bg-strong: rgba(255, 255, 255, 0.1);
  --dp-glass-border: rgba(255, 255, 255, 0.14);
  --dp-glass-border-strong: rgba(255, 255, 255, 0.22);
  --dp-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.32),
                     inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ----------------------------------------------------------------------------
   ANIMATED COUNTERS
   -------------------------------------------------------------------------- */
.counter,
.data-counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.01em;
  transition: color 240ms ease;
  will-change: contents;
}

.counter.is-counting {
  color: var(--dp-cyan);
  text-shadow: 0 0 18px rgba(90, 209, 255, 0.5);
}

/* Flash effects after delta update (balance changed). */
.counter.flash-green {
  animation: counter-flash-green 800ms ease-out;
}
.counter.flash-red {
  animation: counter-flash-red 800ms ease-out;
}

@keyframes counter-flash-green {
  0%   { color: var(--dp-mint); text-shadow: 0 0 24px rgba(92, 228, 182, 0.7); transform: scale(1.05); }
  60%  { color: var(--dp-mint); }
  100% { color: inherit; text-shadow: none; transform: scale(1); }
}

@keyframes counter-flash-red {
  0%   { color: var(--dp-red); text-shadow: 0 0 24px rgba(255, 84, 112, 0.7); transform: scale(0.97); }
  60%  { color: var(--dp-red); }
  100% { color: inherit; text-shadow: none; transform: scale(1); }
}

@keyframes count-up {
  from { opacity: 0.4; transform: translateY(4px); }
  to   { opacity: 1;   transform: translateY(0); }
}

.counter.entering {
  animation: count-up 360ms ease-out both;
}

/* ----------------------------------------------------------------------------
   GLASS MODAL
   -------------------------------------------------------------------------- */
.glass-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  background: rgba(6, 10, 18, 0.55);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  opacity: 0;
  transition: opacity 220ms ease;
}

.glass-modal.open {
  display: flex;
  opacity: 1;
}

.glass-modal .glass-card {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 28px 28px 24px;
  border-radius: 20px;
  background: var(--dp-glass-bg-strong);
  border: 1px solid var(--dp-glass-border-strong);
  box-shadow: var(--dp-glass-shadow),
              0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transform: translateY(16px) scale(0.985);
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.glass-modal.open .glass-card {
  transform: translateY(0) scale(1);
}

.glass-modal .glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
              rgba(246, 196, 83, 0.4),
              rgba(90, 209, 255, 0.2),
              rgba(176, 139, 255, 0.3));
  -webkit-mask: linear-gradient(#000 0 0) content-box,
                linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
}

.glass-modal h3 {
  margin: 0 0 6px;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, var(--dp-gold), var(--dp-cyan));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

.glass-modal .glass-body {
  margin-top: 14px;
  color: rgba(240, 244, 255, 0.88);
  line-height: 1.55;
}

.glass-modal .glass-actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.glass-modal .glass-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.glass-modal .glass-close:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: rotate(90deg);
}

body.modal-open {
  overflow: hidden;
}

/* ----------------------------------------------------------------------------
   STATUS PILLS
   -------------------------------------------------------------------------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--dp-gray);
  white-space: nowrap;
  position: relative;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.status-pill.pending {
  color: var(--dp-amber);
  background: rgba(255, 182, 72, 0.12);
  border-color: rgba(255, 182, 72, 0.35);
  animation: pulse-pending 1.6s ease-in-out infinite;
}

.status-pill.confirmed,
.status-pill.completed,
.status-pill.active,
.status-pill.success {
  color: var(--dp-green);
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.35);
}

.status-pill.rejected,
.status-pill.failed,
.status-pill.error {
  color: var(--dp-red);
  background: rgba(255, 84, 112, 0.12);
  border-color: rgba(255, 84, 112, 0.4);
}

.status-pill.expired,
.status-pill.cancelled,
.status-pill.closed,
.status-pill.draft {
  color: var(--dp-gray);
  background: rgba(138, 147, 166, 0.12);
  border-color: rgba(138, 147, 166, 0.3);
}

.status-pill.listed,
.status-pill.minted {
  color: var(--dp-cyan);
  background: rgba(90, 209, 255, 0.12);
  border-color: rgba(90, 209, 255, 0.4);
}

.status-pill.locked {
  color: var(--dp-rose);
  background: rgba(255, 107, 138, 0.12);
  border-color: rgba(255, 107, 138, 0.4);
}

@keyframes pulse-pending {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 182, 72, 0.55); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 182, 72, 0); }
}

/* ----------------------------------------------------------------------------
   STAT TILES — large gradient cards with hover lift
   -------------------------------------------------------------------------- */
.stat-tile {
  position: relative;
  padding: 22px 22px 20px;
  border-radius: 18px;
  background:
    linear-gradient(135deg,
      rgba(246, 196, 83, 0.18) 0%,
      rgba(90, 209, 255, 0.12) 50%,
      rgba(176, 139, 255, 0.18) 100%);
  border: 1px solid var(--dp-glass-border);
  box-shadow: var(--dp-glass-shadow);
  overflow: hidden;
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 240ms ease,
              border-color 240ms ease;
  isolation: isolate;
}

.stat-tile::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(246, 196, 83, 0.45), transparent 60%);
  filter: blur(40px);
  z-index: -1;
  opacity: 0.7;
}

.stat-tile::after {
  content: "";
  position: absolute;
  inset: auto auto -40% -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(90, 209, 255, 0.35), transparent 60%);
  filter: blur(36px);
  z-index: -1;
  opacity: 0.6;
}

.stat-tile:hover {
  transform: translateY(-4px);
  border-color: var(--dp-glass-border-strong);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4),
              0 0 0 1px rgba(246, 196, 83, 0.18),
              inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.stat-tile .stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(240, 244, 255, 0.6);
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-tile .stat-value {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--dp-gold) 0%, var(--dp-cyan) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

.stat-tile .stat-delta {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.stat-tile .stat-delta.up   { color: var(--dp-green); }
.stat-tile .stat-delta.down { color: var(--dp-red); }
.stat-tile .stat-delta.flat { color: var(--dp-gray); }

/* ----------------------------------------------------------------------------
   TX ADDRESS — monospace + copy button + gradient border
   -------------------------------------------------------------------------- */
.tx-address {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  border-radius: 10px;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: rgba(240, 244, 255, 0.92);
  background: rgba(0, 0, 0, 0.32);
  position: relative;
  border: 1px solid transparent;
  background-clip: padding-box;
}

.tx-address::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg,
              rgba(246, 196, 83, 0.55),
              rgba(90, 209, 255, 0.45),
              rgba(176, 139, 255, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box,
                linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 200ms ease;
}

.tx-address:hover::before { opacity: 1; }

.tx-address .tx-copy {
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(240, 244, 255, 0.85);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 160ms ease, color 160ms ease;
}

.tx-address .tx-copy:hover {
  background: rgba(246, 196, 83, 0.18);
  color: var(--dp-gold);
}

.tx-address .tx-copy.copied {
  background: rgba(74, 222, 128, 0.2);
  color: var(--dp-green);
}

/* ----------------------------------------------------------------------------
   CONFETTI LAYER
   -------------------------------------------------------------------------- */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-layer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ----------------------------------------------------------------------------
   NOTIFICATION BELL
   -------------------------------------------------------------------------- */
.notification-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--dp-glass-border);
  cursor: pointer;
  font-size: 1.05rem;
  transition: background 180ms ease, transform 180ms ease;
  user-select: none;
}

.notification-bell:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.notification-bell .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--dp-red), var(--dp-rose));
  color: white;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(8, 12, 22, 0.95);
  transition: transform 200ms ease;
}

.notification-bell .badge:empty,
.notification-bell .badge[data-zero="1"] {
  display: none;
}

.notification-bell.pulse {
  animation: bell-shake 600ms ease;
}

@keyframes bell-shake {
  0%, 100% { transform: rotate(0); }
  20%  { transform: rotate(-14deg); }
  40%  { transform: rotate(10deg); }
  60%  { transform: rotate(-6deg); }
  80%  { transform: rotate(4deg); }
}

@keyframes glow-border {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(246, 196, 83, 0.45),
                0 0 0 0 rgba(90, 209, 255, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(246, 196, 83, 0),
                0 0 18px 2px rgba(90, 209, 255, 0.45);
  }
}

.notification-bell.glow {
  animation: glow-border 1.6s ease-in-out infinite;
}

/* Notification dropdown panel */
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-width: 92vw;
  max-height: 460px;
  overflow: auto;
  border-radius: 16px;
  background: rgba(14, 18, 30, 0.92);
  border: 1px solid var(--dp-glass-border-strong);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  z-index: 950;
  display: none;
  transform: translateY(-6px);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
}

.notif-panel.open {
  display: block;
  transform: translateY(0);
  opacity: 1;
}

.notif-panel .notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--dp-glass-border);
  font-weight: 600;
  font-size: 0.92rem;
}

.notif-panel .notif-list {
  list-style: none;
  margin: 0;
  padding: 6px;
}

.notif-panel .notif-item {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  display: block;
  color: rgba(240, 244, 255, 0.92);
  text-decoration: none;
  transition: background 160ms ease;
}

.notif-panel .notif-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.notif-panel .notif-item.unread {
  background: rgba(90, 209, 255, 0.07);
  border-left: 3px solid var(--dp-cyan);
  padding-left: 9px;
}

.notif-panel .notif-item .notif-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.notif-panel .notif-item .notif-body {
  font-size: 0.82rem;
  color: rgba(240, 244, 255, 0.7);
  line-height: 1.4;
}

.notif-panel .notif-item .notif-time {
  font-size: 0.7rem;
  color: rgba(240, 244, 255, 0.5);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.notif-panel .notif-empty {
  padding: 36px 16px;
  text-align: center;
  color: rgba(240, 244, 255, 0.55);
  font-size: 0.88rem;
}

/* ----------------------------------------------------------------------------
   TOASTS
   -------------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9900;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 340px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(14, 18, 30, 0.94);
  color: rgba(240, 244, 255, 0.95);
  border: 1px solid var(--dp-glass-border-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toast-in 260ms ease-out both;
}

.toast.is-leaving {
  animation: toast-out 240ms ease-in both;
}

.toast .toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--dp-cyan);
  box-shadow: 0 0 8px currentColor;
  color: var(--dp-cyan);
}

.toast.success .toast-dot { background: var(--dp-green); color: var(--dp-green); }
.toast.error .toast-dot   { background: var(--dp-red);   color: var(--dp-red); }
.toast.warn .toast-dot    { background: var(--dp-amber); color: var(--dp-amber); }

@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(20px); opacity: 0; }
}

/* ----------------------------------------------------------------------------
   REDUCED MOTION
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .counter,
  .stat-tile,
  .glass-modal,
  .glass-modal .glass-card,
  .notification-bell,
  .status-pill.pending,
  .toast {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

/* ----------------------------------------------------------------------------
   SMALL SCREENS
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .stat-tile { padding: 18px; }
  .stat-tile .stat-value { font-size: 1.6rem; }
  .notif-panel { right: -8px; }
}

/* ----------------------------------------------------------------------------
   MOBILE MENU BUTTON
   -------------------------------------------------------------------------- */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}
@media (max-width: 768px) {
  .mobile-menu-btn { display: block; }
  .topbar nav.open {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 100%;
    right: 1rem;
    background: rgba(15, 20, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    gap: 0.5rem;
  }
  .topbar nav.open a { padding: 0.5rem; }
}

/* ----------------------------------------------------------------------------
   RESPONSIVE POLISH (global)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .stat-bar { grid-template-columns: 1fr 1fr !important; gap: 0.75rem !important; }
  .tabs { overflow-x: auto; flex-wrap: nowrap !important; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; }
  .stat-tile { padding: 1rem !important; }
  .stat-tile .num { font-size: 1.5rem !important; }
  .glass-modal { width: 95vw !important; max-width: 95vw !important; margin: 1rem auto !important; }
  .topbar nav { display: none; }
  .topbar .mobile-menu-btn { display: block; }
  .nft-card { font-size: 0.85rem; }
  .notification-bell .badge { font-size: 0.65rem !important; padding: 0.15rem 0.35rem !important; }
  h1 { font-size: 1.75rem !important; }
}

@media (max-width: 480px) {
  .stat-bar { grid-template-columns: 1fr !important; }
  .stat-tile .num { font-size: 1.25rem !important; }
  .container { padding: 0 0.75rem !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
