* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

#app {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calculator {
    max-width: 600px;
    margin: 0 auto;
}

.input-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

select, input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

button {
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    margin-bottom: 20px;
}

button:hover {
    background-color: #2980b9;
}

#result {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

#result h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

#result ul {
    list-style-type: none;
}

#result li {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

#result li:last-child {
    border-bottom: none;
}

/* select2のスタイル調整 */
.select2-container--bootstrap-5 .select2-selection {
    border-color: #ced4da;
}

.select2-container--bootstrap-5 .select2-selection--single {
    height: 38px;
    padding: 0.375rem 0.75rem;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 1.5;
    padding-left: 0;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
    background-color: #0d6efd;
}

/* 材料リストのスタイル */
.list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.25rem;
    background-color: #fff;
}

.list-group-item .item-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.list-group-item .item-name {
    font-weight: 500;
    margin: 0;
}

.list-group-item .item-quantity {
    font-size: 1.1em;
    font-weight: 500;
    color: #0d6efd;
}

.badge {
    font-size: 0.875rem;
    padding: 0.5em 0.75em;
}

/* ラジオボタンのスタイル */
.form-check-input {
    margin-top: 0.3em;
}

/* 入力フィールドのスタイル */
.form-control {
    border-color: #ced4da;
}

.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* 単位選択のスタイル */
.unit-select {
    min-width: 60px;
    max-width: 60px;
    width: auto !important;
    padding: 0.375rem 0.5rem;
    border-left: none;
}

/* 変換表のスタイル */
.table {
    margin-bottom: 0;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.table td {
    vertical-align: middle;
}

.card {
    border: 1px solid rgba(0, 0, 0, 0.125);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card-body {
    padding: 1.5rem;
}

.table-responsive {
    margin-bottom: 1rem;
}

.table-responsive:last-child {
    margin-bottom: 0;
}

/* 材料ツリー・合計素材ボックス用 */
.materials-tree-box {
    margin-bottom: 24px;
    overflow-x: auto;
}

.material-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 1.05em;
    transition: background 0.2s;
    min-width: 0;
    flex-wrap: wrap;
    position: relative;
}

.material-box .item-name {
    font-weight: 600;
    color: #2c3e50;
    min-width: 12em;
    flex-basis: 12em;
    flex-shrink: 0;
    display: inline-block;
    word-break: break-word;
    margin-right: 0.5em;
}

.material-box .item-quantity {
    color: #0d6efd;
    font-weight: 500;
    min-width: 3em;
    display: inline-block;
    flex-shrink: 0;
    margin-right: 1em;
    text-align: right;
}

.material-box .craft-count {
    color: #888;
    font-size: 0.95em;
    margin-left: 0.7em;
}

.sum-materials-box {
    background: #f4f8fb;
    border: 1.5px solid #b6d4fe;
    border-radius: 8px;
    padding: 12px 18px 8px 18px;
    margin-top: 18px;
}

.sum-title {
    font-weight: bold;
    color: #1761a0;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.material-box.nested {
    padding: 5px 10px;
    margin-bottom: 5px;
    border-width: 1px;
    background: #f7fafc;
    margin-left: 20px;
    width: auto;
    display: inline-flex;
    align-items: center;
}

.material-box.nested .item-name {
    min-width: auto;
    flex-basis: auto;
    font-size: 0.95em;
    margin-right: 0.5em;
    white-space: nowrap;
}

.material-box.nested .item-quantity {
    position: static;
    transform: none;
    min-width: auto;
    margin-left: 0;
    font-size: 0.9em;
    text-align: right;
    color: #0d6efd;
    font-weight: 500;
    margin-right: 1em;
}

/* details要素のスタイル調整 */
details {
    margin-left: 0;
    margin-top: 0;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

details summary {
    cursor: pointer;
    padding: 0.25em 0;
    color: #0d6efd;
    font-weight: 500;
    font-size: 0.9em;
    display: inline-block;
    white-space: nowrap;
}

details summary:hover {
    color: #0056b3;
}

details > div {
    margin-left: 1em;
    margin-top: 0.5em;
    width: auto;
}

/* 材料ツリーの横スクロール対応 */
.materials-tree-box {
    overflow-x: auto;
    white-space: nowrap;
    min-width: 100%;
}

.materials-tree-box > div {
    white-space: normal;
    min-width: 100%;
} 