/* price grid css */
.view-product-button {
    background: linear-gradient(145deg, #ff6b00, #ff7d1a);
    color: white !important;
    padding: 12px 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 
        0 2px 4px rgba(255, 107, 0, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
}

.view-product-button:hover {
    background: linear-gradient(145deg, #ff7d1a, #ff8c2b);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 4px 12px rgba(255, 107, 0, 0.15),
        0 8px 16px rgba(0, 0, 0, 0.1);
}

.view-product-button:active {
    transform: translateY(1px);
    box-shadow: 
        0 2px 4px rgba(255, 107, 0, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.05);
}

#top-level-container {
    min-height: 77vh;
}

.pd-breadcrumbs {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
}

.pd-breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pd-breadcrumbs a {
    color: inherit;
    text-underline-offset: 2px;
}

.pd-breadcrumbs li:not(:last-child)::after {
    content: "/";
    margin: 0 0.4rem;
    opacity: 0.55;
}

.pd-breadcrumbs [aria-current="page"] {
    opacity: 0.8;
}

#spinner {
    height: 50vh;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

#best-price-site {
    font-size: 0.75rem;
    color: #3a3a3a;
}

#best-price-date {
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.5);
}

#product-image-carousel {
    min-height: 230px;
}

.chart-price-header:not([hidden]) {
    min-height: 67px;
}

#watchlist-toggle-wrap {
    min-height: 112px;
}

#variant-grid-wrapper:not(.d-none) {
    min-height: 134px;
}

.carousel-item img {
    max-height: 230px;
    object-fit: contain;
}

/* .carousel-control-prev-icon {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23ff0000' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E") !important;
} */

.carousel-control-prev-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ff0000'%3e%3cpath d='M11.354 1.646a1 1 0 0 1 0 1.414L6.414 8l4.94 4.94a1 1 0 0 1-1.414 1.414l-6-6a1 1 0 0 1 0-1.414l6-6a1 1 0 0 1 1.414 0z'/%3e%3c/svg%3e");
}

.carousel-control-next-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ff0000'%3e%3cpath d='M4.646 1.646a1 1 0 0 1 1.414 0l6 6a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414-1.414L9.586 8 4.646 3.06a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
}

#summary-container {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
}

#summary-container > h2,
#variant-grid-wrapper > h2,
#shop-compare-heading {
    margin: 0 0 14px;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
}

.pd-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
}

.pd-stat {
    min-width: 0;
}

.pd-stat dt {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
}

.pd-stat dd {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin: 2px 0 0;
    font-size: 1.05rem;
    font-weight: 600;
}

@media (max-width: 575px) {
    .pd-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 12px;
    }
}

/* Shop logo styling for buy box */
.shop-logo-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    /*
     * Without a definite width, shrink-to-fit sizing for this abspos box can collapse to ~0px
     * in Chrome when the inner <img> uses width:auto + max-width — the logo loads but paints
     * at a few pixels (e.g. 4×4). Reserve a fixed slot so intrinsic sizing works.
     */
    width: 100px;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.shop-logo {
    max-height: 80px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    padding: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Add margin under the badge in the buy box */
#buy-box-container .badge {
    margin-bottom: 0.5rem;
}

/* Add margin under the badge in variant cards */
#variant-grid-container .badge {
    margin-bottom: 5px;
}

#chart-container {
    margin-bottom: 10px;
    position: relative;
    scroll-margin-top: 16px;
}

/* Keep chart slot from collapsing while the delayed loading overlay is hidden. */
#chart-area {
    min-height: 450px;
}

/*
 * ApexCharts ships legend layout in a JS-injected <style> tag. We disable that
 * (CSP + injectStyleSheet: false) and the CDN stylesheet only has focus rules,
 * so overlays otherwise leak markers/labels into the sections below the chart.
 */
#chart-area .apexcharts-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    overflow: visible;
    box-sizing: border-box;
    line-height: normal;
    padding: 4px 0 8px;
}

#chart-area .apexcharts-legend-series {
    display: inline-flex;
    align-items: center;
    width: auto;
    height: auto;
    max-width: 100%;
    line-height: 1;
    overflow: visible;
}

#chart-area span.apexcharts-legend-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 0 0 auto;
    box-sizing: content-box;
    padding: 2px;
    overflow: visible;
    vertical-align: middle;
}

#chart-area span.apexcharts-legend-marker svg {
    display: block;
    overflow: visible;
}

#chart-area .apexcharts-legend-text {
    position: relative;
    display: inline;
    padding-left: 0;
    margin-left: 4px;
}

.chart-loading-spinner {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.8);
}

.chart-loading-spinner.d-none {
    display: none !important;
}

/* Mini price chart under each variant card */
.mini-price-chart {
    margin-top: 8px;
}

.variant-history-spinner {
    min-height: 120px;
}

/* Larger overlay toggle for variant cards */
.variant-overlay-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.variant-overlay-toggle.form-switch {
    padding-left: 0; /* remove Bootstrap's reserved left padding */
}

.variant-overlay-toggle .form-check-input {
    position: static; /* opt-out of Bootstrap's offset */
    width: 2.6em; /* enlarge width (2em base * 1.3) */
    height: 1.3em; /* enlarge height (1em base * 1.3) */
    margin: 0; /* rely on container gap */
    flex: 0 0 auto; /* don't shrink into label */
}

.variant-overlay-toggle .form-check-label {
    margin: 0;
    line-height: 1.3;
}

/* Show pointer cursor when hovering over overlay toggle */
.variant-overlay-toggle,
.variant-overlay-toggle .form-check-input,
.variant-overlay-toggle .form-check-label {
    cursor: pointer;
}

/* Ensure wrapped variant label text aligns with start of text, not the circle */
.site-label {
    display: grid;
    grid-template-columns: 14px auto; /* circle width, then flexible text */
    align-items: start; /* top-align circle with first line of text */
    column-gap: 0.25rem; /* matches Bootstrap me-1 spacing */
}

.site-label > svg {
    margin-right: 0 !important; /* neutralize me-1 to avoid double gap */
    grid-column: 1;
    align-self: start; /* ensure top alignment */
    display: block; /* remove inline baseline gaps */
}

.site-label > span {
    grid-column: 2;
    min-width: 0; /* allow proper wrapping inside grid */
    display: block; /* align top of block to grid start */
    line-height: 1.2; /* tighten to better match visual top of text */
}

/* Buy box & variant cards: extra space above the CTA only (does not push the “as of” line down). */
#buy-box-container .view-product-button,
#variant-grid-container .view-product-button {
    margin-top: 10px;
}

.watchlist-toggle-btn {
    font-weight: 600;
    color: var(--text-primary, #212529);
    background: transparent;
    border: 1.5px solid var(--text-primary, #212529);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.watchlist-toggle-btn:hover {
    color: var(--text-primary, #212529);
    background: color-mix(in srgb, var(--text-primary, #212529) 12%, var(--background-primary, #fff));
    border-color: var(--text-primary, #212529);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 22, 34, 0.14);
}

.watchlist-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(15, 22, 34, 0.08);
}

.watchlist-toggle-btn.is-watched {
    border-width: 1px;
    border-color: var(--border-color, #ced4da);
    background: var(--background-secondary, #f7f8fa);
    color: var(--text-primary, #212529);
    box-shadow: none;
}

.watchlist-toggle-btn.is-watched:hover {
    background: color-mix(in srgb, var(--text-primary, #212529) 12%, var(--background-primary, #fff));
    border-color: var(--text-primary, #212529);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 22, 34, 0.14);
}

.watchlist-toggle-btn.is-watched:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(15, 22, 34, 0.08);
}

.drop-copy-btn {
    font-weight: 600;
    color: var(--text-primary, #212529);
    background: transparent;
    border: 1.5px solid var(--border-color, #ced4da);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.drop-copy-btn:hover {
    color: var(--text-primary, #212529);
    background: color-mix(in srgb, var(--text-primary, #212529) 12%, var(--background-primary, #fff));
    border-color: var(--text-primary, #212529);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 22, 34, 0.14);
}

.drop-copy-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(15, 22, 34, 0.08);
}

#shop-compare {
    margin-top: 20px;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
}

.shop-compare-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

#shop-compare-heading {
    margin: 0;
    text-align: left;
}

.shop-compare-overlay {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    min-height: 44px;
    cursor: pointer;
}

.shop-compare-overlay.form-switch {
    padding-left: 0;
}

.shop-compare-overlay .form-check-input {
    position: static;
    width: 2.6em;
    height: 1.3em;
    margin: 0;
    flex: 0 0 auto;
    cursor: pointer;
}

.shop-compare-overlay .form-check-label {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.3;
    cursor: pointer;
}

.shop-compare-table-wrap {
    margin-top: 12px;
    overflow-x: auto;
}

.shop-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.shop-compare-table th,
.shop-compare-table td {
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.shop-compare-table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: none;
}

.shop-compare-table tbody th {
    font-weight: 600;
}

.shop-compare-this {
    display: inline-block;
    flex: 0 0 auto;
    margin: 0;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: #e8efff;
    color: #1358ff;
}

.shop-compare-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.shop-compare-logo,
.shop-compare-logo-fallback {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e5e7eb);
    background: #fff;
    object-fit: contain;
}

.shop-compare-logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: #6b7280;
    background: #f3f4f6;
}

.shop-compare-copy {
    min-width: 0;
    flex: 1;
}

.shop-compare-shop-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.shop-compare-shop {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
}

.shop-compare-shop-row .shop-compare-shop {
    display: inline;
    min-width: 0;
}

a.shop-compare-shop:hover,
a.shop-compare-shop:focus-visible {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.shop-compare-product {
    display: block;
    margin-top: 2px;
    font-size: 0.95rem;
    color: inherit;
    text-decoration: none;
}

.shop-compare-product:hover,
.shop-compare-product:focus-visible {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.shop-compare-price {
    font-weight: 600;
    white-space: nowrap;
}

.shop-compare-delta {
    white-space: nowrap;
    color: #6b7280;
}

.shop-compare-delta--cheaper {
    color: #157347;
    font-weight: 600;
}

.shop-compare-delta--same {
    color: #6b7280;
}

.shop-compare-row--lowest .shop-compare-price {
    color: #157347;
}

.shop-compare-row--current th,
.shop-compare-row--current td {
    background: color-mix(in srgb, var(--text-primary, #212529) 4%, transparent);
}

.related-products {
    margin-top: 20px;
}

.related-products-section + .related-products-section {
    margin-top: 20px;
}

.related-products-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.related-products-head h2 {
    margin: 0;
    text-align: left;
}

.related-see-all {
    margin-right: auto;
    font-size: 0.875rem;
    font-weight: 600;
    color: inherit;
    text-underline-offset: 2px;
}

.related-carousel-nav {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.related-carousel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 999px;
    background: var(--background-primary, #fff);
    color: var(--text-primary, #212529);
    cursor: pointer;
}

.related-carousel-btn:hover:not(:disabled) {
    background: var(--background-secondary, #f7f8fa);
}

.related-carousel-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.related-products-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 2px;
    padding: 2px;
    scrollbar-width: none;
}

.related-products-grid::-webkit-scrollbar {
    display: none;
}

.related-product-card {
    flex: 0 0 min(248px, 78vw);
    display: flex;
    flex-direction: column;
    min-height: 320px;
    background: var(--background-primary, #fff);
    border: 1px solid var(--border-color, #ccc);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    scroll-snap-align: start;
}

.related-product-card::before {
    content: "";
    display: block;
    height: 4px;
    background: var(--shop-rail, hsl(210 42% 48%));
}

.related-product-media {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 176px;
    padding: 16px;
    background: #f8f9fa;
}

.related-product-card .product-img-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.related-product-card .product-img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.related-product-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    padding: 14px 16px 16px;
}

.related-product-name {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-product-shop {
    font-size: 0.8rem;
    color: #6b7280;
}

.related-product-price {
    margin-top: 4px;
}

.related-product-card .price-text {
    font-size: 1.15rem;
    font-weight: 600;
}

.related-product-card .price-text--last-seen {
    color: #6b7280;
    font-size: 0.95rem;
}

.related-product-link {
    margin-top: auto;
    padding-top: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.related-product-link:hover,
.related-product-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (min-width: 768px) {
    .related-product-card {
        flex-basis: 240px;
    }
}

@media (min-width: 1200px) {
    .related-product-card {
        flex-basis: 256px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .related-products-grid {
        scroll-behavior: auto;
    }
}