/* ============================================
   Kevin的技能集锦 · Skills Marketplace
   Design: Clean, modern, light theme
   ============================================ */

:root {
  --primary: #4F46E5;
  --primary-light: #6366F1;
  --primary-dark: #4338CA;
  --primary-bg: #EEF2FF;
  --accent: #06B6D4;
  --accent-bg: #ECFEFF;
  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-hover: #F1F5F9;
  --text: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; text-decoration: none; }

/* ========== Header ========== */
.header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.logo-icon { font-size: 28px; }
.logo-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

.nav { display: flex; gap: 4px; }
.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
  font-weight: 500;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link.active { background: var(--primary-bg); color: var(--primary); }
.nav-admin {
  background: var(--primary);
  color: white !important;
  margin-left: 8px;
}
.nav-admin:hover { background: var(--primary-dark); }

/* ========== Hero ========== */
.hero {
  background: linear-gradient(135deg, #EEF2FF 0%, #F0F9FF 50%, #ECFEFF 100%);
  padding: 64px 0 48px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.hero-title {
  font-size: 40px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.hero-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.search-box {
  display: flex;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  background: white;
  border: 2px solid var(--border);
  border-radius: 48px;
  padding: 4px 4px 4px 20px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
}

.search-icon { font-size: 18px; opacity: 0.4; }
.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  padding: 12px 8px;
  background: transparent;
  color: var(--text);
}
.search-input::placeholder { color: var(--text-muted); }

.search-clear {
  width: 36px; height: 36px;
  border: none; background: var(--bg-hover);
  border-radius: 50%; cursor: pointer;
  font-size: 14px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  margin-right: 4px;
}
.search-clear:hover { background: var(--border); color: var(--text); }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 32px;
}
.stat { text-align: center; }
.stat-num {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}
.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========== Filters ========== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 32px 0 20px;
  justify-content: center;
}

.filter-btn {
  padding: 8px 18px;
  border-radius: 48px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}
.filter-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}
.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ========== Skill Card Grid ========== */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding: 8px 0 48px;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.skill-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.skill-card.featured {
  border-color: rgba(79,70,229,0.2);
  background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFF 100%);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.card-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.card-title-group { flex: 1; min-width: 0; }
.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-version {
  font-size: 12px;
  color: var(--text-muted);
}

.card-badges {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-featured {
  background: #FEF3C7;
  color: #D97706;
}

.badge-new {
  background: #DCFCE7;
  color: #16A34A;
}

.badge-platform {
  background: #E0E7FF;
  color: #4F46E5;
}

.card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.tag {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text-muted);
  white-space: nowrap;
}

.card-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--primary-bg); border-color: var(--primary-light); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

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

/* ========== Loading ========== */
.loading {
  text-align: center;
  padding: 60px;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: white;
  border-radius: var(--radius);
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(10px);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-hover);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: var(--transition);
}
.modal-close:hover { background: var(--border); }

.modal-content { padding: 36px; }

.modal-header {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.modal-icon {
  font-size: 48px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-bg);
  border-radius: var(--radius);
}
.modal-name { font-size: 24px; font-weight: 800; }
.modal-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.modal-desc { font-size: 15px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.info-item {}
.info-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.info-value { font-size: 14px; color: var(--text); margin-top: 2px; }

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
}

.modal-actions { display: flex; gap: 10px; }

/* ========== Footer ========== */
.footer {
  margin-top: auto;
  padding: 24px 0;
  text-align: center;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-muted);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .hero { padding: 48px 0 36px; }
  .hero-title { font-size: 28px; }
  .hero-stats { gap: 24px; }
  .skill-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .modal-content { padding: 24px; }
  .header-inner { height: 56px; }
  .logo-text { font-size: 18px; }
  .logo-sub { display: none; }
}

/* ========== Admin Page ========== */
.admin-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.admin-title { font-size: 28px; font-weight: 800; }
.admin-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  background: white;
}
.upload-zone:hover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-text { font-size: 16px; color: var(--text); font-weight: 600; }
.upload-hint { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

.form-section {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 24px;
}

.form-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: var(--transition);
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-textarea { min-height: 100px; resize: vertical; }

.form-tags-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 42px;
  align-items: center;
  background: white;
}
.form-tags-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.tag-remove {
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
}
.tag-remove:hover { opacity: 1; }

.tag-input-inner {
  border: none;
  outline: none;
  font-size: 14px;
  min-width: 80px;
  flex: 1;
  padding: 4px;
}

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

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.btn-secondary {
  background: white;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger {
  background: #FEE2E2;
  color: #DC2626;
}
.btn-danger:hover { background: #FECACA; }

.msg {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  display: none;
}
.msg.success { display: block; background: #DCFCE7; color: #16A34A; border: 1px solid #BBF7D0; }
.msg.error { display: block; background: #FEE2E2; color: #DC2626; border: 1px solid #FECACA; }

/* Skill List Table in Admin */
.skill-list-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-light);
  margin-top: 24px;
}

.skill-list-table th {
  background: var(--bg);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.skill-list-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  font-size: 14px;
}

.skill-list-table tr:hover td { background: var(--bg-hover); }

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

.status-badge {
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.status-published { background: #DCFCE7; color: #16A34A; }
.status-draft { background: #FEF3C7; color: #D97706; }
