@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

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

body {
    font-family: 'Roboto', sans-serif;
    color: #333;
    background-color: #f5f5f7;
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 页眉样式 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
}

header h1 {
    font-size: 28px;
    font-weight: 500;
    color: #1a1a1a;
}

.header-icons {
    display: flex;
    gap: 15px;
}

.header-icons span {
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.header-icons span:hover {
    color: #000;
}

/* 主内容区域 */
main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

/* 标签栏样式 */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.tab {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.tab:not(:last-child) {
    border-right: 1px solid #f0f0f0;
}

.tab span:first-child {
    font-size: 24px;
}

.tab.active {
    background-color: #4285F4;
    color: white;
}

.tab:not(.active):hover {
    background-color: #f9f9f9;
}

/* 可视化区域 */
.visualization-section {
    background-color: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    margin-bottom: 2rem;
}

.visualization-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.visualization-header h2 {
    font-size: 22px;
    font-weight: 500;
}

.counter {
    padding: 5px 10px;
    background: #f0f0f0;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
}

.operation {
    flex-basis: 100%;
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 5px;
    font-size: 14px;
    color: #666;
}

.visualization-container {
    height: 300px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 2px;
    border: 1px solid #eaeaea;
    border-radius: 5px;
    padding: 10px;
    background-color: #fcfcfc;
}

.bar {
    background-color: #4285F4;
    position: relative;
    transition: height 0.3s, background-color 0.3s;
    border-radius: 3px 3px 0 0;
}

.bar.comparing {
    background-color: #EA4335;
}

.bar.swapping {
    background-color: #FBBC05;
}

.bar.sorted {
    background-color: #34A853;
}

.bar-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px;
    border: 1px solid #eaeaea;
}

/* 控制面板 */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
}

.dataset-selector label {
    margin-right: 10px;
    font-size: 14px;
    color: #666;
}

.dataset-selector select {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ddd;
    background-color: #fff;
    font-family: 'Roboto', sans-serif;
}

.playback-controls {
    display: flex;
    gap: 10px;
}

.playback-controls button {
    width: 40px;
    height: 40px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}

.playback-controls button:hover {
    background-color: #e0e0e0;
}

.playback-controls .material-icons-outlined {
    font-size: 20px;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.speed-control label {
    font-size: 14px;
    color: #666;
}

.speed-control input[type="range"] {
    width: 100px;
    appearance: none;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 15px;
    height: 15px;
    background: #4285F4;
    border-radius: 50%;
    cursor: pointer;
}

/* 性能对比区域 */
.performance-section {
    background-color: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    margin-bottom: 2rem;
}

.performance-section h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 20px;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.insertion-color {
    background-color: rgba(66, 133, 244, 0.7);
}

.quick-color {
    background-color: rgba(52, 199, 89, 0.7);
}

.merge-color {
    background-color: rgba(175, 82, 222, 0.7);
}

.performance-table-container {
    margin: 20px 0;
    overflow-x: auto;
}

.performance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.performance-table th,
.performance-table td {
    padding: 12px 15px;
    text-align: center;
    border: 1px solid #eaeaea;
}

.performance-table th {
    background-color: #f9f9f9;
    font-weight: 500;
    color: #333;
}

.performance-table td {
    color: #666;
}

.performance-table tr:nth-child(even) {
    background-color: #fcfcfc;
}

.performance-table td:nth-child(2) { color: #4285F4; }
.performance-table td:nth-child(3) { color: #34C759; }
.performance-table td:nth-child(4) { color: #AF52DE; }

/* 添加表格标题样式 */
.table-caption {
    font-size: 16px;
    color: #666;
    text-align: center;
    margin-bottom: 15px;
    font-weight: 500;
}

/* 算法详情区域 */
.algorithm-details-section {
    background-color: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    margin-bottom: 2rem;
}

.algorithm-details-section h2 {
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 500;
}

.algorithm-description h3 {
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 500;
    color: #4285F4;
}

.algorithm-description p {
    margin-bottom: 20px;
    font-size: 15px;
    color: #555;
    line-height: 1.6;
}

.complexity-cards {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.complexity-card {
    flex: 1;
    min-width: 200px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #4285F4;
}

.complexity-card h4 {
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.complexity-card p {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
}

.highlight {
    background: #e6f0ff;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-weight: 500;
}

.code-block {
    margin-bottom: 30px;
    background: #f5f7fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eaeaea;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
}

.code-block code {
    font-family: 'Consolas', monospace;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

.application-scenarios h3 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 500;
}

.scenario-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.scenario-card {
    flex: 1;
    min-width: 250px;
    padding: 15px;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.scenario-card h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.scenario-card p {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.good {
    color: #34A853;
}

.bad {
    color: #EA4335;
}

/* 页脚样式 */
footer {
    margin: 50px 0 30px;
    text-align: center;
    font-size: 14px;
    color: #999;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
    }
    
    .tab:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .visualization-container {
        height: 250px;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .complexity-cards {
        flex-direction: column;
    }
}

/* 图表洞察和注释 */
.chart-insights {
    margin-bottom: 20px;
}

.insight-text {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.chart-footer {
    margin-top: 15px;
    font-size: 12px;
    color: #999;
    text-align: right;
}

.chart-note {
    font-size: 13px;
    color: #777;
}

/* 表格改进 */
.performance-table td {
    transition: background-color 0.2s ease;
}

.performance-table tr:hover td {
    background-color: #f0f7ff;
}

.performance-table td:not(:first-child) {
    position: relative;
}

.performance-table td:not(:first-child)::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    transition: width 0.3s ease;
}

.performance-table td:nth-child(2)::before {
    background-color: #4285F4;
}

.performance-table td:nth-child(3)::before {
    background-color: #34C759;
}

.performance-table td:nth-child(4)::before {
    background-color: #AF52DE;
}

.performance-table tr:hover td:not(:first-child)::before {
    width: 100%;
} 