/* ToolBox 自定义样式 */

body {
    background-color: #f5f7fa;
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

/* 侧边栏 */
.sidebar {
    min-height: calc(100vh - 56px);
    background-color: #ffffff;
    border-right: 1px solid #e5e8ec;
    padding: 0;
}

.sidebar-inner {
    position: sticky;
    top: 56px;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    padding: 1rem 0.75rem 2rem;
}

.sidebar-heading {
    font-size: 0.8rem;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 0.5rem 0.25rem;
}

.sidebar .nav-link {
    color: #343a40;
    border-radius: 0.375rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
}

.sidebar .nav-link:hover {
    background-color: #f0f3f7;
}

.sidebar .nav-link.active {
    background-color: #0d6efd;
    color: #fff;
}

/* 主内容区 */
.main-content {
    padding: 1.5rem 2rem;
}

/* 首页 */
.hero {
    background: linear-gradient(135deg, #eef4ff 0%, #f8f9fa 100%);
    border-radius: 1rem;
    margin-bottom: 2rem;
}

.section-title {
    font-weight: 700;
    margin-bottom: 1rem;
    color: #212529;
}

.tool-card {
    border: 1px solid #e5e8ec;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    color: inherit;
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.12);
    border-color: #b6d4fe;
}

.rank-badge {
    font-size: 0.75rem;
}

.rank-1 { background-color: #ffc107; color: #212529; }
.rank-2 { background-color: #adb5bd; color: #212529; }
.rank-3 { background-color: #cd7f32; color: #fff; }

/* 工具页面通用 */
.tool-header {
    margin-bottom: 1.5rem;
}

.tool-header h3 {
    font-weight: 700;
}

.tool-header .text-muted {
    font-size: 0.95rem;
}

.result-panel {
    background-color: #fff;
    border: 1px solid #e5e8ec;
    border-radius: 0.5rem;
    padding: 1.25rem;
}

.preview-img {
    max-width: 100%;
    max-height: 420px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: repeating-conic-gradient(#f1f3f5 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
}

pre.code-output {
    background-color: #212529;
    color: #e9ecef;
    padding: 1rem;
    border-radius: 0.5rem;
    max-height: 480px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 正则高亮 */
.regex-highlight mark {
    background-color: #ffe08a;
    padding: 0 2px;
    border-radius: 2px;
}

.upload-hint {
    font-size: 0.85rem;
    color: #6c757d;
}

/* 预览图可点击 */
.preview-img {
    cursor: zoom-in;
}

/* 图片预览弹窗 */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 24px;
    z-index: 2002;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox-toolbar {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2002;
    display: flex;
    align-items: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 14px;
    border-radius: 2rem;
}

.lightbox-scale {
    min-width: 52px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.lightbox-tip {
    font-size: 0.8rem;
    opacity: 0.75;
}

.lightbox-stage {
    position: relative;
    z-index: 2001;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 88vh;
    transform-origin: center center;
    transition: transform 0.08s ease-out;
    cursor: grab;
    user-select: none;
}

.lightbox-img.dragging {
    cursor: grabbing;
    transition: none;
}
