/* =============================================
   激活码管理工具 - Web 版样式
   设计原则: 移动端优先, 暗色主题, 现代扁平
============================================= */

:root {
  --bg-base: #0d1117;
  --bg-surface: #161b22;
  --bg-card: #1c2330;
  --bg-hover: #21293a;
  --border: #30363d;
  --border-light: #21293a;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);

  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --purple: #a855f7;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);

  --header-h: 56px;
  --status-h: 32px;
  --tab-h: 48px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

input,
select,
button,
textarea {
  font-family: inherit;
}

ul {
  list-style: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ====================== HEADER ====================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(22, 27, 34, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 22px;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.settings-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.settings-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--bg-hover);
}

/* ====================== STATUS BAR ====================== */
.status-bar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  height: var(--status-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  z-index: 99;
  transition: color 0.3s;
}

.status-bar.success {
  color: var(--green);
}

.status-bar.error {
  color: var(--red);
}

.status-bar.loading {
  color: var(--accent);
  background: linear-gradient(90deg, var(--bg-surface) 0%, var(--bg-hover) 50%, var(--bg-surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0
  }

  100% {
    background-position: -200% 0
  }
}

/* ====================== MAIN ====================== */
.main {
  padding-top: calc(var(--header-h) + var(--status-h));
  padding-bottom: 24px;
  max-width: 900px;
  margin: 0 auto;
}

/* ====================== TAB NAV ====================== */
.tab-nav {
  display: flex;
  gap: 2px;
  padding: 10px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: var(--bg-base);
  position: sticky;
  top: calc(var(--header-h) + var(--status-h));
  z-index: 50;
  border-bottom: 1px solid var(--border);
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

/* ====================== PANELS ====================== */
.panels {
  padding: 16px 12px;
}

.panel {
  display: none;
  animation: fadeIn 0.25s ease;
}

.panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

/* ====================== CARD ====================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title-row .card-title {
  margin-bottom: 0;
}

/* ====================== FORM ====================== */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row.compact {
  flex: 1;
  margin-bottom: 0;
}

.filter-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%238b949e' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.input-with-toggle {
  position: relative;
  display: flex;
}

.input-with-toggle .form-input {
  padding-right: 44px;
}

.eye-btn {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

/* Number input */
.number-input {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface);
}

.num-btn {
  background: var(--bg-hover);
  border: none;
  color: var(--text-primary);
  padding: 10px 16px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.num-btn:hover {
  background: var(--accent);
}

.num-field {
  flex: 1;
  border: none !important;
  border-radius: 0 !important;
  text-align: center;
  box-shadow: none !important;
  background: var(--bg-surface) !important;
}

.num-field::-webkit-inner-spin-button,
.num-field::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

/* ====================== BUTTONS ====================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  outline: none;
  min-height: 42px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 30px;
}

.btn-group {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.full-width {
  width: 100%;
}

/* ====================== TABLE ====================== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.data-table tbody tr {
  transition: background 0.15s;
}

/* 状态标签 */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.badge-purple {
  background: rgba(168, 85, 247, 0.15);
  color: var(--purple);
}

/* 可编辑备注 */
.editable-remark {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 13px;
  padding: 3px 6px;
  width: 100%;
  min-width: 80px;
  outline: none;
  transition: border-color 0.2s;
}

.editable-remark:hover {
  border-color: var(--border);
}

.editable-remark:focus {
  border-color: var(--accent);
  background: var(--bg-surface);
}

/* 激活码文字 */
.license-key {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--accent);
  user-select: all;
}

/* ====================== STATS ====================== */
.list-stats {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 4px;
  margin-bottom: 8px;
}

/* ====================== ADMIN LIST ====================== */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.admin-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-name {
  font-weight: 600;
  font-size: 14px;
}

.admin-time {
  font-size: 11px;
  color: var(--text-muted);
}

.admin-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 20px;
}

/* ====================== HASH RESULT ====================== */
.hash-result {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--green);
  line-height: 1.6;
}

/* ====================== INFO BOX ====================== */
.info-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.7;
}

.info-box.warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
  color: #d4a72a;
}

.info-box p {
  font-weight: 600;
  margin-bottom: 6px;
}

.info-box li::before {
  content: "• ";
  opacity: 0.6;
}

.info-box li {
  margin-left: 8px;
}

/* ====================== DIVIDER ====================== */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0 16px;
}

/* ====================== MODAL ====================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.modal-body {
  padding: 20px;
}

/* ====================== TOAST ====================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 16px;
  left: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

.toast.success {
  border-left: 3px solid var(--green);
  color: var(--green);
}

.toast.error {
  border-left: 3px solid var(--red);
  color: var(--red);
}

.toast.info {
  border-left: 3px solid var(--accent);
  color: var(--accent);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ====================== EMPTY STATE ====================== */
.empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
}

/* ====================== LOADING SPINNER ====================== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ====================== COPY BTN IN TABLE ====================== */
.copy-key-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: color 0.2s;
  vertical-align: middle;
}

.copy-key-btn:hover {
  color: var(--accent);
}

/* 创建者标签 */
.creator-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(168, 85, 247, 0.12);
  color: #a78bfa;
  white-space: nowrap;
}

/* ====================== RESPONSIVE ====================== */
@media (min-width: 600px) {
  .modal {
    border-radius: var(--radius-lg);
    margin: auto;
    max-height: 85vh;
  }

  .modal-overlay {
    align-items: center;
  }

  .panels {
    padding: 20px 24px;
  }

  .tab-btn {
    padding: 10px 18px;
    font-size: 14px;
  }

  .filter-row {
    gap: 16px;
  }
}

@media (min-width: 900px) {
  .tab-nav {
    padding: 12px 24px 0;
  }

  .main {
    padding-top: calc(var(--header-h) + var(--status-h));
  }
}

/* ====================== LINK GENERATOR ====================== */
.link-gen-section {
  background: rgba(168, 85, 247, 0.07);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
}

.link-gen-hint {
  font-size: 12px;
  color: #a78bfa;
  line-height: 1.5;
}

.btn-accent {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border: none;
}

.btn-accent:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9, #9333ea);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.4);
}

.share-link-box {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.share-link-input {
  flex: 1;
  min-width: 0;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #a78bfa !important;
  background: var(--bg-surface) !important;
  cursor: text;
}

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-surface) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 14px;
  display: inline-block;
}

/* 创建者标签 */
.creator-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(168, 85, 247, 0.12);
  color: #a78bfa;
  white-space: nowrap;
}

/* ====================== LOGIN SCREEN ====================== */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  z-index: 500;
  /* 背景装饰 */
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 60%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 0;
  animation: fadeIn 0.4s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 10px;
  /* 发光效果 */
  filter: drop-shadow(0 0 16px rgba(59, 130, 246, 0.4));
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.3));
  }

  50% {
    filter: drop-shadow(0 0 24px rgba(168, 85, 247, 0.5));
  }
}

.login-logo-text {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.login-logo-sub {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.login-card .form-row {
  margin-bottom: 14px;
}

.login-card .btn-primary {
  margin-top: 6px;
  height: 46px;
  font-size: 15px;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.login-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  color: #f87171;
  font-size: 13px;
  line-height: 1.5;
}