/*
Theme Name: Claude Code Guide
Theme URI: https://claudecode.com
Description: Claude Code 学习主题
Version: 2.0.9
Author: Claude Code Community
License: GPL v2 or later
Text Domain: claude-code
*/

/* === 重置样式 === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主题配色方案 */
    --primary-color: #96b97d;          /* 主题绿色 */
    --primary-dark: #7da366;
    --secondary-color: #444444;        /* 深灰 */
    --text-color: #333333;             /* 主文字 */
    --text-light: #777777;             /* 浅灰文字 */
    --border-color: #e5e5e5;           /* 边框色 */
    --bg-color: #F5F5FB;               /* 页面背景 - 菜鸟教程风格 */
    --white: #ffffff;
    --link-color: #2a6496;             /* 链接蓝 */
    --link-hover: #1a4a73;
    --code-bg: #ecf4ee;
    --code-header-bg: #e8e8e8;
    --code-border: #d4d4d4;
}

body {
    font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* === 顶部导航栏 === */
.site-header {
    background: var(--white);
    border-bottom: 3px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 80px;
    gap: 20px;
}

.header-left {
    flex-shrink: 0;
}

.site-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--secondary-color);
    text-decoration: none !important;
}

/* === 顶部搜索框 === */
.header-search {
    position: relative;
    flex-shrink: 0;
    justify-self: end;
    max-width: 200px;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s;
}

.search-input-wrapper:focus-within {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 2px rgba(150, 185, 125, 0.2);
}

#global-search {
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 13px;
    width: 150px;
    outline: none;
    color: var(--text-color);
}

#global-search::placeholder {
    color: #999;
}

.search-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

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

.search-results {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    width: 300px;
    max-height: 500px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
}

.search-results-list {
    padding: 8px 0;
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f8f8f8;
}

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 4px;
}

.search-result-excerpt {
    font-size: 12px;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-result-category {
    font-size: 11px;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.search-no-results {
    padding: 20px 15px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

.search-loading {
    padding: 20px 15px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

/* 搜索结果滚动条 */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* === 主布局 === */
.site-main {
    padding: 20px 0;
}

.main-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    min-height: calc(100vh - 150px);
}

/* === 左侧边栏 === */
.sidebar-left {
    position: sticky;
    top: 70px;
    height: fit-content;
}

.chapter-nav-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--secondary-color);
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    margin-top: 15px;
    margin-bottom: 10px;
}

.chapter-nav-title:first-child {
    margin-top: 0;
}

.chapter-nav {
    list-style: none;
}

.chapter-nav li {
    margin-bottom: 1px;
}

.chapter-nav a {
    display: block;
    padding: 6px 10px;
    color: var(--text-color);
    font-size: 13px;
    text-decoration: none !important;
    border-radius: 3px;
    transition: all 0.2s;
}

.chapter-nav a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.chapter-nav a.active {
    background: var(--primary-color);
    color: var(--white);
}

/* === 主内容区 === */
.content-area {
    background: #fafcfd;  /* 菜鸟教程文章背景色 */
    padding: 30px;
    /* 禁用文本选择 */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.entry-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.entry-title {
    font-size: 28px;
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-weight: bold;
}

.entry-meta {
    color: var(--text-light);
    font-size: 13px;
}

.entry-content {
    font-size: 16px;
    line-height: 1.8;
}

.entry-content h2 {
    font-size: 22px;
    margin: 30px 0 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
    color: var(--secondary-color);
}

.entry-content h3 {
    font-size: 18px;
    margin: 25px 0 12px;
    color: var(--secondary-color);
}

.entry-content h4 {
    font-size: 16px;
    margin: 20px 0 10px;
    color: var(--secondary-color);
}

.entry-content p {
    margin-bottom: 15px;
}

.entry-content ul,
.entry-content ol {
    margin: 15px 0;
    padding-left: 30px;
}

.entry-content li {
    margin-bottom: 8px;
}

/* 图片下方增加间距 */
.entry-content img,
.entry-content figure {
    display: block;
    margin-bottom: 25px;
}

.entry-content figure img {
    margin-bottom: 0;
}

.entry-content figcaption {
    margin-top: 10px;
}

/* === 代码块样式 === */
.entry-content pre {
    background: var(--code-bg) !important;
    border: 1px solid var(--code-border) !important;
    border-radius: 4px;
    margin: 20px 0;
    overflow-x: auto;
    max-width: 100%;
    padding: 0 !important;
    position: relative;
}

/* 覆盖 Prism 的默认背景色 */
.entry-content pre[class*="language-"] {
    background: var(--code-bg) !important;
    padding: 0 !important;
}

.entry-content pre code {
    background: transparent !important;
    padding: 15px !important;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
    word-wrap: normal;
}

/* 覆盖 Prism token 颜色 */
.entry-content pre .token.comment,
.entry-content pre .token.prolog,
.entry-content pre .token.doctype,
.entry-content pre .token.cdata {
    color: #999;
}

.entry-content pre .token.punctuation {
    color: #333;
}

.entry-content pre .token.property,
.entry-content pre .token.tag,
.entry-content pre .token.boolean,
.entry-content pre .token.number,
.entry-content pre .token.constant,
.entry-content pre .token.symbol {
    color: #990073;
}

.entry-content pre .token.selector,
.entry-content pre .token.attr-name,
.entry-content pre .token.string,
.entry-content pre .token.char {
    color: #669900;
}

.entry-content pre .token.operator,
.entry-content pre .token.entity,
.entry-content pre .token.url,
.language-css .token.string,
.style .token.string {
    color: #a67f59;
}

.entry-content pre .token.atrule,
.entry-content pre .token.attr-value,
.entry-content pre .token.keyword {
    color: #0066cc;
}

.entry-content pre .token.function,
.entry-content pre .token.class-name {
    color: #dd4a68;
}

.code-header {
    background: #f5f5f5;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--code-border);
    font-size: 12px;
    color: #666;
}

.code-language {
    font-weight: bold;
    text-transform: uppercase;
}

.copy-button {
    background: white;
    border: 1px solid #ddd;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    color: #333;
    transition: all 0.2s;
}

.copy-button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.code-example {
    background: var(--code-header-bg);
    padding: 8px 15px;
    margin: 15px 0;
    border-radius: 4px;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 13px;
}

.try-it-btn {
    display: inline-block;
    padding: 5px 15px;
    background: var(--primary-color);
    color: var(--white) !important;
    border-radius: 3px;
    font-size: 13px;
    margin-top: 10px;
    text-decoration: none !important;
    transition: all 0.2s;
}

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

/* === 可复制内容块 === */
.copy-box {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
    max-width: 100%;
}

.copy-box-header {
    background: #f5f5f5;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--code-border);
}

.copy-box-title {
    font-weight: bold;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
}

.copy-box-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    color: #333;
    transition: all 0.2s;
}

.copy-box-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.copy-box-content {
    padding: 8px 12px;
    /* 允许选择和复制 */
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
    overflow-x: auto;
}

.entry-content code {
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #d63384;
}

.entry-content pre code {
    display: block;
    padding: 15px;
    color: #333;
    overflow-x: auto;
    background: transparent;
}

.entry-content :not(pre) > code {
    background: #f8f8f8;
    padding: 2px 6px;
    border-radius: 3px;
    color: #e83e8c;
}

/* === 表格样式 === */
.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    border: 1px solid var(--border-color);
}

.entry-content th,
.entry-content td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.entry-content th {
    background: var(--code-header-bg);
    color: var(--secondary-color);
    font-weight: bold;
}

.entry-content tr:nth-child(even) {
    background: #fafafa;
}

/* === 提示框 === */
.note-box {
    padding: 12px 15px;
    margin: 20px 0;
    border-left: 4px solid;
    background: #f8f8f8;
    border-radius: 0 4px 4px 0;
}

.note-box.note-info {
    border-color: #5bc0de;
    background: #f0f8fc;
}

.note-box.note-warning {
    border-color: #f0ad4e;
    background: #fef8f0;
}

.note-box.note-tip {
    border-color: #5cb85c;
    background: #f0fdf4;
}

/* === 右侧边栏 === */
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.widget {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.widget-title {
    font-size: 15px;
    font-weight: bold;
    color: var(--white);
    background: var(--primary-color);
    padding: 10px 15px;
    margin: 0;
}

.widget-content {
    padding: 15px;
}

.widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget li {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-color);
}

.widget li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.widget a {
    color: var(--text-color);
    font-size: 13px;
    text-decoration: none !important;
}

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

/* 搜索框 */
.search-box {
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
}

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

/* 在线工具列表 */
.online-tools li,
.quick-nav li {
    padding: 6px 0;
}

.online-tools a,
.quick-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
}

.online-tools i,
.quick-nav i {
    color: var(--primary-color);
    width: 16px;
}

/* 最新更新 */
.recent-updates li {
    display: flex;
    gap: 10px;
}

.update-date {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 12px;
    min-width: 45px;
}

.update-title {
    flex: 1;
}

/* 微信二维码 */
.wechat-qr {
    text-align: center;
    padding: 15px;
}

.wechat-qr img {
    width: 150px;
    height: 150px;
    margin-bottom: 10px;
}

.wechat-qr p {
    font-size: 12px;
    color: var(--text-light);
    margin: 0;
}

/* === 章节导航 === */
.chapter-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.chapter-navigation .btn {
    flex: 1;
    max-width: 45%;
}

.chapter-navigation .btn-prev {
    text-align: left;
}

.chapter-navigation .btn-next {
    text-align: right;
    margin-left: auto;
}

/* === 文章导航样式 === */
.nav-top,
.nav-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.nav-bottom {
    margin-bottom: 0;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    border-bottom: none;
}

.nav-prev,
.nav-next {
    flex: 1;
    font-size: 14px;
}

.nav-prev {
    text-align: left;
}

.nav-next {
    text-align: right;
}

.nav-prev a,
.nav-next a {
    color: var(--link-color);
    text-decoration: none;
}

.nav-prev a:hover,
.nav-next a:hover {
    text-decoration: underline;
}

/* === 面包屑 === */
.breadcrumbs {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 15px;
}

.breadcrumbs a {
    color: var(--text-light);
}

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

/* === 底部 === */
.site-footer {
    background: var(--secondary-color);
    color: rgba(255,255,255,0.8);
    padding: 30px 0;
    margin-top: 50px;
    font-size: 13px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    text-align: center;
}

.footer-content p {
    margin: 5px 0;
}

.site-footer a {
    color: var(--white);
}

.site-footer a:hover {
    text-decoration: underline;
}

.footer-links {
    margin-top: 10px;
}

/* === 响应式 === */
@media (max-width: 992px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-left {
        display: none;
    }

    .top-menu {
        display: none;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 20px 15px;
    }

    .entry-title {
        font-size: 22px;
    }

    .chapter-navigation {
        flex-direction: column;
        gap: 10px;
    }

    .chapter-navigation .btn {
        max-width: 100%;
    }
}

/* === 工具类 === */
.btn {
    display: inline-block;
    padding: 8px 20px;
    background: var(--primary-color);
    color: var(--white) !important;
    border-radius: 4px;
    font-size: 14px;
    text-decoration: none !important;
    transition: all 0.2s;
}

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

/* === 文章元数据 === */
.entry-meta {
    display: flex;
    gap: 20px;
    padding: 10px 0;
    color: #666;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.entry-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.entry-meta i {
    color: var(--primary-color);
}

/* === Gutenberg 字体大小预设 === */
.has-small-font-size {
    font-size: 16px !important;
}
.has-regular-font-size {
    font-size: 18px !important;
}
.has-medium-font-size {
    font-size: 20px !important;
}
.has-large-font-size {
    font-size: 24px !important;
}
.has-huge-font-size {
    font-size: 32px !important;
}
