:root {
  --mario-red: #d44246;
  --mario-blue: #049cd8;
  --mario-yellow: #fbd000;
  --mario-green: #3fa142;
  --dark-bg: #0a0b0e;
  --darker-bg: #070809;
  --text-color: #e0e0e0;
  --table-border: #1a1b1f;
}

body {
  background: var(--dark-bg);
  color: var(--text-color);
  font-family: "Courier New", monospace;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
  font-size: 12px;
}

.header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
  padding-right: 70px;
}

.header-title > .title {
  position: relative;
  font-family: "Press Start 2P", cursive;
  color: var(--mario-green);
  font-size: 24px;
  text-shadow: 2px 2px var(--mario-blue);
  margin-right: 20px;
}

.header-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 8px;
}

.header > .header-title {
  display: flex;
  align-items: center;
  justify-content: center;
}

#updateButton {
  background: var(--mario-green);
  border: 2px solid var(--mario-yellow);
  color: white;
  font-family: "Press Start 2P", cursive;
  font-size: 10px;
  padding: 8px 16px;
  text-transform: uppercase;
  transition: all 0.3s ease;
  box-shadow: 3px 3px var(--mario-blue);
  position: relative;
  min-width: 140px;
}

#updateButton:hover {
  transform: translateY(-2px);
  box-shadow: 5px 5px var(--mario-blue);
}

#updateButton:active {
  transform: translateY(2px);
  box-shadow: 1px 1px var(--mario-blue);
}

#updateButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.table {
  background: var(--darker-bg);
  color: var(--text-color);
  border-color: var(--table-border);
}

.table thead th {
  background: var(--mario-blue);
  color: white;
  font-family: "Press Start 2P", cursive;
  font-size: 9px;
  border: 1px solid var(--mario-yellow);
  padding: 8px 4px;
}

.table tbody td {
  border-color: var(--table-border);
  font-size: 12px;
  padding: 6px 4px;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(251, 208, 0, 0.1);
}

.positive {
  color: #4db352 !important;
}

.negative {
  color: inherit;
}

@keyframes spin-coin {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(360deg);
  }
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate {
  color: var(--text-color) !important;
  font-size: 12px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text-color) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--mario-red) !important;
  border: 2px solid var(--mario-yellow) !important;
  color: white !important;
  font-family: "Press Start 2P", cursive;
  font-size: 10px;
  box-shadow: 2px 2px var(--mario-blue);
}

.dataTables_filter input {
  background: var(--darker-bg) !important;
  color: var(--text-color) !important;
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
  padding: 5px 10px;
}

/* 添加搜索框focus状态的样式 */
.dataTables_filter input:focus {
  outline: 2px solid var(--mario-green) !important;
  border-color: var(--mario-yellow) !important;
  box-shadow: 0 0 0 2px rgba(63, 161, 66, 0.2) !important;
}

/* 添加全局搜索高亮样式 */
::selection {
  background: var(--mario-green);
  color: white;
}

::-moz-selection {
  background: var(--mario-green);
  color: white;
}

.table tbody tr:hover {
  background-color: rgba(251, 208, 0, 0.1);
}

/* 添加数字列居中的样式 */
.table td:nth-child(3),
.table td:nth-child(4),
.table td:nth-child(5),
.table td:nth-child(6),
.table td:nth-child(7) {
  text-align: center;
}

/* 表头居中 */
.table th {
  text-align: center;
}

.mario-pixel {
  position: fixed;
  left: 100px;
  top: 80%;
  transform: translateY(-50%);
  width: 160px;
  height: 160px;
  animation: mario-jump 1s infinite;
}

.mario-pixel img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes mario-jump {
  0%,
  100% {
    transform: translateY(-50%) scale(1);
  }
  50% {
    transform: translateY(-80%) scale(1.1);
  }
}

.form-check-label {
  color: var(--text-color);
  font-size: 12px;
}

.form-check-input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin-top: 0;
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  vertical-align: middle;
  border-radius: 0;
  border: 2px solid var(--mario-green);
  background-color: var(--darker-bg);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 10px;
  box-shadow: none;
  outline: none;
}

.form-check-input:focus {
  box-shadow: 0 0 0 2px rgba(4, 156, 216, 0.35);
}

.form-check-input:checked {
  background-color: var(--mario-green) !important;
  border-color: var(--mario-green) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M1 5l3 3 7-7'/%3E%3C/svg%3E");
}

/* 修改标签页样式 */
.nav-tabs {
  border-bottom: 1px solid var(--mario-green);
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
  overflow: hidden;
}

.nav-tabs .nav-link {
  color: var(--text-color);
  background: var(--darker-bg);
  border: 1px solid transparent;
  margin-right: 5px;
  font-family: "Press Start 2P", cursive;
  font-size: 10px;
  padding: 8px 15px;
  white-space: nowrap;
  min-width: max-content;
}

.nav-tabs .nav-link:hover {
  border-color: var(--mario-yellow);
  color: var(--mario-yellow);
}

.nav-tabs .nav-link.active {
  background: var(--mario-green);
  color: white;
  border: 2px solid var(--mario-yellow);
  box-shadow: 2px 2px var(--mario-blue);
}

/* 添加滚动条样式（可选） */
.nav-tabs::-webkit-scrollbar {
  height: 4px;
}

.nav-tabs::-webkit-scrollbar-track {
  background: var(--darker-bg);
}

.nav-tabs::-webkit-scrollbar-thumb {
  background: var(--mario-green);
  border-radius: 2px;
}

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

.header-tabs-left {
  display: flex;
  align-items: center;
}

.exchange-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px; /* 可选：调整多选框之间的间距 */
}

.table-responsive {
  overflow: hidden;
}

.telegram-link:hover svg {
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.btn-twitter {
  background: #0f0f0f;
  border: 2px solid #ffffff;
  color: #ffffff;
}

.btn-twitter:hover {
  background: #ffffff;
  color: #0f0f0f;
}

.spinner-border {
  display: block;
  margin: 0 auto; /* Centers the spinner horizontally */
  width: 2rem; /* Smaller size */
  height: 2rem; /* Smaller size */
  border-width: 0.2em; /* Adjust border thickness */
  color: #fff; /* White color */
}

.diff-detail {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: #0a0b0e;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diff-value {
  display: inline-block;
  font-weight: 700;
  color: #0a0b0e;
}

.diff-value.price-diff-value {
  font-size: 11px;
}

.direction-hint {
  cursor: help;
  font-family: inherit;
}

#opportunityTable_wrapper .dataTables_filter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

#opportunityTable_wrapper .dataTables_filter label {
  margin: 0;
}

.opportunity-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.opportunity-controls .form-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.action-lines {
  display: inline-block;
  white-space: normal;
  line-height: 1.25;
}

#opportunityTable {
  table-layout: fixed;
}

#opportunityTable th,
#opportunityTable td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.cex-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--mario-yellow);
  font-family: "Press Start 2P", cursive;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  text-decoration: none;
}

.cex-link.cex-ok {
  background: var(--mario-green);
}

.cex-link.cex-alert {
  background: var(--mario-red);
}

/* CEX Monitor Styles */
.cex-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px;
  background: var(--darker-bg);
  border-radius: 6px;
  border: 1px solid var(--table-border);
  margin-bottom: 20px;
}

.cex-control {
  display: grid;
  gap: 8px;
}

.cex-control label {
  font-size: 10px;
  font-weight: 600;
  color: var(--mario-yellow);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'Press Start 2P', cursive;
}

.cex-control input,
.cex-control select {
  padding: 8px 10px;
  border: 1px solid var(--table-border);
  border-radius: 6px;
  font-size: 12px;
  background: var(--darker-bg);
  color: var(--text-color);
  font-family: inherit;
}

.cex-control input::placeholder {
  color: #8c9096;
}

.cex-control input:focus,
.cex-control select:focus {
  outline: 2px solid rgba(63, 161, 66, 0.4);
  border-color: var(--mario-yellow);
  box-shadow: 0 0 0 2px rgba(63, 161, 66, 0.2);
}

#cex-asset,
#cex-chain {
  text-transform: uppercase;
}

.cex-toggles {
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  align-content: start;
  gap: 8px;
}

.cex-toggles label {
  grid-column: 1 / -1;
}

.cex-toggle {
  border: 1px solid var(--table-border);
  background: var(--darker-bg);
  color: var(--text-color);
  border-radius: 6px;
  padding: 7px 6px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
  font-family: 'Press Start 2P', cursive;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 2px 2px 0 var(--mario-blue);
}

.cex-toggle.active {
  color: #fff;
  border-color: var(--mario-yellow);
  box-shadow: 2px 2px 0 var(--mario-blue);
}

.cex-toggle.active[data-value='true'] {
  background: var(--mario-green);
}

.cex-toggle.active[data-value='false'] {
  background: var(--mario-red);
}

.cex-toggle.active[data-value='any'] {
  background: var(--mario-blue);
}

.cex-toggle:hover {
  border-color: var(--mario-yellow);
  transform: translateY(-1px);
}

.cex-actions {
  align-content: end;
}

#cex-refresh {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--mario-yellow);
  border-radius: 6px;
  background: var(--mario-green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--mario-blue);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-family: 'Press Start 2P', cursive;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#cex-refresh:hover {
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 var(--mario-blue);
}

#cex-refresh:active {
  transform: translateY(1px);
  box-shadow: 2px 2px 0 var(--mario-blue);
}

.cex-status {
  display: grid;
  gap: 16px;
}

.cex-status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  color: var(--text-color);
  font-size: 12px;
  padding: 0 4px;
}

.cex-meta-label {
  font-weight: 600;
  color: var(--mario-yellow);
  margin-right: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'Press Start 2P', cursive;
  font-size: 9px;
}

#cex-exchangeMeta {
  margin-left: auto;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(212, 66, 70, 0.15);
  border: 1px solid rgba(212, 66, 70, 0.5);
  color: #f2c8c9;
  font-weight: 600;
  font-size: 11px;
}

#cex-exchangeMeta:empty {
  display: none;
}

.cex-table {
  background: var(--darker-bg);
  border-radius: 6px;
  border: 1px solid var(--table-border);
  overflow: hidden;
}

.cex-table-head,
.cex-table-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 1fr 0.8fr 0.8fr;
  gap: 12px;
  padding: 12px 16px;
  align-items: center;
}

.cex-table-head {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--mario-blue);
  border-bottom: 1px solid var(--mario-yellow);
  font-family: 'Press Start 2P', cursive;
}

.cex-table-row {
  font-size: 12px;
  border-bottom: 1px solid var(--table-border);
  background: rgba(251, 208, 0, 0.08);
  animation: cexRowIn 0.35s ease forwards;
}

.cex-table-row:hover {
  background: rgba(251, 208, 0, 0.12);
}

.cex-table-row:last-child {
  border-bottom: none;
}

.cex-exchange-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.cex-exchange-icon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--table-border);
  background: var(--darker-bg);
  position: relative;
}

.cex-exchange-icon::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.75;
}

.cex-exchange-icon-binance,
.cex-exchange-icon-kucoin {
  color: var(--mario-yellow);
  border-color: rgba(224, 193, 118, 0.45);
}

.cex-exchange-icon-okx,
.cex-exchange-icon-huobi {
  color: var(--mario-blue);
  border-color: rgba(59, 143, 177, 0.45);
}

.cex-exchange-icon-bybit,
.cex-exchange-icon-bitget {
  color: var(--mario-green);
  border-color: rgba(111, 166, 122, 0.45);
}

.cex-exchange-icon-gateio,
.cex-exchange-icon-kraken {
  color: var(--mario-red);
  border-color: rgba(198, 109, 112, 0.45);
}

.cex-table.asset-mode .cex-table-head,
.cex-table.asset-mode .cex-exchange-row {
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
}

.cex-table.asset-mode .cex-table-body {
  display: grid;
  gap: 14px;
  padding: 16px 20px 20px;
}

.cex-table.asset-mode .cex-table-head span:nth-child(2),
.cex-table.asset-mode .cex-table-head span:nth-child(3) {
  text-align: center;
}

.cex-table.asset-mode .cex-exchange-row span:nth-child(2),
.cex-table.asset-mode .cex-exchange-row span:nth-child(3) {
  justify-self: center;
}

.cex-asset-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--mario-yellow);
  border-radius: 8px;
  background: rgba(4, 156, 216, 0.12);
}

.cex-asset-summary .cex-asset-label {
  font-family: 'Press Start 2P', cursive;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mario-yellow);
}

.cex-asset-summary .cex-asset-name {
  font-family: 'Press Start 2P', cursive;
  font-size: 14px;
  color: #fff;
  text-shadow: 2px 2px 0 var(--mario-blue);
}

.cex-asset-summary .cex-asset-meta {
  font-size: 13px;
  color: var(--text-color);
}

.cex-exchange-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--table-border);
  border-radius: 8px;
  background: var(--darker-bg);
}

.cex-exchange-title {
  display: flex;
  align-items: center;
}

.cex-exchange-title .cex-exchange-label {
  font-family: 'Press Start 2P', cursive;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mario-yellow);
}

.cex-exchange-rows {
  display: grid;
  gap: 8px;
}

.cex-exchange-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--table-border);
  border-radius: 6px;
  background: rgba(251, 208, 0, 0.08);
}

.cex-chain-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(4, 156, 216, 0.5);
  background: rgba(4, 156, 216, 0.18);
  color: #d9ecf3;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  max-width: 100%;
  word-break: break-word;
}

.cex-table-row span:nth-child(3) {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f2f2f2;
}

.cex-table-head span:nth-child(4),
.cex-table-head span:nth-child(5),
.cex-table-row span:nth-child(4),
.cex-table-row span:nth-child(5) {
  text-align: center;
}

.cex-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 9px;
  font-family: 'Press Start 2P', cursive;
  letter-spacing: 0.08em;
  border: 1px solid var(--mario-yellow);
  text-transform: uppercase;
}

.cex-badge.on {
  background: var(--mario-green);
  color: #fff;
}

.cex-badge.off {
  background: var(--mario-red);
  color: #fff;
}

.cex-empty {
  text-align: center;
  color: var(--text-color);
  padding: 24px;
  display: none;
  font-size: 14px;
  border: 1px dashed var(--table-border);
  border-radius: 6px;
  background: transparent;
}

@keyframes cexRowIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .cex-controls {
    grid-template-columns: 1fr;
  }

  .cex-status-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  #cex-exchangeMeta {
    margin-left: 0;
    width: 100%;
  }

  .cex-table-head,
  .cex-table-row {
    grid-template-columns: 1fr 1fr;
    row-gap: 6px;
  }

  .cex-table-head span:nth-child(3),
  .cex-table-head span:nth-child(4),
  .cex-table-head span:nth-child(5) {
    display: none;
  }

  .cex-table-row span:nth-child(3),
  .cex-table-row span:nth-child(4),
  .cex-table-row span:nth-child(5) {
    grid-column: 1 / -1;
  }

  .cex-table.asset-mode .cex-table-head {
    grid-template-columns: 1fr 0.8fr 0.8fr;
  }

  .cex-table.asset-mode .cex-table-head span:nth-child(3) {
    display: inline;
  }

  .cex-table.asset-mode .cex-table-body {
    padding: 12px 14px 16px;
  }

  .cex-table.asset-mode .cex-exchange-row {
    grid-template-columns: 1fr 1fr;
    row-gap: 6px;
  }

  .cex-table.asset-mode .cex-exchange-row span:nth-child(1) {
    grid-column: 1 / -1;
  }
}
