/* ==========================================================
   WC Product Table — no font-family overrides
   ========================================================== */

/* Container: carries width, centering, and margin */
.wcpt-container {
    display: block;
    width: 100%;
    margin: 1em auto;
    box-sizing: border-box;
}

/* Inner wrap: border and scroll */
.wcpt-wrap {
    border: 1px solid #ddd;
    border-radius: 3px;
    overflow-x: auto;
    box-sizing: border-box;
}


.wcpt-title {
    text-align: center;
    margin: 0 0 .25em;
    padding: 0;
}

.wcpt-description {
    text-align: center;
    color: #777;
    font-size: 10pt;
    margin: 0 0 .75em;
    padding: 0;
}

.wcpt-table-scroll {
    width: 100%;
}

.wcpt-table {
    width: 100%;
    border-collapse: collapse;
}

/* Sticky header */
.wcpt-table thead tr {
    position: sticky;
    top: 0;
    z-index: 10;
}

.wcpt-table thead th {
    background: #e5e5e5;
    border-bottom: 2px solid #ccc;
    padding: 9px 10px;
    text-align: left;
    white-space: nowrap;
    vertical-align: bottom;
}

@media ( max-width: 640px ) {
    .wcpt-table thead th {
        white-space: normal;
        word-break: break-word;
    }
}

/* Alternating rows */
/* Hover uses background-color, not filter: a filter promotes every hovered row
   to its own compositing layer and repaints as the pointer crosses the table. */
.wcpt-table tbody tr.wcpt-row-even { background: #ffffff; }
.wcpt-table tbody tr.wcpt-row-odd  { background: #f0f0f8; }
.wcpt-table tbody tr.wcpt-row-even:hover { background: #f4f4f4; }
.wcpt-table tbody tr.wcpt-row-odd:hover  { background: #e6e6f2; }

/* Hidden until toggled */
.wcpt-table tbody tr.wcpt-vars-hidden { display: none; }

.wcpt-toggle-vars {
    font-size: .85em;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    opacity: .7;
}
.wcpt-toggle-vars:hover { opacity: 1; text-decoration: underline; }

/* Toggle link when variations have qty added */
.wcpt-toggle-vars.wcpt-has-qty {
    color: #4442AD;
    font-weight: bold;
    opacity: 1;
}



/* Cells */
.wcpt-table td {
    padding: 7px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #e8e8e8;
}

/* Variation sub-rows */
.wcpt-td-var .wcpt-var-name {
    padding-left: 1.4em;
    display: block;
    font-weight: normal;
}

.wcpt-var-indent { color: #bbb; }

/* Product name */
/* Name column: minimum width so it always gets reasonable space */
.wcpt-table .wcpt-col-name {
    min-width: 160px;
}

.wcpt-product-name {
    text-decoration: none;
    color: inherit;
}
.wcpt-product-name:hover { text-decoration: underline; }

/* Price */
.wcpt-price del  { display: inline; color: #999; font-size: inherit; }
.wcpt-price ins  { display: inline; text-decoration: none; color: inherit; font-weight: 600; }

/* Mobile price inside qty cell — hidden on desktop, shown on mobile */
.wcpt-qty-cell-price { display: none; }

/* SKU */
.wcpt-sku { font-size: .85em; color: #777; }

/* Stock */
.wcpt-instock    { font-size: .85em; color: #2d6a40; }
.wcpt-outofstock { font-size: .85em; color: #a03030; }
.wcpt-backorder  { font-size: .85em; color: #7a6000; }
.wcpt-unavailable { font-size: .8em; font-style: italic; }

/* Qty stepper */
.wcpt-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 3px;
    overflow: hidden;
    white-space: nowrap;
}

.wcpt-step {
    background: #f0f0f0 !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    font-size: 14px !important;
    line-height: 1 !important;
    padding: 12px !important;
    margin-bottom: 0 !important;
    color: #666 !important;
    flex-shrink: 0;
    transition: background .1s;
    box-shadow: none !important;
}

.wcpt-step:hover  { background: #ddd !important; color: #444 !important; }
.wcpt-step:active { background: #ccc !important; }

.wcpt-qty {
    width: 40px;
    text-align: center;
    padding: 4px 2px;
    border: none;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    -moz-appearance: textfield;
    outline: none;
    margin-bottom: 0;
}
.wcpt-qty::-webkit-outer-spin-button,
.wcpt-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Thumbnail */
.wcpt-thumb {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 3px;
}



/* Add-to-cart toast — fixed, so confirming an add never moves the page */
.wcpt-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(92vw, 460px);
    padding: 12px 14px;
    border-top: 3px solid #4442AD;
    border-radius: 3px;
    background: #f0f0fa;
    color: #22223a;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
    transform: translate(-50%, 12px);
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
}

.wcpt-toast.wcpt-toast-in {
    opacity: 1;
    transform: translate(-50%, 0);
}

.wcpt-toast-error {
    border-top-color: #a03030;
    background: #fdf1f1;
    color: #5c1a1a;
}

.wcpt-toast-msg {
    flex: 1 1 auto;
    font-size: .95em;
    line-height: 1.35;
}

.wcpt-toast-btn { flex: 0 0 auto; white-space: nowrap; }

/* Zero specificity, as with the banner button — the theme wins if it styles .button */
:where(.wcpt-toast-btn) {
    display: inline-block;
    padding: .5em .9em;
    border: 0;
    border-radius: 3px;
    background: #4442AD;
    color: #fff;
    font-size: .85em;
    text-decoration: none;
}

.wcpt-toast-close {
    flex: 0 0 auto;
    padding: 0 2px;
    border: 0;
    background: none;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    opacity: .55;
}
.wcpt-toast-close:hover { opacity: 1; }

@media ( max-width: 640px ) {
    /* Anchor to both edges instead of centring a content-width box. Centring
       with a max-width left the three items fighting over a narrow row and
       shrinking into slivers. Here the message takes its own full-width line
       and only the button sits below it. */
    .wcpt-toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
        transform: translateY(12px);
    }

    .wcpt-toast.wcpt-toast-in { transform: translateY(0); }

    .wcpt-toast-msg {
        flex: 1 1 100%;
        padding-right: 22px;   /* clear of the close button */
    }

    .wcpt-toast-btn { flex: 0 0 auto; }

    .wcpt-toast-close {
        position: absolute;
        top: 8px;
        right: 10px;
    }
}

@media ( prefers-reduced-motion: reduce ) {
    .wcpt-toast { transition: none; }
}

/* Inline error */
.wcpt-inline-err {
    font-size: .85em;
    color: #a03030;
    margin-right: 10px;
}



/* Action bar: centered column — show more, totals, button */
.wcpt-action-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0 4px;
    gap: 8px;
}

/* Placeholder rows reserve the incoming batch's height so the page doesn't
   jump when the response lands. Height is set inline from a measured row. */
.wcpt-placeholder-row td {
    padding: 9px 10px;
    border-bottom: 1px solid #eee;
}

.wcpt-placeholder-bar {
    display: block;
    width: 45%;
    height: 12px;
    border-radius: 3px;
    background: #e8e8ee;
    animation: wcpt-pulse 1.2s ease-in-out infinite;
}

@keyframes wcpt-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .45; }
}

@media ( prefers-reduced-motion: reduce ) {
    .wcpt-placeholder-bar { animation: none; }
}

.wcpt-load-more-link {
    /* Fixed box so swapping the label to "Loading…" doesn't reflow the bar */
    min-width: 9em;
    text-align: center;
    font-size: 16pt;
    color: #000;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    margin-bottom: 8px;
    display: inline-block;
}
.wcpt-load-more-link:hover { color: #4442AD; text-decoration: none; }

.wcpt-action-bar-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.wcpt-totals-row {
    display: flex;
    gap: 6px;
    font-size: .85em;
    white-space: nowrap;
}

.wcpt-total-qty   { font-weight: 600; }
.wcpt-total-price { font-weight: 700; }

/* Image column — fixed width */
.wcpt-table .wcpt-col-image {
    width: 50px;
    min-width: 50px;
}

/* ==========================================================
   MOBILE
   ========================================================== */
@media ( max-width: 640px ) {

    .wcpt-table-scroll { font-size: .82em; }

    .wcpt-table thead th,
    .wcpt-table td { padding: 6px 6px; }

    .wcpt-table .wcpt-mobile-hide { display: none; }

    .wcpt-table td.wcpt-attr-col { display: none; }

    .wcpt-attr-inline {
        display: block;
        color: #777;
        font-size: .85em;
        margin-top: 2px;
    }

    /* Hide price column on mobile — price shown above stepper in qty cell instead */
    .wcpt-table .wcpt-col-price { display: none; }

    /* Show price above stepper/toggle inside the qty cell on mobile */
    .wcpt-qty-cell-price {
        display: block;
        font-size: .85em;
        margin-bottom: 4px;
    }
    .wcpt-qty-cell-price del { color: #999; }
    .wcpt-qty-cell-price ins { text-decoration: none; font-weight: 600; }
    /* Strip wrapper span from render_price inside qty-cell-price */
    .wcpt-qty-cell-price .wcpt-price { display: inline; }

    .wcpt-qty { width: 32px; }
    .wcpt-step { padding: 4px 6px; font-size: 13px; }

    /* Ensure thumbnail col keeps minimum size on mobile */
    .wcpt-table .wcpt-col-image { width: 50px; min-width: 50px; }

}

/* ==========================================================
   BANNER MODE  [ckwc_product_table id="X" display="banner"]
   ========================================================== */
.wcpt-banner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    box-sizing: border-box;
    width: 100%;
    margin: 1em 0;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f7f7fb;
}

/* Carries the accent the left border used to provide */
.wcpt-banner-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: #4442AD;
}

.wcpt-banner-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.wcpt-banner-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    /* 0 1 auto, not 1 1 auto — the copy must not expand and shove the button
       out to the far edge. It sits directly beside the heading. */
    flex: 0 1 auto;
}

.wcpt-banner-text {
    font-weight: 700;
    line-height: 1.25;
}

.wcpt-banner-sub {
    color: #777;
    font-size: .85em;
    line-height: 1.3;
}

.wcpt-banner-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Fallback shape only, wrapped in :where() so it carries ZERO specificity.
   Any real theme or WooCommerce button rule outranks it and wins outright —
   this exists purely so the banner still reads as a button on a theme that
   styles nothing. Do not raise the specificity of this block. */
:where(.wcpt-banner-btn) {
    display: inline-block;
    padding: .65em 1.2em;
    border: 0;
    border-radius: 3px;
    background: #4442AD;
    color: #fff;
    font-size: .9em;
    line-height: 1.2;
    text-decoration: none;
}

@media ( max-width: 640px ) {
    /* The container already wraps, so rather than switching to a column and
       stacking the icon above the text, let icon + copy share the first line
       and force the button onto a full-width second line. */
    .wcpt-banner      { gap: 10px 12px; }
    .wcpt-banner-copy { flex: 1 1 auto; }
    .wcpt-banner-btn  { flex: 1 0 100%; text-align: center; }
}
