/* Historical Charts — scoped under .ep-wrap to avoid WP theme conflicts */

/* Reset */
.ep-wrap,
.ep-wrap *,
.ep-wrap *::before,
.ep-wrap *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
    line-height: normal;
    text-decoration: none;
    list-style: none;
    outline: none;
}
.ep-wrap {
    font-family: "Poppins", sans-serif;
    color: #111827;
    box-sizing: border-box;
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    word-break: normal;
    overflow-wrap: break-word;
    /* Prevent accidental horizontal scroll on small screens */
    overflow-x: clip;
    /* Tier colors: summary cards, chart markers & legend (keep in sync with spot-prices.css) */
    --ep-color-cheap: #16a34a;
    --ep-color-mod: #f59e0b;
    --ep-color-exp: #ef4444;
    /* Match default block / paragraph width (e.g. Kadence --global-calc-content-width) */
    width: 100%;
    max-width: min(100%, var(--wp--style--global--content-size, var(--global-calc-content-width, 100%)));
    margin-left: auto;
    margin-right: auto;
    position: relative;
    padding: 0;
}

.ep-wrap .container { max-width: 1580px; width: 100%; margin: 0 auto; background: #fefefe; padding: 24px; border-radius: 14px; box-shadow: 0 10px 30px rgba(17, 24, 39, 0.08); }

.ep-wrap .price-chart-card__legend--no-now .price-chart-legend__now { display: none; }

/* Summary Grid & Cards */
.ep-wrap .summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 10px 0 40px !important; width: 100%; max-width: 100%; }
.ep-wrap .summary-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Chart directly under summary: no extra top margin (40px gap comes from summary margin-bottom above) */
.ep-wrap .summary-grid + section.price-chart-card { margin-top: 0 !important; }

.ep-wrap .summary-card {
    position: relative;
    border-radius: 12px;
    padding: 18px;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: #ffffff;
    box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset, 0 -1px 0 rgba(17,24,39,0.03) inset, 0 12px 24px rgba(17,24,39,0.10);
    overflow: hidden;
    transition: box-shadow 240ms ease, background 240ms ease, color 240ms ease, border-color 240ms ease;
    max-width: 100%;
    min-width: 0;
}
.ep-wrap .summary-card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: transparent; pointer-events: none; opacity: 0; }
.ep-wrap .summary-card--gradient { border: 0; color: #ffffff; background: linear-gradient(135deg, #007FFF 0%, #000CFF 100%); box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 -1px 0 rgba(0,0,0,0.12) inset, 0 14px 30px rgba(0,127,255,0.25); }
.ep-wrap .summary-card--gradient::before { background: linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0) 45%); opacity: 0.85; }
.ep-wrap .summary-card__top { display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: 8px; align-self: stretch; width: 100%; box-sizing: border-box; margin: 0; padding: 0; }
.ep-wrap .summary-card__title { font-family: "Poppins", sans-serif; font-size: 20px; font-weight: 600; letter-spacing: 0.2px; margin: 0; padding: 0; flex: 1 1 auto; min-width: 0; }
.ep-wrap .summary-card__value { margin: 8px 0 0; padding: 0; font-size: 24px; font-weight: 800; line-height: 1.1; width: 100%; }
.ep-wrap .summary-card__sub { margin: 8px 0 0; padding: 0; font-size: 16px; font-weight: 400; opacity: 0.9; width: 100%; }
.ep-wrap .summary-card .summary-card__value { margin-top: 8px; font-size: 18px; font-weight: 800; letter-spacing: -0.1px; }
.ep-wrap .summary-price-line { display: flex; align-items: baseline; justify-content: flex-start; gap: 6px; flex-wrap: wrap; text-align: left; margin: 0; padding: 0; width: 100%; box-sizing: border-box; }
.ep-wrap .summary-datetime { text-align: left; font-size: 11px; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; opacity: 1; }
.ep-wrap .summary-card:not(.summary-card--gradient) .summary-datetime { color: #111827; }
.ep-wrap .summary-card--gradient .summary-datetime { color: #ffffff; }
.ep-wrap .summary-grid:hover .summary-card:not(:hover) .summary-datetime { color: #111827; }
.ep-wrap .summary-grid:hover .summary-card:hover .summary-datetime { color: #ffffff; }
.ep-wrap .summary-price-line__num { font-size: 22px; font-weight: 600; line-height: 1.05; }
.ep-wrap .summary-price-line__unit { font-size: 13px; font-weight: 400; letter-spacing: 0; opacity: 0.95; }

.ep-wrap .icon { width: 32px; height: 30px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; }
.ep-wrap .icon.icon--bolt { width: 32px; height: 32px; flex: 0 0 32px; justify-content: center; margin-left: 0; }
.ep-wrap .icon--bolt { font-size: 24px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15)); }
.ep-wrap .icon--img { width: 26px; height: 26px; flex: 0 0 32px; margin-left: 0; justify-content: center; }
.ep-wrap .icon--img img, .ep-wrap .icon--img svg { width: 32px; height: 32px; object-fit: contain; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.08)); }

.ep-wrap .summary-card__title--yellow { color: var(--ep-color-mod); }
.ep-wrap .summary-card__title--green { color: var(--ep-color-cheap); }
.ep-wrap .summary-card__title--red { color: var(--ep-color-exp); }

/* Make summary icons inherit the title color */
.ep-wrap .summary-card__top .summary-card__title--yellow ~ .icon--img { color: var(--ep-color-mod); }
.ep-wrap .summary-card__top .summary-card__title--green ~ .icon--img { color: var(--ep-color-cheap); }
.ep-wrap .summary-card__top .summary-card__title--red ~ .icon--img { color: var(--ep-color-exp); }
.ep-wrap .summary-card__top .icon--img svg { fill: currentColor; }
.ep-wrap .summary-card__top .icon--img svg [fill] { fill: currentColor; }
.ep-wrap .summary-card__top .icon--img svg [stroke] { stroke: currentColor; }

.ep-wrap .summary-card:hover {
    box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset, 0 -1px 0 rgba(17,24,39,0.03) inset, 0 18px 40px rgba(17,24,39,0.14);
}
.ep-wrap .summary-grid:hover .summary-card { background: #ffffff; color: #111827; border: 1px solid rgba(17,24,39,0.10); }
.ep-wrap .summary-grid:hover .summary-card--gradient {
    background: #ffffff; color: #111827; border: 1px solid rgba(17,24,39,0.10);
    box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset, 0 -1px 0 rgba(17,24,39,0.03) inset, 0 12px 24px rgba(17,24,39,0.10);
}
.ep-wrap .summary-grid:hover .summary-card--gradient::before { background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0) 42%); opacity: 0.75; }
.ep-wrap .summary-grid:hover .summary-card:hover {
    background: linear-gradient(135deg, #007FFF 0%, #000CFF 100%); color: #ffffff; border-color: transparent;
    box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 -1px 0 rgba(0,0,0,0.12) inset, 0 18px 40px rgba(0,127,255,0.28);
}
.ep-wrap .summary-grid:hover .summary-card:hover::before { background: linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0) 45%); opacity: 0.85; }
.ep-wrap .summary-grid:hover .summary-card:hover .summary-card__title { color: #ffffff; }
.ep-wrap .summary-grid:hover .summary-card:hover .icon--img img,
.ep-wrap .summary-grid:hover .summary-card:hover .icon--img svg { filter: drop-shadow(0 2px 8px rgba(0,0,0,0.35)); }

/* Chart Card */
.ep-wrap .price-chart-card {
    --chart-vb-w: 2280;
    --chart-pad-r: 44;
    font-family: "Poppins", sans-serif;
    background: #f3f4f6;
    border-radius: 16px;
    padding: 18px;
    margin-top: 32px;
    box-sizing: border-box;
    border: 1px solid rgba(17, 24, 39, 0.06);
    overflow: visible;
}
.ep-wrap .price-chart-card:first-of-type { margin-top: 0; }
.ep-wrap .price-chart-card__header { display: flex; flex-wrap: wrap; flex-direction: row; align-items: center; justify-content: space-between; gap: 14px 16px; width: 100%; box-sizing: border-box; margin-bottom: 16px; }
.ep-wrap .price-chart-card__title { margin: 0; padding: 0; font-family: "Poppins", sans-serif; font-size: 20px; font-weight: 600; color: #111827; letter-spacing: 0.2px; line-height: 1.2; text-align: left; }
.ep-wrap .price-chart-card__legend {
    display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end;
    gap: 18px 24px; padding: 0; padding-right: calc(100% * var(--chart-pad-r) / var(--chart-vb-w));
    font-family: "Poppins", sans-serif; font-size: 12px; font-weight: 600; letter-spacing: 0.2px; line-height: 1.2; color: #4b5563;
}
.ep-wrap .price-chart-card__legend span { display: inline-flex; align-items: center; gap: 10px; }
.ep-wrap .price-chart-card__legend i { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid #2563eb; background: #fff; box-sizing: border-box; flex-shrink: 0; }
.ep-wrap .price-chart-card__legend .price-chart-legend__high i { border-color: var(--ep-color-exp); }
.ep-wrap .price-chart-card__legend .price-chart-legend__low i { border-color: var(--ep-color-cheap); }

/* Chart SVG */
.ep-wrap .price-chart__wrap { position: relative; width: 100%; overflow-x: visible; overflow: visible; -webkit-overflow-scrolling: touch; }
.ep-wrap .price-chart__tooltip {
    position: absolute; z-index: 8; left: 0; top: 0; padding: 10px 14px; border-radius: 10px;
    background: rgba(255,255,255,0.94); border: 1px solid rgba(148,163,184,0.55);
    box-shadow: 0 8px 24px rgba(15,23,42,0.12); font-family: "Poppins", sans-serif;
    font-size: 15px; font-weight: 600; color: #1e293b; line-height: 1.35;
    pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.06s ease;
    max-width: min(220px, calc(100vw - 48px));
}
.ep-wrap .price-chart__tooltip.is-on { opacity: 1; visibility: visible; }
.ep-wrap .price-chart__tooltip__time { display: block; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.ep-wrap .price-chart__tooltip__price { display: block; margin-top: 4px; font-size: 14px; font-weight: 500; color: #475569; font-variant-numeric: tabular-nums; }
.ep-wrap .price-chart__hover-dot { pointer-events: none; }
.ep-wrap .price-chart__svg { display: block; width: 100%; min-width: 100%; height: auto; max-height: none; overflow: visible; }
.ep-wrap .price-chart__grid line { stroke: #e5e7eb; stroke-width: 1; }
.ep-wrap .price-chart__grid--minor line { stroke: #eef2f7; stroke-width: 1; }
.ep-wrap .price-chart__line--past { fill: none; stroke: #2563eb; stroke-width: 7; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 3; }
.ep-wrap .price-chart__line--future { fill: none; stroke: #2563eb; stroke-width: 7; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 3; stroke-dasharray: 6 5; opacity: 0.45; }
.ep-wrap .price-chart__axis-y text { fill: #6b7280; font-size: 32px; font-family: "Poppins", sans-serif; font-weight: 500; font-variant-numeric: tabular-nums; }
.ep-wrap .price-chart__axis-y-tick { text-anchor: start; }
.ep-wrap .price-chart__axis-x text { fill: #6b7280; font-size: 32px; font-family: "Poppins", sans-serif; font-weight: 500; }
.ep-wrap .price-chart__y-unit { fill: #6b7280; font-size: 24px; font-family: "Poppins", sans-serif; font-weight: 500; letter-spacing: 0.02em; }
.ep-wrap .price-chart__marker text { font-family: "Poppins", sans-serif; font-size: 28px; font-weight: 600; fill: #374151; }
.ep-wrap .price-chart__marker__price { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ep-wrap .price-chart__marker--high .price-chart__marker__price { fill: var(--ep-color-exp); font-size: 38px; font-weight: 800; }
.ep-wrap .price-chart__marker--low .price-chart__marker__price { fill: var(--ep-color-cheap); font-size: 38px; font-weight: 800; }
.ep-wrap .price-chart__marker--flat .price-chart__marker__price { fill: #475569; }
.ep-wrap .price-chart-card__caption { margin: 14px 0 0; font-size: 13px; line-height: 1.45; color: #4b5563; max-width: 52rem; }
.ep-wrap .price-chart-card__empty { font-size: 14px; color: #6b7280; padding: 24px 8px; text-align: center; }

/* Two-year chart smaller x labels */
.ep-wrap .price-chart-card--two-year .price-chart__axis-x text { font-size: 26px; }

/* Monthly price table */
.ep-wrap .monthly-price-table-wrap {
    margin-top: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    border-radius: 12px; background: #ffffff; border: 1px solid rgba(17,24,39,0.08); box-sizing: border-box;
}
.ep-wrap .monthly-price-table { width: 100%; min-width: 280px; border-collapse: collapse; font-family: "Poppins", sans-serif; font-size: 14px; color: #111827; }
.ep-wrap .monthly-price-table th,
.ep-wrap .monthly-price-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid rgba(17,24,39,0.08); vertical-align: middle; }
.ep-wrap .monthly-price-table thead { background-color: #f9fafb; }
.ep-wrap .monthly-price-table thead th {
    font-weight: 600; color: #111827; background-color: #f9fafb; font-size: 13px; letter-spacing: 0.02em;
}
.ep-wrap .monthly-price-table tbody td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.ep-wrap .monthly-price-table tbody tr:last-child td { border-bottom: 0; }

/* Desktop: right-align last column header */
@media (min-width: 901px) {
    .ep-wrap .monthly-price-table thead th:last-child { text-align: right; }
}

/* Mobile */
@media (max-width: 900px) {
    .ep-wrap .container { padding: 16px 15px; border-radius: 12px; }
    .ep-wrap .summary-grid,
    .ep-wrap .summary-grid--three { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; margin: 8px 0 40px !important; }
    /* 3 cards on mobile: 2 on first row, 3rd starts the next row (same size) */
    .ep-wrap .summary-grid--three > .summary-card:nth-child(3) { grid-column: auto; }
    .ep-wrap .summary-card { box-sizing: border-box !important; min-height: 108px !important; height: auto !important; padding: 12px !important; border-radius: 8px; overflow: visible; width: auto !important; max-width: none !important; }
    .ep-wrap .summary-card__title { font-size: 15px; line-height: 1.2; }
    .ep-wrap .summary-card .summary-card__value,
    .ep-wrap .summary-price-line__num,
    .ep-wrap .summary-card__value { margin-top: 6px; font-size: 16px; font-weight: 500; line-height: 1.15; }
    .ep-wrap .summary-card--gradient .summary-price-line__num,
    .ep-wrap .summary-card--gradient .summary-card__value { font-weight: 600; }
    .ep-wrap .summary-datetime,
    .ep-wrap .summary-card__sub.summary-datetime { margin-top: 4px; font-size: 12px; font-weight: 400; }
    .ep-wrap .icon { width: 32px; height: 32px; flex: 0 0 32px; }
    .ep-wrap .icon--img { width: 32px; height: 32px; flex: 0 0 32px; }
    .ep-wrap .icon--img img, .ep-wrap .icon--img svg { width: 32px; height: 32px; max-width: 32px; max-height: 32px; }
    .ep-wrap .price-chart-card { padding: 12px; margin-top: 24px; overflow: visible; }
    .ep-wrap .price-chart-card__header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .ep-wrap .price-chart-card__title { font-size: 15px; width: 100%; }
    .ep-wrap .price-chart-card__legend { justify-content: flex-start; padding-right: 0; font-size: 15px; width: 100%; }
    .ep-wrap .price-chart__wrap { overflow-x: visible; }
    .ep-wrap .price-chart__tooltip { font-size: 24px; padding: 16px 20px; max-width: min(320px, calc(100vw - 28px)); }
    .ep-wrap .price-chart__tooltip__price { font-size: 21px; margin-top: 8px; }
    .ep-wrap .price-chart__axis-y text,
    .ep-wrap .price-chart__axis-x text { font-size: 55px; font-weight: 700; }
    .ep-wrap .price-chart__y-unit { font-size: 48px; }
    .ep-wrap .price-chart__marker text { font-size: 48px; }
    .ep-wrap .price-chart__marker__price { font-size: 60px; font-weight: 800; }
    .ep-wrap .price-chart__marker--high .price-chart__marker__price,
    .ep-wrap .price-chart__marker--low .price-chart__marker__price { font-size: 80px; font-weight: 900; }
    .ep-wrap .price-chart__line--past,
    .ep-wrap .price-chart__line--future { stroke-width: 20; }
    .ep-wrap .price-chart__grid line { stroke-width: 2.25; }
    .ep-wrap .price-chart__grid--minor line { stroke-width: 1.85; }
    .ep-wrap .price-chart-card--two-year .price-chart__axis-x text { font-size: 60px; }
    .ep-wrap .monthly-price-table th,
    .ep-wrap .monthly-price-table td { padding: 8px 10px; font-size: 13px; }
    /* No horizontal scrollbar; table fits the viewport (no wrapper side padding — avoids white strip beside grey thead) */
    .ep-wrap .monthly-price-table-wrap {
        box-sizing: border-box;
        overflow-x: visible;
        -webkit-overflow-scrolling: auto;
    }
    .ep-wrap .monthly-price-table {
        min-width: 0;
        width: 100%;
    }
    .ep-wrap .monthly-price-table thead th:last-child,
    .ep-wrap .monthly-price-table tbody td:last-child {
        padding-right: 20px;
        text-align: right;
    }
    .ep-wrap .monthly-price-table thead th:last-child {
        white-space: normal;
        overflow-wrap: break-word;
    }
}

/* Very small screens: avoid 2-column overflow */
@media (max-width: 420px) {
    .ep-wrap .summary-grid,
    .ep-wrap .summary-grid { grid-template-columns: 1fr !important; }
    /* Keep the 2+1 layout for the 3-card summary on tiny screens, too */
    .ep-wrap .summary-grid--three { grid-template-columns: repeat(2, 1fr) !important; }
    .ep-wrap .summary-grid--three > .summary-card:nth-child(3) { grid-column: auto; }
}

/* Very narrow: monthly table — stop thead grey bleeding / stray stripes on text (see border-collapse + scroll quirks) */
@media (max-width: 335px) {
    .ep-wrap .monthly-price-table-wrap {
        overflow-x: hidden;
        overflow-x: clip;
    }
    .ep-wrap .monthly-price-table tbody td {
        background-color: #ffffff;
        vertical-align: top;
    }
    .ep-wrap .monthly-price-table thead th {
        background-color: #f9fafb;
        background-clip: padding-box;
    }
}
