/* ============================================================
   CSS VARIABLES
   ========================================================= */

:root {
  /* Colors */
  --color-bg: #0a0a0a;
  --color-txt: #ccc;
  --color-2: #1a1a1a;
  --color-3: #252525;
  --color-hvr: #64b5f6;

  /* Borders */
  --border: 1px solid #333;

  /* Special Colors */
  --color-blue: 100, 181, 246;
  --color-green: 129, 199, 132;
  --color-orange: 255, 138, 101;
  --color-red: 208, 88, 154;
}

/* ============================================================
   GLOBAL RESETS
   ========================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Courier New", monospace;
  background: var(--color-bg);
  color: var(--color-txt);
  min-height: 100vh;
  padding: 20px;
}

button,
input {
  font-family: inherit;
}

/* ============================================================
   LAYOUT
   ========================================================= */

.container {
  max-width: 1400px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header .logo {
  margin-right: 10px;
}

.wrapper {
  display: flex;
  justify-content: end;
  align-items: center;
  width: 100%;
  gap: 10px;
}

/* ============================================================
   TYPOGRAPHY
   ========================================================= */

h1 {
  font-size: 2.5rem;
  text-wrap: nowrap;
  text-transform: uppercase;
  letter-spacing: 5px;
  text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.c1 {
  color: #64b5f6;
}

.c2 {
  color: #81c784;
}

.c3 {
  color: #ff8a65;
}

.c4 {
  color: #d0589a;
}

.c5 {
  color: #7986cb;
}

.c6 {
  color: #ffcc80;
}

h1 .space {
  margin-left: 10px;
}

h3 {
  margin-bottom: 20px;
  font-size: 1.2rem;
}

.subtitle {
  color: #666;
  font-size: 1rem;
  margin: 10px 0 40px;
}

/* ============================================================
   WALLET CONNECTION
   ========================================================= */

.connect-widget {
  position: relative;
  user-select: none;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 5px;
}

.connect-btn {
  display: flex;
  align-items: center;
  font-size: 1.1em;
  color: var(--color-txt);
  background: var(--color-2);
  border: none;
  height: 40px;
  padding: 7.5px 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.connect-btn:hover {
  background-color: #7986cb;
  color: var(--color-bg);
}

.connect-btn.connected {
  background-color: transparent;
  color: var(--color-txt);
  gap: 8px;
  transition: all 0.2s ease;
}

.connect-btn.connected:hover {
  color: #ffcc80;
}

.connect-btn.name-resolved {
  flex-direction: row-reverse;
  justify-content: space-between;
  gap: 8px;
  height: auto;
  padding: 5px 10px;
}

.connect-btn.name-resolved img {
  margin-right: 0;
}

.connect-btn .name-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.connect-btn .resolved-name {
  display: flex;
  align-items: center;
}

.connect-btn .named-address-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.connect-btn .named-address {
  font-size: 0.7em;
  opacity: 0.7;
}

.connect-btn img {
  width: 28px;
  height: 28px;
  margin-right: 5px;
  border: 1px solid var(--color-bg);
}

.connect-address-text {
  display: inline-flex;
  align-items: center;
}

.connect-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.connect-copy-btn svg {
  display: block;
  width: 14px;
  height: 14px;
}

.named-address-row .connect-copy-btn {
  width: 10px;
  height: 10px;
}

.named-address-row .connect-copy-btn svg {
  width: 8px;
  height: 8px;
}

.connect-modal {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  min-width: 180px;
  background-color: var(--color-2);
  border: var(--border);
  padding: 5px;
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.connect-modal.show {
  pointer-events: auto;
  opacity: 1;
  transform: scale(1);
}

#connect-rpc {
  position: relative;
  display: flex;
  align-items: center;
  font-size: 1em;
  border: none;
  color: var(--color-txt);
  background-color: var(--color-3);
  width: 100%;
  height: 50px;
  padding: 7.5px 40px 7.5px 7.5px;
  margin: 2.5px 0 0 0;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

#connect-rpc svg {
  height: 28px;
  width: 28px;
  margin-right: 12px;
  flex-shrink: 0;
}

#connect-rpc:hover {
  background-color: #7986cb;
  color: var(--color-bg);
}

.connect-get-wallet {
  display: flex;
  align-items: center;
  font-size: 1em;
  border: none;
  color: var(--color-txt);
  background-color: var(--color-3);
  width: 100%;
  height: 50px;
  margin: 2.5px 0;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0;
}

.connect-get-wallet:hover {
  background-color: #7986cb;
}

.connect-get-wallet a {
  text-decoration: none;
  color: var(--color-txt);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connect-get-wallet a:hover {
  color: var(--color-bg);
}

.connect-wallet-list button {
  position: relative;
  display: flex;
  align-items: center;
  font-size: 1em;
  border: none;
  color: var(--color-txt);
  background-color: var(--color-3);
  width: 100%;
  height: 50px;
  padding: 7.5px 40px 7.5px 7.5px;
  margin: 2.5px 0;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.connect-wallet-list button:hover {
  background-color: #7986cb;
  color: var(--color-bg);
}

.connect-wallet-list button:last-child {
  margin-bottom: 0;
}

.connect-wallet-list button img {
  height: 32px;
  width: 32px;
  margin-right: 8px;
  border-radius: 5px;
}

.connect-chain-list {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 7.5px;
  background-color: var(--color-3);
  max-width: 100%;
  height: 50px;
  box-sizing: border-box;
  margin: 0;
  transition: all 0.2s ease;
}

.connect-chain-list:hover {
  background-color: #7986cb;
}

.connect-chain-list:hover .connect-name {
  color: var(--color-bg);
}

.connect-chain-list button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-size: 1em;
  color: var(--color-txt);
}

.connect-chain-list button img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.connect-chain-list button.chain-single {
  display: flex;
  flex: 1;
  justify-content: flex-start;
}

.connect-chain-list button.chain-single img {
  width: 32px;
  height: 32px;
  margin-right: 8px;
}

.connect-chain-list button.chain-single .connect-name {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  transition: all 0.2s ease;
}

.connect-chain-list button.chain-single .connect-dot {
  position: absolute;
  right: 7.5px;
}

.connect-dot-icon {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: rgb(var(--color-green));
  border: 1px solid var(--color-bg);
}

.connect-dot {
  position: absolute;
  right: 15px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: rgb(var(--color-green));
  animation: connect-pulse 1.5s ease-out infinite;
}

@keyframes connect-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--color-green), 0.5);
  }
  70% {
    box-shadow: 0 0 0 4px rgba(var(--color-green), 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(var(--color-green), 0);
  }
}

/* ============================================================
   FILTERS
   ========================================================= */

.filters-panel {
  background: var(--color-2);
  margin-bottom: 30px;
  overflow: hidden;
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  cursor: pointer;
  user-select: none;
  font-weight: bold;
}

.filters-header h3 {
  margin: 0;
  font-size: 1rem;
}

.filters-toggle {
  transition: transform 0.2s ease;
  font-size: 0.8rem;
}

.filters-header.expanded .filters-toggle {
  transform: rotate(180deg);
}

.filters-content {
  padding: 0 20px 5px;
  transition: opacity 0.2s ease;
}

.filters-content.collapsed {
  display: none;
}

.results-count {
  color: #888;
  font-size: 0.9rem;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 15px 0;
  min-height: 30px;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-hvr);
  color: var(--color-bg);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.active-filter-tag:hover {
  background: #d0589a;
  color: var(--color-txt);
}

.active-filter-tag .remove-icon {
  font-weight: bold;
  font-size: 1rem;
}

.no-filters {
  color: #666;
  font-size: 0.85rem;
  font-style: italic;
}

.available-filters {
  column-count: 4;
  column-gap: 10px;
  margin-bottom: 5px;
}

.filter-category {
  background: var(--color-3);
  padding: 12px;
  border: var(--border);
  break-inside: avoid;
  margin-bottom: 10px;
  display: inline-block;
  width: 100%;
}

.filter-category-title {
  font-size: 0.8rem;
  color: var(--color-hvr);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: var(--border);
}

.filter-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-value {
  padding: 4px 10px;
  background: var(--color-3);
  font-size: 0.75rem;
  color: var(--color-txt);
  cursor: pointer;
  transition: all 0.2s;
  border: var(--border);
}

.filter-value:hover {
  background: var(--color-hvr);
  color: var(--color-bg);
  border-color: var(--color-hvr);
}

/* ============================================================
   GALLERY
   ========================================================= */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  align-items: start;
  content-visibility: auto;
}

.svg-card {
  background: var(--color-2);
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: 0 300px;
  contain: layout style paint;
  cursor: pointer;
}

.svg-preview {
  width: 100%;
  aspect-ratio: 1;
  background: var(--color-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.svg-preview img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.svg-preview img.lazy {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.svg-preview img.loaded {
  opacity: 1;
}

.svg-info {
  padding: 10px;
  background: var(--color-3);
}

.svg-id {
  font-size: 0.85rem;
  color: var(--color-hvr);
  display: inline;
  font-weight: bold;
  align-items: center;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  color: #555;
}

.empty-state p {
  font-size: 1.1rem;
}

/* ============================================================
   MODALS
   ========================================================= */

.item-modal {
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.item-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.item-modal-content {
  background-color: var(--color-2);
  border: var(--border);
  padding: 20px;
  width: 100%;
  max-width: 100%;
  max-height: 80vh;
  color: var(--color-txt);
  transform: translateY(100%);
  transition: transform 0.2s ease;
  position: relative;
  overflow-y: auto;
}

.item-modal.show .item-modal-content {
  transform: translateY(0);
}

.item-modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: var(--color-txt);
  font-size: 24px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.item-modal-close:hover {
  background-color: var(--color-3);
}

.item-modal-body {
  display: flex;
  gap: 30px;
  align-items: stretch;
}

.item-modal-image {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
  overflow: hidden;
}

.item-modal-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.item-modal-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.item-modal-info h3 {
  font-size: 1.5rem;
  color: var(--color-hvr);
  margin-bottom: 15px;
}

.modal-owner {
  font-size: 0.95rem;
  color: var(--color-txt);
  margin-bottom: 12px;
}

.modal-owner-label {
  color: #888;
}

.modal-traits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 20px;
  margin: auto 0;
}

.modal-content-wrapper {
  display: contents;
}

.item-modal-image-mobile {
  display: none;
}

.modal-trait {
  font-size: 0.9rem;
  color: var(--color-txt);
}

.modal-trait-type {
  color: #888;
}

.item-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-modal {
  flex: 1;
  padding: 10px;
  background-color: var(--color-3);
  color: var(--color-txt);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.1em;
  transition: all 0.2s;
}

.btn-download:hover {
  background-color: #ff8a65;
  color: var(--color-bg);
}

.btn-claim:hover {
  background-color: #ffcc80;
  color: var(--color-bg);
}

.rpc-modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.rpc-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.rpc-modal-content {
  background-color: var(--color-2);
  padding: 20px;
  border: var(--border);
  width: 90%;
  max-width: 500px;
  color: var(--color-txt);
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.rpc-modal.show .rpc-modal-content {
  transform: scale(1);
}

.rpc-close-btn {
  float: right;
  width: 24px;
  font-size: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.rpc-close-btn:hover {
  background-color: var(--color-3);
}

#rpc-inputs {
  display: grid;
  gap: 15px;
  margin: 20px 0;
}

#rpc-inputs div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#rpc-inputs label {
  font-weight: 500;
  font-size: 1em;
}

#rpc-inputs input {
  padding: 7.5px 15px;
  border: var(--border);
  background-color: var(--color-2);
  color: var(--color-txt);
  font-size: 1em;
}

#rpc-inputs input:focus {
  outline: none;
  border-color: #81c784;
}

#save-rpc-btn {
  width: 100%;
  padding: 10px;
  background-color: var(--color-3);
  color: var(--color-txt);
  border: none;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: 500;
  transition: all 0.2s;
}

#save-rpc-btn:hover {
  background-color: #81c784;
  color: var(--color-bg);
}

/* ============================================================
   UTILITIES
   ========================================================= */

[data-copy] {
  position: relative;
  cursor: pointer;
  user-select: none;
  gap: 8px;
  display: inline-flex;
  align-items: center;
}

[data-copy] svg {
  opacity: 0.6;
  transition:
    opacity 0.2s,
    stroke 0.2s ease;
}

[data-copy] svg:hover {
  opacity: 0.8;
}

.copy-success svg,
.copy-error svg {
  opacity: 1;
}

/* ============================================================
   NOTIFICATIONS
   ========================================================= */

#notificationContainer {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  max-width: 500px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification {
  position: relative;
  transform: translateX(-100%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  pointer-events: auto;
  max-width: 100%;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification.hide {
  transform: translateX(-100%);
  opacity: 0;
}

.notification.info,
.notification.tx-notification.pending {
  --notif-color: var(--color-blue);
}

.notification.success,
.notification.tx-notification.success {
  --notif-color: var(--color-green);
}

.notification.warning {
  --notif-color: var(--color-orange);
}

.notification.error,
.notification.tx-notification.failed {
  --notif-color: var(--color-red);
}

.notif-content {
  color: rgb(var(--notif-color));
  background-color: var(--color-2);
  border-left: 4px solid rgb(var(--notif-color));
  box-shadow: 0 4px 8px rgba(var(--notif-color), 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px;
  font-size: 16px;
  font-weight: 500;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
}

.notif-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  transition: background-color 0.2s;
}

.notif-close:hover {
  background-color: rgba(var(--notif-color), 0.2);
}

.notification.tx-notification.pending .tx-icon {
  color: rgb(var(--color-blue));
}

.notification.tx-notification.success .tx-icon {
  color: rgb(var(--color-green));
}

.notification.tx-notification.failed .tx-icon {
  color: rgb(var(--color-red));
}

.notification.tx-notification.success .tx-icon::before {
  content: "✓";
  font-size: 20px;
  font-weight: bold;
}

.notification.tx-notification.failed .tx-icon::before {
  content: "✗";
  font-size: 20px;
  font-weight: bold;
}

.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: currentColor;
  opacity: 0.6;
  transform-origin: left;
  animation: progress linear;
}

@keyframes progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

.tx-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.tx-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: tx-spin 0.8s linear infinite;
}

@keyframes tx-spin {
  to {
    transform: rotate(360deg);
  }
}

.tx-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tx-label {
  font-size: 14px;
  font-weight: 600;
  color: currentColor;
}

.tx-hash {
  font-size: 12px;
  color: currentColor;
  opacity: 0.8;
}

.tx-hash a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s;
}

.tx-hash a:hover {
  opacity: 1;
  text-decoration: underline;
}

.tx-status {
  font-size: 12px;
  margin-left: 8px;
  font-weight: 500;
  color: currentColor;
  opacity: 0.9;
  white-space: nowrap;
}

/* ============================================================
   RESPONSIVE DESIGN
   ========================================================= */

@media (max-width: 992px) {
  .available-filters {
    column-count: 2;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 1.8rem;
    letter-spacing: 3px;
  }

  h1 .gallery-text {
    display: none;
  }

  .available-filters {
    column-count: 2;
  }

  .filter-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .results-count {
    margin-left: 0;
    text-align: center;
  }

  .item-modal-body {
    flex-direction: column;
    gap: 15px;
  }

  .item-modal-image {
    display: none;
  }

  .item-modal-info {
    display: flex;
    flex-direction: column;
  }

  .item-modal-info h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
  }

  .modal-content-wrapper {
    display: flex;
    gap: 5px;
    align-items: flex-start;
    margin-bottom: 15px;
  }

  .modal-traits {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 10px;
    flex: 1;
  }

  .item-modal-image-mobile {
    display: block;
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    background: var(--color-bg);
    overflow: hidden;
  }

  .item-modal-image-mobile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
  }

  .modal-trait {
    font-size: 0.8rem;
  }

  .item-modal-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: auto;
  }

  .btn-modal {
    flex: 1;
    padding: 10px;
    font-size: 0.9em;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
    letter-spacing: 2px;
  }

  .available-filters {
    column-count: 1;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  #notificationContainer {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
  }

  .notif-content {
    padding: 12px 16px;
    font-size: 14px;
  }

  .tx-icon {
    width: 28px;
    height: 28px;
  }

  .tx-spinner {
    width: 16px;
    height: 16px;
  }

  .item-modal-content {
    padding: 15px;
  }

  .modal-traits {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .item-modal-info h3 {
    font-size: 1rem;
    margin-bottom: 8px;
  }
}
