/* Simulation42 — preview step layout */

.sim-preview-page {
    margin-bottom: 48px;
}

.sim-preview-page__header {
    margin-bottom: 24px;
}

.sim-preview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 32px;
    align-items: start;
}

.sim-preview-panel,
.sim-config-panel {
    min-width: 0;
}

/* Preview canvas */
.sim-preview-panel {
    position: sticky;
    top: 24px;
}

.sim-canvas {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 20px 20px;
    background: #fff;
    border: 1px solid #ddd;
    text-align: center;
}

.sim-canvas__stage {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    overflow: hidden;
}

.sim-konva {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    overflow: hidden;
}

.sim-konva .konvajs-content {
    margin: 0 auto !important;
}

.sim-konva.is-configured {
    max-width: min(100%, 320px);
}

.sim-canvas__stage:has(.sim-konva.is-configured) {
    max-width: 320px;
}

.sim-canvas.is-zoomed .sim-canvas__stage:has(.sim-konva.is-configured),
.sim-canvas.is-zoomed .sim-konva.is-configured {
    max-width: min(460px, 92vw);
}

.sim-canvas__status {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #666;
    max-width: 320px;
}

.sim-canvas__status.is-ready {
    color: #2e7d32;
    font-weight: 600;
}

.sim-canvas__hint {
    margin: 0 0 12px;
    font-size: 12px;
    color: #888;
    line-height: 1.5;
}

.sim-canvas__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.sim-canvas.is-zoomed {
    position: fixed;
    inset: 0;
    z-index: 1000;
    max-width: none;
    background: rgba(255, 255, 255, 0.96);
    justify-content: center;
}

.sim-canvas.is-zoomed .sim-canvas__stage,
.sim-canvas.is-zoomed .sim-konva {
    max-width: min(420px, 86vw);
}

/* Config panel */
.sim-config-panel {
    background: #fff;
    border: 1px solid #ddd;
    padding: 24px;
}

.sim-config-section {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.sim-config-section:last-child {
    margin-bottom: 0;
}

.sim-config-section--checkout {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.sim-config-section__title {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

/* Fabric part rows */
.sim-part-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.sim-part-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sim-part-row--omakase {
    background: #fafafa;
}

.sim-part-row__omakase {
    font-size: 0.875rem;
    white-space: nowrap;
}

.sim-part-row__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sim-part-thumb {
    width: 52px;
    height: 52px;
    object-fit: cover;
    background: #eee;
    border: 1px solid #ddd;
    display: block;
    flex-shrink: 0;
}

.sim-muted {
    color: #666;
    font-size: 13px;
}

.sim-btn {
    display: inline-block;
    padding: 10px 16px;
    border: 1px solid #333;
    background: #333;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.sim-btn--ghost {
    background: #fff;
    color: #333;
}

.sim-btn--ghost:hover {
    background: #f5f5f5;
}

/* Upload */
.sim-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    padding: 16px;
    border: 1px dashed #ccc;
    background: #fafafa;
    cursor: pointer;
    color: #666;
    font-size: 14px;
}

.sim-upload input {
    display: none;
}

.sim-upload:hover {
    border-color: #999;
    background: #f5f5f5;
}

/* Options */
.sim-options label,
#sim-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
}

.sim-options label span,
#sim-options label span {
    flex: 1;
}

/* Quantity */
.sim-qty,
.ec-numberInput {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ccc;
    background: #fff;
}

.sim-qty button,
.ec-numberInput button {
    width: 40px;
    height: 40px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.sim-qty button:hover,
.ec-numberInput button:hover {
    background: #eee;
}

.sim-qty span,
.ec-numberInput #sim-qty {
    display: inline-block;
    min-width: 44px;
    padding: 0 10px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Estimate */
.sim-estimate {
    display: block;
    width: 100%;
}

.sim-estimate__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px dotted #ddd;
    font-size: 14px;
    line-height: 1.5;
}

.sim-estimate__row:last-child {
    border-bottom: none;
}

.sim-estimate__row--total {
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid #ccc;
    font-weight: 700;
    font-size: 16px;
}

.sim-estimate__label {
    color: #333;
}

.sim-estimate__value {
    flex-shrink: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Checkout */
.sim-price-block {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.sim-price-block__label {
    font-size: 15px;
    font-weight: 600;
}

.sim-price-block__value {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    color: #333;
}

.sim-price-block__value small {
    font-size: 13px;
    font-weight: 400;
    color: #666;
}

.sim-btn--cart {
    width: 100%;
    margin: 0;
}

.sim-btn--cart:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.sim-back-link {
    margin: 20px 0 0;
    font-size: 13px;
}

.sim-back-link a {
    color: #337ab7;
}

/* Fabric modal */
.sim-fabric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    max-height: 360px;
    overflow-y: auto;
    margin: 16px 0;
}

.sim-fabric-item {
    border: 2px solid transparent;
    padding: 4px;
    cursor: pointer;
    background: none;
    text-align: center;
}

.sim-fabric-item.is-selected {
    border-color: #5CB1B1;
}

.sim-fabric-item img,
.sim-fabric-item__ph {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.sim-fabric-item__name {
    font-size: 12px;
    margin-top: 4px;
}

#sim-series-filters button {
    margin: 0 4px 8px 0;
}

#sim-series-filters button.is-active {
    font-weight: bold;
    text-decoration: underline;
}

.sim-cart-meta {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* Shopping cart — simulation-aligned product details */
.simulation42-cart_page .ec-cartRow__summary .ec-cartRow__name a {
    font-size: 15px;
    font-weight: 700;
}

.sim-cart-detail {
    margin-top: 12px;
    padding: 12px 14px;
    background: #fafafa;
    border: 1px solid #eee;
    font-size: 13px;
    line-height: 1.6;
    font-weight: normal;
}

.sim-cart-detail__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
}

.sim-cart-detail__row + .sim-cart-detail__row {
    border-top: 1px dotted #ddd;
    margin-top: 4px;
    padding-top: 8px;
}

.sim-cart-detail__label {
    flex-shrink: 0;
    min-width: 6em;
    color: #666;
}

.sim-cart-detail__value {
    flex: 1;
    text-align: right;
    color: #333;
}

.sim-cart-detail--stack {
    margin: 6px 0 0;
    padding: 0;
    background: none;
    border: none;
    font-size: 13px;
    line-height: 1.7;
    color: #333;
    font-weight: normal;
}

.sim-cart-detail--stack .sim-cart-detail__line {
    display: block;
    text-align: left;
}

.sim-cart-option-lines {
    margin-top: 0;
    font-size: 13px;
    line-height: 1.7;
    font-weight: normal;
    color: #333;
}

.sim-cart-option-lines br:first-of-type {
    display: none;
}

.ec-imageGrid__content .sim-order-price,
.ec-historyRole__detail .ec-historyRole__detailPrice.sim-order-price {
    margin-top: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #525263;
    line-height: 1.5;
}

.ec-imageGrid__content .sim-order-price__sub,
.sim-order-price__sub {
    margin-left: 10px;
    font-weight: 700;
    color: #525263;
}

.simulation42-cart_page .ec-cartRole__totalAmount {
    font-size: 24px;
    font-weight: 700;
}

.simulation42-cart_page .ec-cartRole__actions .ec-blockBtn--action {
    width: 100%;
    max-width: 320px;
    margin-left: auto;
}

.simulation42-cart_page .ec-cartRole__actions .ec-blockBtn--cancel {
    width: 100%;
    max-width: 320px;
    margin-left: auto;
}

.simulation42-cart_page .ec-cartRow__img .js-sim-cart-preview,
.simulation42-cart_page .ec-cartRow__name .js-sim-cart-preview,
.ec-imageGrid__img .js-sim-cart-preview,
.ec-imageGrid__content .js-sim-cart-preview {
    display: inline-block;
    cursor: pointer;
}

.simulation42-cart_page .ec-cartRow__img img.sim-cart-preview {
    height: 100px;
    width: auto;
    object-fit: contain;
    background: #fafafa;
    border: 1px solid #eee;
}

.ec-imageGrid__img img.sim-cart-preview {
    height: 100px;
    width: auto;
    object-fit: contain;
    background: #fafafa;
    border: 1px solid #eee;
}

.sim-cart-zoom-modal .image .kakejiku {
    width: auto;
    height: auto;
    max-width: none;
    object-fit: contain;
}

.sim-size-price {
    margin-left: 8px;
    color: #666;
}

/* Simulation group design mode */
.simulation42-mode-notice {
    margin: 12px 0 0;
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

.simulation42-mode-notice--section {
    margin-top: 8px;
}

.simulation42-mode-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 6px;
    border-radius: 3px;
    background: #e8f4fd;
    color: #1565c0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.simulation42-mode-badge--inline {
    display: inline-block;
    margin: 4px 0 8px;
}

.simulation42-group-design-shelf {
    margin-top: 16px;
}

/* Size selection step */
.sim-size-page {
    margin-bottom: 48px;
}

.sim-size-page__header {
    margin-bottom: 24px;
}

.sim-size-page__lead {
    margin: 8px 0 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.sim-help {
    margin: 0 0 14px;
    color: #666;
    font-size: 13px;
    line-height: 1.6;
}

.sim-empty {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.sim-size-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.sim-config-section--dim {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 2px;
    padding: 20px;
    margin: 0;
}

.sim-choice-list {
    display: grid;
    gap: 10px;
}

.sim-choice-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sim-choice-card:hover {
    border-color: #bbb;
}

.sim-choice-card:has(input:checked) {
    border-color: #5CB1B1;
    box-shadow: inset 0 0 0 1px #5CB1B1;
}

.sim-choice-card input {
    flex-shrink: 0;
    margin: 0;
}

.sim-choice-card__label {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    line-height: 1.4;
}

.sim-choice-card__price {
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    font-variant-numeric: tabular-nums;
}

.sim-dim-form {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
}

.sim-dim-form__field {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    gap: 10px;
}

.sim-dim-form__field label {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.sim-dim-form__field input {
    width: 100%;
    max-width: 140px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    font-size: 15px;
    line-height: 1.2;
}

.sim-dim-form__unit {
    font-size: 14px;
    color: #666;
}

.sim-btn--full {
    width: 100%;
    text-align: center;
}

.sim-footer-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #ddd;
}

.sim-footer-actions .ec-blockBtn--cancel,
.sim-footer-actions .ec-blockBtn--action {
    width: 100%;
    margin: 0;
    text-align: center;
    box-sizing: border-box;
}

@media (max-width: 991px) {
    .sim-preview-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .sim-preview-panel {
        position: static;
    }

    .sim-config-panel {
        padding: 20px 16px;
    }

    .sim-size-split {
        grid-template-columns: 1fr;
    }

    .sim-config-section--dim {
        padding: 16px;
    }

    .sim-footer-actions {
        grid-template-columns: 1fr;
    }
}
