/**
 * Viral Features CSS
 * Badges, Themes, Flex Mode, Animations
 */

/* ============================================
   BADGE STYLES
   ============================================ */

.receipt-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0;
  justify-content: center;
}

.receipt-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--badge-color), color-mix(in srgb, var(--badge-color) 70%, black));
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

.receipt-badge:hover {
  transform: scale(1.05);
}

.receipt-badge .badge-icon {
  font-size: 12px;
}

.receipt-badge .badge-label {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Rarity variations */
.receipt-badge.rarity-legendary {
  animation: legendaryShimmer 2s ease-in-out infinite;
  background: linear-gradient(135deg, #8B5CF6, #EC4899, #8B5CF6);
  background-size: 200% 200%;
}

.receipt-badge.rarity-rare {
  border: 1px solid rgba(255,255,255,0.3);
}

@keyframes legendaryShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Flex card badges (larger) */
.flex-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
  justify-content: center;
}

.flex-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 24px;
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--badge-color), color-mix(in srgb, var(--badge-color) 70%, black));
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.flex-badge .badge-icon {
  font-size: 16px;
}


/* ============================================
   RECEIPT THEME STYLES
   ============================================ */

/* Theme Selector UI */
.theme-selector {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.theme-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-align: center;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-option:hover {
  border-color: var(--text-muted);
  background: var(--bg-hover);
}

.theme-option.active {
  border-color: var(--text);
  background: var(--bg-hover);
}

.theme-option .theme-preview {
  font-size: 20px;
}

.theme-option .theme-name {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
}

.theme-option.active .theme-name {
  color: var(--text);
}

.theme-option .theme-pro {
  font-size: 8px;
  font-weight: 700;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: black;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Receipt Theme: Classic (default) */
.receipt-preview.theme-classic {
  background: #ffffff;
  color: #000000;
}

/* Receipt Theme: Thermal */
.receipt-preview.theme-thermal {
  background: #F5F5F0;
  color: #1A1A1A;
  font-family: 'Courier New', Courier, monospace;
  position: relative;
}

.receipt-preview.theme-thermal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0,0,0,0.03) 2px,
      rgba(0,0,0,0.03) 4px
    );
  pointer-events: none;
}

.receipt-preview.theme-thermal .receipt-value,
.receipt-preview.theme-thermal .receipt-value-lg {
  font-weight: 400;
  letter-spacing: 0.05em;
}

/* Receipt Theme: Dark */
.receipt-preview.theme-dark {
  background: #0A0A0A;
  color: #E5E5E5;
  border: 1px solid #333;
}

.receipt-preview.theme-dark .receipt-divider {
  background: #333;
}

.receipt-preview.theme-dark .receipt-label {
  color: #888;
}

.receipt-preview.theme-dark::after {
  background: radial-gradient(circle, transparent, transparent 4px, #0A0A0A 4px, #0A0A0A 10px) repeat-x;
}

/* Receipt Theme: Luxury */
.receipt-preview.theme-luxury {
  background: #000000;
  color: #D4AF37;
  border: 2px solid #D4AF37;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

.receipt-preview.theme-luxury .receipt-logo {
  font-family: 'Georgia', serif;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.receipt-preview.theme-luxury .receipt-divider {
  background: linear-gradient(90deg, transparent, #D4AF37, transparent);
  height: 1px;
}

.receipt-preview.theme-luxury .receipt-label {
  color: #B8860B;
}

.receipt-preview.theme-luxury .receipt-value,
.receipt-preview.theme-luxury .receipt-value-lg {
  color: #FFD700;
}

.receipt-preview.theme-luxury::after {
  background: radial-gradient(circle, transparent, transparent 4px, #000 4px, #000 10px) repeat-x;
}

/* Receipt Theme: Neon */
.receipt-preview.theme-neon {
  background: #1A0A2E;
  color: #00FFFF;
  border: 2px solid #FF00FF;
  box-shadow:
    0 0 10px rgba(255, 0, 255, 0.5),
    inset 0 0 30px rgba(0, 255, 255, 0.1);
  position: relative;
}

.receipt-preview.theme-neon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 255, 0.03) 2px,
    rgba(0, 255, 255, 0.03) 4px
  );
  pointer-events: none;
}

.receipt-preview.theme-neon .receipt-logo {
  text-shadow: 0 0 10px #00FFFF;
}

.receipt-preview.theme-neon .receipt-divider {
  background: linear-gradient(90deg, #FF00FF, #00FFFF, #FF00FF);
  height: 2px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.receipt-preview.theme-neon .receipt-label {
  color: #FF00FF;
}

.receipt-preview.theme-neon .receipt-value-lg {
  text-shadow: 0 0 10px #00FFFF;
}

.receipt-preview.theme-neon::after {
  background: radial-gradient(circle, transparent, transparent 4px, #1A0A2E 4px, #1A0A2E 10px) repeat-x;
}

/* Receipt Theme: Retro */
.receipt-preview.theme-retro {
  background: #FFF8E7;
  color: #2C1810;
  font-family: 'Courier New', Courier, monospace;
  border: none;
  box-shadow:
    4px 4px 0 #D4C4A8,
    8px 8px 0 rgba(0,0,0,0.1);
  position: relative;
}

.receipt-preview.theme-retro::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none;
}

.receipt-preview.theme-retro .receipt-logo {
  font-weight: 700;
  text-decoration: underline;
}

.receipt-preview.theme-retro .receipt-divider {
  background: none;
  border-bottom: 2px dashed #8B7355;
  height: 0;
}

.receipt-preview.theme-retro .receipt-label {
  color: #8B7355;
}

.receipt-preview.theme-retro::after {
  background: radial-gradient(circle, transparent, transparent 4px, #FFF8E7 4px, #FFF8E7 10px) repeat-x;
}


/* ============================================
   FLEX MODE STYLES
   ============================================ */

.flex-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-md);
}

.flex-toggle-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.flex-toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.flex-toggle-switch.active {
  background: var(--success);
}

.flex-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.flex-toggle-switch.active::after {
  transform: translateX(20px);
}

/* Flex Card Container */
.flex-card-preview {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #ffffff;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.flex-card-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.2) 0%, transparent 50%);
  pointer-events: none;
}

.flex-card-header {
  position: relative;
  z-index: 1;
}

.flex-card-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
}

.flex-card-nft {
  position: relative;
  z-index: 1;
  margin: 20px auto;
}

.flex-card-nft img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.flex-card-name {
  font-size: 18px;
  font-weight: 700;
  margin: 12px 0 4px;
  position: relative;
  z-index: 1;
}

.flex-card-details {
  position: relative;
  z-index: 1;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 16px;
}

.flex-card-pnl {
  position: relative;
  z-index: 1;
  padding: 16px;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  margin: 16px 0;
}

.flex-pnl-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.flex-pnl-row:last-child {
  margin-bottom: 0;
}

.flex-pnl-label {
  color: rgba(255,255,255,0.6);
}

.flex-pnl-value {
  font-weight: 600;
}

.flex-pnl-highlight {
  font-size: 24px;
  font-weight: 800;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.2);
}

.flex-pnl-highlight.gain {
  color: #22C55E;
  text-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

.flex-pnl-highlight.loss {
  color: #EF4444;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

.flex-card-footer {
  position: relative;
  z-index: 1;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: auto;
}


/* ============================================
   PNL DISPLAY STYLES
   ============================================ */

.pnl-section {
  margin-top: 12px;
  padding: 12px;
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
}

.pnl-header {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 8px;
}

.pnl-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.pnl-value.gain {
  color: #22C55E;
}

.pnl-value.loss {
  color: #EF4444;
}

.pnl-value.neutral {
  color: #6B7280;
}

.pnl-details {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10px;
  color: #666;
}


/* ============================================
   ENHANCED ANIMATIONS
   ============================================ */

/* Print animation */
@keyframes printReceipt {
  0% {
    clip-path: inset(100% 0 0 0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    clip-path: inset(0 0 0 0);
    opacity: 1;
  }
}

.receipt-preview.printing {
  animation: printReceipt 0.8s ease-out forwards;
}

/* Enhanced tear animation */
@keyframes tearReceipt {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(-10px) rotate(-1deg);
  }
  100% {
    transform: translateY(20px) rotate(2deg);
    opacity: 0.8;
  }
}

.receipt-preview.tearing {
  animation: tearReceipt 0.6s ease-out;
}

/* Number count up effect */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.count-animate {
  animation: countUp 0.4s ease-out;
}

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10001;
}

/* Success burst animation */
@keyframes successBurst {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.receipt-preview.success-burst {
  animation: successBurst 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Shimmer effect for loading */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-loading {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}


/* ============================================
   FLEX CARD SIZE OPTIONS
   ============================================ */

.flex-size-selector {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.flex-size-btn {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.flex-size-btn:hover {
  border-color: var(--text-muted);
}

.flex-size-btn.active {
  border-color: var(--text);
  color: var(--text);
  background: var(--bg-hover);
}


/* ============================================
   SHARE IMPROVEMENTS
   ============================================ */

.share-preview-info {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.share-preview-info strong {
  color: var(--text);
}


/* ============================================
   MINT AS NFT SECTION
   ============================================ */

.mint-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.mint-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.mint-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #0052FF 0%, #3B82F6 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 82, 255, 0.3);
}

.mint-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 82, 255, 0.4);
}

.mint-btn:active {
  transform: translateY(0);
}

.mint-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.mint-btn svg {
  width: 18px;
  height: 18px;
}

.mint-price {
  font-size: 12px;
  opacity: 0.8;
  margin-left: 4px;
}

.mint-info {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.mint-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-md);
  margin-top: 12px;
}

.mint-success a {
  color: var(--success);
  font-weight: 600;
  text-decoration: none;
}

.mint-success a:hover {
  text-decoration: underline;
}


/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-text.full {
  width: 100%;
}

.skeleton-box {
  height: 100px;
  margin-bottom: 16px;
}

.receipt-preview.loading .receipt-value,
.receipt-preview.loading .receipt-value-lg {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  color: transparent !important;
  border-radius: 4px;
}


/* ============================================
   ENS NAME DISPLAY
   ============================================ */

.ens-name {
  color: var(--text);
  font-weight: 600;
}

.ens-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: linear-gradient(135deg, #5298FF 0%, #2563EB 100%);
  color: white;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  margin-left: 4px;
}

/* ENS Input Validation */
.smart-wrapper.valid-ens {
  border-color: #5298FF !important;
  box-shadow: 0 0 0 3px rgba(82, 152, 255, 0.2);
}

.smart-wrapper.valid-ens .input-indicator {
  background: linear-gradient(135deg, #5298FF 0%, #2563EB 100%);
  color: white;
}


/* ============================================
   SPAM WARNING DISMISSIBLE
   ============================================ */

.spam-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--error);
}

.spam-warning-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spam-warning-dismiss {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.spam-warning-dismiss:hover {
  opacity: 1;
}


/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 480px) {
  .theme-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .flex-card-preview {
    padding: 16px;
    min-height: 350px;
  }

  .flex-card-nft img {
    width: 100px;
    height: 100px;
  }

  .flex-pnl-highlight {
    font-size: 20px;
  }

  .receipt-badges {
    gap: 4px;
  }

  .receipt-badge {
    padding: 3px 6px;
    font-size: 9px;
  }
}


/* ============================================
   LEADERBOARD STYLES
   ============================================ */

.leaderboard-section {
  margin-top: 48px;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.leaderboard-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.leaderboard-stats .stat {
  text-align: center;
  padding: 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
}

.leaderboard-stats .stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.leaderboard-stats .stat-value.gain {
  color: var(--success);
}

.leaderboard-stats .stat-value.loss {
  color: var(--error);
}

.leaderboard-stats .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.leaderboard-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-entry {
  display: grid;
  grid-template-columns: 40px 60px 1fr 80px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.leaderboard-entry .lb-rank {
  font-weight: 700;
}

.leaderboard-entry .lb-chain {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.leaderboard-entry .lb-pnl {
  font-weight: 700;
  font-family: var(--font-mono);
}

.leaderboard-entry .lb-pnl.gain {
  color: var(--success);
}

.leaderboard-entry .lb-pnl.loss {
  color: var(--error);
}

.leaderboard-entry .lb-date {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
}

.leaderboard-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

.leaderboard-empty p {
  margin: 8px 0;
}


/* ============================================
   EXPORT BUTTONS
   ============================================ */

.export-section {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.export-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.export-btn svg {
  width: 14px;
  height: 14px;
}
