/* ============================================================
   BedstTest Price Compare Products — Frontend Styles
   Single product page + archive grid
   ============================================================ */

/* ============================================================
   [btpc_products] shortcode grid
   ============================================================ */

.btpcp-products-wrap { font-family: inherit; }

.btpcp-result-count {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

/* Grid layout — mirrors WooCommerce column classes */
ul.btpcp-product-grid {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid !important;
    gap: 24px;
}
ul.btpcp-grid--cols-1 { grid-template-columns: repeat(1, 1fr) !important; }
ul.btpcp-grid--cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
ul.btpcp-grid--cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
ul.btpcp-grid--cols-4 { grid-template-columns: repeat(4, 1fr) !important; }
ul.btpcp-grid--cols-5 { grid-template-columns: repeat(5, 1fr) !important; }
ul.btpcp-grid--cols-6 { grid-template-columns: repeat(6, 1fr) !important; }

@media (max-width: 900px) {
    ul.btpcp-grid--cols-4,
    ul.btpcp-grid--cols-5,
    ul.btpcp-grid--cols-6 { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 600px) {
    ul.btpcp-product-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
}
@media (max-width: 360px) {
    ul.btpcp-product-grid { grid-template-columns: 1fr !important; }
}

/* Product card — flex column so button always sits at bottom */
.btpcp-product-card {
    background: #fff;
    border: 0.5px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: box-shadow .15s;
}
.btpcp-product-card:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,.08);
}

/* Sale badge */
.btpcp-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    background: #f97316;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 3px 9px;
    border-radius: 20px;
}

/* Card image — fixed square, no jumping ever */
.btpcp-card-image-link {
    display: block;
    background: #f8f8f8;
    width: 100%;
    aspect-ratio: 1 / 1;   /* consistent height across all cards */
    overflow: hidden;
    flex-shrink: 0;
}
.btpcp-card-image {
    width: 100%;
    height: 100%;
    object-fit: contain;    /* never crop, never stretch */
    padding: 16px;
    transition: transform .2s;
    display: block;
}
.btpcp-product-card:hover .btpcp-card-image { transform: scale(1.03); }
.btpcp-card-no-image {
    width: 100%;
    height: 100%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
}

/* Card info — flex column, pushes button to bottom */
.btpcp-card-info {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;                /* fills remaining card height */
}

/* Product name: fixed 2-line clamp so prices sit at the same row */
.btpcp-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    text-decoration: none;
    line-height: 1.4;
    height: calc(1.4em * 2);   /* exactly 2 lines — keeps pricing row aligned */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 10px;
}
.btpcp-card-name:hover { color: #0891b2; }

/* Merchant count pill */
.btpcp-card-merchants {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0f9ff;
    color: #0369a1;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    margin-bottom: 8px;
    align-self: flex-start;
}

/* Pricing row */
.btpcp-card-pricing {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 12px;
}
.btpcp-card-orig {
    font-size: 12px;
    color: #9ca3af;
    text-decoration: line-through;
    line-height: 1;
}
.btpcp-card-price {
    font-size: 20px;
    font-weight: 800;
    color: #15803d;          /* green = affiliate best price */
    line-height: 1.1;
}

/* CTA — pinned to bottom by margin-top: auto on pricing block */
.btpcp-card-cta {
    display: block;
    margin-top: auto;        /* pushes button to card bottom regardless of name length */
    background: #f97316;
    color: #fff;
    text-align: center;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: .03em;
    transition: background .12s;
}
.btpcp-card-cta:hover { background: #ea6c0a; color: #fff; }

/* Pagination */
.btpcp-pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    gap: 4px;
}
.btpcp-pagination .page-numbers {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
}
.btpcp-pagination .page-numbers.current {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
.btpcp-pagination .page-numbers:hover:not(.current) { background: #f3f4f6; }

.btpcp-no-products { color: #6b7280; font-size: 14px; }

/* ============================================================
   Single product page
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
.btpcp-single-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px 60px;
    font-family: inherit;
}

/* ── Breadcrumb ──────────────────────────────────────────── */
.btpcp-breadcrumb {
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 24px;
}
.btpcp-breadcrumb a { color: #6b7280; text-decoration: none; }
.btpcp-breadcrumb a:hover { color: #111; }
.btpcp-sep { margin: 0 6px; }

/* ── Product layout: image left / info right ─────────────── */
.btpcp-product-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 48px;
    align-items: start;
    margin-bottom: 48px;
}
@media (max-width: 768px) {
    .btpcp-product-layout { grid-template-columns: 1fr; gap: 24px; }
}

/* ── Image column ────────────────────────────────────────── */
.btpcp-product-image-wrap {
    position: sticky;
    top: 80px;
    background: #f9fafb;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btpcp-product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 24px;
}
.btpcp-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
}

/* ── Info column ─────────────────────────────────────────── */
.btpcp-product-brand {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6b7280;
}
.btpcp-product-brand a { color: inherit; text-decoration: none; }
.btpcp-product-brand a:hover { color: #111; }

.btpcp-product-title {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.3;
    color: #111;
    margin: 0 0 10px;
}

.btpcp-product-ean {
    font-size: 12px;
    color: #9ca3af;
    margin: 0 0 20px;
}
.btpcp-product-ean span { font-family: monospace; }

/* ── Price summary box ───────────────────────────────────── */
.btpcp-price-summary {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
}
.btpcp-best-price-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #15803d;
    margin-bottom: 4px;
}
.btpcp-best-price-value {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.btpcp-orig-price {
    font-size: 16px;
    color: #9ca3af;
    text-decoration: line-through;
}
.btpcp-current-price {
    font-size: 32px;
    font-weight: 800;
    color: #15803d;
    line-height: 1;
}
.btpcp-savings-badge {
    margin-top: 8px;
    display: inline-block;
    background: #dcfce7;
    color: #15803d;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

/* ── Offer list heading ──────────────────────────────────── */
.btpcp-offers-heading {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btpcp-offer-count {
    font-size: 12px;
    font-weight: 500;
    background: #e5e7eb;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 10px;
}

/* ── Offer list ──────────────────────────────────────────── */
.btpcp-offer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.btpcp-offer-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid #f3f4f6;
    background: #fff;
    position: relative;
    transition: background .12s;
}
.btpcp-offer-item:last-child { border-bottom: none; }
.btpcp-offer-item:hover { background: #f9fafb; }
.btpcp-offer-item--best {
    background: #f0fdf4;
    border-left: 3px solid #16a34a;
}
.btpcp-offer-item--best:hover { background: #dcfce7; }

.btpcp-best-badge {
    position: absolute;
    top: -1px;
    left: 18px;
    background: #16a34a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 2px 7px;
    border-radius: 0 0 5px 5px;
}

/* Merchant logo */
.btpcp-offer-logo {
    flex: 0 0 120px;
    display: flex;
    align-items: center;
}
.btpcp-offer-logo img {
    max-width: 120px;
    max-height: 34px;
    object-fit: contain;
    display: block;
}
.btpcp-logo-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Price column */
.btpcp-offer-price-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.btpcp-offer-price {
    font-size: 18px;
    font-weight: 700;
    color: #111;
}
.btpcp-offer-price--best { color: #15803d; }
.btpcp-offer-diff {
    font-size: 12px;
    color: #ef4444;
}

/* CTA button */
.btpcp-offer-cta {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    background: #e5e7eb;
    color: #374151;
    transition: background .12s, color .12s;
    white-space: nowrap;
}
.btpcp-offer-cta:hover { background: #d1d5db; color: #111; }
.btpcp-offer-cta--best {
    background: #f97316;
    color: #fff;
}
.btpcp-offer-cta--best:hover { background: #ea6c0a; color: #fff; }

/* ── Description ─────────────────────────────────────────── */
.btpcp-product-description {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}
.btpcp-product-description h2 {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin-bottom: 16px;
}
.btpcp-desc-content {
    color: #374151;
    line-height: 1.7;
    font-size: 15px;
}

/* ── Related products ────────────────────────────────────── */
.btpcp-related-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid #e5e7eb;
}
.btpcp-related-section h2 {
    font-size: 20px;
    font-weight: 700;
    color: #111;
    margin-bottom: 20px;
}
.btpcp-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 20px;
}
.btpcp-related-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s;
}
.btpcp-related-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.btpcp-related-image-link {
    display: block;
    background: #f9fafb;
    aspect-ratio: 1/1;
}
.btpcp-related-image-link img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
}
.btpcp-related-no-img {
    width: 100%;
    height: 100%;
    background: #f3f4f6;
}
.btpcp-related-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #f97316;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
}
.btpcp-related-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}
.btpcp-related-name {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.btpcp-related-name:hover { color: #0891b2; }
.btpcp-related-orig {
    font-size: 12px;
    color: #9ca3af;
    text-decoration: line-through;
}
.btpcp-related-price {
    font-size: 15px;
    font-weight: 700;
    color: #15803d;
}
.btpcp-related-cta {
    display: block;
    margin-top: 8px;
    background: #f97316;
    color: #fff;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background .12s;
}
.btpcp-related-cta:hover { background: #ea6c0a; color: #fff; }

/* ── Mobile tweaks ───────────────────────────────────────── */
@media (max-width: 520px) {
    .btpcp-offer-item { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
    .btpcp-offer-logo { flex: 0 0 90px; }
    .btpcp-offer-price { font-size: 16px; }
    .btpcp-offer-cta { padding: 8px 14px; font-size: 12px; }
    .btpcp-current-price { font-size: 26px; }
    .btpcp-product-title { font-size: 20px; }
}
