/* 前台页面级样式统一入口
 * 收纳原先散落在 tools/home.php、tools/favorite.php、tools/category.php、
 * tools/tool.php、tools/singlepages/zaixianbaiban.php 中的内联 <style>。
 *
 * 加载顺序：common.css -> /css/tools/{ref}.css -> pages.css
 * （与原内联 <style> 位于所有 link 之后等价，保持对公共样式的覆盖关系）
 *
 * 作用域约定：
 * - .empty-state 必须带列表页容器前缀：100+ 工具页内部也用这个类名，
 *   全局定义会覆盖工具页自己的空状态样式。
 * - 在线白板是独立全屏页，含 * / html,body 全局规则，统一用 .page-whiteboard
 *   隔离，避免影响其它 250+ 页面。
 */

/* ============ 1. 列表页通用：卡片网格（首页 / 常用 / 分类 / 标签） ============ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.tool-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: center;
}
.tool-card:hover {
    border-color: #8b5cf6;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}
.tool-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.tool-card-info {
    flex: 1;
    min-width: 0;
}
.tool-card-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 6px 0;
}
.tool-card-info p {
    font-size: 13px;
    color: #888;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 空状态：仅列表页生效，工具页内部的 .empty-state 仍由 common.css / 工具 CSS 控制 */
.home-container .empty-state,
.common-container .empty-state,
.category-container .empty-state {
    text-align: center;
    padding: 60px;
    color: #888;
    background: #fff;
    border-radius: 16px;
}
.common-container .empty-state { padding: 60px 20px; }
.common-container .empty-state .empty-icon { font-size: 44px; margin-bottom: 12px; }
.common-container .empty-state p { margin: 4px 0; }
.common-container .empty-state .empty-hint { font-size: 13px; color: #aaa; }

/* ============ 2. 首页 ============ */
.home-container {
    max-width: 1400px;
    padding: 20px;
}
.category-section {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.category-section .category-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.category-section .category-icon {
    font-size: 20px;
}

/* ============ 3. 常用页 ============ */
.common-container {
    max-width: 1400px;
    padding: 20px;
}
.history-section { margin-top: 40px; }
.history-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 16px;
}
.history-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin: 0;
}
.history-header .content-desc { margin: 0; }
.fav-clear-btn {
    margin-left: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.fav-clear-btn:hover { color: #ef4444; border-color: #fca5a5; background: #fef2f2; }
.fav-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.fav-header-main { min-width: 0; }
.fav-toolbar { flex-shrink: 0; display: flex; gap: 8px; margin-top: 4px; }
@media (max-width: 560px) {
    .fav-header { flex-direction: column; gap: 10px; }
}
.fav-tool-btn {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.fav-tool-btn:hover { color: #8b5cf6; border-color: #c4b5fd; background: #f5f3ff; }

/* ============ 4. 分类页 / 标签聚合页 ============ */
.category-container {
    max-width: 1400px;
    padding: 20px;
}
.category-header {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.category-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}
.category-header p {
    font-size: 14px;
    color: #888;
    margin: 0;
}

/* 标签聚合页附加样式（分类页不渲染这些元素） */
.group-badge { display: inline-block; padding: 3px 11px; border-radius: 99px; font-size: 12px; font-weight: 600; color: #fff; margin-bottom: 10px; }
.group-meta { font-size: 13px; color: #94a3b8; margin-top: 8px; }
.group-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid #eef2f7; }
.group-tags a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; border: 1px solid #e2e8f0; background: #f8fafc; color: #475569; font-size: 12.5px; text-decoration: none; transition: all .18s; }
.group-tags a:hover, .group-tags a.is-active { border-color: #c7d2fe; color: #4f46e5; background: #eef2ff; }
.group-tags a.is-active { font-weight: 600; }
.tag-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.card-tags span { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #eef2ff; color: #4f46e5; }

/* ============ 5. 工具页头部 ============ */
/* 标题旁收藏星标：common.css 里 .fav-star 默认是卡片右上角的 absolute 定位，
   此处用双类名提高优先级并加 !important 覆盖为行内 static。
   星标用固定方形盒子 + flex 双向居中，避免符号字形度量导致的垂直漂移；
   h1 的 margin-bottom 移到行容器上，保证 flex 按内容盒（而非 margin 盒）对齐中心 */
.tool-name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.tool-name-row .tool-name { margin-bottom: 0; line-height: 1.3; }
.fav-star.fav-star-page {
    position: static !important; top: auto !important; right: auto !important;
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; padding: 0 !important;
    font-size: 20px; line-height: 1;
}
/* 面包屑行内文字统一 13px（common.css 里描述是 14px，这里覆盖对齐） */
.breadcrumb-row .tool-desc { font-size: 13px; }
.breadcrumb-left { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }
.tool-tags-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.tool-tag-chip { display: inline-flex; align-items: center; padding: 0 8px; border-radius: 6px; font-size: 13px; font-weight: 500; line-height: 20px; color: #6b7280; background: #f3f4f6; text-decoration: none; transition: all .18s; }
.tool-tag-chip:hover { color: #4f46e5; background: #e0e7ff; }
@media (max-width: 768px) {
    .breadcrumb-row { flex-direction: column; align-items: flex-start; gap: 6px; }
    .breadcrumb-row .tool-desc { text-align: left; max-width: 100%; padding-left: 0; }
}

/* ============ 6. 在线白板（独立全屏页，body/html 带 page-whiteboard） ============ */
html.page-whiteboard, body.page-whiteboard {
    width: 100%; height: 100%; overflow: hidden;
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
body.page-whiteboard * { margin: 0; padding: 0; box-sizing: border-box; }
body.page-whiteboard #app { width: 100vw; height: 100vh; overflow: hidden; position: relative; }
body.page-whiteboard #whiteboard { display: block; cursor: crosshair; background: #fff; }

body.page-whiteboard .toolbar {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: #fff; border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06);
    padding: 8px 12px; display: flex; align-items: center; gap: 4px;
    z-index: 1000; user-select: none;
}

body.page-whiteboard .tool-btn {
    width: 38px; height: 38px; border: none; border-radius: 8px;
    background: transparent; cursor: pointer; font-size: 17px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease; color: #374151;
}
body.page-whiteboard .tool-btn:hover:not(:disabled):not(.active) { background: #f3f4f6; }
body.page-whiteboard .tool-btn.active { background: linear-gradient(135deg,#10b981,#059669); color: #fff; }
body.page-whiteboard .tool-btn:disabled { opacity: 0.35; cursor: not-allowed; }
body.page-whiteboard .tool-btn.svg-icon svg { width: 18px; height: 18px; }
body.page-whiteboard .tool-btn.svg-icon.active svg { stroke: #fff; }

body.page-whiteboard .divider { width: 1px; height: 26px; background: #e5e7eb; margin: 0 4px; }

body.page-whiteboard #colorPicker { width: 32px; height: 32px; border: none; border-radius: 8px; cursor: pointer; padding: 2px; }
body.page-whiteboard #colorPicker::-webkit-color-swatch-wrapper { padding: 0; }
body.page-whiteboard #colorPicker::-webkit-color-swatch { border: 2px solid #e5e7eb; border-radius: 6px; }

body.page-whiteboard .size-label { font-size: 11px; color: #6b7280; min-width: 36px; text-align: center; font-family: monospace; }

body.page-whiteboard #sizeSlider { width: 100px; height: 34px; -webkit-appearance: none; background: transparent; cursor: pointer; }
body.page-whiteboard #sizeSlider::-webkit-slider-runnable-track { height: 4px; background: #e5e7eb; border-radius: 2px; }
body.page-whiteboard #sizeSlider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; background: #374151; border-radius: 50%; margin-top: -6px; cursor: pointer; }

body.page-whiteboard .text-input-wrapper {
    position: absolute; z-index: 999;
    background: rgba(255,255,255,0.95);
    border: 2px dashed #10b981; border-radius: 6px; padding: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    min-width: 150px;
}

body.page-whiteboard .text-input-wrapper input {
    width: 100%; border: none; outline: none;
    font-size: 16px; background: transparent; color: #111;
    margin-bottom: 8px;
}

body.page-whiteboard .text-preview {
    border-top: 1px dashed #ddd; padding-top: 6px;
    min-height: 20px; word-break: break-all;
    transition: font-size 0.1s, color 0.1s;
}

body.page-whiteboard .help-panel {
    position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 2000;
    display: flex; align-items: center; justify-content: center;
}
body.page-whiteboard .help-content {
    background: #fff; border-radius: 16px; padding: 24px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2); max-width: 380px; width: 90%;
}
body.page-whiteboard .help-content h3 { font-size: 17px; margin-bottom: 14px; color: #1f2937; }
body.page-whiteboard .help-content table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
body.page-whiteboard .help-content tr { border-bottom: 1px solid #f3f4f6; }
body.page-whiteboard .help-content td { padding: 7px 4px; font-size: 13px; color: #4b5563; }
body.page-whiteboard .help-content td:first-child { font-weight: 600; font-family: monospace; color: #10b981; width: 110px; }
body.page-whiteboard .close-btn {
    width: 100%; padding: 10px; background: #f3f4f6; border: none; border-radius: 8px;
    font-size: 14px; cursor: pointer; color: #374151; transition: all 0.15s;
}
body.page-whiteboard .close-btn:hover { background: #e5e7eb; }
