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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #10b981;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

/* 导航栏 */
.navbar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-icon {
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.nav-link.active {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

/* 主内容区 */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Hero 区域 */
.hero {
    text-align: center;
    margin-bottom: 60px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 16px 48px;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 1rem;
    background: var(--bg-primary);
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

/* 工具分区 */
.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.tools-section {
    margin-bottom: 60px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* 工具卡片 */
.tool-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.tool-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.tool-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.tool-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 12px;
    line-height: 1.5;
}

.tool-category {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* 工具面板 */
.tool-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.tool-panel {
    background: var(--bg-primary);
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.panel-content {
    padding: 24px;
}

/* 文本计数器工具 */
.text-input {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 24px;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 按钮样式 */
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-buttons.center {
    justify-content: center;
    margin: 20px 0;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* 工具分区样式 */
.tool-section {
    margin-bottom: 20px;
}

.tool-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.tool-section textarea,
.tool-section input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
}

.tool-section textarea {
    min-height: 120px;
    resize: vertical;
}

.tool-section input[type="text"]:focus,
.tool-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 颜色工具 */
.color-picker-section {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.color-picker-section input[type="color"] {
    width: 60px;
    height: 40px;
    cursor: pointer;
}

.color-results {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}

.color-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-result-item input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: monospace;
}

.color-preview {
    height: 100px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

/* UUID 工具 */
.generated-uuid {
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 20px;
    word-break: break-all;
}

.uuid-options {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    justify-content: center;
}

.uuid-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* 时间戳工具 */
.current-timestamp {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.timestamp-section {
    margin-bottom: 24px;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 24px 0;
}

.conversion-result {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-weight: 500;
}

/* 正则匹配工具 */
.regex-results {
    margin-top: 20px;
}

.match-item {
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-family: monospace;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
}

.footer p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 16px 20px;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 12px;
    }
    
    .nav-link {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tool-panel {
        margin: 20px;
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 20px 16px;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .color-picker-section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .uuid-options {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* 暗色模式支持（可选） */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #9ca3af;
        --bg-primary: #1f2937;
        --bg-secondary: #111827;
        --border-color: #374151;
    }
    
    .tool-card:hover {
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    }
}

/* ===== 新增工具样式 ===== */

/* SHA-256 工具 */
.hash-output {
    font-family: monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

/* 密码生成器 */
.generated-password {
    padding: 24px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 1.4rem;
    text-align: center;
    margin-bottom: 20px;
    word-break: break-all;
    letter-spacing: 2px;
}

.password-strength {
    margin-bottom: 20px;
}

.strength-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.strength-fill {
    height: 100%;
    transition: all 0.3s ease;
}

.strength-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.password-options {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.option-row {
    margin-bottom: 16px;
}

.option-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.option-row input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
}

/* 图片转Base64 */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.image-info {
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.image-preview-container {
    margin-bottom: 20px;
    text-align: center;
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.base64-result textarea.base64-textarea {
    min-height: 150px;
    font-family: monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

/* 二维码生成器 */
.qrcode-options {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.color-options {
    display: flex;
    gap: 20px;
    margin-top: 16px;
}

.color-option {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-option label {
    font-size: 0.95rem;
}

.color-option input[type="color"] {
    width: 50px;
    height: 36px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.qrcode-preview {
    text-align: center;
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.qrcode-preview img {
    max-width: 100%;
    border-radius: var(--radius);
}

/* 大小写转换 */
.case-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.case-buttons .btn {
    font-size: 0.9rem;
}

/* CSS渐变生成器 */
.gradient-preview {
    height: 200px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.gradient-options {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.gradient-options select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--bg-primary);
}

.gradient-colors {
    margin-top: 20px;
}

.color-stops {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.color-stop {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-stop input[type="color"] {
    width: 50px;
    height: 40px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.btn-remove {
    background: #ef4444;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-remove:hover {
    background: #dc2626;
}

.gradient-output {
    margin-bottom: 20px;
}

.gradient-code {
    display: block;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.9rem;
    word-break: break-all;
    border: 1px solid var(--border-color);
}

/* 代码格式化 */
.code-formatter-tool select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--bg-primary);
    margin-bottom: 16px;
}

.code-textarea {
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    tab-size: 4;
}

/* 响应式优化 - 新增工具 */
@media (max-width: 768px) {
    .checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .color-options {
        flex-direction: column;
        gap: 12px;
    }
    
    .case-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .color-stops {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .case-buttons {
        grid-template-columns: 1fr;
    }
    
    .generated-password {
        font-size: 1rem;
        letter-spacing: 1px;
    }
}
