/* 字节工具箱 - 全局样式 */
:root {
    --primary-color: #2196F3;
    --primary-light: #64B5F6;
    --primary-dark: #1976D2;
    --text-color: #333;
    --text-light: #666;
    --text-lighter: #999;
    --bg-color: #fff;
    --bg-light: #f5f7fa;
    --bg-white: #fff;
    --border-color: #e8eef3;
    --border-light: #f0f4f8;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "微软雅黑", -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-light);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

input, textarea, button {
    font-family: inherit;
    font-size: inherit;
}

/* 布局容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.site-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 30px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
    color: var(--text-color);
}

.logo:hover {
    color: var(--primary-color);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.logo-text {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-nav {
    display: flex;
    gap: 30px;
}

.main-nav a {
    color: var(--text-color);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

.header-search {
    flex: 0 0 280px;
}

.header-search form {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.header-search form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.header-search input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    outline: none;
    background: var(--bg-light);
}

.header-search button {
    padding: 10px 20px;
    border: none;
    background: var(--primary-color);
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.header-search button:hover {
    background: var(--primary-dark);
}

/* 主内容区 */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 30px 0;
}

/* 页面标题 */
.page-title {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-light);
}

/* 工具卡片 */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.tool-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 25px;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transform: scaleX(0);
    transition: var(--transition);
}

.tool-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.tool-card:hover::before {
    transform: scaleX(1);
}

.tool-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border-radius: var(--radius);
    margin-bottom: 15px;
}

.tool-icon svg {
    width: 28px;
    height: 28px;
}

.tool-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.tool-desc {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 15px;
}

.tool-meta {
    display: flex;
    gap: 10px;
}

.tool-badge {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 20px;
    background: var(--bg-light);
    color: var(--text-light);
}

.tool-badge.hot {
    background: #fff3e0;
    color: #f57c00;
}

.tool-badge.new {
    background: #e8f5e9;
    color: #4caf50;
}

.tool-card:hover .tool-badge {
    background: var(--primary-color);
    color: #fff;
}

/* 工具详情页 */
.tool-container {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.tool-header .tool-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border-radius: var(--radius);
    margin-bottom: 0;
}

.tool-header .tool-icon svg {
    width: 36px;
    height: 36px;
}

.tool-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.tool-header .tool-desc {
    margin-bottom: 0;
}

.tool-content {
    min-height: 300px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-color);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
    background: var(--bg-white);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.form-btn.primary {
    background: var(--primary-color);
    color: #fff;
}

.form-btn.primary:hover {
    background: var(--primary-dark);
}

.form-btn.secondary {
    background: var(--bg-light);
    color: var(--text-color);
}

.form-btn.secondary:hover {
    background: var(--border-color);
}

/* 结果区域 */
.result-box {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
}

.result-label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.result-content {
    font-size: 16px;
    word-break: break-all;
    font-family: 'Consolas', monospace;
}

.result-content.error {
    color: #f44336;
}

.result-content.success {
    color: #4caf50;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-color);
    transition: var(--transition);
}

.pagination a:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination .current {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* 广告容器 */
.ad-container {
    text-align: center;
    margin: 20px 0;
    overflow: hidden;
}

.ad-container img {
    max-width: 100%;
    height: auto;
}

.ad-container a {
    display: inline-block;
}

.ad-header,
.ad-footer {
    margin: 10px 0;
}

.ad-content {
    margin: 20px 0;
    text-align: center;
}

.ad-sidebar {
    text-align: center;
    margin: 20px auto;
    max-width: 300px;
}

/* 页脚 */
.site-footer {
    background: transparent;
    border-top: 1px solid var(--border-light);
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: var(--text-light);
}

.footer-section ul li a:hover {
    color: var(--primary-color);
}

.footer-section p {
    color: var(--text-light);
    font-size: 13px;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-light);
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary-color);
    color: #fff;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    color: var(--text-lighter);
    font-size: 13px;
}

.footer-bottom a {
    color: var(--text-light);
}

/* 后台样式 */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 240px;
    background: #1a1a2e;
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
}

.admin-sidebar .logo {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-sidebar .logo:hover {
    color: var(--primary-light);
}

.admin-nav {
    padding: 20px 0;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255,255,255,0.7);
    transition: var(--transition);
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left: 3px solid var(--primary-color);
}

.admin-main {
    flex: 1;
    margin-left: 240px;
    background: var(--bg-light);
    min-height: 100vh;
}

.admin-header {
    background: #fff;
    padding: 15px 30px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-content {
    padding: 30px;
}

.admin-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

.admin-card-title {
    font-size: 18px;
    font-weight: 600;
}

/* 表格样式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-color);
}

.data-table tr:hover td {
    background: var(--bg-light);
}

.data-table .actions {
    display: flex;
    gap: 10px;
}

.data-table .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.data-table .btn-edit {
    background: var(--primary-color);
    color: #fff;
}

.data-table .btn-delete {
    background: #f44336;
    color: #fff;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 24px;
    margin-bottom: 15px;
}

.stat-card .stat-icon.blue {
    background: #e3f2fd;
    color: var(--primary-color);
}

.stat-card .stat-icon.green {
    background: #e8f5e9;
    color: #4caf50;
}

.stat-card .stat-icon.orange {
    background: #fff3e0;
    color: #f57c00;
}

.stat-card .stat-icon.purple {
    background: #f3e5f5;
    color: #9c27b0;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-card .stat-label {
    color: var(--text-light);
    font-size: 14px;
}

/* 搜索结果页 */
.search-results {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
}

.search-result-item {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-light);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item h3 {
    margin-bottom: 8px;
}

.search-result-item h3 a {
    color: var(--primary-color);
    font-size: 18px;
}

.search-result-item p {
    color: var(--text-light);
    font-size: 14px;
}

/* 响应式 */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        height: auto;
        padding: 15px 0;
    }
    
    .main-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 15px;
    }
    
    .header-search {
        flex: 1;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tool-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .admin-sidebar {
        width: 60px;
    }
    
    .admin-sidebar .logo-text,
    .admin-nav span {
        display: none;
    }
    
    .admin-main {
        margin-left: 60px;
    }
}

@media (max-width: 480px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: #333;
    color: #fff;
    font-size: 12px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}
