/* Structure Code Collapsible Plugin Styles */

/* 代码块容器 */
.scc-code-wrapper {
    margin: 20px 0;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    background: #1e1e1e;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 代码预览区域（显示前几行） */
.scc-code-preview {
    padding: 16px;
    background: #1e1e1e;
    max-height: 150px;
    overflow: hidden;
    position: relative;
    border-top: 1px solid #3a3a3a;
}

.scc-code-preview pre {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

.scc-code-preview code {
    background: transparent !important;
    padding: 0 !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #d4d4d4;
    white-space: pre;
}

/* 预览渐变遮罩（底部淡出效果） */
.scc-code-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom, rgba(30,30,30,0), rgba(30,30,30,1));
    pointer-events: none;
}

/* 展开时隐藏预览 */
.scc-code-wrapper[aria-expanded="true"] .scc-code-preview {
    display: none;
}

/* 代码块头部 */
.scc-code-header {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
    padding: 12px 16px;
    border-bottom: 1px solid #d1d5da;
}

/* 折叠按钮 */
.scc-toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    transition: all 0.3s ease;
    flex: 1;
    text-align: left;
}

.scc-toggle-btn:hover {
    opacity: 0.9;
}

.scc-toggle-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* 切换图标 */
.scc-toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 12px;
}

.scc-code-wrapper[aria-expanded="true"] .scc-toggle-icon,
.scc-toggle-btn[aria-expanded="true"] .scc-toggle-icon {
    transform: rotate(90deg);
}

/* 语言标识 */
.scc-language-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
}

/* 代码内容区域 */
.scc-code-content {
    padding: 0;
    background: #1e1e1e;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    border-top: 1px solid #3a3a3a;
}

/* 展开状态 */
.scc-code-wrapper[aria-expanded="true"] .scc-code-content,
.scc-toggle-btn[aria-expanded="true"] ~ .scc-code-content {
    max-height: 2000px;
}

.scc-code-content pre {
    margin: 0 !important;
    padding: 16px !important;
    background: #1e1e1e !important;
    border: none !important;
    border-radius: 0 !important;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
}

.scc-code-content code {
    background: transparent !important;
    padding: 0 !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.scc-code-content pre code {
    color: #d4d4d4;
    white-space: pre;
}

/* 滚动条样式（Webkit 浏览器）*/
.scc-code-content pre::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.scc-code-content pre::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 5px;
}

.scc-code-content pre::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 5px;
}

.scc-code-content pre::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Firefox 滚动条样式 */
.scc-code-content pre {
    scrollbar-width: thin;
    scrollbar-color: #555 #2d2d2d;
}


/* 响应式设计 */
@media (max-width: 768px) {
    .scc-code-wrapper {
        margin: 15px -15px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .scc-code-header {
        padding: 10px 12px;
    }
    
    .scc-toggle-btn {
        font-size: 13px;
    }
    
    .scc-code-content pre {
        padding: 12px !important;
    }
    
    .scc-code-content code {
        font-size: 12px;
    }
}

/* 暗色主题已默认启用，无需媒体查询 */

/* 平滑展开动画 */
.scc-code-content {
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.scc-code-content pre {
    transition: opacity 0.3s ease;
}

/* 复制按钮 */
.scc-copy-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 4px;
    margin-left: auto;
    transition: all 0.2s ease;
}

.scc-copy-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.scc-copy-btn.scc-copied {
    background: rgba(46, 213, 115, 0.9);
    border-color: rgba(46, 213, 115, 1);
}

.scc-copy-icon {
    font-size: 14px;
}

.scc-copy-text {
    font-size: 12px;
}

/* 无障碍支持 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

