/* 首页特定样式 */
.markdown-body {
    padding: 20px 0;  /* 上下内边距，左右无内边距 */
}

/* 页面主标题 */
.page-title {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    position: relative;
    display: inline-block;
    margin-left: auto;
    margin-right: auto;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 3px;
}

.page-subtitle {
    text-align: center;
    margin-bottom: 40px;
    color: var(--text-secondary);
    font-weight: normal;
    font-size: 1.2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* 卡片网格布局容器 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 改为3列 */
    gap: 30px; /* 增加卡片间距 */
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* 工具卡片容器样式 */
.tool-card {
    background-color: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-speed) ease-in-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 280px; /* 默认卡片高度 */
    position: relative;
    cursor: pointer;
    transform: translateY(0);
    backface-visibility: hidden; /* 提高性能 */
}

/* 展开状态的卡片 */
.tool-card.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 90%;
    max-width: 1200px;
    height: auto;
    min-height: 280px;
    max-height: 80vh;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(79, 70, 229, 0.1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.3s ease,
                width 0.3s ease,
                height 0.3s ease,
                max-height 0.3s ease;
    display: flex;
    flex-direction: column;
    margin: 0; /* 重置外边距，避免影响居中 */
    border-radius: 20px; /* 增加圆角 */
    background-color: var(--bg-secondary); /* 确保背景色 */
    animation: card-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border: none;
}

@keyframes card-pop {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.5;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* 移动设备上的展开卡片样式 */
@media (max-width: 768px) {
    .tool-card.expanded {
        width: 95%;
        max-height: 90vh;
        top: 50%;
        padding-bottom: 10px;
    }
    
    .tool-card.expanded .tool-header {
        padding: 15px 20px;
    }
    
    .tool-card.expanded .tool-content {
        padding: 20px;
        font-size: 1em;
    }
    
    .tool-card.expanded::before {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 24px;
    }
}

/* 小屏幕设备上的展开卡片样式 */
@media (max-width: 480px) {
    .tool-card.expanded {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        top: 0;
        left: 0;
        transform: none !important; /* 强制覆盖transform */
        border-radius: 0;
        animation: none;
    }
    
    .tool-card.expanded .tool-header {
        padding: 12px 16px;
        border-radius: 0;
    }
    
    .tool-card.expanded .tool-content {
        padding: 16px;
        border-radius: 0;
    }
    
    /* 调整关闭按钮位置 */
    .tool-card.expanded::before {
        top: 8px;
        right: 8px;
    }
    
    /* 确保遮罩层在小屏幕上正常工作 */
    .overlay.active {
        backdrop-filter: blur(2px);
    }
}

/* 添加关闭按钮 */
.tool-card.expanded::before {
    content: '×';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 24px;
    color: white;
    cursor: pointer;
    z-index: 1001;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    opacity: 0.9;
    transform: scale(1);
}

.tool-card.expanded::before:hover, .tool-card.expanded::before:active {
    background-color: var(--primary-light);
    transform: scale(1.1);
    opacity: 1;
}

/* 修复伪元素hover选择器 */
.tool-card.expanded:hover::before {
    background-color: var(--primary-light);
    transform: scale(1.1);
    opacity: 1;
}

/* 创建遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* 增加遮罩层不透明度 */
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease; /* 添加visibility过渡 */
    backdrop-filter: blur(3px); /* 添加模糊效果 */
    -webkit-backdrop-filter: blur(3px); /* Safari支持 */
}

/* 显示遮罩层 */
.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 工具卡片悬停效果 */
.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.15);
}

/* 工具卡片头部 */
.tool-header {
    padding: 16px 20px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* 添加卡片头部装饰效果 */
.tool-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    opacity: 0.8;
}

/* 展开状态下的卡片头部 */
.tool-card.expanded .tool-header {
    padding: 20px 24px;
    background-color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
}

/* 展开状态下的卡片标题 */
.tool-card.expanded .tool-header h2 {
    color: white;
    font-size: 1.5em;
    padding-right: 40px; /* 为关闭按钮留出空间 */
}

/* 展开状态下的卡片标题链接 */
.tool-card.expanded .tool-header h2 a {
    color: rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-right: 40px; /* 为关闭按钮留出空间 */
}

.tool-card.expanded .tool-header h2 a:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* 工具卡片内容区域 */
.tool-content {
    padding: 18px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 隐藏溢出内容 */
    max-height: 180px; /* 默认高度 */
    transition: all 0.5s ease; /* 添加所有属性过渡效果 */
    position: relative; /* 为渐变遮罩定位 */
    line-height: 1.5; /* 增加行高 */
    color: var(--text-secondary); /* 设置文本颜色 */
    font-size: 0.95rem; /* 调整字体大小 */
}

/* 内容区域渐变遮罩 */
.tool-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), var(--bg-secondary) 80%);
    pointer-events: none; /* 确保不会阻止点击事件 */
    opacity: 0.9;
}

/* 展开状态的卡片内容 */
.tool-card.expanded .tool-content {
    max-height: none; /* 移除最大高度限制 */
    padding: 30px; /* 增加内边距 */
    overflow-y: auto; /* 添加垂直滚动 */
    line-height: 1.6;
    font-size: 1.05em;
}

/* 优化展开状态下的滚动条 */
.tool-card.expanded .tool-content::-webkit-scrollbar {
    width: 8px;
}

.tool-card.expanded .tool-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.tool-card.expanded .tool-content::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

.tool-card.expanded .tool-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 展开状态下移除渐变遮罩 */
.tool-card.expanded .tool-content::after {
    display: none;
}

/* 展开状态下优化内容排版 */
.tool-card.expanded .tool-content p {
    line-height: 1.6;
    margin-bottom: 16px;
}

.tool-card.expanded .tool-content h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.tool-card.expanded .tool-content ul,
.tool-card.expanded .tool-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.tool-card.expanded .tool-content li {
    margin-bottom: 8px;
}

/* 添加展开指示器 */
.expand-indicator {
    text-align: center;
    padding: 10px 0;
    color: var(--primary-color);
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    background: linear-gradient(to bottom, rgba(255,255,255,0), var(--bg-secondary) 60%);
    transition: all 0.3s ease;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px dashed rgba(0,0,0,0.05);
    letter-spacing: 0.02em;
}

/* 展开状态下隐藏展开指示器 */
.tool-card.expanded .expand-indicator {
    opacity: 0;
    pointer-events: none;
}

/* 展开指示器箭头 */
.expand-indicator .arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    margin-left: 6px;
    font-size: 0.9em;
    color: var(--primary-light);
}

/* 展开状态下箭头旋转 */
.tool-card.expanded .expand-indicator .arrow {
    transform: rotate(180deg);
}

/* 卡片悬停时展开指示器样式 */
.tool-card:hover .expand-indicator {
    color: var(--primary-dark);
    border-top-color: rgba(79, 70, 229, 0.1);
}

.tool-card:hover .expand-indicator .arrow {
    transform: translateY(2px);
    color: var(--primary-color);
}

/* 移除旧的伪元素样式 */

/* 工具卡片装饰性渐变效果 */
.tool-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 65%, rgba(64, 158, 255, 0.1) 100%);
    z-index: 0;
    pointer-events: none;
}

/* 工具分类标题样式 */
.tool-header h2 {
    margin: 0;  /* 重置外边距 */
    padding: 0;  /* 重置内边距 */
    color: var(--text-primary);  /* 更深的文字颜色 */
    font-size: 1.25rem;  /* 稍微增大字体 */
    font-weight: 600;  /* 半粗体 */
    position: relative;  /* 相对定位 */
    display: flex;  /* 弹性布局 */
    justify-content: space-between;  /* 两端对齐 */
    align-items: center;  /* 垂直居中 */
    transition: all var(--transition-speed);  /* 过渡动画 */
    letter-spacing: 0.01em;  /* 轻微字间距 */
}

/* 标题悬停效果 */
.tool-header h2:hover {
    transform: translateY(-2px);  /* 上移效果 */
    color: var(--primary-color);  /* 悬停时变为主色调 */
}

/* 详情链接按钮样式 */
.tool-header h2 a {
    font-size: 0.65em;  /* 字体大小 */
    font-weight: 500;  /* 中等粗细 */
    color: white;  /* 文字颜色 */
    background-color: var(--primary-color);  /* 背景色 */
    text-decoration: none;  /* 移除下划线 */
    transition: all var(--transition-speed);  /* 过渡动画 */
    padding: 4px 10px;  /* 增加内边距 */
    border-radius: 6px;  /* 增加圆角 */
    margin-left: 10px;  /* 增加左侧外边距 */
    white-space: nowrap;  /* 不换行 */
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);  /* 添加轻微阴影 */
    letter-spacing: 0.02em;  /* 增加字间距 */
}

/* 详情链接按钮悬停效果 */
.tool-header h2 a:hover {
    background-color: var(--primary-dark);  /* 背景色变化 */
    transform: translateY(-2px) scale(1.05);  /* 上移并轻微放大 */
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);  /* 增强阴影 */
}

/* 卡片颜色区分 - 第1、4、7...个卡片 */
.card-grid .tool-card:nth-child(3n+1) .tool-header {
    border-bottom: 2px solid var(--primary-color);  /* 主色调 */
}

/* 卡片颜色区分 - 第2、5、8...个卡片 */
.card-grid .tool-card:nth-child(3n+2) .tool-header {
    border-bottom: 2px solid var(--success-color);  /* 成功色 */
}

/* 卡片颜色区分 - 第3、6、9...个卡片 */
.card-grid .tool-card:nth-child(3n+3) .tool-header {
    border-bottom: 2px solid var(--warning-color);  /* 警告色 */
}

/* 卡片内容区域的段落样式 */
.tool-content p {
    margin: 8px 0;
    line-height: 1.4;
    font-size: 0.95em;
}

/* 卡片内容区域的列表样式 */
.tool-content ul, .tool-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.tool-content li {
    margin: 4px 0;
    line-height: 1.4;
    font-size: 0.95em;
}

/* 添加警告块样式 */
.markdown-body .warning {
    background-color: rgba(230, 162, 60, 0.1);  /* 警告色背景 */
    border-left: 4px solid var(--warning-color);  /* 警告色边框 */
    padding: 12px 16px;  /* 内边距 */
    margin: 16px 0;  /* 外边距 */
    border-radius: 4px;  /* 圆角 */
}

/* 添加成功块样式 */
.markdown-body .success {
    background-color: rgba(103, 194, 58, 0.1);  /* 成功色背景 */
    border-left: 4px solid var(--success-color);  /* 成功色边框 */
    padding: 12px 16px;  /* 内边距 */
    margin: 16px 0;  /* 外边距 */
    border-radius: 4px;  /* 圆角 */
}

/* 添加危险块样式 */
.markdown-body .danger {
    background-color: rgba(245, 108, 108, 0.1);  /* 危险色背景 */
    border-left: 4px solid var(--danger-color);  /* 危险色边框 */
    padding: 12px 16px;  /* 内边距 */
    margin: 16px 0;  /* 外边距 */
    border-radius: 4px;  /* 圆角 */
}

/* 响应式布局 */
@media (max-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr); /* 大屏幕保持3列 */
        gap: 25px;
        padding: 25px;
    }
}

@media (max-width: 992px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr); /* 中等屏幕2列 */
        gap: 20px;
    }
}

@media (max-width: 576px) {
    .card-grid {
        grid-template-columns: 1fr; /* 移动设备1列 */
        gap: 15px;
        padding: 15px;
    }
    
    .tool-card {
        margin-bottom: 5px;
    }
}

/* 响应式调整 - 超大屏幕设备 */
@media (min-width: 1400px) {
    /* 超大屏幕卡片网格调整 - 4列 */
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1400px;
        gap: 25px;
    }
}

/* 移动端标题样式调整 */
@media (max-width: 768px) {
    .tool-header h2 {
        padding: 10px 0;  /* 减小内边距 */
        font-size: 1.3em;  /* 减小字体 */
        flex-direction: column;  /* 改为纵向排列 */
        align-items: flex-start;  /* 左对齐 */
    }
    
    /* 移动端详情链接按钮调整 */
    .tool-header h2 a {
        margin-top: 8px;  /* 添加上边距 */
        font-size: 0.7em;  /* 减小字体 */
        display: inline-block;  /* 块级显示 */
    }
    
    /* 移动端工具卡片调整 */
    .tool-card {
        margin-bottom: 15px;  /* 底部间距 */
    }
    
    /* 移动端卡片内容区域调整 */
    .tool-content {
        padding: 15px;  /* 减小内边距 */
    }
    
    /* 移动端容器调整 */
    .container {
        padding: 15px;  /* 减小内边距 */
        margin: 15px auto;  /* 减小外边距 */
    }
}


/* 代码块样式 */
.markdown-body pre {
    background-color: #303133;  /* 深色背景 */
    border-radius: 8px;
    margin: 15px 0;
    overflow: auto;
}

.markdown-body code {
    font-family: 'Courier New', monospace;
    color: #ffffff;  /* 白色文字 */
}

.markdown-body pre code {
    display: block;
    padding: 15px;
    overflow-x: auto;
    line-height: 1.5;
}

/* 行内代码样式 */
.markdown-body p code {
    background-color: rgba(48, 49, 51, 0.1);  /* 半透明背景 */
    color: var(--primary-color);  /* 保持行内代码为主题色 */
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* 代码块滚动条样式 */
.markdown-body pre::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.markdown-body pre::-webkit-scrollbar-track {
    background: rgba(64, 158, 255, 0.1);  /* 滚动条轨道颜色改为蓝色半透明 */
    border-radius: 4px;
}

.markdown-body pre::-webkit-scrollbar-thumb {
    background: var(--primary-color);  /* 滚动条滑块颜色改为主题蓝色 */
    border-radius: 4px;
}

.markdown-body pre::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);  /* 滚动条滑块悬停颜色改为深蓝色 */
}


/* 卡片内容样式优化 */
.tool-content p {
    margin-bottom: 12px;
    line-height: 1.6;
}

.tool-content ul, .tool-content ol {
    padding-left: 20px;
    margin-bottom: 15px;
}

.tool-content li {
    margin-bottom: 5px;
}

/* 命令块样式优化 */
.command {
    background-color: #303133;  /* 深色背景 */
    color: #ffffff;  /* 白色文字 */
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    position: relative;
    overflow-x: auto;
    margin: 12px 0;
    white-space: nowrap;
    border-left: 3px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 0.9em;
    line-height: 1.5;
}

.command::before {
    content: '$';
    color: var(--primary-color);  /* 保持命令提示符为主题色 */
    margin-right: 10px;
    font-weight: bold;
}

/* 复制按钮样式优化 */
.copy-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all var(--transition-speed);
    opacity: 0;  /* 默认不可见 */
    pointer-events: none;  /* 默认不可交互 */
}

/* 命令块悬停时显示复制按钮 */
.command:hover .copy-btn {
    opacity: 1;  /* 悬停时可见 */
    pointer-events: auto;  /* 悬停时可交互 */
}

.copy-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-50%) scale(1.05);
}

/* 卡片内代码块样式优化 */
.tool-content pre {
    margin: 12px 0;
    border-radius: 8px;
    max-width: 100%;
    overflow-x: auto;
}

.tool-content code {
    font-size: 0.9em;
}

/* 卡片内警告块样式优化 */
.tool-content .warning {
    margin: 12px 0;
    border-radius: 6px;
}