/**
 * Single Product Page - Offers & Prices Styles
 * Prices section, merchant table, price history
 */

/* ============================================================================
   AFFILIATE DISCLOSURE
   ============================================================================ */

.affiliate-disclosure {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.affiliate-disclosure a {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* ============================================================================
   PRICES SECTION - Compact
   ============================================================================ */

.prices-section {
    margin-bottom: clamp(1.25rem, 2.5vw, 1.75rem);
    padding: clamp(1.5rem, 2vw, 1.75rem) 0;
    background-color: transparent;
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--border);
    box-shadow: none;
}

.prices-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: var(--text-secondary);
}

/* ============================================================================
   PRICES TABLE
   ============================================================================ */

.prices-table__header {
    display: grid;
    grid-template-columns: 1.5fr 130px 100px 80px;
    gap: 12px;
    padding: 10px 12px;
    background-color: var(--accent);
    border-radius: 8px 8px 0 0;
    font-size: 0.65rem;
    font-weight: 700;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prices-table__row {
    display: grid;
    grid-template-columns: 1.5fr 130px 100px 80px;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
    font-size: 0.8125rem;
}

.prices-table__mobile-label {
    display: none;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 3px;
}

.prices-table__row:hover {
    background-color: var(--bg-tertiary);
}

.prices-table__row:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.prices-table__row.is-lowest {
    background-color: var(--success-bg);
    border-left: 2px solid var(--success);
}

.prices-table__col--shop {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prices-table__shop-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.prices-table__logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background-color: #fff;
    padding: 2px;
}

.prices-table__shop-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
}

.prices-table__lowest-badge {
    display: inline-flex;
    padding: 2px 6px;
    background-color: var(--success);
    color: #000;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 3px;
    margin-left: 4px;
}

.prices-table__price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.prices-table__shipping {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.prices-table__btn-buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    background-color: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 0.75rem;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.prices-table__btn-buy:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ============================================================================
   MERCHANT TABLE - Compact
   ============================================================================ */

.merchants-table {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.merchant-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
    font-size: 0.8rem;
}

.merchant-row:first-child {
    border-radius: 8px 8px 0 0;
}

.merchant-row:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.merchant-row:hover {
    background-color: var(--bg-tertiary);
}

.merchant-row--lowest {
    background-color: var(--success-bg);
    border-left: 2px solid var(--success);
}

.merchant-row__left {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.merchant-row__logo-wrap {
    width: 36px;
    height: 36px;
    background-color: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 3px;
}

.merchant-row__logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.merchant-row__info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.merchant-row__name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.merchant-row__lowest-badge {
    display: inline-flex;
    padding: 2px 5px;
    background-color: var(--success);
    color: #000;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 2px;
    flex-shrink: 0;
}

.merchant-row__stock {
    font-size: 0.7rem;
    font-weight: 600;
}

.merchant-row__stock--in {
    color: var(--success);
}

.merchant-row__stock--out {
    color: var(--error);
}

.merchant-row__shipping {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: block;
    margin-top: 1px;
}

.merchant-row__center {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    text-align: right;
}

.merchant-row__price-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

.merchant-row__price-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.merchant-row__price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
}

.merchant-row__updated {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.merchant-row__right {
    flex-shrink: 0;
}

.btn-merchant-buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: var(--accent);
    color: #000;
    font-size: 0.75rem;
    font-weight: 700;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
}

.btn-merchant-buy:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ============================================================================
   STOCK BADGE
   ============================================================================ */

.stock-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
}

.stock-badge--in-stock {
    background-color: var(--success-bg);
    color: var(--success);
}

.stock-badge--out-stock {
    background-color: var(--error-bg);
    color: var(--error);
}

/* ============================================================================
   PRICES EMPTY / DISCLAIMER
   ============================================================================ */

.prices-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.8rem;
}

.prices-disclaimer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.prices-empty-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.prices-empty-notice svg {
    flex-shrink: 0;
    color: var(--warning);
    margin-top: 1px;
    width: 16px;
    height: 16px;
}

.prices-empty-notice p {
    margin: 0;
    line-height: 1.5;
}

/* ============================================================================
   PRICE HISTORY SECTION - Compact
   ============================================================================ */

.price-history-section {
    margin-bottom: clamp(1.25rem, 2.5vw, 1.75rem);
    padding: clamp(1.5rem, 2vw, 1.75rem) 0;
    background-color: transparent;
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--border);
    box-shadow: none;
}

.price-history__toggle {
    display: flex;
    gap: 4px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    padding: 3px;
}

.price-history__btn {
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.price-history__btn:hover {
    color: var(--text-primary);
}

.price-history__btn.is-active {
    background-color: var(--accent);
    color: #000;
    font-weight: 700;
}

/* Controls wrapper: toggle + period buttons */
.price-history__controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Supplier toggle checkbox */
.price-history__supplier-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

.price-history__supplier-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

.price-history__supplier-toggle span {
    line-height: 1;
}

.price-history__chart-wrapper {
    height: 250px;
    position: relative;
    margin-top: 16px;
}

.price-history__chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

.price-history__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 180px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.price-history__stats {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    padding: 12px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    flex-wrap: wrap;
}

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

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

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

.price-history__stat-value--low {
    color: var(--success);
}

.price-history__stat-value--high {
    color: var(--error);
}

.price-history__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 180px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
}

.price-history__empty p {
    margin: 0;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================================================
   INLINE VARIANT SELECTOR (Packaging: Boxed/Tray/OEM)
   ============================================================================ */

.variant-selector-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
}

.variant-selector-inline__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.variant-selector-inline__select {
    flex: 1;
    max-width: 200px;
    padding: 6px 28px 6px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.variant-selector-inline__select:hover {
    border-color: var(--accent);
}

.variant-selector-inline__select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-bg);
}

.variant-selector-inline__select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--bg-secondary);
}

/* ============================================================================
   MERCHANT ROW EAN DROPDOWN
   ============================================================================ */

.merchant-row__ean-dropdown {
    display: block;
    margin-top: 4px;
    padding: 3px 22px 3px 6px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0 !important;
    -webkit-border-radius: 0 !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    max-width: 140px;
    transition: border-color 0.2s;
    cursor: pointer;
}

.merchant-row__ean-dropdown:hover {
    border-color: var(--accent);
}

.merchant-row__ean-dropdown:focus {
    outline: none;
    border-color: var(--accent);
}

/* EAN dropdown - mobile: compact size, always visible */
@media (max-width: 480px) {
    .merchant-row__ean-dropdown {
        display: block;
        font-size: 0.55rem;
        padding: 2px 18px 2px 4px;
        max-width: 100px;
        background-position: right 3px center;
        background-size: 8px 8px;
    }
}

/* ============================================================================
   PRICE TREND — integrated in merchant feed header
   ============================================================================ */

.product-merchant-feed__title-row {
    display: flex;
    align-items: baseline;
    gap: clamp(8px, 1.5vw, 12px);
}

.product-merchant-feed__count {
    font-size: clamp(12px, 0.7vw + 6px, 13px);
    color: var(--text-muted);
    font-weight: 500;
}

.product-merchant-feed__trend {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 12px);
    margin-top: 6px;
}

.price-trend-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: clamp(12px, 0.7vw + 6px, 13px);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.price-trend-tag__label {
    font-weight: 400;
    opacity: 0.7;
}

.price-trend-tag--low {
    color: var(--success);
}

.price-trend-tag--high {
    color: var(--text-secondary);
}

.price-trend-range {
    font-size: clamp(11px, 0.6vw + 5px, 12px);
    color: var(--text-muted);
    padding-left: clamp(8px, 1.5vw, 12px);
    border-left: 1px solid var(--border);
}

/* Mobile: trend row wraps so range drops to its own line */
@media (max-width: 480px) {
    .product-merchant-feed__trend {
        flex-wrap: wrap;
        gap: 4px;
    }

    .price-trend-range {
        border-left: none;
        padding-left: 0;
    }
}
