/* 基于C1的样式，添加C2特有的增强 */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #1e293b;
    --light-bg: #f8fafc;
    --text-dark: #0f172a;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--light-bg);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* C2特有：版本标识 */
.version-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 1rem;
}

.tech-badge {
    display: inline-block;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem 0;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 导航栏 */
.protocol-nav {
    background: white;
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.protocol-nav .container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background: white;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 主内容区 */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.protocol-section {
    display: none;
}

.protocol-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.protocol-header {
    margin-bottom: 2rem;
}

.protocol-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.protocol-intro {
    font-size: 1.1rem;
    color: var(--text-light);
    line-height: 1.8;
}

/* 信息卡片 */
.info-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.info-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.8;
}

.info-card li:last-child {
    border-bottom: none;
}

/* 波形容器 */
.waveform-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.waveform-container h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

/* 控制面板 */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 8px;
}

.controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.controls input[type="text"] {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    width: 120px;
    font-family: 'Courier New', monospace;
}

.controls input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.controls input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* C2新增：次要按钮 */
.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-small {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-small.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 波形显示区 */
.waveform-display {
    background: #fafbfc;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    min-height: 300px;
    overflow-x: auto;
}

/* C2特有：Canvas交互层 */
.canvas-overlay-container {
    position: relative;
    margin-top: 1rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: #f0f4f8;
}

.interaction-canvas {
    width: 100%;
    height: 200px;
    border-radius: 4px;
    background: white;
    cursor: crosshair;
}

.waveform-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
    white-space: nowrap;
}

.waveform-tooltip.show {
    opacity: 1;
}

.wave-description {
    margin-top: 1rem;
    padding: 1rem;
    background: #eff6ff;
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* C2新增：JSON编辑器 */
.json-editor-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.json-editor-container h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.editor-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.json-editor {
    width: 100%;
    padding: 1rem;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.9rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: #f8f9fa;
    resize: vertical;
    line-height: 1.5;
}

.json-editor:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

/* 时序步骤 */
.timing-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step {
    display: flex;
    gap: 1rem;
    align-items: start;
}

.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1.2rem;
}

.step-content {
    flex: 1;
    padding-top: 0.5rem;
}

.step-content strong {
    color: var(--primary-color);
}

/* C2新增：技术对比网格 */
.tech-comparison {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #bae6fd;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.feature strong {
    display: block;
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.feature p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* 页脚 */
footer {
    background: var(--dark-bg);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* WaveDrom SVG 样式覆盖 */
svg.WaveDrom {
    width: 100% !important;
    height: auto !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .version-badge {
        display: block;
        margin-left: 0;
        margin-top: 0.5rem;
        width: fit-content;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls label {
        flex-direction: column;
        align-items: start;
    }
    
    .controls input[type="text"] {
        width: 100%;
    }
    
    .waveform-display {
        overflow-x: scroll;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
    }
    
    .editor-controls {
        flex-direction: column;
    }
    
    .btn-small {
        width: 100%;
    }
}
