/* ============================================================
   KUPR PREMIUM UI SYSTEM — v1.0 March 2026
   Components:
     1. CSS Variables
     2. Top Progress Bar
     3. Skeleton Loader System
     4. Toast Notification System
     5. Button Micro-interactions & States
     6. Live Stats Bar
     7. Activity Ticker
     8. Count-Up & Number Animation
     9. Global Card Polish
     10. CTA Glow Effects
     11. Page Transition Fade
     12. Ripple Effect
   ============================================================ */

/* ============ 1. CSS VARIABLES ============ */
:root {
  --kp-gold:       #FFD700;
  --kp-gold-dim:   #F5A623;
  --kp-gold-glow:  rgba(255,215,0,0.35);
  --kp-bg:         #0D1117;
  --kp-card:       #161B22;
  --kp-card2:      #1C2128;
  --kp-border:     rgba(255,255,255,0.06);
  --kp-border-gold:rgba(255,215,0,0.18);
  --kp-text:       #E6EDF3;
  --kp-muted:      #8B949E;
  --kp-green:      #00D68F;
  --kp-red:        #FF4757;
  --kp-blue:       #58a6ff;
  --kp-purple:     #BB86FC;
  --kp-radius:     12px;
  --kp-radius-sm:  8px;
  --kp-ease:       cubic-bezier(0.22, 0.68, 0, 1.2);
  --kp-ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============ 2. TOP PROGRESS BAR ============ */
#kupr-progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--kp-gold), var(--kp-gold-dim), var(--kp-green));
  z-index: 999999;
  transition: width 0.3s ease, opacity 0.4s ease;
  pointer-events: none;
  box-shadow: 0 0 8px var(--kp-gold-glow);
}
#kupr-progress-bar.kupr-pb-done {
  width: 100% !important;
  opacity: 0;
}

/* ============ 3. SKELETON LOADER SYSTEM ============ */
@keyframes kupr-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

.kupr-skel {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.09) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: kupr-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--kp-radius-sm);
  color: transparent !important;
}
.kupr-skel-line  { height: 14px; border-radius: 4px; margin: 6px 0; }
.kupr-skel-title { height: 20px; border-radius: 4px; width: 60%; }
.kupr-skel-avatar {
  border-radius: 50% !important;
  width: 44px; height: 44px;
  flex-shrink: 0;
}
.kupr-skel-card {
  background: var(--kp-card) !important;
  border: 1px solid var(--kp-border) !important;
  border-radius: var(--kp-radius) !important;
  padding: 16px;
  overflow: hidden;
}
.kupr-skel-img {
  width: 100%; padding-top: 100%;
  border-radius: var(--kp-radius-sm);
}
.kupr-skel-btn {
  height: 36px; width: 100px;
  border-radius: 20px;
}

/* Grid skeleton — used while data loads */
.kupr-skel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.kupr-skel-grid-item {
  background: var(--kp-card);
  border: 1px solid var(--kp-border);
  border-radius: var(--kp-radius);
  padding: 16px;
}

/* ============ 4. TOAST NOTIFICATION SYSTEM ============ */
#kupr-toast-wrap {
  position: fixed;
  bottom: 72px; /* above bottom nav on mobile */
  right: 16px;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 340px;
  width: calc(100vw - 32px);
}
@media (min-width: 768px) {
  #kupr-toast-wrap { bottom: 24px; }
}

@keyframes kupr-toast-in {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0)   scale(1);    }
}
@keyframes kupr-toast-out {
  from { opacity: 1; transform: translateX(0)   scale(1);    }
  to   { opacity: 0; transform: translateX(40px) scale(0.9); max-height: 0; margin: 0; padding: 0; }
}

.kupr-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(22,27,34,0.96);
  border: 1px solid var(--kp-border);
  border-radius: var(--kp-radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  pointer-events: all;
  animation: kupr-toast-in 0.35s var(--kp-ease-out) forwards;
  cursor: pointer;
  min-width: 240px;
}
.kupr-toast.removing {
  animation: kupr-toast-out 0.3s ease forwards;
}
.kupr-toast-icon {
  font-size: 18px;
  line-height: 1.2;
  flex-shrink: 0;
  margin-top: 1px;
}
.kupr-toast-body { flex: 1; min-width: 0; }
.kupr-toast-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--kp-text);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kupr-toast-msg {
  font-size: 12px;
  color: var(--kp-muted);
  margin: 0;
  line-height: 1.4;
}
.kupr-toast-close {
  color: var(--kp-muted);
  font-size: 14px;
  opacity: 0.6;
  flex-shrink: 0;
  padding: 0 2px;
  transition: opacity 0.2s;
}
.kupr-toast-close:hover { opacity: 1; }

/* Toast color variants */
.kupr-toast-success { border-left: 3px solid var(--kp-green); }
.kupr-toast-success .kupr-toast-icon { color: var(--kp-green); }

.kupr-toast-error   { border-left: 3px solid var(--kp-red); }
.kupr-toast-error .kupr-toast-icon   { color: var(--kp-red); }

.kupr-toast-warning { border-left: 3px solid var(--kp-gold); }
.kupr-toast-warning .kupr-toast-icon { color: var(--kp-gold); }

.kupr-toast-info    { border-left: 3px solid var(--kp-blue); }
.kupr-toast-info .kupr-toast-icon    { color: var(--kp-blue); }

.kupr-toast-activity { border-left: 3px solid var(--kp-purple); }
.kupr-toast-activity .kupr-toast-icon { color: var(--kp-purple); }

/* ============ 5. BUTTON MICRO-INTERACTIONS & STATES ============ */

/* Global button press feel */
.btn:not(:disabled),
.btn-main:not(:disabled),
[class*="btn-kupr"]:not(:disabled) {
  position: relative;
  overflow: hidden;
  transition: transform 0.12s var(--kp-ease), box-shadow 0.15s ease,
              background-color 0.2s ease, border-color 0.2s ease !important;
}
.btn:not(:disabled):active,
.btn-main:not(:disabled):active,
[class*="btn-kupr"]:not(:disabled):active {
  transform: scale(0.965) !important;
}

/* Loading state spinner */
.btn-loading, .btn[data-loading="1"] {
  pointer-events: none !important;
  color: transparent !important;
}
.btn-loading::after, .btn[data-loading="1"]::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: kupr-spin 0.65s linear infinite;
}
@keyframes kupr-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Ripple effect */
@keyframes kupr-ripple {
  0%   { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0;   }
}
.kupr-ripple-el {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  pointer-events: none;
  animation: kupr-ripple 0.5s linear forwards;
  transform-origin: center;
  width: 40px; height: 40px;
  margin-left: -20px; margin-top: -20px;
}

/* Gold CTA button glow */
.btn-main, .btn-kupr-primary {
  background: linear-gradient(135deg, #FFD700 0%, #F5A623 100%) !important;
  color: #0D1117 !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: 0 4px 16px rgba(255,215,0,0.25) !important;
}
.btn-main:hover, .btn-kupr-primary:hover {
  box-shadow: 0 6px 24px rgba(255,215,0,0.45) !important;
  transform: translateY(-1px) !important;
}

/* ============ 6. LIVE STATS BAR ============ */
#kupr-stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 16px;
  background: rgba(13,17,23,0.9);
  border-bottom: 1px solid rgba(255,215,0,0.08);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
  overflow: hidden;
}

.kupr-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.3s;
}
.kupr-stat-pill-online {
  background: rgba(0,214,143,0.12);
  color: var(--kp-green);
  border: 1px solid rgba(0,214,143,0.2);
}
.kupr-stat-pill-kupr {
  background: rgba(255,215,0,0.1);
  color: var(--kp-gold);
  border: 1px solid rgba(255,215,0,0.2);
}
.kupr-stat-pill-bounty {
  background: rgba(88,166,255,0.1);
  color: var(--kp-blue);
  border: 1px solid rgba(88,166,255,0.2);
}
.kupr-stat-pill-pred {
  background: rgba(187,134,252,0.1);
  color: var(--kp-purple);
  border: 1px solid rgba(187,134,252,0.2);
}

/* Pulsing online dot */
@keyframes kupr-online-dot {
  0%, 100% { opacity: 1; transform: scale(1);    }
  50%       { opacity: 0.5; transform: scale(1.4); }
}
.kupr-online-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--kp-green);
  animation: kupr-online-dot 2s ease-in-out infinite;
}

/* Separator dots */
.kupr-stat-sep {
  color: rgba(255,255,255,0.15);
  font-size: 10px;
  margin: 0 2px;
}

/* ============ 7. ACTIVITY TICKER ============ */
#kupr-activity-ticker {
  overflow: hidden;
  background: rgba(22,27,34,0.7);
  border-bottom: 1px solid rgba(255,215,0,0.06);
  height: 32px;
  display: flex;
  align-items: center;
  position: relative;
}
#kupr-activity-ticker::before,
#kupr-activity-ticker::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 40px;
  z-index: 2;
  pointer-events: none;
}
#kupr-activity-ticker::before {
  left: 0;
  background: linear-gradient(to right, rgba(22,27,34,0.9), transparent);
}
#kupr-activity-ticker::after {
  right: 0;
  background: linear-gradient(to left,  rgba(22,27,34,0.9), transparent);
}

.kupr-ticker-label {
  flex-shrink: 0;
  padding: 0 10px 0 14px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--kp-gold);
  background: rgba(255,215,0,0.08);
  border-right: 1px solid rgba(255,215,0,0.15);
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  position: relative;
  z-index: 5;
  isolation: isolate;  /* own stacking context — immune to track composite layer */
}

/* Viewport clips the scrolling track so it can never bleed over the label */
.kupr-ticker-viewport {
  flex: 1;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
}

.kupr-ticker-track {
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  animation: kupr-ticker-scroll linear infinite;
  will-change: transform;
}
@keyframes kupr-ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.kupr-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 20px;
  font-size: 11.5px;
  color: var(--kp-muted);
  border-right: 1px solid rgba(255,255,255,0.05);
}
.kupr-ticker-item .kupr-ti-icon { font-size: 13px; }
.kupr-ticker-item .kupr-ti-user {
  color: var(--kp-text);
  font-weight: 600;
}
.kupr-ticker-item .kupr-ti-val {
  font-weight: 700;
}
.kupr-ticker-item .kupr-ti-val.up   { color: var(--kp-green); }
.kupr-ticker-item .kupr-ti-val.gold { color: var(--kp-gold);  }
.kupr-ticker-item .kupr-ti-val.blue { color: var(--kp-blue);  }
.kupr-ticker-item .kupr-ti-val.purp { color: var(--kp-purple);}
.kupr-ticker-item .kupr-ti-age {
  font-size: 10px;
  color: rgba(139,148,158,0.6);
}

/* Ticker pause on hover */
#kupr-activity-ticker:hover .kupr-ticker-track {
  animation-play-state: paused;
}

/* ============ 8. COUNT-UP & NUMBER ANIMATION ============ */
@keyframes kupr-countup-flash {
  0%   { color: var(--kp-green); }
  100% { color: inherit; }
}
.kupr-num-up   { animation: kupr-countup-flash 1s ease forwards; }
.kupr-num-down { animation: kupr-countup-flash 1s ease forwards; color: var(--kp-red) !important; }

/* Counter badge (bouncing) when new activity */
@keyframes kupr-badge-pop {
  0%   { transform: scale(0);   }
  70%  { transform: scale(1.3); }
  100% { transform: scale(1);   }
}
.kupr-badge-pop { animation: kupr-badge-pop 0.4s var(--kp-ease) forwards; }

/* ============ 9. GLOBAL CARD POLISH ============ */

/* Cards that don't have their own hover get this subtle lift */
.post-page-wrapper,
.featured-card-inner,
.user-card,
.item-post-main {
  transition: transform 0.25s var(--kp-ease), box-shadow 0.25s ease !important;
}
.post-page-wrapper:hover { transform: translateY(-2px); }

/* Post actions — gold hover */
.post-action-buttons a:hover svg,
.post-action-buttons a:hover i { color: var(--kp-gold) !important; }

/* Comment box focus glow */
.comment-text:focus,
.postText:focus {
  border-color: rgba(255,215,0,0.4) !important;
  box-shadow: 0 0 0 3px rgba(255,215,0,0.08) !important;
}

/* ============ 10. CTA GLOW EFFECTS ============ */

/* Pulsing gold glow on main CTAs */
@keyframes kupr-cta-glow {
  0%, 100% { box-shadow: 0 4px 16px rgba(255,215,0,0.25); }
  50%       { box-shadow: 0 6px 28px rgba(255,215,0,0.55); }
}

/* Applied only to premium-designated CTAs */
.kupr-cta-glow {
  animation: kupr-cta-glow 2.5s ease-in-out infinite;
}
.kupr-cta-glow:hover { animation-play-state: paused; }

/* Earn/join CTA buttons — gold gradient variant */
.kupr-btn-earn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #FFD700, #F5A623);
  color: #0D1117 !important;
  font-weight: 700;
  font-size: 13px;
  border-radius: 8px;
  text-decoration: none !important;
  transition: all 0.2s var(--kp-ease);
  box-shadow: 0 4px 16px rgba(255,215,0,0.3);
  border: none;
}
.kupr-btn-earn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255,215,0,0.5);
}
.kupr-btn-earn:active { transform: scale(0.97); }

/* ============ 11. PAGE TRANSITION FADE ============ */
@keyframes kupr-page-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
#contnet {
  animation: kupr-page-fadein 0.35s ease forwards;
}

/* ============ 12. COPY SUCCESS FEEDBACK ============ */
.kupr-copied-flash {
  animation: kupr-copy-flash 0.5s ease forwards;
}
@keyframes kupr-copy-flash {
  0%   { background: rgba(0,214,143,0.2); }
  100% { background: transparent; }
}

/* Tooltip for copy feedback */
.kupr-copy-wrap { position: relative; display: inline-flex; }
.kupr-copy-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: rgba(0,214,143,0.9);
  color: #0D1117;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.kupr-copy-wrap.copied .kupr-copy-tip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ── TOP AI AGENTS sidebar widget — prevent name truncation ─────── */
/* The agents UL is the first .list-group immediately after the profile card.
   WoWonder constrains the inner name div to 84px, which clips "Hidden Agent #72".
   We use the adjacent-sibling combinator to target ONLY this widget. */
.wow_side_loggd_usr + ul.list-group .list-group-item a > div {
  width: auto !important;        /* removes the hard 84px constraint */
  max-width: 150px !important;   /* still clipped by the parent <a> max-width */
}
.wow_side_loggd_usr + ul.list-group .list-group-item a > div > div {
  width: auto !important;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  #kupr-stats-bar { padding: 4px 8px; gap: 4px; }
  .kupr-stat-pill { padding: 3px 8px; font-size: 10.5px; }
  .kupr-stat-sep  { display: none; }
  #kupr-toast-wrap { max-width: calc(100vw - 24px); right: 12px; }
}
@media (max-width: 480px) {
  .kupr-stat-pill-pred { display: none; } /* hide least important on very small screens */
  #kupr-stats-bar { gap: 3px; }
}
