/* javascript-learning.css - 当发网JavaScript学习频道 */

/* ===== CSS变量定义 ===== */
:root {
    --primary-color: #82255E;
    --primary-dark: #6a1e4c;
    --secondary-color: #B83B6A;
    --accent-color: #D1C39D;
    --dark-color: #2A101B;
    --light-color: #D9D0CA;
    --white: #FFFFFF;
    --gray-light: #f5f5f5;
    --gray-medium: #e0e0e0;
    --font-family: "微软雅黑", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --border-radius: 10px;
    --transition: all 0.3s ease;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.15);
}

/* ===== 基础重置与布局 ===== */
body,
h1,
h2,
h3,
h4,
p,
ul,
li,
article,
header,
footer,
main,
nav,
div {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: #333;
    background-color: var(--gray-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
}

/* ===== 通用组件样式 ===== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #82255e, #e91e63);
    z-index: 1000;
    transition: width 0.1s ease;
    pointer-events: none;
}

/* ===== 头部和导航样式 ===== */
header {
    background-color: var(--primary-color);
    color: var(--accent-color);
    text-align: center;
    padding: 1.5rem 1rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.header-content {
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 900;
    margin: 0 0 0.5rem 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.header-links,
.footer-nav-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-links a,
.footer-nav-links a {
    color: var(--accent-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: 0.9rem;
}

.header-links a:hover,
.footer-nav-links a:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

.main-nav {
    background-color: var(--dark-color);
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.nav-menu {
    display: flex;
    list-style: none;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0;
    margin: 0;
    transition: var(--transition);
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    display: block;
    color: var(--light-color);
    text-decoration: none;
    padding: 0.8rem 1.2rem;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.95rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-menu a:hover,
.nav-menu a.active {
    background-color: var(--primary-color);
    color: var(--accent-color);
}

.hamburger {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: auto;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    transition: var(--transition);
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--accent-color);
    margin: 3px 0;
    transition: var(--transition);
    border-radius: 2px;
}

/* ===== 主内容区域样式 ===== */
main {
    background-color: var(--secondary-color);
    padding: 1.5rem 1rem;
    flex-grow: 1;
}

.hero-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 3rem;
}

.hero-content {
    background-color: var(--accent-color);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.hero-content h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.hero-content p {
    color: var(--dark-color);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--dark-color);
}

.hero-visual {
    display: flex;
    justify-content: center;
}

.code-preview {
    background-color: var(--dark-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 500px;
    color: var(--gray-medium);
}

/* ===== 学习路径和卡片样式 ===== */
.learning-path,
.featured-cards,
.quick-links {
    margin-bottom: 3rem;
}

.learning-path h2,
.featured-cards h2,
.quick-links h2 {
    color: var(--accent-color);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.path-steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.path-step,
.featured-card,
.quick-link {
    background-color: var(--accent-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-align: center;
}

.path-step {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.featured-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.quick-link {
    padding: 1rem;
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.path-step:hover,
.featured-card:hover,
.quick-link:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.quick-link:hover {
    transform: translateY(-3px);
}

.step-number,
.card-icon {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.card-icon {
    width: 50px;
    height: 50px;
}

.path-step h3,
.featured-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.featured-card h3 {
    margin-bottom: 1rem;
}

.path-step p,
.featured-card p {
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.featured-card p {
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.step-link,
.card-link {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.step-link:hover,
.card-link:hover {
    background-color: var(--primary-dark);
}

.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.link-title {
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.link-desc {
    color: var(--dark-color);
    font-size: 0.9rem;
}

/* ===== 内容区域和代码块样式 ===== */
.content-section {
    background-color: var(--accent-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.content-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.6rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.content-section h3 {
    color: var(--primary-dark);
    margin: 1.5rem 0 1rem 0;
    font-size: 1.3rem;
}

.content-section p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.content-section ul,
.content-section ol {
    margin: 0 0 1rem 1.5rem;
}

.content-section li {
    margin-bottom: 0.5rem;
}

.code-example {
    background-color: var(--dark-color);
    color: var(--light-color);
    border-radius: var(--border-radius);
    margin: 1rem 0;
    overflow: hidden;
}

.code-header {
    background-color: #1a1a1a;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.code-title {
    color: var(--light-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.code-content {
    padding: 1rem;
    overflow-x: auto;
    transition: max-height 0.3s ease-out;
}

.code-content pre {
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-content code {
    display: block;
    white-space: pre;
}

.line-number {
    display: inline-block;
    width: 2.5em;
    padding-right: 1em;
    margin-right: 1em;
    color: #6c757d;
    text-align: right;
    border-right: 1px solid #444;
    user-select: none;
}

.code-content .keyword {
    color: #e06c75;
}

.code-content .function {
    color: #61afef;
}

.code-content .string {
    color: #98c379;
}

.code-content .number {
    color: #d19a66;
}

.code-content .comment {
    color: #5c6370;
}

.code-content .operator {
    color: #56b6c2;
}

.copy-code-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.copy-code-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.copy-code-btn.copied {
    background: #28a745;
}

.copy-code-btn svg {
    width: 14px;
    height: 14px;
}

.code-content.collapsed {
    max-height: 0;
    overflow: hidden;
}

.example-preview {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.tip-box,
.warning-box {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.tip-box {
    background-color: #e8f4fd;
    border-left: 4px solid #2196F3;
}

.warning-box {
    background-color: #ffebee;
    border-left: 4px solid #f44336;
}

/* ===== 表格和表单样式 ===== */
.syntax-table table,
.type-table,
.operators-demo-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background-color: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.syntax-table th,
.syntax-table td,
.type-table th,
.type-table td,
.operators-demo-table th,
.operators-demo-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-medium);
}

.syntax-table th,
.type-table th,
.operators-demo-table th {
    background-color: var(--primary-color);
    color: var(--accent-color);
    font-weight: 600;
}

.syntax-table tr:last-child td,
.type-table tr:last-child td,
.operators-demo-table tr:last-child td {
    border-bottom: none;
}

.syntax-table tr:hover,
.type-table tr:hover,
.operators-demo-table tr:hover {
    background-color: var(--gray-light);
}

.browser-support {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 1rem 0;
    border-left: 4px solid #4CAF50;
}

.support-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.support-browser {
    width: 100px;
    font-weight: bold;
}

.support-version {
    flex: 1;
}

.tag-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    margin: 1rem 0;
}

.tag-item {
    background-color: var(--white);
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.form-preview,
.form-validation-demo {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-medium);
    margin: 1rem 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-medium);
    border-radius: 4px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(130, 37, 94, 0.2);
}

.password-strength {
    font-size: 0.8rem;
    margin-top: 5px;
}

.form-feedback {
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    display: none;
}

.form-feedback.success {
    color: #4caf50;
    background-color: #e8f5e9;
}

.form-feedback.error {
    color: #f44336;
    background-color: #ffebee;
}

.error-message {
    color: #f44336;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* ===== 搜索和参考手册样式 ===== */
.search-box {
    margin: 20px 0;
    position: relative;
    z-index: 20;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    box-sizing: border-box;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    z-index: 15;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.search-loading,
.search-stats,
.search-result-more,
.search-no-results {
    padding: 15px;
    text-align: center;
    color: var(--dark-color);
}

.search-stats {
    padding: 8px 15px;
    background-color: var(--gray-light);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--gray-medium);
}

.search-result-more {
    padding: 10px 15px;
    font-size: 0.9rem;
    border-top: 1px solid var(--gray-light);
}

.show-all-results {
    color: var(--primary-color);
    text-decoration: none;
}

.show-all-results:hover {
    text-decoration: underline;
}

.search-history-item,
.search-popular-item,
.search-result-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--gray-light);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    outline: none;
}

.search-history-item:hover,
.search-popular-item:hover,
.search-result-item:hover,
.search-result-item:focus {
    background-color: var(--gray-light);
}

.search-history-icon {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.search-history-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    margin-left: auto;
    padding: 2px 6px;
    border-radius: 3px;
    transition: var(--transition);
}

.search-history-remove:hover {
    background-color: #ffebee;
    color: #f44336;
}

.search-popular-count {
    background-color: var(--primary-color);
    color: var(--accent-color);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.8rem;
    min-width: 20px;
    text-align: center;
}

.search-result-item.touch-active {
    background-color: var(--gray-light) !important;
}

.search-category-header {
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--primary-dark);
}

.search-result-title {
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--primary-color);
}

.search-result-desc {
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--dark-color);
}

.search-result-meta {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

mark {
    background-color: #ffeb3b;
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
}

.reference-category {
    margin-bottom: 2rem;
}

.reference-section {
    background: var(--accent-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
    margin-top: 15px;
}

.quick-nav a {
    background: var(--primary-color);
    color: var(--accent-color);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.quick-nav a:hover {
    background: var(--primary-dark);
}

.quick-nav.visible {
    opacity: 1;
    transform: translateY(0);
}

.tag-badge {
    display: inline-block;
    background: var(--dark-color);
    color: var(--light-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin-right: 5px;
}

/* ===== 兼容性表格样式 ===== */
.compatibility-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.compatibility-table th,
.compatibility-table td {
    padding: 8px;
    text-align: center;
    border: 1px solid var(--gray-medium);
}

.compatibility-table th {
    background: var(--primary-color);
    color: var(--accent-color);
}

.supported {
    background: #d4edda;
    color: #155724;
}

.partial {
    background: #fff3cd;
    color: #856404;
}

.unsupported {
    background: #f8d7da;
    color: #721c24;
}

/* ===== 底部样式 ===== */
.footer-nav {
    background-color: var(--primary-color);
    padding: 1rem 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

footer {
    background-color: var(--dark-color);
    color: var(--light-color);
    text-align: center;
    padding: 1.25rem 1rem;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

footer p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

footer a {
    color: var(--light-color);
    text-decoration: none;
    transition: var(--transition);
}

footer a:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

/* ===== 动画效果 ===== */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.error-notification {
    animation: slideIn 0.3s ease-out;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-icon {
    font-size: 16px;
}

.error-dismiss {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
}

.selected {
    background-color: var(--primary-color);
    color: var(--accent-color);
}

#demoList li {
    padding: 5px 10px;
    margin: 2px 0;
    border: 1px solid var(--gray-medium);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

#demoList li:hover {
    background-color: var(--gray-light);
}

/* ===== 实践练习模块样式 ===== */
.demo-variables,
.demo-console,
.demo-expressions,
.demo-section,
.function-demo-section,
.object-demo-section {
    margin: 15px 0;
}

.demo-variables table,
.demo-expressions table {
    width: 100%;
    margin: 10px 0;
}

.demo-controls,
.object-demo-controls,
.list-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.demo-button,
.object-demo-button,
.operation-button {
    background-color: var(--primary-color);
    color: var(--accent-color);
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-size: 0.9rem;
}

.demo-button:hover,
.object-demo-button:hover,
.operation-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.demo-button.secondary,
.object-demo-button.secondary {
    background-color: var(--secondary-color);
}

.demo-button.secondary:hover,
.object-demo-button.secondary:hover {
    background-color: #a52c5a;
}

.operation-button {
    padding: 6px 12px;
    font-size: 0.8rem;
    margin: 2px;
    width: 100%;
}

.demo-output,
.object-demo-output {
    background-color: var(--gray-light);
    padding: 15px;
    border-radius: var(--border-radius);
    min-height: 100px;
    border: 1px solid var(--gray-medium);
}

.object-demo-output {
    margin-top: 15px;
    padding: 15px;
    border-left: 4px solid var(--primary-color);
    min-height: 50px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

.code-input {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    margin: 10px 0;
    resize: vertical;
}

.demo-result {
    margin-top: 15px;
    padding: 10px;
    background-color: #e8f5e9;
    border-radius: var(--border-radius);
    border-left: 4px solid #4CAF50;
}

.demo-error,
.object-demo-error {
    margin-top: 15px;
    padding: 10px;
    background-color: #ffebee;
    border-radius: var(--border-radius);
    border-left: 4px solid #f44336;
    color: #c62828;
}

.object-demo-error {
    color: #c62828;
    font-weight: bold;
}

.object-demo-success {
    color: #2e7d32;
    font-weight: bold;
}

.console-output-line {
    background: #f5f5f5;
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 3px;
    border-left: 3px solid #82255E;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.code-input-section {
    margin-top: 20px;
    padding: 15px;
    background: var(--gray-light);
    border-radius: var(--border-radius);
}

.interactive-type-demo,
.conversion-practice,
.control-flow-demo,
.function-demo-container,
.object-demo-container,
.dynamic-list-demo,
.event-demo-section {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-medium);
    margin-top: 1rem;
}

.control-flow-demo,
.function-demo-container,
.object-demo-container {
    margin: 15px 0;
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.demo-section-header,
.function-demo-header,
.object-demo-header {
    background-color: var(--primary-color);
    color: var(--accent-color);
    padding: 10px 15px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.demo-section-content,
.function-demo-content,
.object-demo-content {
    padding: 15px;
    background-color: var(--white);
    border-top: 1px solid var(--gray-medium);
}

.demo-code-block {
    background-color: var(--dark-color);
    color: var(--light-color);
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 10px 0;
    overflow-x: auto;
}

.demo-execution-area,
.function-test-area {
    margin-top: 15px;
    padding: 15px;
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
}

.demo-input-group,
.function-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.demo-input-label,
.function-input-label {
    min-width: 80px;
    font-weight: bold;
}

.demo-input,
.function-input,
.interactive-expression-input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    font-family: 'Courier New', Courier, monospace;
}

.demo-output-area {
    margin-top: 15px;
    padding: 15px;
    background-color: var(--white);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    min-height: 50px;
}

.demo-output-log,
.function-output-log,
.object-demo-log {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    margin: 5px 0;
}

.function-output-log {
    background-color: var(--dark-color);
    color: var(--light-color);
    padding: 10px;
    border-radius: var(--border-radius);
}

.object-demo-log {
    margin: 8px 0;
    padding: 8px;
    background-color: var(--gray-light);
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.4;
}

.demo-output-error {
    color: #c62828;
    font-weight: bold;
}

.demo-output-success {
    color: #2e7d32;
    font-weight: bold;
}

.performance-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.performance-item {
    background-color: var(--gray-light);
    padding: 10px;
    border-radius: var(--border-radius);
    text-align: center;
}

.performance-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.performance-label {
    font-size: 0.8rem;
    color: var(--dark-color);
}

.type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-right: 5px;
}

.type-string {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.type-number {
    background-color: #e3f2fd;
    color: #1565c0;
}

.type-boolean {
    background-color: #fff3e0;
    color: #ef6c00;
}

.type-object {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.type-null {
    background-color: #e0e0e0;
    color: #424242;
}

.type-undefined {
    background-color: #ffebee;
    color: #c62828;
}

.type-function {
    background-color: #e0f2f1;
    color: #00695c;
}

.type-symbol {
    background-color: #fff8e1;
    color: #ff8f00;
}

.type-bigint {
    background-color: #e8eaf6;
    color: #3949ab;
}

.conversion-examples {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.conversion-example {
    background-color: var(--gray-light);
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.conversion-code {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--dark-color);
    color: var(--light-color);
    padding: 0.5rem;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.conversion-result {
    font-weight: bold;
    color: var(--primary-color);
}

.scope-chain-visual,
.prototype-chain {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 15px 0;
}

.scope-level,
.prototype-level {
    background-color: var(--gray-light);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 10px;
    margin: 5px 0;
    width: 80%;
    text-align: center;
}

.prototype-level {
    font-family: 'Courier New', Courier, monospace;
}

.scope-variable {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: 4px;
    padding: 5px;
    margin: 5px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.scope-arrow,
.prototype-arrow {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 5px 0;
}

.scope-demo-container,
.closure-demo-container {
    margin-bottom: 20px;
}

.binary-explanation {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: var(--dark-color);
    background-color: var(--gray-light);
    padding: 5px;
    border-radius: 4px;
    margin-top: 5px;
}

.object-visualization {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    padding: 15px;
    margin: 10px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.object-property {
    margin: 5px 0;
    padding-left: 20px;
}

.object-method {
    margin: 5px 0;
    padding-left: 20px;
    color: var(--primary-color);
    font-style: italic;
}

.object-operations-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 15px 0;
}

.operation-group {
    background-color: var(--gray-light);
    padding: 10px;
    border-radius: var(--border-radius);
}

.operation-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.demo-prompt {
    text-align: center;
    padding: 2rem;
    color: var(--dark-color);
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
    border: 2px dashed var(--primary-color);
}

.demo-prompt p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.prompt-hint {
    font-size: 0.9rem !important;
    color: var(--secondary-color);
    opacity: 0.8;
}

/* ===== DOM操作演示样式 ===== */
.dom-operation-info {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.operation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-medium);
}

.operation-title {
    font-weight: bold;
    color: var(--primary-color);
}

.operation-time {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.operation-content {
    line-height: 1.5;
}

.list-stats {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.dynamic-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 5px;
    background-color: var(--gray-light);
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.remove-item {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
}

.remove-item:hover {
    background: #a52c5a;
}

.traversal-info {
    background-color: var(--gray-light);
    padding: 10px;
    border-radius: 4px;
}

.traversal-info h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.children-list {
    list-style: none;
    padding-left: 0;
}

.children-list li {
    padding: 5px 0;
    border-bottom: 1px dashed var(--gray-medium);
}

.demo-created-item {
    background-color: #e8f5e9;
    border: 1px solid #4caf50;
    border-radius: var(--border-radius);
    padding: 10px;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.demo-created-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.item-label {
    font-weight: bold;
}

.item-timestamp {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.demo-created-item .remove-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--secondary-color);
    padding: 0 5px;
}

.demo-created-item .remove-btn:hover {
    color: #f44336;
}

.delegate-item {
    padding: 10px 15px;
    margin: 5px 0;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.delegate-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.delegate-item.selected {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.calendar-grid {
    display: inline-block;
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 10px 0;
    background-color: var(--white);
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: var(--primary-color);
    color: var(--accent-color);
    font-weight: bold;
    text-align: center;
    padding: 8px 0;
}

.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    padding: 8px;
    text-align: center;
    border: 1px solid var(--gray-light);
    min-width: 30px;
}

.calendar-day.empty {
    background-color: var(--gray-light);
}

/* ===== 工具类 ===== */
.text-center {
    text-align: center;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

.visible {
    display: block;
}

/* ===== 响应式设计 ===== */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
        padding: 0 15px;
    }

    header {
        padding: 1.75rem 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1.05rem;
    }

    main {
        padding: 1.75rem 1rem;
    }

    .hero-content {
        padding: 2.5rem;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .path-step {
        padding: 2rem;
    }

    .featured-card {
        padding: 2rem;
    }

    .quick-link {
        padding: 1.25rem;
    }

    .content-section {
        padding: 1.75rem;
    }

    footer {
        padding: 1.5rem 1rem;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }

    header {
        padding: 2rem 1rem;
    }

    header h1 {
        font-size: 2.25rem;
    }

    header p {
        font-size: 1.1rem;
    }

    main {
        padding: 2rem 1rem;
    }

    .hero-section {
        flex-direction: row;
        align-items: center;
    }

    .hero-content {
        flex: 1;
        text-align: left;
    }

    .hero-stats {
        justify-content: flex-start;
    }

    .hero-visual {
        flex: 1;
        justify-content: flex-end;
    }

    .path-steps {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .path-step {
        flex: 1;
        min-width: 200px;
    }

    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .links-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .content-section {
        padding: 2rem;
    }

    .tag-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .conversion-examples {
        grid-template-columns: 1fr 1fr;
    }

    .object-operations-panel {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
        padding: 0 15px;
    }

    header {
        padding: 2.5rem 1rem;
    }

    header h1 {
        font-size: 2.5rem;
    }

    main {
        padding: 2.5rem 1rem;
    }

    .hamburger {
        display: none;
    }

    .nav-menu {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 0;
    }

    .nav-menu a {
        padding: 0.8rem 0.6rem;
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hero-content {
        padding: 3rem;
    }

    .hero-content h2 {
        font-size: 2.2rem;
    }

    .path-step {
        padding: 2.5rem 1.5rem;
    }

    .featured-card {
        padding: 2.5rem;
    }

    .quick-link {
        padding: 1.5rem;
    }

    .content-section {
        padding: 2.25rem;
    }

    .links-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }

    header h1 {
        font-size: 2.8rem;
    }

    .hero-content h2 {
        font-size: 2.5rem;
    }

    .content-section {
        padding: 2.5rem;
    }

    .nav-menu a {
        padding: 0.8rem 1rem;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }

    header {
        padding: 3rem 1rem;
    }

    .hero-content {
        padding: 4rem;
    }

    .content-section {
        padding: 3rem;
    }
}

@media (max-width: 991px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--dark-color);
        flex-direction: column;
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        z-index: 99;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
        display: flex;
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-menu li {
        width: 100%;
        text-align: center;
    }

    .nav-menu a {
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .hamburger.active {
        transform: translateY(-50%) rotate(90deg);
    }

    .syntax-table {
        display: block;
        overflow-x: auto;
    }

    .tag-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .search-result-title {
        font-size: 0.9rem;
    }

    .search-result-desc {
        font-size: 0.8rem;
    }

    .demo-controls,
    .object-demo-controls,
    .list-controls {
        flex-direction: column;
    }

    .demo-button,
    .object-demo-button {
        width: 100%;
        margin-bottom: 5px;
    }

    .scope-level {
        width: 95%;
        font-size: 0.9rem;
    }

    .scope-variable {
        font-size: 0.8rem;
    }

    .demo-input-group,
    .function-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .demo-input-label,
    .function-input-label {
        min-width: auto;
        margin-bottom: 5px;
    }

    .performance-comparison {
        grid-template-columns: 1fr;
    }

    .demo-prompt {
        padding: 1.5rem;
    }

    .demo-prompt p {
        font-size: 1rem;
    }

    .prompt-hint {
        font-size: 0.85rem !important;
    }

    .list-controls input,
    .list-controls button {
        width: 100%;
        margin-bottom: 5px;
    }

    .demo-created-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .demo-created-item .remove-btn {
        align-self: flex-end;
        margin-top: 5px;
    }

    .calendar-grid {
        font-size: 12px;
    }

    .calendar-day {
        padding: 6px;
        min-width: 25px;
    }

    .object-demo-button {
        padding: 10px 20px;
        font-size: 16px;
        width: 100%;
    }

    .code-content pre {
        font-size: 11px;
        padding: 8px;
    }

    .operation-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .operation-time {
        margin-top: 5px;
    }
}

/* ===== 可访问性优化 ===== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .path-step:hover,
    .featured-card:hover,
    .quick-link:hover {
        transform: none;
    }

    .hamburger span {
        transition: none;
    }

    .error-notification {
        animation: none;
    }
}

@media (prefers-contrast: more) {
    :root {
        --primary-color: #000000;
        --secondary-color: #333333;
        --accent-color: #ffffff;
        --dark-color: #000000;
        --light-color: #ffffff;
        --gray-light: #ffffff;
    }

    .path-step,
    .featured-card,
    .quick-link {
        border: 2px solid #000;
    }
}

/* ===== 打印样式优化 ===== */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    .path-step,
    .featured-card,
    .quick-link {
        border: 1px solid #000;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }

    header,
    footer {
        background: white !important;
        color: black !important;
    }

    .hamburger,
    .nav-menu {
        display: none !important;
    }

    .code-example {
        background: white !important;
        color: black !important;
        border: 1px solid #000;
    }

    .code-content code {
        color: black !important;
    }
}

/* ===== 滚动条样式 ===== */
.object-demo-output::-webkit-scrollbar {
    width: 8px;
}

.object-demo-output::-webkit-scrollbar-track {
    background: var(--gray-light);
    border-radius: 4px;
}

.object-demo-output::-webkit-scrollbar-thumb {
    background: var(--gray-medium);
    border-radius: 4px;
}

.object-demo-output::-webkit-scrollbar-thumb:hover {
    background: var(--gray-dark);
}

/* 异步编程演示特定样式 */
.async-demo-status {
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
}

.async-demo-status.pending {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.async-demo-status.success {
    background-color: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.async-demo-status.error {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.async-operation-timeline {
    margin: 15px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    border: 1px solid #e9ecef;
}

.timeline-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    padding: 8px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.timeline-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
}

.timeline-marker.pending {
    background-color: #ffc107;
}

.timeline-marker.running {
    background-color: #17a2b8;
}

.timeline-marker.success {
    background-color: #28a745;
}

.timeline-marker.error {
    background-color: #dc3545;
}

.timeline-content {
    flex: 1;
}

.timeline-time {
    font-size: 0.8rem;
    color: #6c757d;
    margin-left: 10px;
}

.retry-counter {
    display: inline-block;
    background: #6c757d;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.8rem;
    margin-left: 8px;
}

/* ===== 模块化演示优化样式 ===== */
.dynamic-module-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

@media (min-width: 768px) {
    .dynamic-module-container {
        grid-template-columns: 1fr 1fr;
    }
}

.dynamic-module-panel {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    padding: 1rem;
    overflow: hidden;
}

.dynamic-module-panel pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.85rem;
    line-height: 1.4;
}

.dynamic-module-content {
    max-height: 400px;
    overflow-y: auto;
}

.code-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
}

.module-demo-output {
    background-color: var(--gray-light);
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    margin-top: 1rem;
    min-height: 100px;
    max-height: 500px;
    overflow-y: auto;
}

.object-demo-controls {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.object-demo-button {
    background-color: var(--primary-color);
    color: var(--accent-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    white-space: nowrap;
}

.object-demo-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.object-demo-button.secondary {
    background-color: var(--secondary-color);
}

.object-demo-button.secondary:hover {
    background-color: #a52c5a;
}

/* ===== 设计模式演示特定样式 ===== */
.pattern-demo-container {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
}

.pattern-demo-header {
    background-color: var(--primary-color);
    color: var(--accent-color);
    padding: 10px 15px;
    font-weight: bold;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pattern-demo-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.pattern-code-section {
    background-color: var(--dark-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    color: var(--light-color);
}

.pattern-code-header {
    background-color: #1a1a1a;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pattern-execution-section {
    background-color: var(--gray-light);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.pattern-output {
    background-color: var(--dark-color);
    color: var(--light-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    min-height: 100px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-top: 1rem;
}

.pattern-instance-info {
    background-color: var(--gray-light);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    margin: 0.5rem 0;
}

.pattern-instance-info .instance-id {
    font-weight: bold;
    color: var(--primary-color);
}

.pattern-instance-info .instance-method {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.pattern-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
    margin: 1rem 0;
}

.pattern-control-btn {
    background-color: var(--primary-color);
    color: var(--accent-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.pattern-control-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.pattern-control-btn.secondary {
    background-color: var(--secondary-color);
}

.pattern-control-btn.secondary:hover {
    background-color: #a52c5a;
}

.observer-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.observer-item {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.observer-item.active {
    border-left: 4px solid var(--primary-color);
}

.observer-item .observer-name {
    font-weight: bold;
}

.observer-item .observer-status {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.factory-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.factory-product-card {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    transition: var(--transition);
}

.factory-product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.factory-product-card .product-type {
    font-size: 0.8rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.factory-product-card .product-name {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.factory-product-card .product-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--dark-color);
}

.strategy-comparison {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

@media (min-width: 768px) {
    .pattern-demo-content {
        grid-template-columns: 1fr 1fr;
    }

    .strategy-comparison {
        grid-template-columns: 1fr 1fr;
    }
}

.strategy-card {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.strategy-card .strategy-name {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.strategy-card .strategy-result {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    margin: 0.5rem 0;
}

.strategy-card .strategy-savings {
    color: #4CAF50;
    font-weight: bold;
}

.pattern-demo-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-medium);
    margin-bottom: 1rem;
}

.pattern-demo-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.pattern-demo-tab.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.pattern-demo-tab-content {
    display: none;
}

.pattern-demo-tab-content.active {
    display: block;
}

/* apis.html 实践练习模块新增样式 */
.api-demo-container {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
}

.api-demo-header {
    background-color: var(--primary-color);
    color: var(--accent-color);
    padding: 10px 15px;
    font-weight: bold;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.api-demo-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-medium);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.api-demo-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    color: var(--dark-color);
    white-space: nowrap;
}

.api-demo-tab.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.api-demo-tab-content {
    display: none;
    padding: 1rem 0;
}

.api-demo-tab-content.active {
    display: block;
}

.api-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
    margin: 1rem 0;
}

.api-control-btn {
    background-color: var(--primary-color);
    color: var(--accent-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.api-control-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.api-control-btn.secondary {
    background-color: var(--secondary-color);
}

.api-control-btn.secondary:hover {
    background-color: #a52c5a;
}

.api-output {
    background-color: var(--dark-color);
    color: var(--light-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-top: 1rem;
    border-left: 4px solid var(--primary-color);
}

.canvas-container {
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
}

.canvas-controls {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
    justify-content: center;
}

.storage-item {
    background-color: var(--gray-light);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary-color);
}

.storage-item .key {
    font-weight: bold;
    color: var(--primary-color);
}

.storage-item .value {
    color: var(--dark-color);
    font-family: 'Courier New', Courier, monospace;
}

.storage-item .actions {
    display: flex;
    gap: 0.5rem;
}

.geo-status {
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin: 0.5rem 0;
    font-weight: bold;
}

.geo-status.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.geo-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.geo-status.info {
    background-color: #cce7ff;
    color: #004085;
    border-left: 4px solid #007bff;
}

.fetch-response {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    border: 1px solid var(--gray-medium);
}

.fetch-response pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
}

.api-demo-log {
    margin: 8px 0;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.4;
    border-left: 3px solid var(--primary-color);
}

.api-demo-log.success {
    border-left-color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

.api-demo-log.error {
    border-left-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

.api-demo-log.info {
    border-left-color: #17a2b8;
    background-color: rgba(23, 162, 184, 0.1);
}

/* 正则表达式演示特定样式 */
.regex-demo-section,
.validation-demo-section,
.regex-practice-section {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-medium);
    margin-bottom: 1rem;
}

.regex-test-cases {
    margin: 1rem 0;
}

.regex-test-case {
    background-color: var(--gray-light);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary-color);
}

.regex-test-case h5 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.regex-pattern {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--dark-color);
    color: var(--light-color);
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.test-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
}

.test-result {
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.test-result.passed {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.test-result.failed {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.test-input {
    font-weight: bold;
}

.test-status {
    margin-left: 0.5rem;
    font-weight: bold;
}

.test-detail {
    display: block;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    opacity: 0.8;
}

.custom-regex-tester {
    background-color: var(--gray-light);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

.regex-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-medium);
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    margin-top: 0.25rem;
}

.regex-test-result {
    background-color: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    margin-top: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.test-summary {
    line-height: 1.6;
}

.validation-feedback {
    font-size: 0.9rem;
    margin-top: 0.25rem;
    min-height: 1.2rem;
}

.validation-results {
    background-color: var(--gray-light);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

.practice-description {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--secondary-color);
}

/* 交互演示模块特定样式 */
.module-demo-log {
    padding: 8px 12px;
    margin: 5px 0;
    background: white;
    border-left: 4px solid #007bff;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.module-demo-success {
    border-left-color: #28a745;
    background: #f8fff9;
}

.module-demo-error {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.module-demo-warning {
    border-left-color: #ffc107;
    background: #fffef0;
}

.module-performance-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.performance-stat {
    text-align: center;
    padding: 15px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.performance-value {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 5px;
}

.performance-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
}

.module-dependency-graph {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    padding: 20px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.dependency-node {
    background: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    margin: 0 10px;
}

.dependency-arrow {
    color: #6c757d;
    font-weight: bold;
    margin: 0 5px;
}

.dynamic-module-content pre::-webkit-scrollbar {
    height: 8px;
}

.dynamic-module-content pre::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.dynamic-module-content pre::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.dynamic-module-content pre::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

@media (max-width: 767px) {
    .dynamic-module-container {
        grid-template-columns: 1fr;
    }

    .dynamic-module-panel {
        min-width: 0;
    }

    .object-demo-controls {
        flex-direction: column;
    }

    .object-demo-button {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 768px) {
    .api-demo-tabs {
        flex-direction: column;
    }

    .api-demo-tab {
        width: 100%;
        text-align: left;
        border-bottom: 1px solid var(--gray-medium);
        border-left: 3px solid transparent;
    }

    .api-demo-tab.active {
        border-left-color: var(--primary-color);
        border-bottom-color: var(--gray-medium);
    }

    .api-controls {
        grid-template-columns: 1fr;
    }

    .storage-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .storage-item .actions {
        align-self: flex-end;
    }

    .test-results {
        grid-template-columns: 1fr;
    }

    .regex-test-case {
        padding: 0.75rem;
    }

    .demo-controls {
        flex-direction: column;
    }

    .demo-button {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .timeline-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .timeline-time {
        margin-left: 0;
        margin-top: 5px;
    }
}

/* ===== DOM实践练习区域专用样式 ===== */
/* 基础样式 */
#demoContainer {
    border: 2px solid #82255e;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    background-color: #f9f5f8;
    min-height: 150px;
}

.demo-item {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    padding: 10px;
    margin: 8px 0;
    border-radius: 4px;
    font-weight: 500;
}

.nested {
    background-color: #fff3cd;
    border: 1px dashed #ffc107;
    padding: 12px;
    margin: 10px 0;
    border-radius: 6px;
}

.nested span {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    padding: 6px 12px;
    margin: 0 5px;
    border-radius: 3px;
    display: inline-block;
}

/* 动态创建元素的样式 */
.demo-created-item {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px;
    margin: 8px 0;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeIn 0.3s ease-in;
}

.demo-created-item .item-label {
    font-weight: bold;
    color: #155724;
}

.demo-created-item .item-timestamp {
    font-size: 0.8em;
    color: #6c757d;
}

.demo-created-item .remove-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}