/* ===== 变量定义 ===== */
:root {
  --mc-dirt: #8B6914;
  --mc-grass: #5D8C3A;
  --mc-stone: #7D7D7D;
  --mc-wood: #6B4226;
  --mc-gold: #F4D142;
  --mc-red: #B02E26;
  --mc-green: #5D8C3A;
  --mc-blue: #3C44AA;
  --mc-dark: #1a1a2e;
  --mc-panel: #2d2d44;
  --mc-border: #4a4a6a;
  --mc-text: #e0e0e0;
  --mc-text-dim: #8888aa;
  --pixel-shadow: 4px 4px 0px rgba(0,0,0,0.5);
  --pixel-shadow-sm: 2px 2px 0px rgba(0,0,0,0.5);
}

/* ===== 基础样式 ===== */
* { box-sizing: border-box; image-rendering: pixelated; }

body {
  margin: 0;
  font-family: 'VT323', monospace;
  background: var(--mc-dark);
  color: var(--mc-text);
  overflow-x: hidden;
  line-height: 1.4;
}

/* 像素风背景 */
.mc-bg {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: -1;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.mc-bg::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px);
  pointer-events: none;
}

/* ===== 布局 ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

/* ===== 导航栏 ===== */
.nav-bar {
  background: linear-gradient(180deg, #2d2d44 0%, #1a1a2e 100%);
  border-bottom: 4px solid var(--mc-border);
  box-shadow: 0 4px 0px rgba(0,0,0,0.3);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-wrap: wrap;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo {
  width: 40px;
  height: 40px;
  background: var(--mc-grass);
  border: 3px solid #000;
  box-shadow: 3px 3px 0px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.nav-title {
  font-size: 28px;
  color: var(--mc-gold);
  text-shadow: 2px 2px 0px #000;
}

.nav-items {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-item {
  padding: 12px 24px;
  font-size: 20px;
  cursor: pointer;
  border-bottom: 4px solid transparent;
  transition: all 0.2s;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--mc-gold);
}

.nav-item.active {
  border-bottom-color: var(--mc-gold);
  color: var(--mc-gold);
  background: rgba(244, 209, 66, 0.1);
}

/* ===== 通用组件 ===== */
.pixel-btn {
  font-family: 'VT323', monospace;
  font-size: 18px;
  padding: 8px 20px;
  border: 3px solid #000;
  background: var(--mc-grass);
  color: white;
  cursor: pointer;
  box-shadow: var(--pixel-shadow-sm);
  transition: all 0.1s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pixel-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px rgba(0,0,0,0.5);
  filter: brightness(1.1);
}

.pixel-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px rgba(0,0,0,0.5);
}

.pixel-btn.red { background: var(--mc-red); }
.pixel-btn.blue { background: var(--mc-blue); }
.pixel-btn.gold { background: var(--mc-gold); color: #333; }
.pixel-btn.wood { background: var(--mc-wood); }

.pixel-panel {
  background: var(--mc-panel);
  border: 4px solid var(--mc-border);
  box-shadow: var(--pixel-shadow);
  position: relative;
}

.pixel-panel::before {
  content: '';
  position: absolute;
  top: 4px; left: 4px; right: 4px; bottom: 4px;
  border: 2px solid rgba(255,255,255,0.05);
  pointer-events: none;
}

.pixel-input {
  font-family: 'VT323', monospace;
  font-size: 18px;
  padding: 8px 12px;
  background: #1a1a2e;
  border: 3px solid var(--mc-border);
  color: var(--mc-text);
  outline: none;
  width: 100%;
}

.pixel-input:focus {
  border-color: var(--mc-gold);
  box-shadow: 0 0 8px rgba(244, 209, 66, 0.3);
}

.pixel-tag {
  display: inline-block;
  padding: 2px 10px;
  font-size: 14px;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
  margin: 2px;
  cursor: pointer;
  user-select: none;
}

.pixel-tag.survival { background: #5D8C3A; }
.pixel-tag.creative { background: #3C44AA; }
.pixel-tag.minigame { background: #F4D142; color: #333; }
.pixel-tag.pvp { background: #B02E26; }
.pixel-tag.rpg { background: #9D5EC2; }
.pixel-tag.vanilla { background: #7D7D7D; }
.pixel-tag.modded { background: #E67E22; }

.pixel-tag.active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px rgba(0,0,0,0.5);
  filter: brightness(1.3);
}

/* ===== 状态指示 ===== */
.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 0;
  border: 2px solid #000;
  display: inline-block;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.3);
}

.status-dot.online { background: #5D8C3A; animation: pulse 2s infinite; }
.status-dot.offline { background: #B02E26; }
.status-dot.checking { background: #F4D142; animation: blink 0.5s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== 首页统计 ===== */
.section-title {
  margin: 0;
  font-size: 28px;
  color: var(--mc-gold);
  text-shadow: 2px 2px 0px #000;
}

.stats-panel { padding: 24px; margin-bottom: 24px; }

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.check-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: var(--mc-text-dim);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 16px;
  text-align: center;
  background: var(--mc-panel);
  border: 3px solid var(--mc-border);
  box-shadow: var(--pixel-shadow-sm);
}

.stat-card.stat-online { background: rgba(93, 140, 58, 0.2); }
.stat-card.stat-players { background: rgba(60, 68, 170, 0.2); }
.stat-card.stat-total { background: rgba(244, 209, 66, 0.2); }
.stat-card.stat-offline { background: rgba(176, 46, 38, 0.2); }

.stat-label {
  font-size: 14px;
  color: var(--mc-text-dim);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 36px;
  text-shadow: 2px 2px 0px #000;
}

.stat-online .stat-value { color: var(--mc-gold); }
.stat-players .stat-value { color: #6B8DD6; }
.stat-total .stat-value { color: var(--mc-gold); }
.stat-offline .stat-value { color: #e74c3c; }

.version-distribution { margin-top: 16px; }
.version-label {
  font-size: 16px;
  color: var(--mc-text-dim);
  margin-bottom: 8px;
}

/* ===== 搜索筛选 ===== */
.search-panel { padding: 16px; margin-bottom: 24px; }

.search-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input { flex: 1; min-width: 200px; }
.version-select { width: auto; min-width: 140px; }
.tag-filters { display: flex; gap: 4px; flex-wrap: wrap; }

/* ===== 服务器列表 ===== */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.list-subtitle {
  font-size: 14px;
  color: var(--mc-text-dim);
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  display: none;
}

.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-title { font-size: 20px; color: var(--mc-text-dim); }
.empty-desc { font-size: 16px; color: var(--mc-text-dim); margin-top: 8px; }

/* ===== 服务器卡片 ===== */
.server-card {
  background: var(--mc-panel);
  border: 4px solid var(--mc-border);
  box-shadow: var(--pixel-shadow);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.server-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: var(--mc-grass);
}

.server-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px rgba(0,0,0,0.5);
  border-color: var(--mc-gold);
}

.server-card.offline::before { background: var(--mc-red); }
.server-card.offline { opacity: 0.7; }

.card-inner {
  display: flex;
  gap: 16px;
}

.pixel-avatar {
  width: 64px;
  height: 64px;
  border: 3px solid #000;
  box-shadow: 3px 3px 0px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.card-body { flex: 1; min-width: 0; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.card-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pending-badge {
  font-size: 12px;
  background: var(--mc-gold);
  color: #333;
  padding: 2px 8px;
  border: 2px solid #000;
}

.card-desc {
  font-size: 14px;
  color: var(--mc-text-dim);
  margin-bottom: 8px;
}

.card-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.version-badge, .player-badge {
  padding: 2px 10px;
  font-size: 14px;
  border: 2px solid #000;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
}

.version-badge { background: #3C44AA; }
.player-badge.online { background: #5D8C3A; }
.player-badge.offline { background: #B02E26; }

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.address-box {
  flex: 1;
  background: #1a1a2e;
  border: 2px solid #000;
  padding: 6px 10px;
  font-size: 14px;
  font-family: monospace;
  color: var(--mc-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-section { margin-top: 10px; }

.pixel-progress {
  height: 20px;
  background: #1a1a2e;
  border: 3px solid #000;
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}

.pixel-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mc-grass), #7bc452);
  transition: width 0.5s ease;
  position: relative;
}

.pixel-progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(90deg, transparent, transparent 4px, rgba(0,0,0,0.1) 4px, rgba(0,0,0,0.1) 8px);
}

.progress-label {
  font-size: 12px;
  color: var(--mc-text-dim);
  margin-top: 4px;
  text-align: right;
}

/* ===== 发布页面 ===== */
.publish-panel { padding: 0; overflow: hidden; max-width: 700px; margin: 0 auto; }

.publish-form { padding: 24px; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  color: var(--mc-text-dim);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row .form-group { margin-bottom: 0; }
.flex-2 { grid-column: span 2; }
.flex-1 { grid-column: span 1; }

.form-tip {
  padding: 12px;
  background: rgba(244, 209, 66, 0.1);
  border: 2px dashed var(--mc-gold);
  margin: 8px 0 16px;
  font-size: 14px;
  color: var(--mc-gold);
}

.publish-btn {
  width: 100%;
  font-size: 20px;
  padding: 12px;
}

/* ===== 管理后台 ===== */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-actions { display: flex; gap: 8px; }

.admin-stats { padding: 20px; margin-bottom: 20px; }

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.admin-stat { text-align: center; }
.admin-stat-value { font-size: 32px; }
.admin-stat-online { color: var(--mc-green); }
.admin-stat-offline { color: var(--mc-red); }
.admin-stat-pending { color: var(--mc-blue); }
.admin-stat-label { font-size: 14px; color: var(--mc-text-dim); }

.admin-table-panel { padding: 0; overflow: hidden; }

.admin-filters {
  padding: 16px;
  background: var(--mc-wood);
  border-bottom: 3px solid #000;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrapper { overflow-x: auto; }

/* ===== 表格 ===== */
.pixel-table {
  width: 100%;
  border-collapse: collapse;
}

.pixel-table th {
  background: var(--mc-wood);
  padding: 12px;
  text-align: left;
  border: 2px solid #000;
  font-size: 18px;
}

.pixel-table td {
  padding: 10px 12px;
  border: 2px solid var(--mc-border);
  font-size: 16px;
}

.pixel-table tr:nth-child(even) { background: rgba(255,255,255,0.03); }
.pixel-table tr:hover { background: rgba(244, 209, 66, 0.1); }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 20px;
}

.modal-content {
  background: var(--mc-panel);
  border: 4px solid var(--mc-border);
  box-shadow: var(--pixel-shadow);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.login-modal { max-width: 400px; }

.modal-header {
  background: linear-gradient(90deg, var(--mc-grass), #4a7a2a);
  padding: 16px 24px;
  border-bottom: 4px solid #000;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { margin: 0; font-size: 22px; }

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  font-family: 'VT323', monospace;
}

.login-options { padding: 24px; display: flex; flex-direction: column; gap: 12px; }

.login-option { padding: 16px; cursor: pointer; }
.login-option-title { font-size: 20px; }
.login-option-desc { font-size: 14px; color: var(--mc-text-dim); margin-top: 4px; }

.edit-form { padding: 24px; }

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.form-actions .pixel-btn { flex: 1; }

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border: 3px solid #000;
  box-shadow: var(--pixel-shadow);
  font-size: 16px;
  animation: slideIn 0.3s ease;
  min-width: 250px;
}

.toast.success { background: var(--mc-grass); }
.toast.error { background: var(--mc-red); }
.toast.info { background: var(--mc-blue); }
.toast.warn { background: var(--mc-gold); color: #333; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== 选中效果 ===== */
.selectable:hover {
  background: rgba(244, 209, 66, 0.1);
  cursor: pointer;
}

.selectable.selected {
  background: rgba(244, 209, 66, 0.2);
  border-color: var(--mc-gold);
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: #1a1a2e; }
::-webkit-scrollbar-thumb { background: var(--mc-border); border: 2px solid #1a1a2e; }
::-webkit-scrollbar-thumb:hover { background: var(--mc-gold); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .nav-inner { justify-content: center; }
  .nav-item { padding: 8px 12px; font-size: 16px; }
  .server-grid { grid-template-columns: 1fr; }
  .stats-header { flex-direction: column; align-items: flex-start; }
  .search-row { flex-direction: column; align-items: stretch; }
  .form-row { grid-template-columns: 1fr; }
  .form-row .flex-2, .form-row .flex-1 { grid-column: span 1; }
  .admin-header { flex-direction: column; align-items: flex-start; }
  .pixel-table { font-size: 14px; }
  .pixel-table th, .pixel-table td { padding: 6px 8px; }
}
