/* 価格推移: PCはフロート、スマホはカード内展開 */

/* ---- 共通: 開くボタン ---- */
.price-chart-open-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    min-width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    vertical-align: middle;
}

.price-chart-open-btn:hover {
    background: #5a6fd6;
}

.price-chart-open-btn.is-active {
    background: #4338ca;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.price.price-with-chart {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 0;
}

.price-chart-period-btn {
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    color: #495057;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
}

.price-chart-period-btn.is-active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.price-chart-stat {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.price-chart-stat__label {
    color: #6c757d;
    font-size: 11px;
    margin-bottom: 2px;
}

.price-chart-stat__value {
    font-weight: 700;
    color: #333;
}

/* ---- PC: フローティングポップアップ ---- */
.price-chart-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: min(440px, calc(100vw - 32px));
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
    z-index: 10050;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.price-chart-float.is-open {
    display: flex;
}

.price-chart-float__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: move;
    user-select: none;
}

.price-chart-float__title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 4px;
}

.price-chart-float__meta {
    font-size: 11px;
    opacity: 0.9;
}

.price-chart-float__close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.price-chart-float__close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.price-chart-float__periods {
    display: flex;
    gap: 6px;
    padding: 10px 14px 0;
    flex-wrap: wrap;
}

.price-chart-float__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px 14px;
    font-size: 12px;
}

.price-chart-float__body {
    padding: 0 12px 14px;
    min-height: 220px;
}

.price-chart-float__canvas-wrap {
    position: relative;
    height: 220px;
}

.price-chart-float__message {
    padding: 40px 16px;
    text-align: center;
    color: #6c757d;
    font-size: 13px;
}

/* ---- スマホ: カード内インライン展開 ---- */
.product-card.has-price-chart {
    cursor: default;
}

.product-card.has-price-chart:hover {
    transform: none;
}

.product-card-price-chart {
    border-top: 1px solid #e9ecef;
    background: #fafbff;
    padding: 10px 12px 12px;
}

.product-card-price-chart__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.product-card-price-chart__periods {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.product-card-price-chart__close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #e9ecef;
    color: #495057;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.product-card-price-chart__close:hover {
    background: #dee2e6;
}

.product-card-price-chart__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
    font-size: 12px;
}

.product-card-price-chart__stats .price-chart-stat {
    background: #fff;
    border: 1px solid #eef0f4;
    padding: 6px 4px;
}

.product-card-price-chart__stats .price-chart-stat__value {
    font-size: 12px;
}

.product-card-price-chart__body {
    min-height: 160px;
}

.product-card-price-chart__canvas-wrap {
    position: relative;
    height: 180px;
    background: #fff;
    border: 1px solid #eef0f4;
    border-radius: 8px;
    padding: 6px;
}

.product-card-price-chart__message {
    padding: 28px 12px;
    text-align: center;
    color: #6c757d;
    font-size: 13px;
}

@media (max-width: 768px) {
    /* スマホではフロートは使わない */
    .price-chart-float {
        display: none !important;
    }

    .product-card-price-chart {
        grid-column: 1 / -1;
        grid-row: 2;
        padding: 8px 10px 10px;
    }

    .product-card-price-chart__canvas-wrap {
        height: 160px;
    }

    .price-chart-open-btn {
        width: 30px;
        min-width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .product-card-price-chart__periods .price-chart-period-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}
