/* Product Catalog — Frontend Styles */

/* .tdp-catalog: no max-width / margin / padding box — fills the content column
   as laid out by the theme (.entry-content). */

/* Tabs */
.tdp-catalog-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    border-bottom: 2px solid #e5e5e5;
    margin-bottom: 2rem;
    scrollbar-width: none;
}
.tdp-catalog-tabs::-webkit-scrollbar { display: none; }
.tdp-tab {
    padding: 0.75rem 1.25rem;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
a.tdp-tab,
a.tdp-tab:hover {
    text-decoration: none;
}
.tdp-tab:hover { color: #161e2e; }
.tdp-tab.active {
    color: #0000ff;
    border-bottom-color: #0000ff;
}
.tdp-tab-count {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
    margin-left: 4px;
}

/* Grid */
.tdp-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}
.tdp-catalog-empty {
    grid-column: 1 / -1;
    margin: 0;
    color: #6b7280;
}

/* Product Card */
.tdp-product-card {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.tdp-product-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    border-color: #c7d2fe;
}
.tdp-product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.tdp-product-link:hover { text-decoration: none; }
.tdp-product-image {
    position: relative;
    background: #fff;
    aspect-ratio: 1/1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tdp-product-image img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
    padding: 0.75rem;
    box-sizing: border-box;
}
.tdp-product-placeholder {
    width: 100%;
    height: 100%;
    background: #fff;
}
.tdp-product-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: #0000ff;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 3px;
}
.tdp-product-info {
    padding: 1rem 1rem 0.75rem;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px 12px;
    flex: 1 1 auto;
}
.tdp-product-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.35;
    color: #161e2e;
}
.tdp-product-price {
    flex: 0 0 auto;
    padding-top: 1px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-muted, #6b7280);
    white-space: nowrap;
}

/* Store buttons — full-width so the lower half of the card stays even */
.tdp-product-stores {
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
    margin-top: auto;
}
.tdp-store-action {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
    width: 100%;
}
/* Store CTAs = theme .btn-primary. Extra specificity beats a.btn-primary. */
.tdp-product-card a.tdp-store-btn.btn-primary,
.tdp-product-card a.tdp-store-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 20px;
    background: var(--btn-primary-bg, #0000ff);
    color: #fff !important;
    border: 2px solid var(--btn-primary-bg, #0000ff);
    border-radius: var(--btn-radius, 8px);
    font-family: var(--btn-font, inherit);
    font-size: var(--btn-font-size, 16px);
    font-weight: var(--btn-weight, 600);
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    box-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.tdp-product-card a.tdp-store-btn.btn-primary:hover,
.tdp-product-card a.tdp-store-btn:hover {
    background: var(--btn-primary-bg-hover, #0000cc);
    border-color: var(--btn-primary-bg-hover, #0000cc);
    color: #fff !important;
    text-decoration: none;
    opacity: 1;
}
/* Destination host only — not the full affiliate URL */
.tdp-store-domain {
    display: block;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.3;
    color: #6b7280;
    word-break: break-all;
    text-align: center;
}
.tdp-single-stores {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: flex-start;
}
.tdp-single-stores .tdp-store-action {
    align-items: center;
    width: auto;
    max-width: 100%;
}
.tdp-single-stores a.tdp-store-btn.btn-primary,
.tdp-single-stores a.tdp-store-btn {
    display: inline-block;
    width: auto;
    min-width: 140px;
}
.tdp-single-stores .tdp-store-domain {
    text-align: center;
    width: 100%;
}

/* ─── Single Product Page ─── */
.tdp-single-product { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }
.tdp-single-product-header { display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: 2rem; }
.tdp-single-product-image { flex: 0 0 400px; max-width: 100%; }
.tdp-single-product-image img { width: 100%; height: auto; border-radius: 8px; }
.tdp-single-product-meta { flex: 1; min-width: 250px; }
.tdp-single-product-meta h1 { font-size: 2rem; margin: 0 0 0.5rem; }
.tdp-single-badge { display: inline-block; background: #0000ff; color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase; padding: 4px 12px; border-radius: 3px; margin-bottom: 1rem; }
.tdp-single-product .tdp-single-price {
    display: block;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-muted, #6b7280);
}
.tdp-single-stores { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.tdp-single-stores .tdp-store-btn { padding: 10px 24px; font-size: 15px; }
.tdp-single-description { line-height: 1.75; margin-bottom: 2rem; }
.tdp-specs-title { font-size: 1.25rem; margin: 0 0 1rem; }
.tdp-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 0 2rem;
}
.tdp-spec {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}
.tdp-spec:nth-child(odd) { border-right: 1px solid #e5e7eb; }
.tdp-spec-label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
}
.tdp-spec-value {
    display: block;
    font-weight: 700;
    color: #161e2e;
}
@media (max-width: 600px) {
    .tdp-specs { grid-template-columns: 1fr; }
    .tdp-spec:nth-child(odd) { border-right: 0; }
}
.tdp-single-source { padding: 1rem; background: #f9fafb; border-radius: 8px; font-size: 14px; }
.tdp-single-source a { font-weight: 600; color: #0000ff; }

/* Related products */
.tdp-related { margin-top: 3rem; }
.tdp-related-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.tdp-related h2 { font-size: 1.25rem; margin: 0; }
.tdp-related-head a { font-size: 14px; font-weight: 600; }
.tdp-related .tdp-catalog-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Regional buy box. Shown only when a product has extra store rows. */
.tdp-single-product .tdp-offer {
    position: relative;
    max-width: 100%;
    margin: 0 0 1rem;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    color: #161e2e;
}
.tdp-single-product .tdp-offer p {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
}
.tdp-single-product .tdp-offer svg.tdp-flag {
    display: inline-block;
    width: 20px;
    height: 15px;
    border-radius: 2px;
    flex: none;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(1, 10, 55, 0.12);
    vertical-align: middle;
}
.tdp-single-product .tdp-offer__loc {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 16px;
    background: #f6f7f9;
    border-bottom: 1px solid #e5e5e5;
}
.tdp-single-product .tdp-offer__loc-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.3;
}
.tdp-single-product .tdp-offer__loc-label b {
    color: #010a37;
    font-weight: 600;
}
.tdp-single-product .tdp-offer__change {
    display: none;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: #0000ff;
    font: 600 13px/1.3 inherit;
    cursor: pointer;
    white-space: nowrap;
}
.tdp-single-product .tdp-offer.is-ready .tdp-offer__change {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.tdp-single-product .tdp-offer__change:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.tdp-single-product .tdp-offer__body { padding: 16px 16px 14px; }
.tdp-single-product .tdp-offer__store {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: #010a37;
}
.tdp-single-product .tdp-offer__store .tdp-flag { width: 16px; height: 12px; }
.tdp-single-product .tdp-offer__tag {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
}
.tdp-single-product .tdp-offer__tag--local {
    background: #e8f7ef;
    color: #0b6b3f;
}
.tdp-single-product .tdp-offer__price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 8px;
}
.tdp-single-product .tdp-offer__amount {
    font-size: 32px;
    line-height: 40px;
    font-weight: 800;
    color: #010a37;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}
.tdp-single-product .tdp-offer__currency {
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.02em;
}
.tdp-single-product .tdp-offer__note {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.4;
    color: #6b7280;
}
.tdp-single-product a.tdp-offer__cta.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 16px;
    white-space: normal;
}
.tdp-single-product .tdp-offer__domain {
    margin-top: 10px;
    font-size: 12px;
    line-height: 16px;
    color: #6b7280;
    text-align: center;
}
.tdp-single-product .tdp-offer__more { border-top: 1px solid #e5e5e5; }
.tdp-single-product .tdp-offer__more summary {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    min-height: 48px;
    padding: 0 16px;
    font-size: 14px;
    line-height: 1.3;
    color: #161e2e;
    cursor: pointer;
    list-style: none;
}
.tdp-single-product .tdp-offer__more summary > span:first-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tdp-single-product .tdp-offer__more summary::-webkit-details-marker { display: none; }
.tdp-single-product .tdp-offer__more summary b { color: #010a37; font-weight: 600; }
.tdp-single-product .tdp-offer__more summary .tdp-offer__chev {
    flex: none;
    margin-left: 0;
    color: #6b7280;
    transition: transform 0.15s ease;
}
.tdp-single-product .tdp-offer__more[open] summary .tdp-offer__chev { transform: rotate(180deg); }
.tdp-single-product .tdp-offer__flags {
    display: inline-flex;
    align-items: center;
    flex: none;
    gap: 4px;
    margin-left: auto;
}
.tdp-single-product .tdp-offer__flags .tdp-flag {
    width: 20px;
    height: 15px;
    margin: 0;
    box-shadow: 0 0 0 1px rgba(1, 10, 55, 0.12);
}
.tdp-single-product .tdp-offer__more-extra {
    margin-left: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
}
.tdp-single-product .tdp-offer__more ul { padding: 0 0 8px; }
.tdp-single-product .tdp-offer__more li { line-height: 1.3; }
.tdp-single-product .tdp-offer__more li + li a { border-top: 1px solid #f0f1f4; }
.tdp-single-product .tdp-offer__more a {
    display: grid;
    grid-template-columns: 20px 1fr auto;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 8px 16px;
    color: inherit;
    text-decoration: none;
}
.tdp-single-product .tdp-offer__more a:hover { background: #f6f7f9; }
.tdp-single-product .tdp-offer__more a:hover .tdp-offer__more-name { color: #0000ff; }
.tdp-single-product .tdp-offer__more-name {
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    color: #010a37;
}
.tdp-single-product .tdp-offer__more small {
    display: block;
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
    color: #6b7280;
}
.tdp-single-product .tdp-offer__more b {
    text-align: right;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 700;
    color: #010a37;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.tdp-single-product .tdp-offer__more b small {
    display: inline;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 600;
}
.tdp-single-product .tdp-offer-live {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.tdp-single-product .tdp-offer-commission {
    margin: 0 0 1.5rem;
    font-size: 13px;
    line-height: 1.5;
    color: #6b7280;
}
.tdp-offer-dialog {
    width: min(420px, calc(100vw - 24px));
    max-height: min(640px, calc(100vh - 16px));
    overflow: auto;
    overscroll-behavior: contain;
    padding: 0;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    background: #fff;
    color: #161e2e;
    box-shadow: 0 16px 48px rgba(1, 10, 55, 0.18), 0 2px 8px rgba(1, 10, 55, 0.08);
}
.tdp-offer-dialog::backdrop { background: rgba(1, 10, 55, 0.28); }
.tdp-offer-dialog__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px 12px;
}
.tdp-offer-dialog__head h2 {
    margin: 0;
    font-size: 16px;
    line-height: 24px;
    font-weight: 700;
    color: #010a37;
}
.tdp-offer-dialog__head p {
    margin: 2px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: #6b7280;
}
.tdp-offer-dialog__close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin: -4px -8px 0 auto;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #6b7280;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.tdp-offer-dialog__close:hover { background: #f6f7f9; color: #010a37; }
.tdp-offer-dialog__list { margin: 0; padding: 0 0 8px; list-style: none; }
.tdp-offer-dialog__list button {
    display: grid;
    grid-template-columns: 20px 1fr auto 18px;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 8px 20px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.tdp-offer-dialog__list li + li button { border-top: 1px solid #f0f1f4; }
.tdp-offer-dialog__list button:hover { background: #f6f7f9; }
.tdp-offer-dialog__list button:focus-visible { outline: 2px solid #0000ff; outline-offset: -2px; }
.tdp-offer-dialog__list span {
    min-width: 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    color: #010a37;
}
.tdp-offer-dialog__list small {
    display: block;
    overflow: hidden;
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
    color: #6b7280;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tdp-offer-dialog__list b {
    text-align: right;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 700;
    color: #010a37;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.tdp-offer-dialog__list b small {
    display: inline;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 600;
}
.tdp-offer-dialog .tdp-flag {
    display: block;
    width: 20px;
    height: 15px;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(1, 10, 55, 0.12);
}
.tdp-offer-dialog .tdp-offer-check { visibility: hidden; color: #0000ff; }
.tdp-offer-dialog [aria-selected="true"] { background: #f2f4ff; box-shadow: inset 3px 0 0 #0000ff; }
.tdp-offer-dialog [aria-selected="true"] .tdp-offer-check { visibility: visible; }
@media (max-width: 700px) {
    .tdp-single-product .tdp-offer__amount { font-size: 28px; line-height: 36px; }
    .tdp-single-product .tdp-offer__flags .tdp-flag:nth-child(n+4),
    .tdp-single-product .tdp-offer__more-extra { display: none; }
    .tdp-single-product-header { gap: 1rem; }
    .tdp-single-product { margin-top: 1rem; }
    .tdp-offer-dialog {
        width: 100%;
        max-width: none;
        max-height: 88vh;
        margin-top: auto;
        margin-bottom: 0;
        border: 0;
        border-radius: 16px 16px 0 0;
    }
    .tdp-offer-dialog::backdrop { background: rgba(1, 10, 55, 0.45); }
}
@media (max-width: 360px) {
    .tdp-single-product .tdp-offer__flags .tdp-flag:nth-child(n+3) { display: none; }
    .tdp-single-product .tdp-offer__more summary { gap: 6px; padding: 0 12px; font-size: 13px; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 700px) {
    .tdp-offer-dialog[open] { animation: tdp-offer-up 0.2s ease-out; }
    @keyframes tdp-offer-up {
        from { transform: translateY(24px); }
    }
}
