/**
 * TallyUp coded single templates.
 *
 * These rules replace only the layout geometry Elementor previously supplied
 * and the bundle-only visual presentation. Existing TallyUp component styling
 * in assets/css/style.css remains the primary UI source of truth.
 */

/* Keep horizontal overflow from any card slider/gallery inside the coded
   templates from shifting the entire site canvas. This is deliberately scoped
   to the coded TallyUp pages so other WooCommerce pages are untouched. */
body.tallyup-coded-single-product-page,
body.tallyup-coded-single-card-library-page {
    overflow-x: hidden;
    overflow-x: clip;
}

.tallyup-single-template {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    overflow-x: clip;
}

.tallyup-single-template,
.tallyup-single-template * {
    box-sizing: border-box;
}

.tallyup-single-template__notices {
    width: min(1440px, 100%);
    margin: 20px auto 0;
    padding: 0 30px;
}

/* Existing Elementor geometry: 1440px, 60/40 split, 35px gap. */
.tallyup-single-template__hero {
    width: 100%;
    max-width: 1440px;
    margin: 40px auto 60px;
    padding: 0 30px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 35px;
}

.tallyup-single-template__visual {
    flex: 0 1 60%;
    width: 60%;
    min-width: 0;
}

.tallyup-single-template__summary {
    flex: 0 1 40%;
    width: 40%;
    min-width: 0;
    padding: 18px 0 0;
}

/* Give the stock state a small amount of breathing room before the primary
   purchase action. */
.tallyup-single-template__summary > .tallyup-stock-status {
    margin-bottom: 10px;
}

/* Do not make the product image sticky. The image must finish before the
   description/bundle content beneath it and must never scroll over that copy. */
.tallyup-single-template__visual-gallery {
    position: static;
    width: 100%;
}

/* Restore the sense of an image panel without returning to the heavier grey
   Elementor background. */
.tallyup-single-template__visual-gallery .tallyup-gallery,
.tallyup-card-library-single-gallery {
    height: auto;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

/* Keep the card artwork just clear of the image-panel border. The side spacing
   remains unchanged so this is visually identical apart from the requested
   small top/bottom breathing room. */
.tallyup-single-template__visual-gallery .tallyup-gallery {
    padding-top: 6px;
    padding-bottom: 6px;
}

/* Existing Elementor/Raven short-description typography. */
.tallyup-single-template__short-description {
    margin: 22px 0 0;
    color: #797979;
    font-family: "Poppins", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
}

.tallyup-single-template__short-description > :last-child,
.tallyup-single-template__description-copy > :last-child {
    margin-bottom: 0;
}

/* Product Description remains directly below the image. */
.tallyup-single-template__description {
    margin-top: 20px;
}

.tallyup-single-template__description-title {
    margin: 0;
    color: #121212;
    font-family: "almaq-rough", sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 24px;
}

.tallyup-single-template__description-copy {
    margin-top: 16px;
}

/* The bundle section is deliberately separate from Product Description. */
.tallyup-single-template__bundle-contents {
    margin-top: 52px;
}

.tallyup-single-template__bundle-contents > .tallyup-single-template__description-title {
    margin-bottom: 20px;
}

/* Keep clear vertical separation between the seller action, the card-detail
   panel and the vendor/store block. */
.tallyup-single-template__summary > .tallyup-card-details {
    margin-top: 28px;
}

.tallyup-single-template__summary > .tallyup-vendor-card {
    margin-top: 26px;
}

/* Existing repeated slider sections. */
.tallyup-single-template__section {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto 80px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.tallyup-single-template__section-title {
    margin: 0;
    color: #121212;
    font-family: "almaq-rough", sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 24px;
    text-align: center;
}

.tallyup-single-template__section-content {
    width: 100%;
    min-width: 0;
}

.tallyup-single-template__section-content > .tallyup-slider-container,
.tallyup-single-template__section-content > .tallyup-recommendation-slider,
.tallyup-single-template__section-content > .tallyup-recommendation-empty {
    width: 100%;
}

/* Existing market-stats placement. Bundle pages do not render this section. */
.tallyup-single-template__market {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto 79px;
    padding: 0 30px;
}

.tallyup-single-template__market > .bc-card-stats,
.tallyup-single-template__market > .tallyup-membership-lock,
.tallyup-single-template__market > * {
    width: 100%;
}

/* Card Library single image uses the same image-panel geometry and placeholder
   behaviour as the Library/feed image helper. */
.tallyup-card-library-single-gallery__spacer {
    display: block;
    width: 100%;
    min-width: 0;
}

.tallyup-card-library-single-gallery .tallyup-gallery-image {
    cursor: default;
}

/* ------------------------------------------------------------
   Bundle summary actions
   Contact Seller keeps its existing white/black treatment. The full-list
   action is its inverse, matching the black Tally action language.
------------------------------------------------------------ */
.tallyup-single-template__bundle-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

body.single-product .tallyup-single-template__bundle-actions .tallyup-contact-seller-button {
    margin-top: 0 !important;
}

body.single-product .tallyup-view-bundle-list-button {
    width: auto;
    min-width: 210px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 12px 20px;
    border: 2px solid #151515;
    border-radius: 14px;
    background: #151515;
    color: #ffffff;
    box-shadow: none;
    font-weight: 900;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease;
}

body.single-product .tallyup-view-bundle-list-button:hover,
body.single-product .tallyup-view-bundle-list-button:focus {
    border-color: #151515;
    background: #151515;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #151515;
    outline: none;
}

/* ------------------------------------------------------------
   Bundle contents: compact visual cards
------------------------------------------------------------ */
.tallyup-bundle-card-grid {
    width: 100%;
    display: grid;
    /* Bundle cards keep the compact desktop footprint at every viewport.
       Additional space is left empty rather than stretching cards wider. */
    grid-template-columns: repeat(auto-fill, minmax(140px, 150px));
    gap: 14px;
    align-items: stretch;
    justify-content: start;
}

.tallyup-bundle-card-tile {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid #dedede;
    border-radius: 8px;
    background: #ffffff;
    color: #171717;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: none;
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.tallyup-bundle-card-tile:hover,
.tallyup-bundle-card-tile:focus,
.tallyup-bundle-card-tile:focus-visible {
    border-color: #bcbcbc;
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(0, 0, 0, .08);
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
}

.tallyup-bundle-card-tile__image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 7;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 5px;
    background: #f5f5f5;
}

.tallyup-bundle-card-tile__image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.tallyup-bundle-card-tile__reference {
    position: absolute;
    right: 6px;
    bottom: 6px;
    max-width: calc(100% - 12px);
    padding: 4px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .92);
    color: #555;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
}

.tallyup-bundle-card-tile__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tallyup-bundle-card-tile__name {
    display: block;
    color: #171717;
    font-family: "almaq-rough", sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.08;
}

.tallyup-bundle-card-tile__number-year,
.tallyup-bundle-card-tile__series,
.tallyup-bundle-card-tile__condition {
    display: block;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
}

.tallyup-bundle-card-tile__condition {
    margin-top: 3px;
    color: #333;
    font-weight: 800;
}

.tallyup-bundle-empty {
    margin: 0;
    color: #666;
}

/* ------------------------------------------------------------
   Bundle card detail modal
------------------------------------------------------------ */
body.tallyup-bundle-modal-open {
    overflow-y: hidden;
    overflow-x: clip;
}

.tallyup-bundle-card-modal[hidden] {
    display: none !important;
}

.tallyup-bundle-card-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.tallyup-bundle-card-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .72);
}

.tallyup-bundle-card-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(1080px, 100%);
    max-height: calc(100vh - 56px);
    overflow: auto;
    padding: 28px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
}

.tallyup-bundle-card-modal__close {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 2;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
}

.tallyup-bundle-card-modal__close:focus,
.tallyup-bundle-card-modal__close:focus-visible,
.tallyup-bundle-card-modal__close:active {
    outline: none !important;
    box-shadow: none !important;
}

.tallyup-bundle-card-modal__layout {
    display: grid;
    grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr);
    gap: 34px;
    align-items: start;
}

.tallyup-bundle-card-modal__visual {
    min-width: 0;
}

.tallyup-bundle-card-modal__visual img {
    width: 100%;
    max-height: 620px;
    display: block;
    object-fit: contain;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    background: #f7f7f7;
}

.tallyup-bundle-card-modal__image-note {
    margin: 10px 0 0;
    color: #707070;
    font-size: 12px;
    line-height: 1.35;
}

.tallyup-bundle-card-modal__content {
    min-width: 0;
    padding-top: 6px;
}

.tallyup-bundle-card-modal__content h3 {
    margin: 0 42px 20px 0;
    color: #111;
    font-family: "almaq-rough", sans-serif;
    font-size: 30px;
    line-height: 1.05;
}

.tallyup-bundle-card-modal__details {
    margin: 0;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px 16px;
    background: #fafafa;
}

.tallyup-bundle-card-modal__details > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 6px 0;
    border-bottom: 1px solid #ececec;
}

.tallyup-bundle-card-modal__details > div:last-child {
    border-bottom: 0;
}

.tallyup-bundle-card-modal__details dt {
    color: #555;
    font-weight: 700;
}

.tallyup-bundle-card-modal__details dd {
    margin: 0;
    color: #111;
    font-weight: 500;
    text-align: right;
}

.tallyup-bundle-card-modal__market {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e5;
}

.tallyup-bundle-card-modal__market h4 {
    margin: 0 0 14px;
    color: #111;
    font-family: "almaq-rough", sans-serif;
    font-size: 22px;
    line-height: 1.1;
}

.tallyup-bundle-card-modal__market-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.tallyup-bundle-card-modal__market-summary > div {
    padding: 12px 14px;
    border-radius: 7px;
    background: #f5f5f5;
}

.tallyup-bundle-card-modal__market-summary span,
.tallyup-bundle-card-modal__market-summary strong {
    display: block;
}

.tallyup-bundle-card-modal__market-summary span {
    margin-bottom: 3px;
    color: #666;
    font-size: 12px;
    font-weight: 700;
}

.tallyup-bundle-card-modal__market-summary strong {
    color: #111;
    font-size: 17px;
}

.tallyup-bundle-card-modal__chart-wrap {
    position: relative;
    width: 100%;
    height: 240px;
}

.tallyup-bundle-card-modal__chart {
    width: 100% !important;
    height: 240px !important;
}

.tallyup-bundle-card-modal__market-empty {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* ------------------------------------------------------------
   Full bundle card list modal
   This is the compact verification view; the visual card grid remains fully
   visible on the product page and is never hidden behind progressive loading.
------------------------------------------------------------ */
.tallyup-bundle-list-modal__dialog {
    width: min(1180px, 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tallyup-bundle-list-modal__heading {
    flex: 0 0 auto;
    margin: 0 46px 18px 0;
}

.tallyup-bundle-list-modal__heading h3 {
    margin: 0;
    color: #111;
    font-family: "almaq-rough", sans-serif;
    font-size: 30px;
    line-height: 1.05;
}

.tallyup-bundle-list-modal__heading p {
    margin: 7px 0 0;
    color: #666;
    font-size: 14px;
    font-weight: 700;
}

.tallyup-bundle-list-modal__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    border: 1px solid #dedede;
    border-radius: 9px;
    background: #ffffff;
}

.tallyup-bundle-list-table {
    width: 100%;
    min-width: 860px;
    border-collapse: separate;
    border-spacing: 0;
    color: #222;
    font-size: 14px;
    line-height: 1.25;
}

.tallyup-bundle-list-table th,
.tallyup-bundle-list-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
}

.tallyup-bundle-list-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #151515;
    color: #ffffff;
    font-weight: 900;
    white-space: nowrap;
}

.tallyup-bundle-list-table tbody tr:nth-child(odd) td {
    background: #f2f2f2;
}

.tallyup-bundle-list-table tbody tr:nth-child(even) td {
    background: #fafafa;
}

.tallyup-bundle-list-table tbody tr + tr td {
    border-top: 1px solid #ffffff;
}

.tallyup-bundle-list-table td:first-child,
.tallyup-bundle-list-table td:nth-child(3),
.tallyup-bundle-list-table td:last-child {
    white-space: nowrap;
}

.tallyup-bundle-list-table td strong {
    color: #171717;
    font-family: "almaq-rough", sans-serif;
    font-size: 15px;
    line-height: 1.1;
}

@media (max-width: 1024px) {
    .tallyup-single-template__hero {
        flex-direction: column-reverse;
        padding-left: 20px;
        padding-right: 20px;
    }

    .tallyup-single-template__visual,
    .tallyup-single-template__summary {
        flex-basis: auto;
        width: 100%;
    }

    .tallyup-single-template__section,
    .tallyup-single-template__market {
        padding-left: 30px;
        padding-right: 30px;
    }
}

@media (max-width: 760px) {
    .tallyup-bundle-card-grid {
        grid-template-columns: repeat(2, minmax(130px, 160px));
        column-gap: 12px;
        row-gap: 14px;
        justify-content: center;
    }

    .tallyup-bundle-card-grid > .tallyup-bundle-card-tile:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        justify-self: center;
        width: min(160px, 100%);
    }

    .tallyup-single-template__bundle-actions {
        flex-wrap: nowrap;
        gap: 8px;
    }

    body.single-product .tallyup-single-template__bundle-actions .tallyup-contact-seller-button,
    body.single-product .tallyup-view-bundle-list-button {
        min-width: 0 !important;
        min-height: 46px !important;
        padding: 10px 14px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }

    .tallyup-bundle-list-modal__dialog {
        padding: 22px 18px;
    }

    .tallyup-bundle-list-modal__heading h3 {
        font-size: 26px;
    }

    .tallyup-bundle-card-modal {
        padding: 14px;
    }

    .tallyup-bundle-card-modal__dialog {
        max-height: calc(100vh - 28px);
        padding: 22px 18px;
    }

    .tallyup-bundle-card-modal__layout {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .tallyup-bundle-card-modal__visual img {
        max-height: 430px;
    }

    .tallyup-bundle-card-modal__market-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .tallyup-single-template__hero {
        padding-left: 20px;
        padding-right: 20px;
    }

    .tallyup-single-template__summary {
        margin-top: 30px;
    }

    .tallyup-single-template__section {
        margin-bottom: 200px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .tallyup-single-template__market,
    .tallyup-single-template__notices {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 350px) {
    .tallyup-single-template__bundle-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 420px) {
    .tallyup-bundle-card-grid {
        grid-template-columns: repeat(2, minmax(120px, 150px));
        gap: 10px;
        justify-content: center;
    }

    .tallyup-bundle-card-grid > .tallyup-bundle-card-tile:last-child:nth-child(odd) {
        width: min(150px, 100%);
    }

    .tallyup-bundle-card-tile {
        padding: 8px;
    }
}

/* A single product image is not a slider. With the arrow buttons omitted, let
   the image wrapper use the full gallery width rather than inheriting the
   three-column navigation grid. */
.tallyup-single-template__visual-gallery .tallyup-gallery--single-image {
    grid-template-columns: minmax(0, 1fr);
}
