/* ============================================================
   万能常用工具箱 - 全局样式
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* 锚点跳转避开吸顶 header（header 高 56px，留 20px 余量）
   注意：只使用 scroll-padding-top，不要再加 scroll-margin-top，
   两者会叠加导致跳转位置偏移过大 */
html {
    scroll-padding-top: 76px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }

a { color: #2563eb; text-decoration: none; }
a:hover { color: #1d4ed8; }

/* ---------- 头部 ---------- */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    flex-wrap: wrap;
}
.logo {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}
.logo-mark {
    background: #2563eb;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
    color: #475569;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
}
.main-nav a:hover { background: #eef2ff; color: #2563eb; }

/* ---------- 主体 ---------- */
.main { padding: 24px 16px 40px; }

/* ---------- 首页 ---------- */
.hero {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    border-radius: 14px;
    padding: 32px 28px;
    color: #fff;
    margin-bottom: 24px;
}
.hero h1 { font-size: 26px; margin-bottom: 8px; }
.hero p { color: #dbeafe; font-size: 15px; }

.search-box {
    display: flex;
    gap: 8px;
    margin: 18px 0 20px;
    flex-wrap: wrap;
    align-items: center;
}
.search-box input {
    flex: 1;
    min-width: 220px;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
}
.search-box input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.cat-tab {
    padding: 6px 14px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    transition: all .15s;
}
.cat-tab.active { background: #2563eb; border-color: #2563eb; color: #fff; }

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 26px 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title::before {
    content: "";
    width: 4px;
    height: 18px;
    background: #2563eb;
    border-radius: 2px;
}

/* 工具网格 */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.tool-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    display: block;
    color: #333;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
    border-color: #bfdbfe;
    color: #333;
}
.tool-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: #eef2ff;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
}
.tool-card h3 { font-size: 16px; margin-bottom: 4px; color: #1e293b; }
.tool-card p { font-size: 13px; color: #64748b; }

/* 热门工具标签 */
.hot-badge {
    display: inline-block;
    background: #fef3c7;
    color: #b45309;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ---------- 工具页 ---------- */
.tool-intro { margin-bottom: 20px; }
.tool-intro h1 { font-size: 22px; color: #1e293b; margin-bottom: 6px; }
.tool-intro p { color: #64748b; font-size: 14px; }

.tool-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}
.tool-box textarea {
    width: 100%;
    min-height: 160px;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    resize: vertical;
    outline: none;
}
.tool-box textarea:focus { border-color: #2563eb; }
.tool-box input[type="text"], .tool-box input[type="number"], .tool-box input[type="date"] {
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    max-width: 100%;
}
.tool-box input:focus { border-color: #2563eb; }
.tool-box select {
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    outline: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
}
.btn:hover { background: #1d4ed8; }
.btn-gray { background: #f1f5f9; color: #334155; }
.btn-gray:hover { background: #e2e8f0; }
.btn-green { background: #16a34a; }
.btn-green:hover { background: #15803d; }
.btn-orange { background: #f59e0b; }
.btn-orange:hover { background: #d97706; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.col { flex: 1; min-width: 200px; }
label.lbl { font-size: 13px; color: #475569; margin-right: 6px; }

.result-box {
    margin-top: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    min-height: 60px;
    word-break: break-all;
    white-space: pre-wrap;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    max-height: 360px;
    overflow: auto;
}
.result-box mark { background: #fde047; padding: 0 2px; border-radius: 2px; }

.tip {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin: 14px 0;
}

.switch-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0; }
.switch-row label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* 图片工具 */
.img-preview { max-width: 100%; max-height: 380px; border-radius: 8px; margin-top: 10px; display: none; }
.img-info { font-size: 13px; color: #64748b; margin-top: 8px; }

/* 二维码预览 */
.qr-preview { margin-top: 12px; text-align: center; }
.qr-preview img { max-width: 260px; border: 1px solid #e2e8f0; border-radius: 8px; }

/* ---------- 页脚 ---------- */
.site-footer {
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 20px 0;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}
.footer-tip { margin-top: 4px; font-size: 12px; color: #94a3b8; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
    .hero { padding: 22px 18px; }
    .hero h1 { font-size: 21px; }
    .header-inner { height: auto; padding: 10px 0; gap: 8px; }
    .tool-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
