/* ==================================================
   1. Machine Detail Header
================================================== */

.machine-detail {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.machine-detail-header {
    margin: 0;
    padding: 0 0 14px;
    border-bottom: 1px solid #e5e5e5;
}

.machine-detail-header .page-title {
    margin: 0;
    font-size: clamp(
        24px,
        3vw,
        34px
    );
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.machine-detail-header .page-description {
    margin: 7px 0 0;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

.updated-at {
    margin: 5px 0 0;
    color: #777;
    font-size: 12px;
    line-height: 1.5;
}


/* ==================================================
   2. Common Section Heading
================================================== */

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.section-title {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.section-heading .section-title {
    margin-bottom: 0;
}

.section-count {
    flex-shrink: 0;
    margin: 0;
    color: #666;
    font-size: 13px;
}


/* ==================================================
   3. Machine Overview Card
================================================== */

.machine-overview {
    padding: 16px;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.04);
}

.machine-overview-grid {
    display: grid;
    grid-template-columns:
        150px
        minmax(0, 1fr);
    gap: 20px;
    align-items: center;
}

.machine-image-area {
    display: flex;
    min-height: 190px;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 8px;
    background: #fafafa;
}

.machine-main-image {
    display: block;
    width: 125px;
    max-width: 100%;
    height: 180px;
    object-fit: contain;
}

.machine-image-placeholder {
    display: flex;
    width: 100%;
    min-height: 170px;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 13px;
}

.machine-information {
    min-width: 0;
}

.machine-information-list {
    margin: 0;
    border-top: 1px solid #e5e5e5;
}

.machine-information-row {
    display: grid;
    grid-template-columns:
        90px
        minmax(0, 1fr);
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid #e5e5e5;
}

.machine-information-row dt {
    color: #666;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.6;
}

.machine-information-row dd {
    min-width: 0;
    margin: 0;
    color: #222;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.machine-reference-link {
    margin: 14px 0 0;
}

.machine-reference-link .button {
    display: inline-flex;
    min-width: 190px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
}


/* ==================================================
   4. Price Summary Cards
================================================== */

.price-summary-section {
    margin-top: 0;
}

.summary {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(135px, 1fr)
        );
    gap: 10px;
}

.summary-item {
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.03);
}

.summary-label {
    display: block;
    color: #666;
    font-size: 12px;
    line-height: 1.4;
}

.summary-value {
    display: block;
    margin-top: 5px;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.summary-item:first-child .summary-value {
    color: #d13b2f;
}


/* ==================================================
   5. Price History
================================================== */

.price-history-section {
    margin-top: 0;
}

.price-history-chart-container {
    position: relative;
    width: 100%;
    height: 330px;
    padding: 12px;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    background: #fff;
}

.price-history-chart {
    width: 100%;
    height: 100%;
}

.price-history-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 10px;
}

.price-history-legend-item {
    color: #555;
    font-size: 12px;
}

.price-history-note {
    margin: 8px 0 0;
    color: #777;
    font-size: 12px;
    line-height: 1.7;
}


/* ==================================================
   6. Lowest Product Card
================================================== */

.lowest-product-section {
    margin-top: 0;
}

.lowest-product {
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

.lowest-product-image-area {
    display: flex;
    width: 170px;
    height: 170px;
    flex: 0 0 170px;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #eee;
    background: #fafafa;
}

.lowest-product-image {
    display: block;
    width: 130px;
    height: 130px;
    object-fit: contain;
}

.lowest-product-content {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    padding: 18px 22px;
}

.lowest-product-shop {
    margin: 0 0 5px;
    color: #555;
    font-size: 13px;
    font-weight: 700;
}

.lowest-product-name {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.lowest-product-price {
    margin: 0;
    color: #d13b2f;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.3;
}

.lowest-product-date {
    margin: 7px 0 0;
    color: #777;
    font-size: 12px;
}

.lowest-product-link {
    margin: 13px 0 0;
}

.lowest-product-link .button {
    display: inline-flex;
    min-width: 180px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
}


/* ==================================================
   7. Product List
================================================== */

.product-list-section {
    margin-top: 0;
}

.product-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}


/* ==================================================
   8. Product Card
================================================== */

.product-card {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.product-card:hover {
    transform: translateY(-1px);
    border-color: #ccc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.product-card-image-area {
    display: flex;
    width: 160px;
    min-height: 160px;
    flex: 0 0 160px;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #eee;
    background: #fafafa;
}

.product-card-image {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.product-image-placeholder {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 145px;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 13px;
}

.product-card-body {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    padding: 15px 18px;
}

.product-shop-name {
    margin: 0 0 5px;
    color: #555;
    font-size: 13px;
    font-weight: 700;
}

.product-name {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.product-price {
    margin: 0 0 10px;
    color: #d32f2f;
    font-size: 25px;
    font-weight: 700;
    line-height: 1.3;
}

.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0;
}

.product-meta-row {
    display: flex;
    gap: 5px;
    color: #555;
    font-size: 12px;
}

.product-meta-row dt {
    color: #777;
}

.product-meta-row dd {
    margin: 0;
}

.product-card-link {
    margin: auto 0 0;
    padding-top: 12px;
}

.product-card-link .button {
    display: inline-flex;
    width: 170px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
}

.product-url-missing {
    margin: auto 0 0;
    padding-top: 12px;
    color: #999;
    font-size: 12px;
}


/* ==================================================
   9. Related Machines
================================================== */

.related-machines-section {
    min-width: 0;
    margin-top: 0;
}

.related-machine-grid {
    display: flex;
    gap: 12px;

    width: 100%;
    padding: 2px 2px 14px;

    overflow-x: auto;
    overflow-y: hidden;

    scroll-snap-type: x proximity;
    scroll-padding-left: 2px;

    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;

    scrollbar-width: thin;
    scrollbar-color: #bbb #f1f1f1;
}

.related-machine-grid::-webkit-scrollbar {
    height: 8px;
}

.related-machine-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 999px;
}

.related-machine-grid::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 999px;
}

.related-machine-grid::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.related-machine-card {
    width: 220px;
    min-width: 220px;
    flex: 0 0 220px;

    overflow: hidden;

    border: 1px solid #ddd;
    border-radius: 9px;

    background: #fff;

    scroll-snap-align: start;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.related-machine-card:hover {
    transform: translateY(-1px);
    border-color: #ccc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.related-machine-link {
    display: flex;
    height: 100%;
    flex-direction: column;

    color: inherit;
    text-decoration: none;
}

.related-machine-image-area {
    display: flex;
    height: 150px;
    align-items: center;
    justify-content: center;

    padding: 10px;

    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.related-machine-image {
    display: block;

    width: 105px;
    max-width: 100%;
    height: 130px;

    object-fit: contain;
}

.related-machine-body {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;

    padding: 11px 12px;
}

.related-machine-name {
    margin: 0;

    font-size: 14px;
    line-height: 1.5;

    overflow-wrap: anywhere;
}

.related-machine-price {
    margin: 8px 0 0;

    color: #666;
    font-size: 12px;
    line-height: 1.5;
}

.related-machine-price strong {
    display: block;

    margin-top: 2px;

    color: #d13b2f;
    font-size: 17px;
}

.related-machine-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 10px;

    margin-top: auto;
    padding-top: 8px;

    color: #777;
    font-size: 11px;
}


/* ==================================================
   10. Machine Note
================================================== */

.machine-note-section {
    margin-top: 0;
}

.machine-note {
    padding: 16px;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    background: #fff;
    color: #444;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}


/* ==================================================
   11. Share Section
================================================== */

.share-section {
    margin-top: 0;
    padding-top: 18px;
    border-top: 1px solid #e5e5e5;
}

.share-section .section-title {
    margin-bottom: 10px;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.share-button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 7px;
    background: #fff;
    color: #333;
    font: inherit;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.share-button:hover {
    border-color: #bbb;
    background: #f7f7f7;
}

.share-icon {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    fill: currentColor;
}

.share-copy-message {
    margin: 8px 0 0;
    color: #555;
    font-size: 12px;
}

.share-copy-message.is-error {
    color: #c62828;
}

.share-button-copy:disabled {
    cursor: default;
    opacity: 0.65;
}


/* ==================================================
   12. Empty State
================================================== */

.empty-state {
    padding: 26px 18px;
    border: 1px solid #ddd;
    border-radius: 9px;
    background: #fff;
    text-align: center;
}

.empty-state-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.empty-state-description {
    margin: 7px 0 0;
    color: #666;
    font-size: 13px;
    line-height: 1.7;
}


/* ==================================================
   13. Tablet Responsive
================================================== */

@media (max-width: 900px) {
    .machine-overview-grid {
        grid-template-columns:
            140px
            minmax(0, 1fr);
        gap: 16px;
    }

    .machine-image-area {
        min-height: 175px;
    }

    .machine-main-image {
        width: 115px;
        height: 165px;
    }

    .machine-information-row {
        grid-template-columns:
            85px
            minmax(0, 1fr);
        gap: 12px;
    }

    .related-machine-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }
}


/* ==================================================
   14. Mobile Responsive
================================================== */

@media (max-width: 700px) {
    .machine-detail {
        gap: 20px;
    }

    .machine-detail-header {
        padding-bottom: 12px;
    }

    .machine-detail-header .page-title {
        font-size: 24px;
    }

    .section-title {
        margin-bottom: 10px;
        font-size: 18px;
    }

    .section-heading {
        margin-bottom: 10px;
    }

    .machine-overview {
        padding: 14px;
    }

    .machine-overview-grid {
        grid-template-columns:
            110px
            minmax(0, 1fr);
        gap: 14px;
        align-items: start;
    }

    .machine-image-area {
        min-height: 150px;
        padding: 8px;
    }

    .machine-main-image {
        width: 95px;
        height: 140px;
    }

    .machine-image-placeholder {
        min-height: 135px;
    }

    .machine-information-row {
        grid-template-columns: 75px minmax(0, 1fr);
        gap: 8px;
        padding: 8px 0;
    }

    .machine-information-row dt {
        font-size: 12px;
    }

    .machine-information-row dd {
        font-size: 13px;
    }

    .machine-reference-link {
        margin-top: 11px;
    }

    .machine-reference-link .button {
        width: 100%;
        min-width: 0;
    }

    .summary {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

    .price-history-chart-container {
        height: 280px;
        padding: 8px;
    }

    .lowest-product {
        align-items: stretch;
    }

    .lowest-product-image-area {
        width: 135px;
        height: auto;
        min-height: 155px;
        flex: 0 0 135px;
    }

    .lowest-product-image {
        width: 105px;
        height: 105px;
    }

    .lowest-product-content {
        padding: 14px;
    }

    .lowest-product-price {
        font-size: 23px;
    }

    .lowest-product-link .button {
        width: 100%;
        min-width: 0;
    }

    .product-card-image-area {
        width: 135px;
        min-height: 150px;
        flex: 0 0 135px;
    }

    .product-card-image {
        width: 100px;
        height: 100px;
    }

    .product-card-body {
        padding: 13px 14px;
    }

    .product-price {
        font-size: 22px;
    }

    .product-card-link .button {
        width: 100%;
    }
}


/* ==================================================
   15. Small Mobile Responsive
================================================== */

@media (max-width: 520px) {
    .machine-detail-header .page-title {
        font-size: 22px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .machine-overview {
        padding: 12px;
    }

    .machine-overview-grid {
        grid-template-columns:
            90px
            minmax(0, 1fr);
        gap: 10px;
    }

    .machine-image-area {
        min-height: 125px;
        padding: 6px;
    }

    .machine-main-image {
        width: 78px;
        height: 115px;
    }

    .machine-image-placeholder {
        min-height: 110px;
        font-size: 11px;
    }

    .machine-information-row {
        grid-template-columns: 1fr;
        gap: 2px;
        padding: 6px 0;
    }

    .machine-information-row dt {
        font-size: 11px;
    }

    .machine-information-row dd {
        font-size: 12px;
    }

    .summary-item {
        padding: 11px;
    }

    .summary-value {
        font-size: 17px;
    }

    .price-history-chart-container {
        height: 240px;
    }

    .lowest-product {
        flex-direction: column;
    }

    .lowest-product-image-area {
        width: 100%;
        height: 145px;
        min-height: 0;
        flex-basis: auto;
        border-right: 0;
        border-bottom: 1px solid #eee;
    }

    .lowest-product-image {
        width: 105px;
        height: 105px;
    }

    .lowest-product-content {
        padding: 13px;
    }

    .lowest-product-name {
        font-size: 14px;
    }

    .lowest-product-price {
        font-size: 22px;
    }

    .product-card {
        flex-direction: column;
    }

    .product-card-image-area {
        width: 100%;
        min-height: 135px;
        flex-basis: auto;
        border-right: 0;
        border-bottom: 1px solid #eee;
    }

    .product-card-image {
        width: 95px;
        height: 95px;
    }

    .product-card-body {
        padding: 12px;
    }

    .product-name {
        font-size: 14px;
    }

    .product-price {
        font-size: 21px;
    }

    .product-meta {
        flex-direction: column;
        gap: 4px;
    }

    .related-machine-grid {
        gap: 9px;
    }

    .related-machine-image-area {
        height: 125px;
        padding: 8px;
    }

    .related-machine-image {
        width: 85px;
        height: 105px;
    }

    .related-machine-body {
        padding: 9px;
    }

    .related-machine-name {
        font-size: 12px;
    }

    .related-machine-price strong {
        font-size: 15px;
    }

    .share-button {
        flex: 1 1 calc(50% - 4px);
    }
}


/* ==================================================
   16. Extra Small Mobile
================================================== */

@media (max-width: 360px) {
    .machine-detail-header .page-title {
        font-size: 20px;
    }

    .machine-overview-grid {
        grid-template-columns: 1fr;
    }

    .machine-image-area {
        min-height: 135px;
    }

    .machine-main-image {
        width: 90px;
        height: 125px;
    }

    .summary {
        grid-template-columns: 1fr;
    }

    .lowest-product-price {
        font-size: 20px;
    }

    .product-price {
        font-size: 20px;
    }

    .related-machine-grid {
        grid-template-columns: 1fr;
    }

    .related-machine-image-area {
        height: 145px;
    }
}