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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

/* 黑夜模式样式 */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #f0f0f0;
}

.dark-mode header {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
}

.dark-mode .tool-card {
    background: rgba(30, 30, 46, 0.95);
    color: #f0f0f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .tool-card h2 {
    color: #e2e8f0;
}

.dark-mode .tool-card p {
    color: #cbd5e1;
}

.dark-mode .tool-card.coming-soon {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
}

.dark-mode .instructions {
    background: rgba(30, 30, 46, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .instructions h3 {
    color: #e2e8f0;
}

.dark-mode .instructions li {
    color: #cbd5e1;
}

.dark-mode .instructions strong {
    color: #63b3ed;
}

.dark-mode footer {
    background: rgba(30, 30, 46, 0.8);
    color: #cbd5e1;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
    color: white;
    text-align: center;
    padding: 1.5rem 1rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(30deg);
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 0.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto 0.5rem;
}

/* 语言切换和黑夜模式切换按钮 */
.header-content {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-actions {
    position: absolute;
    top: 0; /* Align to top relative to header padding content area if relative, but header has padding. */
    /* Wait, header has padding: 2.5rem 1rem. 
       If .header-content is inside header, and .header-actions is absolute to .header-content.
       It's better to make .header-actions absolute to header if possible, or just use absolute within relative container.
       In index.html: <header> <div class="header-content"> ... </div> </header>
       .header-content needs width: 100%.
    */
    right: 0;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.header-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.language-switcher, .theme-switcher {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    /* 移除backdrop-filter以提升性能 */
}

.language-switcher:hover, .theme-switcher:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
}

.language-switcher, .theme-switcher {
    will-change: transform, background-color;
}

/* 主体内容 */
main {
    max-width: 1300px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.tool-search-wrapper {
    margin-bottom: 1.2rem;
}

.tool-search-input-group {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.tool-search-input {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 999px;
    border: 1px solid #c9d4ea;
    background: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-search-input:focus {
    border-color: #4b6cb7;
    box-shadow: 0 0 0 3px rgba(75, 108, 183, 0.15);
}

.tool-search-clear {
    border: none;
    border-radius: 999px;
    padding: 0.7rem 1rem;
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

.tool-search-clear.hidden,
.tool-search-empty.hidden {
    display: none;
}

.tool-search-empty {
    margin-top: 0.8rem;
    color: #666;
    font-size: 0.95rem;
}

/* 工具卡片容器 */
.tools-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* 工具卡片 */
.tool-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 1.8rem 1.5rem;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-out, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    /* 移除backdrop-filter以提升性能 */
    border: 1px solid rgba(255, 255, 255, 0.3);
    will-change: transform;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
    border-radius: 16px 16px 0 0;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.tool-card h2 {
    color: #182848;
    margin-bottom: 0.8rem;
    font-size: 1.6rem;
    font-weight: 700;
}

.tool-card p {
    color: #555;
    margin-bottom: 1.2rem;
    line-height: 1.6;
    font-size: 1rem;
}

.tool-card button {
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(75, 108, 183, 0.4);
    position: relative;
    overflow: hidden;
    will-change: transform, box-shadow;
}

.tool-card button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.tool-card button:hover::before {
    left: 100%;
}

.tool-card button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(75, 108, 183, 0.6);
}

/* 黑夜模式下的工具卡片 */
.dark-mode .tool-card::before {
    background: linear-gradient(90deg, #63b3ed 0%, #3182ce 100%);
}

.dark-mode .tool-card button {
    background: linear-gradient(135deg, #63b3ed 0%, #3182ce 100%);
    box-shadow: 0 4px 15px rgba(99, 179, 237, 0.4);
}

.dark-mode .tool-card button:hover {
    box-shadow: 0 8px 20px rgba(99, 179, 237, 0.6);
}

/* 即将推出卡片 */
.tool-card.coming-soon {
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
}

.tool-card.coming-soon h2 {
    color: #182848;
}

.tool-card.coming-soon::before {
    background: linear-gradient(90deg, #a1c4fd 0%, #c2e9fb 100%);
}

/* 黑夜模式下的即将推出卡片 */
.dark-mode .tool-card.coming-soon {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
}

.dark-mode .tool-card.coming-soon h2 {
    color: #e2e8f0;
}

.dark-mode .tool-card.coming-soon::before {
    background: linear-gradient(90deg, #63b3ed 0%, #3182ce 100%);
}

.dark-mode .tool-search-input {
    background: rgba(30, 30, 46, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
    color: #f0f0f0;
}

.dark-mode .tool-search-input::placeholder {
    color: #9ca3af;
}

.dark-mode .tool-search-empty {
    color: #cbd5e1;
}

.dark-mode .tool-search-clear {
    background: linear-gradient(135deg, #63b3ed 0%, #3182ce 100%);
}

/* 使用说明 */
.container {
    max-width: 1300px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

.instructions {
    background: rgba(227, 242, 253, 0.95);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2.5rem;
    text-align: left;
    /* 移除backdrop-filter以提升性能 */
    border: 1px solid rgba(179, 219, 255, 0.5);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.instructions h3 {
    color: #182848;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 700;
}

.instructions ol {
    padding-left: 2rem;
}

.instructions li {
    margin-bottom: 0.8rem;
    line-height: 1.7;
    font-size: 1.1rem;
    color: #444;
}

.instructions strong {
    color: #4b6cb7;
    font-weight: 600;
}

/* 黑夜模式下的使用说明 */
.dark-mode .instructions {
    background: rgba(30, 30, 46, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .instructions h3 {
    color: #e2e8f0;
}

.dark-mode .instructions li {
    color: #cbd5e1;
}

.dark-mode .instructions strong {
    color: #63b3ed;
}

/* 底部样式 */
footer {
    text-align: center;
    padding: 2.5rem;
    color: #555;
    margin-top: 3rem;
    background: rgba(255, 255, 255, 0.95);
    /* 移除backdrop-filter以提升性能 */
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 1.1rem;
}

.signature-badge {
    display: inline-block;
    margin-top: 0.6rem;
    padding: 0.4rem 1.2rem;
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
    color: #fff;
    border-radius: 999px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(75, 108, 183, 0.35);
    animation: badge-pulse 2s infinite ease-in-out;
    letter-spacing: 0.5px;
}

@keyframes badge-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(75, 108, 183, 0.35);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(75, 108, 183, 0.5);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(75, 108, 183, 0.35);
    }
}

.dark-mode .signature-badge {
    background: linear-gradient(135deg, #63b3ed 0%, #3182ce 100%);
    box-shadow: 0 4px 12px rgba(99, 179, 237, 0.35);
    animation: badge-pulse-dark 2s infinite ease-in-out;
}

@keyframes badge-pulse-dark {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(99, 179, 237, 0.35);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(99, 179, 237, 0.5);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(99, 179, 237, 0.35);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        padding: 1.2rem 1rem;
    }
    
    .header-actions {
        position: static;
        width: 100%;
        justify-content: center;
        margin-bottom: 1rem;
        flex-wrap: wrap;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .tools-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .tool-search-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }

    .tool-search-clear {
        width: 100%;
    }
    
    main {
        margin: 1.5rem auto;
        padding: 0 1rem;
    }
    
    .tool-card {
        padding: 1.5rem 1.2rem;
    }
    
    .tool-card h2 {
        font-size: 1.4rem;
    }
    
    .tool-card p {
        font-size: 0.95rem;
    }
    
    .tool-card button {
        padding: 0.8rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .instructions {
        padding: 1.5rem;
    }
    
    .instructions h3 {
        font-size: 1.4rem;
    }
    
    footer {
        padding: 1.5rem;
        font-size: 0.95rem;
    }
}

/* 新增动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-card {
    animation: fadeInUp 0.7s ease forwards;
}

.tool-card:nth-child(1) { animation-delay: 0.1s; }
.tool-card:nth-child(2) { animation-delay: 0.2s; }
.tool-card:nth-child(3) { animation-delay: 0.3s; }
.tool-card:nth-child(4) { animation-delay: 0.4s; }
.tool-card:nth-child(5) { animation-delay: 0.5s; }

/* 滚动条样式优化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4b6cb7, #182848);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #3a5ca0, #0f1c35);
}
