@import url('https://fonts.googleapis.com/css2?family=Source+Han+Sans+CN:wght@400;500;700;900&display=swap');

* { font-family: 'Source Han Sans CN', 'Noto Sans SC', sans-serif; }
html { scroll-behavior: smooth; }
.page { display: none; }
.page.active { display: block; }
.fade-in { animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.mobile-menu { display: none; }
.mobile-menu.open { display: block; }
@media (min-width: 768px) { .mobile-menu.open { display: none; } }
.lang-dropdown { display: none; }
.lang-dropdown.open { display: block; }
.hero-overlay {
  background-image: url('https://material-image.wanwang.xin/1407313552554868/WS20260430153449000001/4aca2bdc-34af-4984-ae3e-8f02206ab014.png');
  background-size: cover;
  background-position: center;
}

/* Edit mode styles */
body.edit-mode .editable-text {
  outline: 2px dashed #3b82f6 !important;
  outline-offset: 2px;
  cursor: text;
  border-radius: 4px;
  padding: 2px 4px;
  transition: outline 0.15s;
}
body.edit-mode .editable-text:hover { outline-color: #2563eb; background: rgba(59,130,246,0.05); }
body.edit-mode .editable-text:focus { outline: 2px solid #2563eb !important; background: rgba(59,130,246,0.08); }

body.edit-mode img.editable-image {
  outline: 3px dashed #3b82f6 !important;
  outline-offset: 3px;
  cursor: pointer;
  transition: outline 0.15s, filter 0.15s;
}
body.edit-mode img.editable-image:hover { outline-color: #2563eb; filter: brightness(1.05); }

body.edit-mode .editable-icon {
  outline: 2px dashed #f59e0b !important;
  outline-offset: 2px;
  cursor: pointer;
  border-radius: 4px;
  transition: outline 0.15s;
}
body.edit-mode .editable-icon:hover { outline-color: #d97706; background: rgba(245,158,11,0.1); }

body.edit-mode .editable-section {
  outline: 2px dotted #10b981 !important;
  outline-offset: 4px;
  cursor: pointer;
  transition: outline 0.15s;
}
body.edit-mode .editable-section:hover { outline-color: #059669; }

/* Floating edit button */
#edit-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#edit-toggle-btn:hover { background: #2563eb; transform: scale(1.1); }
#edit-toggle-btn.active { background: #ef4444; }
#edit-toggle-btn.active:hover { background: #dc2626; }

/* Edit toolbar */
#edit-toolbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: #1e40af;
  color: white;
  padding: 8px 16px;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
body.edit-mode #edit-toolbar { display: block; }
#edit-toolbar button {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin: 0 4px;
  font-size: 13px;
  transition: background 0.2s;
}
#edit-toolbar button:hover { background: rgba(255,255,255,0.35); }
#edit-toolbar button.danger { background: rgba(239,68,68,0.6); border-color: rgba(239,68,68,0.8); }
#edit-toolbar button.danger:hover { background: #ef4444; }

/* Modal overlay */
.edit-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.6);
  align-items: center;
  justify-content: center;
}
.edit-modal-overlay.open { display: flex; }
.edit-modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.edit-modal h3 { margin: 0 0 16px 0; font-size: 18px; color: #111; }
.edit-modal label { display: block; font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.edit-modal input[type="text"],
.edit-modal input[type="url"],
.edit-modal input[type="file"] {
  width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 14px; margin-bottom: 12px; box-sizing: border-box;
}
.edit-modal input:focus { outline: none; border-color: #3b82f6; ring: 2px solid #3b82f6; }
.edit-modal .btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.edit-modal button {
  padding: 8px 20px; border-radius: 6px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: background 0.2s;
}
.edit-modal .btn-primary { background: #3b82f6; color: white; }
.edit-modal .btn-primary:hover { background: #2563eb; }
.edit-modal .btn-cancel { background: #e5e7eb; color: #374151; }
.edit-modal .btn-cancel:hover { background: #d1d5db; }
.edit-modal .preview-img { max-width: 100%; max-height: 200px; border-radius: 8px; margin-bottom: 12px; }

/* Icon picker grid */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}
.icon-grid .icon-item {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 1;
  border: 2px solid #e5e7eb; border-radius: 8px;
  cursor: pointer; font-size: 22px; color: #374151;
  transition: all 0.15s;
}
.icon-grid .icon-item:hover { border-color: #3b82f6; background: #eff6ff; color: #2563eb; }
.icon-grid .icon-item.selected { border-color: #f59e0b; background: #fffbeb; color: #d97706; }

/* Style panel */
#style-panel {
  display: none;
  position: fixed;
  right: 24px;
  bottom: 84px;
  z-index: 9997;
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 240px;
  font-size: 13px;
}
#style-panel.open { display: block; }
#style-panel label { display: block; font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 4px; margin-top: 8px; }
#style-panel select, #style-panel input { width: 100%; padding: 4px 8px; font-size: 13px; border: 1px solid #d1d5db; border-radius: 4px; }
#style-panel .close-btn { position: absolute; top: 8px; right: 8px; background: none; border: none; font-size: 16px; cursor: pointer; color: #9ca3af; }
#style-panel .close-btn:hover { color: #374151; }

/* Hover tooltip */
.edit-tooltip {
  display: none;
  position: absolute;
  background: #1f2937;
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10001;
}
body.edit-mode .editable-image:hover + .edit-tooltip,
body.edit-mode .editable-icon:hover + .edit-tooltip { display: block; }

/* Matches page styles */
.match-card {
  transition: all 0.3s ease;
}
.match-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.match-score {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Standings table */
.standings-table th, .standings-table td {
  padding: 10px 8px;
  text-align: center;
}
.standings-table th:first-child, .standings-table td:first-child { text-align: left; }
.standings-table tr.highlight { background: rgba(234,179,8,0.1); }

/* Hide native edit UI when loaded in admin iframe */
body.from-admin #edit-toggle-btn,
body.from-admin #edit-toolbar,
body.from-admin #style-panel,
body.from-admin .edit-modal-overlay { display: none !important; }

/* Admin styles */
.admin-sidebar { min-height: 100vh; }
.admin-card { transition: box-shadow 0.2s; }
.admin-card:hover { box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
