/* MaxcTool 工具集 - 前台样式 */
:root {
  --bg-0: #0a0e1a;
  --bg-1: #0f1424;
  --bg-2: #161c33;
  --bg-card: rgba(22, 28, 51, 0.7);
  --border: rgba(120, 145, 220, 0.15);
  --border-hover: rgba(120, 200, 255, 0.45);
  --text-1: #e8ecf5;
  --text-2: #a0aac4;
  --text-3: #6b7596;
  --accent: #4dd6ff;
  --accent-2: #7c5cff;
  --accent-grad: linear-gradient(135deg, #4dd6ff 0%, #7c5cff 100%);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 16px;
}

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

html, body {
  min-height: 100%;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', Consolas, 'Microsoft YaHei', monospace;
  color: var(--text-1);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(1000px 600px at -10% 110%, rgba(77, 214, 255, 0.15), transparent 60%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 145, 220, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 145, 220, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

/* 顶部 */
.site-header {
  position: relative;
  z-index: 2;
  padding: 18px 6vw;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 26, 0.4);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-1);
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #0a0e1a;
  letter-spacing: -1px;
  box-shadow: 0 6px 18px rgba(77, 214, 255, 0.35);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: 0.3px; }
.brand-sub { font-size: 10px; color: var(--text-3); letter-spacing: 2px; text-transform: uppercase; }

/* 顶栏右侧操作区 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* 搜索按钮（默认小图标，点击展开） */
.search-trigger {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(22, 28, 51, 0.6);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0;
  height: 38px;
  width: 38px;
  overflow: hidden;
  transition: width .35s cubic-bezier(.2,.7,.3,1), border-color .25s, box-shadow .25s;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.search-trigger:hover {
  border-color: var(--border-hover);
}

.search-trigger.open {
  width: min(360px, 50vw);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(77, 214, 255, 0.12);
}

.search-trigger .search-icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex-shrink: 0;
  cursor: pointer;
}

.search-trigger.open .search-icon-btn { color: var(--accent); }

.search-trigger .search-input-inline {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-1);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  padding: 0 14px 0 4px;
  min-width: 0;
  opacity: 0;
  transition: opacity .2s .1s;
}

.search-trigger.open .search-input-inline { opacity: 1; }

.search-trigger .search-clear {
  display: none;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 50%;
  background: rgba(120, 145, 220, 0.15);
  color: var(--text-2);
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1;
}
.search-trigger.open.has-text .search-clear { display: flex; }
.search-trigger .search-clear:hover { background: rgba(248, 113, 113, 0.2); color: var(--text-1); }

.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(22, 28, 51, 0.6);
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  text-decoration: none;
  backdrop-filter: blur(8px);
  transition: all .25s ease;
  flex-shrink: 0;
}

.btn-admin:hover {
  border-color: var(--border-hover);
  color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}

/* 分类标签 */
.category-bar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 22px 6vw 6px;
}

.cat-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(22, 28, 51, 0.5);
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all .22s ease;
  white-space: nowrap;
}

.cat-chip:hover { border-color: var(--border-hover); color: var(--text-1); }

.cat-chip.active {
  background: var(--accent-grad);
  color: #0a0e1a;
  border-color: transparent;
  font-weight: 600;
}

/* 工具网格 */
.tools-section {
  position: relative;
  z-index: 2;
  padding: 24px 6vw 80px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-decoration: none;
  color: var(--text-1);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: all .28s cubic-bezier(.2,.7,.3,1);
  opacity: 0;
  transform: translateY(20px);
  animation: cardIn .55s forwards;
  cursor: pointer;
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), rgba(77, 214, 255, 0.12), transparent 60%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.tool-card:hover::before { opacity: 1; }

/* 工具卡片头部：icon + 名称 + 分类，分类不换行 */
.tool-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  min-width: 0;
}

.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(77, 214, 255, 0.15), rgba(124, 92, 255, 0.15));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.tool-name-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.tool-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* 名称稍长：缩小字号 */
.tool-name.long {
  font-size: 14px;
}

/* 名称特别长：换行显示 */
.tool-name.very-long {
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}

.tool-cat {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-3);
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(120, 145, 220, 0.08);
  letter-spacing: 0.5px;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-desc {
  color: var(--text-2);
  font-size: 13px;
  flex: 1;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px dashed var(--border);
  padding-top: 11px;
  gap: 8px;
}

.tool-url {
  font-family: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.tool-go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-weight: 600;
  transition: gap .2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tool-card:hover .tool-go { gap: 8px; }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
}

.empty-state .em { font-size: 48px; margin-bottom: 16px; }

/* Footer */
.site-footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--border);
  padding: 28px 6vw;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  background: rgba(10, 14, 26, 0.6);
  backdrop-filter: blur(8px);
}

.site-footer .copyright { margin-bottom: 6px; }
.site-footer .icp a, .site-footer .icp { color: var(--text-3); text-decoration: none; }
.site-footer .icp a:hover { color: var(--accent); }
.site-footer .footer-extra { margin-top: 8px; color: var(--text-2); }

/* Toast 提示 */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-2);
  border: 1px solid var(--border-hover);
  color: var(--text-1);
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: 9999;
  font-size: 13px;
  opacity: 0;
  transition: all .35s cubic-bezier(.2,.7,.3,1);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast .toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0e1a;
  font-size: 14px;
  flex-shrink: 0;
}

/* 响应式 */
@media (max-width: 640px) {
  .site-header { padding: 14px 5vw; gap: 10px; }
  .tools-section { padding: 20px 5vw 60px; }
  .tools-grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .tool-cat { max-width: 70px; }
  .search-trigger.open { width: calc(100vw - 130px); }
  .btn-admin .btn-admin-text { display: none; }
  .btn-admin { padding: 8px; }
}
