/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    background-color: #1a73e8;
    color: white;
    border-radius: 8px;
}

header h1 {
    margin-bottom: 10px;
}

section {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h2 {
    color: #1a73e8;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eaeaea;
}

/* IPv6报头结构图样式 */
.header-visual {
    width: 100%;
    border: 2px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 20px;
}

.header-row {
    display: flex;
    border-bottom: 1px solid #ddd;
}

.header-row:last-child {
    border-bottom: none;
}

.header-cell {
    padding: 15px;
    text-align: center;
    border-right: 1px solid #ddd;
    background-color: #f0f8ff;
    transition: background-color 0.3s;
    position: relative;
}

.header-cell:last-child {
    border-right: none;
}

.header-cell span {
    display: block;
    font-size: 0.8em;
    color: #666;
    margin-top: 5px;
}

/* 不同位宽的单元格样式 */
.bits-0-3 {
    flex: 1;
}

.bits-4-11 {
    flex: 2;
}

.bits-12-31 {
    flex: 5;
}

.bits-0-15, .bits-16-23, .bits-24-31 {
    flex: 1;
}

.source-address, .destination-address {
    flex: 1;
}

/* 拖放目标样式 */
.header-cell.drag-over {
    background-color: #e3f2fd;
    border: 2px dashed #1a73e8;
}

.header-cell.correct-match {
    background-color: #e8f5e9;
    border: 2px solid #4caf50;
}

/* 组件样式 */
.components-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.component {
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 5px;
    padding: 15px;
    cursor: grab;
    transition: all 0.3s;
    flex: 1 0 calc(25% - 15px);
    min-width: 200px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.component:hover {
    background-color: #bbdefb;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.component.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

/* 信息部分样式 */
.info-content {
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.info-content h3 {
    color: #1a73e8;
    margin: 15px 0 10px;
}

.info-content ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.info-content li {
    margin-bottom: 8px;
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 20px 0;
    color: #666;
    font-size: 0.9em;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .components-container {
        flex-direction: column;
    }
    
    .component {
        flex: 1 0 100%;
    }
    
    .header-row {
        flex-direction: column;
    }
    
    .header-cell {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .header-cell:last-child {
        border-bottom: none;
    }
}