/**
 * Single Product Page - SSR Component Styles
 * Server-side rendered price history charts and compare checkbox
 */

/* ============================================================================
   SSR PRICE HISTORY CHART
   Static chart image rendered server-side for SEO/no-JS
   ============================================================================ */

.product-price-history {
    margin-bottom: clamp(1.25rem, 2.5vw, 1.75rem);
    padding: clamp(1.5rem, 2vw, 1.75rem) 0;
    border-top: 1px solid var(--border);
}

.product-price-history__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.product-price-history__title {
    font-size: clamp(0.95rem, 1.8vw + 0.1rem, 1.1rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    padding-bottom: clamp(0.6rem, 1vw, 0.8rem);
    border-bottom: 2px solid var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Chart container */
.product-price-history__chart {
    position: relative;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    min-height: 200px;
}

/* Responsive chart image */
.product-price-history__chart img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    background-color: var(--bg-secondary);
}

/* Dark mode image adjustment */
html.dark .product-price-history__chart img {
    filter: brightness(0.95) contrast(1.05);
}

/* Last update note */
.product-price-history__note {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

/* Fallback placeholder when no chart available */
.product-price-history__fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 180px;
    padding: 2rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    text-align: center;
}

.product-price-history__fallback svg {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

.product-price-history__fallback p {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.product-price-history__fallback span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================================================
   COMPARE CHECKBOX - DISABLED STATE
   When max products are already selected for comparison
   ============================================================================ */

.product-compare-checkbox--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.product-compare-checkbox--disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.product-compare-checkbox--disabled label {
    cursor: not-allowed;
    color: var(--text-muted);
}

/* Tooltip hint for disabled state */
.product-compare-checkbox--disabled[title] {
    position: relative;
}

/* Disabled checkbox in table row context */
.catalog-table .product-compare-checkbox--disabled {
    opacity: 0.4;
}

/* Disabled checkbox in product card context */
.product-card .product-compare-checkbox--disabled {
    opacity: 0.4;
}

/* ============================================================================
   COMPARE CHECKBOX - BASE STYLES
   Standard styling for compare checkboxes
   ============================================================================ */

.product-compare-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.product-compare-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
}

.product-compare-checkbox label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.product-compare-checkbox:hover label {
    color: var(--text-primary);
}

.product-compare-checkbox input[type="checkbox"]:checked + label {
    color: var(--accent);
    font-weight: 600;
}

/* Focus state for accessibility */
.product-compare-checkbox input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 640px) {
    .product-price-history__chart {
        min-height: 150px;
    }

    .product-price-history__chart img {
        max-height: 220px;
    }

    .product-price-history__fallback {
        min-height: 140px;
        padding: 1.5rem;
    }

    .product-compare-checkbox label {
        font-size: 0.75rem;
    }
}

/* ============================================================================
   INLINE SVG PRICE CHART (SSR)
   Generated server-side, matches Chart.js dimensions for seamless hydration
   ============================================================================ */

.price-chart-ssr {
    width: 100%;
}

.price-chart-ssr__chart {
    width: 100%;
    position: relative;
    background: var(--bg-tertiary);
    border-radius: 0;
    overflow: hidden;
}

/* SVG chart styling - matches JS chart wrapper height (250px desktop, 180px mobile) */
.price-chart-svg {
    display: block;
    width: 100%;
    height: 250px;
}

.price-history-mobile .price-chart-svg,
.price-history__chart-wrapper--mobile .price-chart-svg {
    height: 180px;
}

/* Placeholder when no data */
.price-chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    background: var(--bg-tertiary);
}

/* Stats section - matches JS price-history__stats */
.price-chart-ssr__stats {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    padding: 12px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    flex-wrap: wrap;
}

.price-chart-ssr__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.price-chart-ssr__stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.price-chart-ssr__stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.price-chart-ssr__stat-value--lowest {
    color: var(--success);
}

.price-chart-ssr__stat-value--down {
    color: var(--success);
}

.price-chart-ssr__stat-value--up {
    color: var(--error);
}

/* SSR Controls (disabled buttons matching JS version) */
.price-history__controls--ssr .price-history__btn {
    opacity: 0.6;
    cursor: default;
}

.price-history__controls--ssr .price-history__btn:hover {
    background: transparent;
    transform: none;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .price-chart-ssr__stats {
        gap: 12px;
        padding: 10px;
    }

    .price-chart-ssr__stat-label {
        font-size: 0.6rem;
    }

    .price-chart-ssr__stat-value {
        font-size: 0.85rem;
    }
}
