:root {
  --popcard-text: #f5f5f5;
}

/* PopCard Modal */
.popcard-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.popcard-overlay.active {
  display: flex;
}

.popcard {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 85vh;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  overflow-y: auto;
}

.popcard-cover {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 20px;
  display: block;
}

.popcard-cover-container {
  position: relative;
  margin-bottom: 20px;
}

.popcard-mint-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(60, 60, 80, 0.75);
  border: 1px solid rgba(150, 150, 180, 0.4);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 8px;
  font-weight: 500;
  color: rgba(200, 200, 220, 0.9);
  letter-spacing: 0.3px;
  font-family: "Courier New", monospace;
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  appearance: none;
  cursor: pointer;
}

.popcard-mint-badge:hover {
  border-color: rgba(190, 190, 220, 0.7);
  background: rgba(70, 70, 95, 0.85);
}

.popcard-mint-badge:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.popcard-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.popcard-close:hover {
  color: #fff;
}

.popcard-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fff;
}

.popcard-artist {
  font-size: 1.1rem;
  opacity: 0.85;
  margin-bottom: 4px;
}

.popcard-year {
  font-size: 0.9rem;
  opacity: 0.6;
  margin-bottom: 4px;
}

.popcard-mintid {
  font-size: 0.85rem;
  opacity: 0.5;
  margin-bottom: 20px;
  font-family: "Courier New", monospace;
}

.popcard-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.popcard-btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.popcard-btn-primary {
  background: #ffffff;
  color: #0b0b0b;
}

.popcard-btn-primary:hover {
  background: #e8e8e8;
  transform: translateY(-1px);
}

.popcard-btn-secondary {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.popcard-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.popcard-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.85rem;
}

.popcard-text-link {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color 0.2s;
}

.popcard-text-link:hover {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
}

.popcard-text-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
  border-radius: 2px;
}

.popcard-link-separator {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.75rem;
}

.popcard-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.popcard-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 10px;
}

.popcard-description {
  font-size: 0.95rem;
  line-height: 1.6;
  opacity: 0.85;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.popcard-metadata {
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.popcard-metadata-formatted {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.popcard-metadata-label {
  font-weight: 600;
  opacity: 0.7;
  text-align: right;
  white-space: nowrap;
}

.popcard-metadata-value {
  opacity: 0.9;
  word-wrap: break-word;
}

.popcard-metadata-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  font-size: 0.8rem;
}

/* Debug panel - hidden in production. To enable for debugging, remove display: none */
.popcard-advanced-section {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.popcard-advanced-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.popcard-advanced-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.9);
}

.popcard-advanced-content {
  display: none;
  margin-top: 12px;
}

.popcard-advanced-content.expanded {
  display: block;
}

.popcard-copy-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
}

.popcard-copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
}

.popcard-copy-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.popcard-copy-btn.copied {
  background: rgba(100, 200, 100, 0.2);
  border-color: rgba(100, 200, 100, 0.5);
  color: rgba(150, 255, 150, 1);
}

.popcard-metadata-toggle {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.popcard-metadata-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.5);
}

.popcard-metadata-content {
  display: none;
  margin-top: 10px;
}

.popcard-metadata-content.expanded {
  display: block;
}

.popcard-toggle-icon {
  transition: transform 0.2s;
}

.popcard-metadata-toggle.expanded .popcard-toggle-icon {
  transform: rotate(180deg);
}

.hidden {
  display: none;
}

/* Default cover info styles for PopCard */
.popcard-cover-info {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  margin-top: -12px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.popcard-cover-info-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 0 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: underline;
  cursor: pointer;
  display: inline;
}

.popcard-cover-info-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 380px;
  width: 90%;
  background: rgba(5, 5, 5, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  z-index: 1001;
  max-height: 85vh;
  overflow-y: auto;
}

.popcard-cover-info-panel.hidden {
  display: none;
}

.popcard-cover-info-panel-title {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 13px;
}

.popcard-cover-info-panel-body p {
  margin: 6px 0;
}

.popcard-cover-info-panel-body ul {
  margin: 6px 0 8px 20px;
  padding: 0;
}

.popcard-cover-info-panel-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.popcard-cover-info-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: all 0.2s;
}

.popcard-cover-info-close:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.6);
}

/* Variant: legacy (matches older discover PopCard rendering) */
.popcard.popcard-variant-legacy {
  max-width: 500px;
  max-height: none;
  overflow-y: visible;
}

.popcard.popcard-variant-legacy #popcard-description-section,
.popcard.popcard-variant-legacy #popcard-metadata-section,
.popcard.popcard-variant-legacy .popcard-links,
.popcard.popcard-variant-legacy #popcard-cover-info {
  display: none !important;
}

.popcard.popcard-variant-legacy .popcard-title {
  font-size: 1.5rem;
}

.popcard.popcard-variant-legacy .popcard-buttons {
  margin-top: 12px;
}
