/* Advanced Tools CSS - Stats Tooltip, Level Badge, Stage Badge, Enhanced TPI Badge, Pie Chart Badge */

/* CRITICAL: Prevent tooltip cutoff */
.nft-card {
  overflow: visible !important;
}

.nft-image {
  position: relative;
  overflow: visible !important;
}

/* Chain Badge - TOP RIGHT CORNER */
.nft-card .nft-image .chain-badge,
.nft-image .chain-badge {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  bottom: auto !important;
  left: auto !important;
  background: rgba(0, 0, 0, 0.85);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 16px;
  z-index: 4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Listed Badge - TOP LEFT CORNER */
.nft-card .nft-image .listed-badge,
.nft-image .listed-badge {
  position: absolute !important;
  top: 8px !important;
  left: 8px !important;
  bottom: auto !important;
  right: auto !important;
  z-index: 3;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

/* Pie Chart Badge - BOTTOM LEFT, above sleeve badge */
.nft-card .nft-image .pie-chart-badge,
.nft-image .pie-chart-badge {
  position: absolute !important;
  bottom: 40px !important;
  left: 8px !important;
  top: auto !important;
  right: auto !important;
  background: rgba(20, 20, 30, 0.9);
  padding: 4px;
  border-radius: 8px;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: help;
  transition: all 0.2s ease;
}

.pie-chart-badge:hover {
  background: rgba(20, 20, 30, 0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Pie Chart Tooltip - FIXED POSITIONING TO PREVENT CUTOFF */
.pie-chart-tooltip {
  position: fixed;
  background: rgba(15, 15, 25, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px;
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 10000;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  white-space: nowrap;
}

/* Show pie tooltip on hover only when stats tooltip is NOT present */
.pie-chart-badge:hover .pie-chart-tooltip {
  opacity: 1;
  visibility: visible;
}
/* When pie chart badge also contains stats tooltip, hide the small pie tooltip */
.pie-chart-badge:has(.stats-tooltip):hover .pie-chart-tooltip {
  opacity: 0;
  visibility: hidden;
}

/* TPI/PWR Badge - BOTTOM LEFT CORNER */
.nft-card .nft-image .tpi-badge,
.nft-image .tpi-badge {
  position: absolute !important;
  bottom: 8px !important;
  left: 8px !important;
  top: auto !important;
  right: auto !important;
  padding: 6px 10px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  max-width: fit-content;
}

/* Level Tag Styling (appears next to game tag in nft-details) */
.nft-level-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}

/* Stage Badge Styling (appears next to game tag in nft-details) */
.nft-stage-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}

/* Stats Tooltip Container - FIXED, positioned by JS relative to pie chart */
.stats-tooltip {
  position: fixed;
  background: rgba(15, 15, 25, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 10000;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

/* Stats tooltip inside badge stays hidden — JS clones it to body */

/* Clone appended to body gets full styling */
.stats-tooltip-clone {
  background: rgba(15, 15, 25, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px;
  min-width: 220px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  transition: opacity 0.2s ease;
}

/* Tooltip header */
.stats-tooltip-header {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}

/* Individual stat row */
.stat-row {
  display: grid;
  grid-template-columns: 80px 1fr 45px;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

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

/* Stat name */
.stat-name {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

/* Stat bar container */
.stat-bar-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

/* Stat bar */
.stat-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
  position: relative;
  box-shadow: 0 0 8px currentColor;
}

/* Stat value */
.stat-value {
  font-size: 12px;
  color: #fff;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Animation for stat bars */
@keyframes fillBar {
  from {
    width: 0%;
  }
  to {
    width: var(--final-width);
  }
}

.nft-image:hover .stat-bar {
  animation: fillBar 0.5s ease-out forwards;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .stats-tooltip {
    min-width: 200px;
    padding: 10px;
  }
  
  .stat-row {
    grid-template-columns: 70px 1fr 40px;
    gap: 6px;
  }
  
  .stat-name {
    font-size: 10px;
  }
  
  .stat-value {
    font-size: 11px;
  }
  
  .pie-chart-badge {
    padding: 3px;
  }
  
  .pie-chart-tooltip {
    min-width: 140px;
    padding: 6px;
  }
  
  .chain-badge {
    font-size: 14px;
    padding: 3px 6px;
  }
}

/* Hover effect for cards with stats */
.nft-card .nft-image[data-has-stats="true"] {
  cursor: help;
}

/* Advanced Filters Section - TPI Sort Dropdown */
.advanced-filter-item.tpi-sort {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.advanced-filter-label {
  font-size: 0.85rem;
  color: #aaa;
  font-weight: 500;
}

.advanced-filter-select {
  padding: 0.5rem;
  background: #2a2a3a;
  border: 1px solid #3a3a4a;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.advanced-filter-select:focus {
  outline: none;
  border-color: #4a9eff;
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.1);
}

.advanced-filter-select:hover {
  border-color: #4a9eff;
  background: #3a3a4a;
}

.advanced-filter-select option {
  background: #2a2a3a;
  color: #ffffff;
}

/* ===== ILLUVITAR BURN HANDOFF ===== */

/* Sleeve zone — bottom-right, offset left to not cover Alpha tag */
.sleeve-zone {
  position: absolute !important;
  bottom: 8px !important;
  right: 36px !important;
  top: auto !important;
  left: auto !important;
  z-index: 4;
}

/* Loading spinner while fetching sleeve status */
.burn-loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: burnSpin 0.6s linear infinite;
}

@keyframes burnSpin {
  to { transform: rotate(360deg); }
}

/* "In Album" text badge for sleeved Illuvitars */
.sleeve-badge {
  display: inline-block;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

/* Token ID tag in nft-details */
.nft-token-id-tag {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #888;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  font-family: monospace;
  margin-left: 4px;
}

/* ===== BURN CONFIRMATION MODAL ===== */

.burn-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  backdrop-filter: blur(4px);
  animation: burnFadeIn 0.15s ease;
}

@keyframes burnFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.burn-confirm-modal {
  background: #1a1a2e;
  border: 1px solid rgba(255, 100, 100, 0.25);
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(239, 68, 68, 0.1);
}

.burn-confirm-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.burn-confirm-modal h3 {
  color: #fff;
  font-size: 20px;
  margin: 0 0 8px;
}

.burn-confirm-modal p {
  color: #aaa;
  font-size: 13px;
  margin: 4px 0;
  line-height: 1.5;
}

.burn-confirm-nft-name {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 0 2px;
}

.burn-confirm-token-id {
  color: #f59e0b;
  font-size: 18px;
  font-family: monospace;
  padding: 6px 12px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  margin: 10px 0;
  display: inline-block;
}

.burn-confirm-note {
  color: #888 !important;
  font-size: 12px !important;
  margin-top: 10px !important;
  line-height: 1.6 !important;
}

.burn-confirm-proceed:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.burn-confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
}

.burn-confirm-cancel {
  padding: 10px 20px;
  background: #2a2a3a;
  color: #ccc;
  border: 1px solid #3a3a4a;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.burn-confirm-cancel:hover {
  background: #3a3a4a;
  color: #fff;
}

.burn-confirm-proceed {
  padding: 10px 20px;
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  color: #fff;
  border: 1px solid rgba(255, 100, 100, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.burn-confirm-proceed:hover {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
}

/* Power display in single burn confirmation */
.burn-confirm-power {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 8px 16px;
  margin: 10px 0;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 8px;
  font-size: 14px;
}

.burn-confirm-power-total {
  font-size: 16px;
}

.burn-power-label {
  color: #aaa;
}

.burn-power-value {
  color: #f59e0b;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.burn-power-points {
  color: #4ade80;
  font-weight: 600;
}

/* Sleeved warning in bulk burn */
.burn-sleeved-warning {
  padding: 8px 14px;
  margin: 8px 0;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 8px;
  color: #93c5fd;
  font-size: 12px;
}

/* NFT list preview in bulk burn modal */
.burn-list-preview {
  max-height: 200px;
  overflow-y: auto;
  margin: 12px 0;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.burn-list-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.burn-list-item:last-child {
  border-bottom: none;
}

.burn-list-name {
  color: #ddd;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.burn-list-power {
  color: #f59e0b;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.burn-list-more {
  text-align: center;
  color: #888;
  font-size: 11px;
  padding: 4px;
}

.burn-bulk-modal {
  max-width: 440px;
}

/* Bulk action bar — burn button */
.bulk-action-btn.burn {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  color: #fff;
  border: 1px solid rgba(255, 100, 100, 0.3);
}

.bulk-action-btn.burn:hover {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

/* Power info in bulk action bar */
.bulk-action-bar-power {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  margin-top: 2px;
}

.bulk-power-icon {
  font-size: 12px;
}

.bulk-power-value {
  color: #f59e0b;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bulk-power-points {
  color: #4ade80;
  font-size: 11px;
}

/* Burn button in detail modal */
.btn-burn {
  background: linear-gradient(135deg, #b91c1c, #dc2626) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 100, 100, 0.3) !important;
}

.btn-burn:hover {
  background: linear-gradient(135deg, #dc2626, #ef4444) !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

/* ===== BURN TERMS POPUP ===== */

.burn-terms-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  backdrop-filter: blur(4px);
  animation: burnFadeIn 0.15s ease;
}

.burn-terms-modal {
  background: #1a1a2e;
  border: 1px solid rgba(255, 200, 50, 0.3);
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 200, 50, 0.08);
}

.burn-terms-icon {
  font-size: 40px;
  text-align: center;
  margin-bottom: 8px;
}

.burn-terms-modal h3 {
  color: #fbbf24;
  font-size: 18px;
  margin: 0 0 14px;
  text-align: center;
}

.burn-terms-text {
  color: #bbb;
  font-size: 13px;
  line-height: 1.6;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 8px;
}

.burn-terms-text p {
  margin: 8px 0;
}

.burn-terms-text ul {
  margin: 8px 0;
  padding-left: 20px;
}

.burn-terms-text li {
  margin: 6px 0;
  color: #ccc;
}

.burn-terms-text strong {
  color: #f87171;
}

.burn-terms-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #ddd;
}

.burn-terms-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #f59e0b;
  cursor: pointer;
  flex-shrink: 0;
}

.burn-terms-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: center;
}

.burn-terms-cancel {
  padding: 10px 20px;
  background: #2a2a3a;
  color: #ccc;
  border: 1px solid #3a3a4a;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.burn-terms-cancel:hover {
  background: #3a3a4a;
  color: #fff;
}

.burn-terms-accept {
  padding: 10px 20px;
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.burn-terms-accept:hover:not(:disabled) {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.burn-terms-accept:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
