/**
 * assets/css/tokupicks-pricechart.css
 * [tokupicks_price_chart] ショートコード専用スタイル
 * 単体で動作するよう独自のCSS変数を持つ（tokupicks.cssの読み込みは前提としない）
 */

.tp-pc-widget {
    --tp-pc-accent: #06b6d4;
    --tp-pc-accent2: #f97316;
    --tp-pc-text: #1f2937;
    --tp-pc-sub: #6b7280;
    --tp-pc-border: #e5e7eb;
    --tp-pc-bg: #ffffff;
    --tp-pc-bg-soft: #f8fafc;
    --tp-pc-up: #dc2626;   /* 値上がり（購入者視点で悪い方向） */
    --tp-pc-down: #16a34a; /* 値下がり（購入者視点で良い方向） */

    box-sizing: border-box;
    background: var(--tp-pc-bg);
    border: 1px solid var(--tp-pc-border);
    border-radius: 14px;
    padding: 18px 20px 16px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    color: var(--tp-pc-text);
}
.tp-pc-widget * { box-sizing: border-box; }

.tp-pc-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.tp-pc-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--tp-pc-text);
}

.tp-pc-range-switch {
    display: flex;
    gap: 4px;
    background: var(--tp-pc-bg-soft);
    border: 1px solid var(--tp-pc-border);
    border-radius: 999px;
    padding: 3px;
}

.tp-pc-range-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--tp-pc-sub);
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    white-space: nowrap;
}
.tp-pc-range-btn:hover { color: var(--tp-pc-text); }
.tp-pc-range-btn.tp-sel {
    background: var(--tp-pc-accent);
    color: #fff;
}

.tp-pc-stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
    font-size: 13px;
}
.tp-pc-stats-caption {
    text-align: left;
    font-size: 12px;
    color: var(--tp-pc-sub);
    margin-bottom: 6px;
    caption-side: top;
}
.tp-pc-stats-period {
    font-weight: 700;
    color: var(--tp-pc-text);
}
.tp-pc-stats-table th,
.tp-pc-stats-table td {
    padding: 7px 10px;
    border: 1px solid var(--tp-pc-border);
    text-align: right;
    white-space: nowrap;
}
.tp-pc-stats-table thead th {
    background: var(--tp-pc-bg-soft);
    color: var(--tp-pc-sub);
    font-weight: 600;
    font-size: 11.5px;
    text-align: right;
}
.tp-pc-stats-table thead th:first-child,
.tp-pc-stats-table tbody th {
    text-align: left;
}
.tp-pc-stats-table tbody th {
    background: var(--tp-pc-bg-soft);
    font-weight: 600;
    white-space: normal;
}
.tp-pc-stats-table tbody td { font-weight: 700; font-variant-numeric: tabular-nums; }
.tp-pc-chg-up   { color: var(--tp-pc-up); }
.tp-pc-chg-down { color: var(--tp-pc-down); }
.tp-pc-chg-flat { color: var(--tp-pc-sub); }

.tp-pc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 0;
    color: var(--tp-pc-sub);
    font-size: 13px;
}
.tp-pc-spinner {
    width: 18px; height: 18px;
    border: 2.5px solid var(--tp-pc-border);
    border-top-color: var(--tp-pc-accent);
    border-radius: 50%;
    animation: tp-pc-spin .8s linear infinite;
}
@keyframes tp-pc-spin { to { transform: rotate(360deg); } }

.tp-pc-chart-wrap {
    width: 100%;
    line-height: 0;
}

.tp-pc-svg {
    width: 100%;
    height: 260px;
    display: block;
}

.tp-pc-grid {
    stroke: var(--tp-pc-border);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.tp-pc-axis-y, .tp-pc-axis-x {
    font-size: 10.5px;
    fill: var(--tp-pc-sub);
    font-family: inherit;
}

.tp-pc-line {
    stroke-width: 2.25;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.tp-pc-line-price { stroke: var(--tp-pc-accent); }
.tp-pc-line-eff    { stroke: var(--tp-pc-accent2); }

.tp-pc-dot {
    stroke: #fff;
    stroke-width: 1.2;
    cursor: pointer;
    transition: r .1s ease;
}
.tp-pc-dot-price { fill: var(--tp-pc-accent); }
.tp-pc-dot-eff    { fill: var(--tp-pc-accent2); }
.tp-pc-dot:hover { r: 5; }

.tp-pc-datalabel {
    font-size: 11.5px;
    font-weight: 700;
    font-family: inherit;
    paint-order: stroke;
    stroke: var(--tp-pc-bg);
    stroke-width: 3px;
    stroke-linejoin: round;
}
.tp-pc-datalabel-price { fill: var(--tp-pc-accent); }
.tp-pc-datalabel-eff    { fill: var(--tp-pc-accent2); }

.tp-pc-empty {
    padding: 40px 12px;
    text-align: center;
    color: var(--tp-pc-sub);
    font-size: 13px;
    line-height: 1.7;
}

.tp-pc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--tp-pc-border);
}
.tp-pc-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--tp-pc-sub);
}
.tp-pc-dotline {
    display: inline-block;
    width: 16px;
    height: 3px;
    border-radius: 2px;
}
.tp-pc-dotline-price { background: var(--tp-pc-accent); }
.tp-pc-dotline-eff    { background: var(--tp-pc-accent2); }

.tp-pc-meta {
    margin-top: 8px;
    font-size: 12px;
    color: var(--tp-pc-text);
    font-weight: 600;
    min-height: 1.4em;
}

.tp-pc-note {
    margin-top: 8px;
    font-size: 11px;
    color: var(--tp-pc-sub);
    line-height: 1.7;
}

.tp-hidden { display: none !important; }

@media (max-width: 560px) {
    .tp-pc-widget { padding: 14px 14px 12px; border-radius: 12px; }
    .tp-pc-header { flex-direction: column; align-items: flex-start; }
    .tp-pc-range-switch { width: 100%; overflow-x: auto; }
    .tp-pc-title { font-size: 14.5px; }
    .tp-pc-svg { height: 220px; }
    .tp-pc-stats-table { display: block; overflow-x: auto; }
}
