/* DevTools 开发者工具箱 - 前台样式 */
:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
    --radius: 8px;
    --radius-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    height: 60px;
    gap: 30px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}
.logo i { font-size: 22px; }
.nav { display: flex; gap: 20px; }
.nav a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: all .2s;
}
.nav a:hover, .nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.header-search {
    margin-left: auto;
    position: relative;
}
.header-search input {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 36px 6px 14px;
    font-size: 14px;
    width: 220px;
    outline: none;
    transition: all .2s;
}
.header-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.header-search i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    padding: 50px 0;
    text-align: center;
}
.hero h1 { font-size: 32px; margin-bottom: 12px; }
.hero p { font-size: 16px; opacity: .9; max-width: 600px; margin: 0 auto; }

/* Tool Section */
.main-content { padding: 40px 20px; }
.tool-section { margin-bottom: 40px; }
.section-title {
    font-size: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}
.section-title i { color: var(--primary); }
.more-link {
    margin-left: auto;
    font-size: 14px;
    font-weight: 400;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.tool-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all .2s;
    color: var(--text);
}
.tool-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--text);
}
.tool-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tool-icon i { font-size: 18px; color: var(--primary); }
.tool-info h3 { font-size: 15px; margin-bottom: 2px; }
.tool-info p { font-size: 12px; color: var(--text-secondary); }

/* Article Section */
.article-section { margin-top: 50px; }
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}
.article-card {
    display: block;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all .2s;
    color: var(--text);
}
.article-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    color: var(--text);
}
.article-card h3 { font-size: 16px; margin-bottom: 8px; }
.article-summary { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-light);
}
.article-meta i { margin-right: 4px; }

/* Article List */
.page-title { font-size: 24px; margin-bottom: 24px; }
.article-list { display: flex; flex-direction: column; gap: 12px; }
.article-item {
    display: block;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all .2s;
    color: var(--text);
}
.article-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    color: var(--text);
}
.article-item h2 { font-size: 17px; margin-bottom: 6px; }
.article-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 10px; }

/* Article Detail */
.article-detail {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}
.article-detail-header { margin-bottom: 30px; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.article-detail-header h1 { font-size: 26px; margin-bottom: 12px; }
.article-content { line-height: 1.8; font-size: 16px; }
.article-content h1, .article-content h2, .article-content h3 { margin: 24px 0 12px; }
.article-content p { margin-bottom: 16px; }
.article-content pre { background: #1e293b; color: #e2e8f0; padding: 16px; border-radius: var(--radius); overflow-x: auto; margin: 16px 0; }
.article-content code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.article-content pre code { background: none; padding: 0; }
.article-content img { max-width: 100%; border-radius: var(--radius); }
.article-content ul, .article-content ol { padding-left: 24px; margin-bottom: 16px; }
.article-content blockquote { border-left: 4px solid var(--primary); padding: 12px 20px; background: #f8fafc; margin: 16px 0; border-radius: 0 var(--radius) var(--radius) 0; }
.article-nav { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Pagination */
.pagination { margin-top: 30px; }
.page-list { display: flex; gap: 6px; justify-content: center; list-style: none; flex-wrap: wrap; }
.page-list li a, .page-list li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: all .2s;
}
.page-list li a:hover { border-color: var(--primary); color: var(--primary); }
.page-list li.active span { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-list li.disabled span { color: var(--text-light); cursor: not-allowed; }
.page-list li.ellipsis span { border: none; }

/* Empty */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; }

/* Breadcrumb */
.breadcrumb {
    padding: 10px 0;
    font-size: 13px;
}
.breadcrumb ol {
    display: flex;
    list-style: none;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.breadcrumb li::after {
    content: '/';
    margin-left: 6px;
    color: var(--text-light);
}
.breadcrumb li:last-child::after {
    content: '';
}
.breadcrumb li:last-child {
    color: var(--text-secondary);
}
.breadcrumb a {
    color: var(--text-secondary);
}
.breadcrumb a:hover {
    color: var(--primary);
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 60px;
}

/* Tool Page Layout */
.tool-page { padding: 30px 20px; }
.tool-page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.tool-page-header h1 { font-size: 24px; }
.tool-page-header i { color: var(--primary); font-size: 24px; }
.tool-page-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }

.tool-workspace {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.tool-workspace textarea {
    width: 100%;
    min-height: 200px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}
.tool-workspace textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }

.tool-actions {
    display: flex;
    gap: 10px;
    margin: 16px 0;
    flex-wrap: wrap;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
    background: var(--bg-card);
    color: var(--text);
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.tool-output {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 100px;
}
.tool-output.success { border-left: 4px solid #22c55e; }
.tool-output.error { border-left: 4px solid #ef4444; }

.tool-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) {
    .tool-row { grid-template-columns: 1fr; }
    .header-inner { gap: 12px; }
    .header-search { display: none; }
    .hero h1 { font-size: 24px; }
    .tool-grid { grid-template-columns: 1fr 1fr; }
    .article-grid { grid-template-columns: 1fr; }
    .article-detail { padding: 20px; }
}

/* Form elements for tools */
.tool-form-group {
    margin-bottom: 16px;
}
.tool-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}
.tool-form-group input,
.tool-form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
}
.tool-form-group input:focus,
.tool-form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.tool-inline {
    display: flex;
    gap: 10px;
    align-items: center;
}
.tool-inline input { flex: 1; }
.tool-inline .btn { flex-shrink: 0; }

.result-box {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 14px;
    word-break: break-all;
}

/* Rich Text Content */
.rich-text {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text);
    word-wrap: break-word;
}
.rich-text h1 { font-size: 28px; font-weight: 700; margin: 32px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.rich-text h2 { font-size: 24px; font-weight: 700; margin: 28px 0 14px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.rich-text h3 { font-size: 20px; font-weight: 600; margin: 24px 0 12px; }
.rich-text h4 { font-size: 18px; font-weight: 600; margin: 20px 0 10px; }
.rich-text h5 { font-size: 16px; font-weight: 600; margin: 18px 0 8px; }
.rich-text h6 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; color: var(--text-secondary); }
.rich-text p { margin: 0 0 16px; }
.rich-text a { color: var(--primary); text-decoration: none; }
.rich-text a:hover { text-decoration: underline; }
.rich-text img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 16px 0; }
.rich-text ul, .rich-text ol { padding-left: 24px; margin: 0 0 16px; }
.rich-text li { margin-bottom: 6px; }
.rich-text blockquote {
    border-left: 4px solid var(--primary);
    margin: 16px 0;
    padding: 8px 16px;
    background: rgba(79,70,229,.04);
    color: var(--text-secondary);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.rich-text blockquote p:last-child { margin-bottom: 0; }
.rich-text pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 16px 0;
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
}
.rich-text code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 0.9em;
}
.rich-text pre code {
    background: none;
    padding: 0;
    color: inherit;
}
.rich-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}
.rich-text th, .rich-text td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}
.rich-text th {
    background: #f8fafc;
    font-weight: 600;
}
.rich-text hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}
.rich-text iframe {
    max-width: 100%;
    border-radius: var(--radius);
}
.rich-text figure {
    margin: 16px 0;
    text-align: center;
}
.rich-text figcaption {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 8px;
}
