/**
 * Code List & Read Code Pages - 统一样式 (2026 v2)
 * 与首页/下载页/tag页风格统一：1400px, 白色卡片, #1A56DB
 */

/* ========== PAGE WRAPPER ========== */
.codepage-wrapper {
    background: #F1F5F9;
    min-height: 100vh;
    padding-bottom: 60px;
}

/* ========== PAGE HEADER ========== */
.codepage-header {
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    padding: 28px 0 24px;
}

.codepage-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 面包屑 */
.cp-bc {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #94A3B8;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.cp-bc a {
    color: #64748B;
    text-decoration: none;
    transition: color 0.2s;
}

.cp-bc a:hover {
    color: #1A56DB;
}

.cp-bc-sep {
    color: #CBD5E1;
}

.cp-bc-cur {
    color: #334155;
    font-weight: 600;
}

/* 头部内容 */
.cp-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.cp-header-left {
    flex: 1;
    min-width: 0;
}

.cp-page-title {
    font-size: 24px;
    font-weight: 800;
    color: #0F172A;
    margin: 0 0 10px;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cp-title-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #1A56DB 0%, #3B82F6 100%);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}

.cp-page-desc {
    font-size: 14px;
    color: #64748B;
    line-height: 1.7;
    margin: 0 0 12px;
    max-width: 700px;
}

.cp-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.cp-tag-item {
    display: inline-block;
    padding: 3px 12px;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    color: #1A56DB;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.cp-tag-item:hover {
    background: #EBF2FF;
    border-color: rgba(26, 86, 219, 0.2);
}

.cp-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #1A56DB;
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.cp-back-btn:hover {
    background: #1648B7;
    color: #fff;
}

/* 统计标签 */
.cp-stat-badges {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.cp-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    font-size: 13px;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
}

.cp-stat-badge .num {
    font-size: 18px;
    font-weight: 900;
    color: #1A56DB;
    letter-spacing: -0.5px;
}

/* ========== MAIN LAYOUT ========== */
.cp-layout {
    max-width: 1400px;
    margin: 20px auto 0;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

/* ========== SECTIONS ========== */
.cp-section {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
    overflow: hidden;
    margin-bottom: 16px;
}

.cp-section-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #F1F5F9;
    flex-wrap: wrap;
    gap: 10px;
}

.cp-section-title {
    font-size: 16px;
    font-weight: 800;
    color: #0F172A;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding-left: 14px;
    border-left: 4px solid #1A56DB;
}

.cp-section-count {
    font-size: 12px;
    font-weight: 600;
    color: #64748B;
    background: #F1F5F9;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #E2E8F0;
}

/* ========== FILE LIST TABLE ========== */
.cp-file-head {
    display: grid;
    grid-template-columns: 54px 1fr 90px 100px;
    gap: 12px;
    padding: 12px 24px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    font-size: 12px;
    font-weight: 700;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cp-file-row {
    display: grid;
    grid-template-columns: 54px 1fr 90px 100px;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid #F8FAFC;
    align-items: center;
    transition: background 0.15s;
}

.cp-file-row:last-child {
    border-bottom: none;
}

.cp-file-row:hover {
    background: #F8FAFC;
}

.cp-file-num {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    color: #64748B;
}

.cp-file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1E293B;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    word-break: break-all;
    transition: color 0.2s;
    line-height: 1.4;
}

.cp-file-name:hover {
    color: #1A56DB;
}

.cp-file-ext {
    display: inline-block;
    padding: 2px 7px;
    background: #EBF2FF;
    color: #1A56DB;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    flex-shrink: 0;
}

.cp-file-size {
    font-size: 12px;
    color: #94A3B8;
    font-weight: 600;
    text-align: center;
}

.cp-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 14px;
    background: #1A56DB;
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.cp-view-btn:hover {
    background: #1648B7;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(26, 86, 219, 0.25);
}

/* ========== BINARY FILE STATES ========== */
.cp-file-binary {
    background: #FAFBFC;
}

.cp-file-binary:hover {
    background: #F5F6F8;
}

.cp-file-binary .cp-file-num {
    background: #F5F6F8;
    border-color: #E8EBF0;
    color: #B0B8C8;
}

.cp-file-disabled {
    color: #94A3B8 !important;
    cursor: default;
}

.cp-file-disabled:hover {
    color: #94A3B8 !important;
}

.cp-ext-binary {
    background: #F1F5F9 !important;
    color: #94A3B8 !important;
    border: 1px solid #E2E8F0;
}

.cp-binary-tag {
    display: inline-block;
    padding: 1px 8px;
    background: #FEF2F2;
    color: #DC2626;
    border: 1px solid #FECACA;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    margin-left: 4px;
    flex-shrink: 0;
}

.cp-view-disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 12px;
    background: #F1F5F9;
    color: #94A3B8;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: not-allowed;
    border: 1px solid #E2E8F0;
}

/* ========== PAGINATION ========== */
.cp-pagination {
    padding: 20px 24px;
    display: flex;
    justify-content: center;
    border-top: 1px solid #F1F5F9;
}

.cp-pagination-wrap {
    display: flex;
    gap: 5px;
    align-items: center;
}

.cp-page-link,
.cp-pagination .pagination li a,
.cp-pagination .pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: #fff;
    color: #1E293B;
    text-decoration: none;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s;
}

.cp-page-link:hover,
.cp-pagination .pagination li a:hover {
    border-color: #1A56DB;
    color: #1A56DB;
}

.cp-page-link.active,
.cp-pagination .pagination li.active span {
    background: #1A56DB;
    border-color: #1A56DB;
    color: #fff;
}

.cp-page-link.disabled {
    background: #F8FAFC;
    color: #CBD5E1;
    cursor: not-allowed;
    pointer-events: none;
}

.cp-page-info {
    font-size: 13px;
    color: #94A3B8;
    text-align: center;
    margin-top: 10px;
}

/* ========== CODE VIEWER ========== */
.cp-code-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E2E8F0;
}

.cp-code-filename {
    font-size: 20px;
    font-weight: 800;
    color: #0F172A;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cp-code-lang {
    display: inline-block;
    padding: 3px 10px;
    background: #EBF2FF;
    color: #1A56DB;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.cp-code-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: #64748B;
}

.cp-code-meta a {
    color: #1A56DB;
    text-decoration: none;
}

.cp-code-meta a:hover {
    text-decoration: underline;
}

/* 工具栏 */
.cp-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    flex-wrap: wrap;
    gap: 8px;
}

.cp-toolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cp-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.cp-tool-btn:hover {
    border-color: #1A56DB;
    color: #1A56DB;
    background: #EBF2FF;
}

.cp-tool-btn i {
    font-size: 13px;
}

.cp-font-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 700;
}

.cp-font-btn:hover {
    border-color: #1A56DB;
    color: #1A56DB;
}

.cp-search-input {
    padding: 6px 12px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    width: 180px;
    font-size: 12px;
    color: #334155;
    outline: none;
    transition: border-color 0.2s;
}

.cp-search-input:focus {
    border-color: #1A56DB;
}

.cp-search-input::placeholder {
    color: #94A3B8;
}

/* 代码显示区 */
.cp-code-display {
    background: #1E1E2E;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.65;
    counter-reset: line;
    position: relative;
    min-height: 200px;
}

.cp-code-display pre {
    margin: 0;
    padding: 16px 0;
}

.cp-code-display pre code {
    display: block;
    white-space: pre;
    color: #CDD6F4;
}

.cp-code-line {
    display: block;
    position: relative;
    padding: 0 16px 0 64px;
    min-height: 22px;
}

.cp-code-line:hover {
    background: rgba(255, 255, 255, 0.04);
}

.cp-code-line::before {
    content: counter(line);
    counter-increment: line;
    position: absolute;
    left: 0;
    width: 48px;
    text-align: right;
    padding-right: 12px;
    color: #585B70;
    border-right: 1px solid #313244;
    user-select: none;
    font-size: 12px;
}

/* 全屏模式 */
.cp-code-display.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    border-radius: 0;
}

/* 滚动条 */
.cp-code-display::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.cp-code-display::-webkit-scrollbar-track {
    background: #1E1E2E;
}

.cp-code-display::-webkit-scrollbar-thumb {
    background: #45475A;
    border-radius: 4px;
}

.cp-code-display::-webkit-scrollbar-thumb:hover {
    background: #585B70;
}

/* 代码分页 */
.cp-code-pager {
    padding: 16px 24px;
    text-align: center;
    border-top: 1px solid #F1F5F9;
}

.cp-code-pager a,
.cp-code-pager span {
    display: inline-block;
    padding: 6px 14px;
    margin: 0 3px;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    color: #334155;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.cp-code-pager a:hover {
    border-color: #1A56DB;
    color: #1A56DB;
}

.cp-code-pager .current {
    background: #1A56DB;
    color: #fff;
    border-color: #1A56DB;
}

.cp-code-pager .disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* 空状态 */
.cp-empty {
    text-align: center;
    padding: 50px 20px;
    color: #94A3B8;
}

.cp-empty i {
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
    opacity: 0.35;
}

.cp-empty p {
    font-size: 14px;
    margin: 4px 0;
}

/* ========== SIDEBAR ========== */
.cp-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 80px;
}

.cp-widget {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
    overflow: hidden;
}

.cp-widget-title {
    font-size: 15px;
    font-weight: 800;
    color: #0F172A;
    padding: 16px 20px;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding-left: 32px;
    position: relative;
}

.cp-widget-title::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    background: #1A56DB;
    border-radius: 2px;
}

/* 下载提示卡 */
.cp-widget-download {
    border-color: #FCD34D;
    background: #FFFBEB;
}

.cp-widget-download .cp-widget-title::before {
    background: #F59E0B;
}

.cp-download-body {
    padding: 20px;
    text-align: center;
}

.cp-download-body p {
    font-size: 14px;
    color: #92400E;
    margin: 0 0 16px;
    line-height: 1.6;
}

.cp-download-btn {
    display: block;
    padding: 12px;
    background: #1A56DB;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    transition: all 0.2s;
}

.cp-download-btn:hover {
    background: #1648B7;
    color: #fff;
}

/* 信息列表 */
.cp-info-list {
    padding: 6px 20px;
}

.cp-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #F1F5F9;
    font-size: 13px;
}

.cp-info-item:last-child {
    border-bottom: none;
}

.cp-info-label {
    color: #94A3B8;
    font-weight: 500;
}

.cp-info-val {
    color: #334155;
    font-weight: 600;
}

.cp-info-val a {
    color: #1A56DB;
    text-decoration: none;
}

.cp-info-val a:hover {
    text-decoration: underline;
}

/* 相关列表 */
.cp-rel-list {
    list-style: none;
    padding: 6px 0;
    margin: 0;
}

.cp-rel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    transition: background 0.2s;
}

.cp-rel-item:hover {
    background: #F8FAFC;
}

.cp-rel-rank {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #E2E8F0;
    color: #64748B;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cp-rel-rank.top {
    background: linear-gradient(135deg, #1A56DB, #3B82F6);
    color: #fff;
}

.cp-rel-item a {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.2s;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cp-rel-item a:hover {
    color: #1A56DB;
}

.cp-rel-dl {
    font-size: 11px;
    color: #94A3B8;
    font-weight: 600;
    flex-shrink: 0;
}

/* 标签 */
.cp-tags-wrap {
    padding: 14px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cp-tags-wrap a {
    display: inline-block;
    padding: 5px 12px;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    transition: all 0.2s;
}

.cp-tags-wrap a:hover {
    background: #EBF2FF;
    border-color: rgba(26, 86, 219, 0.2);
    color: #1A56DB;
}

/* 快捷导航 */
.cp-nav-links {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cp-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    border: 1px solid transparent;
}

.cp-nav-link:hover {
    background: #F8FAFC;
    border-color: #E2E8F0;
}

.cp-nav-link.primary {
    background: #1A56DB;
    color: #fff;
}

.cp-nav-link.primary:hover {
    background: #1648B7;
    color: #fff;
}

.cp-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 13px;
}

/* 查看更多链接 */
.cp-view-all {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid #F1F5F9;
}

.cp-view-all a {
    font-size: 13px;
    font-weight: 600;
    color: #1A56DB;
    text-decoration: none;
}

.cp-view-all a:hover {
    opacity: 0.7;
}

/* ========== SEO FOOTER ========== */
.cp-seo-footer {
    max-width: 1400px;
    margin: 20px auto 0;
    padding: 0 20px;
}

.cp-seo-inner {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
    padding: 24px;
}

.cp-seo-title {
    font-size: 16px;
    font-weight: 800;
    color: #0F172A;
    margin: 0 0 12px;
    padding-left: 14px;
    border-left: 4px solid #1A56DB;
}

.cp-seo-text {
    font-size: 14px;
    line-height: 1.8;
    color: #64748B;
}

.cp-seo-text p {
    margin: 0 0 8px;
}

/* Toast 提示 */
.cp-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background: #1A56DB;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(26, 86, 219, 0.3);
    z-index: 10000;
    font-size: 14px;
    font-weight: 600;
    animation: cpToastIn 0.3s ease-out;
}

@keyframes cpToastIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 快捷键面板 */
.cp-shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: none;
}

.cp-shortcuts-overlay.show {
    display: block;
}

.cp-shortcuts-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 420px;
    width: 90%;
    z-index: 10001;
    display: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.cp-shortcuts-panel.show {
    display: block;
}

.cp-shortcuts-title {
    font-size: 16px;
    font-weight: 800;
    color: #0F172A;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #E2E8F0;
}

.cp-shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
    color: #475569;
}

.cp-shortcut-key {
    padding: 3px 10px;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
    .cp-layout {
        grid-template-columns: 1fr 280px;
    }
}

@media (max-width: 900px) {
    .cp-layout {
        grid-template-columns: 1fr;
    }

    .cp-sidebar {
        position: static;
    }

    .cp-stat-badges {
        display: none;
    }

    .cp-page-title {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .cp-file-head {
        display: none;
    }

    .cp-file-row {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 12px 16px;
    }

    .cp-file-num {
        display: none;
    }

    .cp-code-display {
        font-size: 12px;
    }

    .cp-code-line {
        padding-left: 48px;
    }

    .cp-code-line::before {
        width: 36px;
    }

    .cp-toolbar {
        padding: 8px 16px;
    }
}