/*
 * coax的小工具 - 一套实用的前端工具集合
 * 
 * MIT License
 * 
 * Copyright (c) 2025 coax
 * 
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the "Software"), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 * 
 *  The above copyright notice and this permission notice shall be included in all
 *  copies or substantial portions of the Software.
 * 
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 *  SOFTWARE.
 * 
 *  一套实用的前端工具集合，包括文本处理、数据转换、文件操作等多种实用工具。
 *  源码可得，快乐加倍！记得给个Star哦~ 🌟
 */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s; /* 添加主题切换过渡效果 */
}

/* 主题样式 */
/* 浅色主题 */
body[data-theme="light"] {
    background-color: #f5f5f5;
    color: #333;
}

body[data-theme="light"] .tool-card {
    background: white;
    color: #333;
}

/* 深色主题 */
body[data-theme="dark"] {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body[data-theme="dark"] .tool-card {
    background: #2d2d2d;
    color: #e0e0e0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .tool-card h3 {
    color: #f0f0f0;
}

body[data-theme="dark"] .tool-card p {
    color: #b0b0b0;
}

body[data-theme="dark"] .tool-card .btn {
    color: white;
}

body[data-theme="dark"] .header-content::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 主题下的头部样式 */
body[data-theme="light"] header {
    background: #ececec !important;
    color: #555 !important;
}

body[data-theme="dark"] header {
    background: #2d2d2d !important;
    color: #e0e0e0 !important;
}

.header-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.header-content p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 主要内容区域 */
main {
    padding: 2rem 0;
}

.tools-intro {
    text-align: center;
    margin-bottom: 2rem;
}

.tools-intro h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #333;
}

.tools-intro p {
    font-size: 1.1rem;
    color: #666;
    max-width: 800px;
    margin: 0 auto;
}

/* 工具网格布局 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.tool-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: visible; /* 允许按钮超出边界 */
    background-size: 200% 200%;
    /* 为按钮预留空间 */
    padding-bottom: 3.5rem;
    /* 初始状态用于动画 */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* 动画类，用于触发动画 */
.tool-card.animate {
    opacity: 1;
    transform: translateY(0);
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* 深色主题下的卡片悬停效果 */
body[data-theme="dark"] .tool-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.tool-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
    color: #4a4a4a;
    position: relative;
    z-index: 1;
}

.tool-card p {
    color: #666;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

/* 立即使用按钮样式 */
.tool-card .btn {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    opacity: 0;
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translate(-50%, 100%);
    white-space: nowrap;
    transition: all 0.2s ease; /* 快速过渡 */
}

/* 鼠标悬停时显示按钮 */
.tool-card:hover .btn {
    transform: translate(-50%, 0);
    opacity: 1;
}

.tool-card .btn:hover {
    opacity: 0.9;
    color: white;
    transform: translate(-50%, 0); /* 确保悬停按钮时位置不变 */
}

/* 底部样式 */
footer {
    background: #ececec;
    color: #333;
    text-align: center;
    padding: 0;
    margin-top: 2rem;
    height: 25px;
    line-height: 25px;
    font-size: 14px;
}

/* 主题下的底部样式 */
body[data-theme="light"] footer {
    background: #ececec;
    color: #555;
}

body[data-theme="dark"] footer {
    background: #2d2d2d;
    color: #e0e0e0;
}

.footer-content p {
    margin: 0;
    padding: 0;
}

/* 公共安全图标样式 */
.public-security-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iIzMzMyI+PHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyczQuNDggMTAgMTAgMTAgMTAtNC40OCAxMC0xMFMxNy41MiAyIDEyIDJ6bTAgMThjLTQuNDEgMC04LTMuNTktOC04czMuNTktOCA4LTggOCAzLjU5IDggOC0zLjU5IDgtOCA4eiIvPjxwYXRoIGQ9Ik0xMiA2Yy0zLjMxIDAtNiAyLjY5LTYgNnMyLjY5IDYgNiA2IDYtMi42OSA2LTYtMi42OS02LTYtNnoiLz48cGF0aCBkPSJNMTIgMTBjLTEuMSAwLTItLjktMi0ycy45LTIgMi0yIDIgLjkgMiAyLS45IDItMiAyeiIvPjwvc3ZnPg==');
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
    margin-right: 4px;
}

/* 深色主题下的公共安全图标 */
body[data-theme="dark"] .public-security-icon {
    filter: invert(1); /* 反转图标颜色以适应深色主题 */
}

/* 页面过渡动画 */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.page-transition.active {
    opacity: 1;
    visibility: visible;
}

.page-transition.slide-in-left {
    transform: translateX(-100%);
}

.page-transition.slide-in-left.active {
    transform: translateX(0);
}

.page-transition.slide-out-right {
    transform: translateX(0);
}

.page-transition.slide-out-right.active {
    transform: translateX(100%);
}

/* 返回按钮 */
.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.back-button:hover {
    transform: scale(1.1);
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }
    
    .header-content p {
        font-size: 1rem;
    }
    
    .tools-intro h2 {
        font-size: 1.6rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}