/* ==========================================================================
   Radian Theme — WooCommerce Overrides
   ========================================================================== */

/* --- Shop Page Header --- */

.radian-shop-header {
    margin-bottom: 2rem;
}

.radian-shop-header .radian-section-label { margin-bottom: 0.5rem; }

.radian-shop-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 1rem;
}

/* Real, wp-admin-editable description (Shop page content / category & tag
   term description) rendered by WooCommerce core between the title and meta. */
.radian-shop-header .page-description,
.radian-shop-header .term-description {
    font-size: 0.95rem;
    color: var(--color-text);
    line-height: 1.7;
    max-width: 620px;
    margin: 0 0 0.75rem;
}

.radian-shop-header .page-description p,
.radian-shop-header .term-description p {
    margin: 0 0 0.75rem;
}

.radian-shop-header .page-description p:last-child,
.radian-shop-header .term-description p:last-child {
    margin-bottom: 0;
}

.radian-shop-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0 0 1.5rem;
}

/* --- Shop Toolbar --- */

.radian-shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.radian-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Zero the bottom margin WooCommerce core puts on the result count and
   ordering form (.woocommerce ... {margin:0 0 1em}). Scoped under the toolbar
   so it out-specifies core; otherwise those two sit higher than the category
   filter in the centered flex row. */
.radian-shop-toolbar .woocommerce-result-count,
.radian-shop-toolbar .woocommerce-ordering,
.radian-shop-toolbar .radian-cat-filter {
    margin: 0;
    line-height: 1;
}

.woocommerce-result-count {
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.radian-cat-filter select,
.woocommerce-ordering select {
    min-width: 170px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.85rem;
    line-height: 1.2;
    color: var(--color-text);
    background: var(--color-bg);
    cursor: pointer;
    vertical-align: top;
}

@media (max-width: 600px) {
    .radian-toolbar-controls {
        width: 100%;
        flex-wrap: wrap;
    }
    .radian-cat-filter,
    .woocommerce-ordering,
    .radian-cat-filter select,
    .woocommerce-ordering select {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* --- Product Grid --- */

.woocommerce ul.products,
.woocommerce-page ul.products,
ul.products.columns-4,
ul.products.columns-3 {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.5rem !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none;
}

@media (max-width: 1024px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    ul.products.columns-4,
    ul.products.columns-3 { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 768px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    ul.products.columns-4,
    ul.products.columns-3 { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 480px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    ul.products.columns-4,
    ul.products.columns-3 { grid-template-columns: 1fr !important; }
}

/* --- Product Card --- */

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
ul.products li.product {
    position: relative;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-bg);
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex !important;
    flex-direction: column;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    float: none !important;
    max-width: none !important;
}

.woocommerce ul.products li.product:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.woocommerce ul.products li.product a img,
.woocommerce ul.products li.product .attachment-woocommerce_thumbnail {
    border-radius: 0;
    margin: 0;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.woocommerce ul.products li.product .woocommerce-loop-product__link {
    display: block;
    position: relative;
}

/* Sale Badge on Product Card */
.woocommerce ul.products li.product .onsale {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: #16a34a;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    z-index: 2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.4;
    margin: 0;
    min-height: auto;
    min-width: auto;
}

/* Purity Badge on Product Card */
.woocommerce ul.products li.product .radian-purity-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #dcfce7;
    color: #15803d;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    z-index: 2;
    letter-spacing: 0.02em;
}

/* Product Card Body */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0 0 0.25rem;
    padding: 0 1rem;
    display: block !important;
    visibility: visible !important;
    text-align: center;
}

.woocommerce ul.products li.product .radian-product-category {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    padding: 1rem 1rem 0.35rem;
    margin: 0;
}

.woocommerce ul.products li.product .price {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-primary);
    padding: 0 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* Stock Dot */
.radian-stock-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    flex-shrink: 0;
}
.radian-stock-dot.out-of-stock { background: var(--color-error); }

/* Add to Cart Button */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product a.button,
ul.products li.product .button,
ul.products li.product a.button {
    display: block !important;
    width: calc(100% - 2rem) !important;
    margin: auto 1rem 1rem !important;
    padding: 0.65rem 1rem !important;
    background: var(--color-primary) !important;
    color: var(--color-primary-contrast) !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    text-align: center !important;
    cursor: pointer;
    transition: background 0.15s;
    box-sizing: border-box;
}
.woocommerce ul.products li.product .button:hover,
.woocommerce ul.products li.product a.button:hover,
ul.products li.product .button:hover,
ul.products li.product a.button:hover {
    background: var(--color-primary-hover) !important;
    color: var(--color-primary-contrast) !important;
}

/* AJAX add-to-cart states — single-variation products add straight from the
   card (see radian_loop_add_to_cart_link() in inc/woocommerce.php).
   WooCommerce's .loading spinner is position:absolute, so without a
   positioning context of its own it anchors to li.product and lands in the
   card's top-right corner, on top of the favourite heart. */
.woocommerce ul.products li.product a.button,
ul.products li.product a.button {
    position: relative;
}

/* Header cart count is always in the DOM so woocommerce_add_to_cart_fragments
   has a node to replace after an AJAX add (see radian_cart_count_html()) —
   hidden rather than omitted when the cart is empty. */
.radian-cart-count--empty { display: none !important; }

/* The "View cart" link core appends after a successful add. Pulled up against
   the button's own 1rem bottom margin so the pair reads as one unit. */
.woocommerce ul.products li.product a.added_to_cart,
ul.products li.product a.added_to_cart {
    display: block;
    margin: -0.5rem 1rem 1rem;
    padding: 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    color: var(--color-primary);
    text-decoration: none;
}
.woocommerce ul.products li.product a.added_to_cart:hover,
ul.products li.product a.added_to_cart:hover {
    text-decoration: underline;
}

/* Product card title — ensure visible and properly spaced */
ul.products li.product .woocommerce-loop-product__title,
ul.products li.product h2.woocommerce-loop-product__title {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: var(--color-primary) !important;
    margin: 0 0 0.25rem !important;
    padding: 0.75rem 1rem 0 !important;
    display: block !important;
    visibility: visible !important;
    text-align: center !important;
}

/* Product card price */
ul.products li.product .price {
    padding: 0.25rem 1rem 0 !important;
    margin-bottom: 0.75rem !important;
    display: flex !important;
    align-items: baseline !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
}

/* --- Single Product --- */

.woocommerce div.product {
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    /* 25px row gap = the single source of vertical rhythm between sections */
    gap: 25px 2rem;
}

.woocommerce div.product div.images {
    width: calc(50% - 1rem);
    float: none;
    margin-bottom: 0; /* WC core adds 2em */
}

.woocommerce div.product div.summary {
    width: calc(50% - 1rem);
    float: none;
    margin-bottom: 0; /* WC core adds 2em */
}

@media (max-width: 768px) {
    .woocommerce div.product {
        flex-direction: column;
    }
    .woocommerce div.product div.images,
    .woocommerce div.product div.summary {
        width: 100%;
    }
}

/* Force full-width sections below the product image+summary */
.woocommerce div.product .woocommerce-tabs,
.woocommerce div.product .related,
.woocommerce div.product .upsells,
.woocommerce div.product .radian-tech-specs,
.radian-recently-viewed {
    width: 100%;
    flex-basis: 100%;
}

.woocommerce div.product div.images .woocommerce-product-gallery {
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: var(--color-bg-card);
}

.woocommerce div.product div.images .woocommerce-product-gallery__image,
.woocommerce div.product div.images .woocommerce-product-gallery__wrapper {
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.woocommerce div.product div.images .woocommerce-product-gallery__image img,
.woocommerce div.product div.images img.wp-post-image {
    border-radius: var(--radius-xl);
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

/* Product Title */
.woocommerce div.product .product_title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

/* Price */
.woocommerce div.product p.price,
.woocommerce div.product span.price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Original price — strikethrough, dimmed */
.woocommerce div.product .price del {
    text-decoration: line-through !important;
    opacity: 0.45;
    font-size: 1.1rem;
    font-weight: 500;
    order: -1;
}

/* Sale price — no underline, bold */
.woocommerce div.product .price ins {
    text-decoration: none !important;
    font-weight: 700;
}

/* --- Product Card Price: Sale & Range Styling --- */

/* Sale price (ins) — bold, green accent */
.woocommerce ul.products li.product .price ins {
    text-decoration: none !important;
    font-weight: 700;
    color: #16a34a;
}

/* Original price (del) — smaller, muted, strikethrough */
.woocommerce ul.products li.product .price del {
    text-decoration: line-through !important;
    opacity: 1;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-text-muted);
}

/* Non-sale prices keep default styling */
.woocommerce ul.products li.product .price > .woocommerce-Price-amount {
    font-weight: 700;
}

/* Dark mode: green still readable */
body.dark-mode .woocommerce ul.products li.product .price ins {
    color: #4ade80;
}
body.dark-mode .woocommerce ul.products li.product .price del {
    color: var(--color-text-light);
}

/* Variation swatches area */
.woocommerce div.product .variations {
    margin-bottom: 0.75rem;
}

/* Compact, single-line layout: label, swatch(es) and the Clear link all sit
   on one row instead of stacking (the swatch plugin forces th/td to
   display:block, and its swatch wrapper is a block-level flex container,
   which otherwise pushes "Clear" onto its own line below). Wraps on narrow
   screens if there isn't room. */
.woocommerce div.product .variations tbody tr {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
}

.woocommerce div.product .variations th.label,
.woocommerce div.product .variations td.value {
    display: block;
    width: auto;
    padding: 0;
    line-height: 1.3 !important;
}

.woocommerce div.product .variations td.value {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1 1 auto;
}

.woocommerce div.product .variations td.value > .variable-items-wrapper,
.woocommerce div.product .variations td.value > select {
    margin: 0;
}

.woocommerce div.product .variations .reset_variations {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* A single attribute with only one possible value has nothing to choose or
   clear — hide the swatch picker and reset link entirely (JS auto-selects
   the only option so price/stock/add-to-cart still work without a click);
   the "Size : 10 mg" label text is left in place as plain information.
   !important is required for .reset_variations: WooCommerce's own JS
   (toggleResetLink) runs .hide().fadeIn() on it once a variation is
   selected, which sets an inline display style that would otherwise
   override a plain (non-!important) rule and make Clear reappear. */
.woocommerce div.product .variations tbody:has(tr:only-child)
    td.value:has(> .variable-items-wrapper > .variable-item:only-child) .variable-items-wrapper {
    display: none !important;
}
.woocommerce div.product .variations tbody:has(tr:only-child)
    td.value:has(> .variable-items-wrapper > .variable-item:only-child) .reset_variations {
    display: none !important;
}

/* Variation swatch items — selected state */
.woo-variation-swatches .variable-items-wrapper .variable-item.selected,
.woo-variation-swatches .variable-items-wrapper .variable-item.selected:hover {
    box-shadow: 0 0 0 2px var(--color-primary) !important;
    background-color: var(--color-primary) !important;
    color: var(--color-primary-contrast) !important;
}

.woo-variation-swatches .variable-items-wrapper .variable-item.button-variable-item.selected:not(.no-stock) {
    background-color: var(--color-primary) !important;
    color: var(--color-primary-contrast) !important;
}

.woo-variation-swatches .variable-items-wrapper .variable-item.button-variable-item.selected:not(.no-stock) .variable-item-contents {
    color: var(--color-primary-contrast) !important;
}

/* Unselected swatches — subtle border */
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.selected) {
    border-color: var(--color-border) !important;
    opacity: 0.75;
    transition: opacity 0.15s, border-color 0.15s;
}

.woo-variation-swatches .variable-items-wrapper .variable-item:not(.selected):hover {
    opacity: 1;
    border-color: var(--color-primary) !important;
}

/* Stock status */
.woocommerce div.product .stock {
    font-size: 0.88rem;
    margin: 0 0 0.75rem;
}
.woocommerce div.product .stock.in-stock { color: var(--color-success); }
.woocommerce div.product .stock.out-of-stock { color: var(--color-error); }

/* Variation price/description/availability inside .single_variation_wrap —
   kill leftover default <p> top margins so they don't stack on top of the
   .variations and .stock spacing above/below them. */
.woocommerce div.product .woocommerce-variation-price,
.woocommerce div.product .woocommerce-variation-description {
    margin: 0 0 0.5rem;
}
.woocommerce div.product .woocommerce-variation-price > p,
.woocommerce div.product .woocommerce-variation-description > p {
    margin: 0;
}
/* Most variations don't set a per-variation description — don't reserve
   margin for a div that renders empty. */
.woocommerce div.product .woocommerce-variation-description:empty {
    margin: 0;
}
.woocommerce div.product .woocommerce-variation-availability {
    margin: 0;
}
.woocommerce div.product .woocommerce-variation-availability > .stock {
    margin: 0 0 0.75rem;
}

/* Research Use Disclaimer on Product */
.radian-product-disclaimer {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-left: 3px solid #D97706;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}
.radian-product-disclaimer strong {
    display: block;
    color: #D97706;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

/* Hide the plugin's default table — we render cards instead */
.wdr_bulk_table_msg.sar-table { display: none !important; }

/* Reset the plugin wrapper so it adds no padding/margin */
.awdr-bulk-customizable-table { padding: 0; margin: 0; }

/* Loading state while the table refreshes for a newly selected variation */
.awdr-bulk-customizable-table.is-loading {
    position: relative;
    min-height: 3rem;
}

.awdr-bulk-customizable-table.is-loading > * {
    opacity: 0.35;
    transition: opacity 0.15s;
    pointer-events: none;
}

.awdr-bulk-customizable-table.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.4rem;
    height: 1.4rem;
    margin: -0.7rem 0 0 -0.7rem;
    border: 2.5px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: radian-awdr-spin 0.7s linear infinite;
}

@keyframes radian-awdr-spin {
    to { transform: rotate(360deg); }
}

/* Skeleton shown on first paint while the initial per-variation bulk
   table AJAX call is in flight (see discount_table.php) — same box as
   the real card so nothing shifts when content swaps in, and the
   spinner overlay above never has to sit over empty space. */
.radian-skeleton-bar {
    display: block;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--color-border) 25%, var(--color-bg) 50%, var(--color-border) 75%);
    background-size: 200% 100%;
    animation: radian-skeleton-shimmer 1.4s ease-in-out infinite;
}

.radian-skeleton-bar--title {
    width: 6rem;
    height: 0.6rem;
    margin-bottom: 0.7rem;
}

.radian-skeleton-bar--card {
    height: 3.4rem;
    border-radius: var(--radius-md);
}

@keyframes radian-skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Volume Discounts (InstantPeptides style) --- */

.radian-volume-discounts {
    background: var(--color-bg-alt);
    border: none;
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin: 1.25rem 0;
}

.radian-volume-discounts__title {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 0.6rem;
}

.radian-volume-discounts__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
}

.radian-volume-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.7rem 0.5rem;
    background: var(--color-bg);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: default;
    transition: border-color 0.2s, background 0.2s;
}

.radian-volume-card.is-active {
    border-color: #86efac;
    background: #ecfdf5;
}

body.dark-mode .radian-volume-card.is-active {
    border-color: #22c55e;
    background: rgba(22, 163, 74, 0.15);
}

.radian-volume-card__pct {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-primary);
}

.radian-volume-card.is-active .radian-volume-card__pct {
    color: #16a34a;
}

.radian-volume-card__range {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.radian-volume-card.is-active .radian-volume-card__range {
    color: #16a34a;
}

/* Dynamic Total */
.radian-dynamic-total {
    display: none;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.radian-dynamic-total.is-visible {
    display: flex;
}

.radian-dynamic-total__label {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

.radian-dynamic-total__price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--color-primary);
}

.radian-dynamic-total__original {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    text-decoration: line-through;
}

.radian-dynamic-total__saving {
    font-size: 0.82rem;
    font-weight: 600;
    color: #22c55e;
}

/* Below the first tier the row is just "Total $x" — without this the flex gap
   still reserves space either side of the two empty spans. */
.radian-dynamic-total__original:empty,
.radian-dynamic-total__saving:empty {
    display: none;
}

/* Add to Cart */
.woocommerce div.product form.cart .button,
.woocommerce div.product form.cart button.single_add_to_cart_button {
    background: var(--color-primary) !important;
    color: var(--color-primary-contrast) !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    padding: 1rem 2rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    width: 100%;
    cursor: pointer;
    transition: background 0.15s;
}
.woocommerce div.product form.cart .button:hover,
.woocommerce div.product form.cart button.single_add_to_cart_button:hover {
    background: var(--color-primary-hover) !important;
}

/* Product Meta — SKU / Categories, each on its own line */
.woocommerce div.product .product_meta {
    margin-top: 1.5rem;
}

.woocommerce div.product .product_meta > span {
    display: block;
}

.woocommerce div.product .product_meta > span + span {
    margin-top: 0.35rem;
}

/* Quantity Input — Stepper (InstantPeptides style) */
.woocommerce div.product form.cart .radian-qty {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0;
}

.radian-qty__label {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--color-text);
    white-space: nowrap;
}

.radian-qty__controls {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--color-bg-alt);
    width: fit-content;
}

.radian-qty__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    transition: color 0.15s;
    user-select: none;
    line-height: 1;
}

.radian-qty__btn:hover {
    color: var(--color-primary);
}

.radian-qty__controls .qty {
    width: 44px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 0;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-primary);
    background: transparent;
    -moz-appearance: textfield;
    appearance: textfield;
}

.radian-qty__controls .qty::-webkit-inner-spin-button,
.radian-qty__controls .qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.radian-qty__controls .qty:focus {
    outline: none;
}

/* Cart form layout — stack: qty → total → button */
.woocommerce div.product form.cart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
    margin-bottom: 0.35rem;
}

/* Variable products nest qty + button inside this wrapper */
.woocommerce div.product .woocommerce-variation-add-to-cart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Inline variation notice */
.radian-variation-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    color: #991b1b;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s, transform 0.2s;
}

.radian-variation-notice.is-visible {
    opacity: 1;
    transform: translateY(0);
}

body.dark-mode .radian-variation-notice {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.3);
    color: #fca5a5;
}

/* Tabs */
.woocommerce-tabs.wc-tabs-wrapper { margin-bottom: 0; }
.woocommerce-tabs ul.tabs { display: none !important; }

/* .panel is needed to out-rank WC core's `.woocommerce div.product .woocommerce-tabs .panel { padding: 0 }` */
.woocommerce div.product .woocommerce-tabs .panel.woocommerce-Tabs-panel--description {
    background: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: 25px;
    margin-bottom: 0; /* WC core adds 2em; the product flex row-gap spaces sections */
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid var(--color-border);
}

.woocommerce div.product .woocommerce-tabs .panel.woocommerce-Tabs-panel--description p:last-child {
    margin-bottom: 0; /* keep inner bottom spacing equal to the 25px padding */
}

.woocommerce div.product .woocommerce-tabs .panel.woocommerce-Tabs-panel--description h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

/* Related + Upsells + Recently Viewed */
.woocommerce div.product .related,
.woocommerce div.product .upsells,
.radian-recently-viewed {
    clear: both;
    padding-top: 2rem;
    margin-top: 0;
    border-top: 1px solid var(--color-border);
}

.woocommerce div.product .related h2,
.woocommerce div.product .upsells h2,
.radian-recently-viewed h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Ensure grids inside related/upsells/recently-viewed also get proper grid */
.woocommerce div.product .related ul.products,
.woocommerce div.product .upsells ul.products,
.radian-recently-viewed ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.5rem !important;
}
@media (max-width: 1024px) {
    .woocommerce div.product .related ul.products,
    .woocommerce div.product .upsells ul.products,
    .radian-recently-viewed ul.products { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 768px) {
    .woocommerce div.product .related ul.products,
    .woocommerce div.product .upsells ul.products,
    .radian-recently-viewed ul.products { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 480px) {
    .woocommerce div.product .related ul.products,
    .woocommerce div.product .upsells ul.products,
    .radian-recently-viewed ul.products { grid-template-columns: 1fr !important; }
}

/* Infinite Scroll */
.radian-scroll-loader {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    width: 100%;
    clear: both;
}

.radian-scroll-sentinel {
    height: 1px;
    width: 100%;
    clear: both;
}

/* --- Form Layout (replaces woocommerce-layout.css form rules) --- */

.woocommerce form .form-row label { display: block; }
.woocommerce form .form-row label.checkbox { display: inline; }
.woocommerce form .form-row select,
.woocommerce form .form-row .input-text { box-sizing: border-box; width: 100%; }
.woocommerce form .form-row-first,
.woocommerce form .form-row-last { width: 48%; overflow: visible; }
.woocommerce form .form-row-first { float: left; }
.woocommerce form .form-row-last { float: right; }
.woocommerce form .form-row-wide { clear: both; }

/* Result count + ordering — laid out via flex .radian-shop-toolbar, not floats */
.woocommerce .woocommerce-result-count { float: none; }
.woocommerce .woocommerce-ordering { float: none; }

/* Cart layout */
.woocommerce table.cart img { height: auto; }
.woocommerce table.cart td.actions { text-align: right; }
.woocommerce table.cart td.actions .coupon { float: left; }
.woocommerce .cart-collaterals { width: 100%; }
.woocommerce .cart-collaterals::after { content: ''; display: table; clear: both; }
.woocommerce .cart-collaterals .cart_totals { float: right; width: 48%; }

/* Checkout payment */
.woocommerce #payment .wc-terms-and-conditions,
.woocommerce #payment .terms { text-align: left; padding: 0 1em 0 0; float: left; }
.woocommerce #payment #place_order { float: right; }

/* My Account layout */
.woocommerce-account .woocommerce-MyAccount-navigation { float: left; width: 30%; }
.woocommerce-account .woocommerce-MyAccount-content { float: right; width: 68%; }
@media (max-width: 768px) {
    .woocommerce-account .woocommerce-MyAccount-navigation,
    .woocommerce-account .woocommerce-MyAccount-content { float: none; width: 100%; }
}

/* Pagination */
.woocommerce .woocommerce-pagination ul.page-numbers { display: inline-flex; gap: 0.25rem; list-style: none; margin: 1.5rem 0; padding: 0; }

/* Two-col layout */
.woocommerce .col2-set::after { content: ''; display: table; clear: both; }
.woocommerce .col2-set .col-1 { float: left; width: 48%; }
.woocommerce .col2-set .col-2 { float: right; width: 48%; }

/* --- Cart & Checkout --- */

.woocommerce table.shop_table {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.woocommerce table.shop_table th {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

/* --- My Account --- */

.woocommerce-account .woocommerce-MyAccount-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li a {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    transition: background 0.15s;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li a:hover,
.woocommerce-account .woocommerce-MyAccount-navigation ul li.is-active a {
    background: var(--color-bg-alt);
    color: var(--color-primary);
}

/* Orders list actions. WooCommerce's template echoes each button straight after
   the last with no whitespace between them, so without this they render edge to
   edge as one lump. */
.woocommerce-account .woocommerce-orders-table a.button + a.button {
    margin-left: 0.4rem;
}

/* "Pay" is the action we want taken on an unpaid order, so it gets filled
   treatment while View / Cancel keep WooCommerce's default grey pill.
   inc/payment-gateway-ui.php adds it for unpaid Cash App / Venmo orders (which
   sit in on-hold, a status WooCommerce's own Pay action doesn't cover). */
.woocommerce-account .woocommerce-orders-table a.button.pay {
    background: var(--color-primary);
    color: var(--color-primary-contrast);
}
.woocommerce-account .woocommerce-orders-table a.button.pay:hover {
    background: var(--color-primary-hover);
    color: var(--color-primary-contrast);
}

/* Notices */
.woocommerce-message,
.woocommerce-info {
    border-top-color: var(--color-primary);
    background: var(--color-bg-alt);
    border-radius: var(--radius-sm);
}

.woocommerce-error {
    border-top-color: var(--color-error);
    background: #FEF2F2;
    border-radius: var(--radius-sm);
}

/* --- Favorites --- */

.radian-favorite-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    padding: 0;
}

.radian-favorite-btn .radian-favorite-icon {
    transition: transform 0.2s ease, color 0.15s, fill 0.15s;
    flex-shrink: 0;
}

.radian-favorite-btn.is-favorited .radian-favorite-icon {
    color: var(--color-error);
    fill: var(--color-error);
}

.radian-favorite-btn.is-popping .radian-favorite-icon {
    transform: scale(1.25);
}

/* Card overlay variant */
.radian-favorite-btn--card {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 3;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    opacity: 0.55;
    transition: opacity 0.2s ease, background 0.15s, box-shadow 0.15s;
}
.radian-favorite-btn--card:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
ul.products li.product:hover .radian-favorite-btn--card,
.radian-favorite-btn--card:hover,
.radian-favorite-btn--card.is-favorited {
    opacity: 1;
}

body.dark-mode .radian-favorite-btn--card {
    background: rgba(31, 41, 55, 0.85);
}
body.dark-mode .radian-favorite-btn--card:hover {
    background: rgba(31, 41, 55, 1);
}

/* Single product variant — secondary outline button below Add to Cart */
.radian-favorite-single-wrap {
    margin-top: 0.35rem;
}

.radian-favorite-btn--single {
    width: 100%;
    padding: 0.85rem 1.5rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
}
.radian-favorite-btn--single:hover {
    border-color: var(--color-text-light);
    background: var(--color-bg-alt);
}
.radian-favorite-btn--single.is-favorited {
    border-color: var(--color-error);
}

/* My Account — Favorites tab empty state */
.radian-favorites-empty {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    padding: 1rem 0;
}

/* --- Smallscreen replacements (cart, checkout, forms — NOT product grids) --- */

@media (max-width: 768px) {
    .woocommerce .col2-set .col-1,
    .woocommerce .col2-set .col-2 { float: none; width: 100%; }

    .woocommerce div.product div.images,
    .woocommerce div.product div.summary { float: none; width: 100%; }

    .woocommerce table.cart td.actions { text-align: left; }
    .woocommerce table.cart td.actions .coupon { float: none; padding-bottom: 0.5em; }
    .woocommerce table.cart td.actions .button { display: block; width: 100%; }

    .woocommerce .cart-collaterals .cart_totals,
    .woocommerce .cart-collaterals .shipping_calculator,
    .woocommerce .cart-collaterals .cross-sells { width: 100%; float: none; text-align: left; }

    .woocommerce #payment .terms { text-align: left; padding: 0; }
    .woocommerce #payment #place_order { float: none; width: 100%; margin-bottom: 1em; }

    .woocommerce .lost_reset_password .form-row-first,
    .woocommerce .lost_reset_password .form-row-last { width: 100%; float: none; }

    .woocommerce-account .woocommerce-MyAccount-navigation,
    .woocommerce-account .woocommerce-MyAccount-content { float: none; width: 100%; }
}

/* Responsive table */
@media (max-width: 768px) {
    .woocommerce table.shop_table_responsive thead { display: none; }
    .woocommerce table.shop_table_responsive tbody th { display: none; }
    .woocommerce table.shop_table_responsive tr { display: block; }
    .woocommerce table.shop_table_responsive tr td {
        display: block;
        text-align: right !important;
    }
    .woocommerce table.shop_table_responsive tr td::before {
        content: attr(data-title) ': ';
        font-weight: 700;
        float: left;
    }
    .woocommerce table.shop_table_responsive tr td.product-remove::before,
    .woocommerce table.shop_table_responsive tr td.actions::before { display: none; }
}

/* ==========================================================================
   NUCLEAR GRID OVERRIDE
   WooCommerce applies float/width/clear via inline styles and .first/.last
   classes. This section must come LAST to win specificity battles.
   ========================================================================== */

/* Kill all floats and inline widths on product items */
.woocommerce ul.products[class] li.product,
.woocommerce-page ul.products[class] li.product,
body ul.products li.product,
body .related ul.products li.product,
body .upsells ul.products li.product,
body .radian-recently-viewed ul.products li.product {
    width: auto !important;
    float: none !important;
    clear: none !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    margin-bottom: 0 !important;
}

/* Kill WooCommerce's .first/.last width hacks */
.woocommerce ul.products li.product.first,
.woocommerce ul.products li.product.last {
    clear: none !important;
    margin-right: 0 !important;
}

/* Force grid on every product list — highest specificity */
body .woocommerce ul.products,
body .woocommerce-page ul.products,
body ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.5rem !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    float: none !important;
    width: 100% !important;
}

/* CRITICAL: WooCommerce's general stylesheet adds clearfix pseudo-elements
   (.woocommerce ul.products::before/::after { content:" "; display:table }).
   When the <ul> becomes a grid, these pseudo-elements turn into grid items
   and consume grid cells, breaking the column flow. Neutralize them. */
body .woocommerce ul.products::before,
body .woocommerce ul.products::after,
body .woocommerce-page ul.products::before,
body .woocommerce-page ul.products::after,
body ul.products::before,
body ul.products::after {
    content: none !important;
    display: none !important;
}

body .related.products ul.products,
body .upsells ul.products,
body .radian-recently-viewed ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.5rem !important;
}

@media (max-width: 1024px) {
    body .woocommerce ul.products,
    body .woocommerce-page ul.products,
    body ul.products,
    body .related.products ul.products,
    body .upsells ul.products,
    body .radian-recently-viewed ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
@media (max-width: 768px) {
    body .woocommerce ul.products,
    body .woocommerce-page ul.products,
    body ul.products,
    body .related.products ul.products,
    body .upsells ul.products,
    body .radian-recently-viewed ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 480px) {
    body .woocommerce ul.products,
    body .woocommerce-page ul.products,
    body ul.products,
    body .related.products ul.products,
    body .upsells ul.products,
    body .radian-recently-viewed ul.products {
        grid-template-columns: 1fr !important;
    }
}

/* My Account — Favorites grid: 3 per row instead of the site-wide 4.
   Matches the "highest specificity" pattern above (body prefix) since
   ul.products columns are fought over by several rules in this file. */
body .radian-favorites-grid ul.products {
    grid-template-columns: repeat(3, 1fr) !important;
}
@media (max-width: 768px) {
    body .radian-favorites-grid ul.products { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 480px) {
    body .radian-favorites-grid ul.products { grid-template-columns: 1fr !important; }
}

/* --- Back In Stock Notifier ("Email when stock available") --- */

.cwginstock-subscribe-form {
    margin: 1.25rem 0;
    max-width: 420px;
}

.cwginstock-subscribe-form .panel.panel-primary {
    background: var(--color-bg-alt) !important;
    border: 1.5px solid var(--color-border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: none !important;
    overflow: hidden;
}

.cwginstock-subscribe-form .panel-primary > .panel-heading {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    padding: 0.6rem 1rem;
}

.cwginstock-subscribe-form .panel-heading h4 {
    color: var(--color-primary-contrast) !important;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin: 0;
}

.cwginstock-subscribe-form .panel-body {
    background: transparent;
    padding: 0.85rem !important;
}

/* Plugin markup nests Bootstrap grid columns without a .row in between,
   which stacks their gutters on top of .panel-body's own padding. */
.cwginstock-subscribe-form .row,
.cwginstock-subscribe-form .col-md-12 {
    margin: 0 !important;
    padding: 0 !important;
}

.cwginstock-subscribe-form .form-group {
    margin-bottom: 0.6rem !important;
}

.cwginstock-subscribe-form input.cwgstock_name,
.cwginstock-subscribe-form input.cwgstock_email,
.cwginstock-subscribe-form input.cwgstock_phone {
    text-align: left !important;
    background: var(--color-bg) !important;
    color: var(--color-text) !important;
    border: 1.5px solid var(--color-border) !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.75rem 1rem !important;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: border-color 0.15s;
}

.cwginstock-subscribe-form input.cwgstock_name::placeholder,
.cwginstock-subscribe-form input.cwgstock_email::placeholder {
    color: var(--color-text-light);
}

.cwginstock-subscribe-form input.cwgstock_name:focus,
.cwginstock-subscribe-form input.cwgstock_email:focus,
.cwginstock-subscribe-form input.cwgstock_phone:focus {
    outline: none;
    border-color: var(--color-text-light) !important;
}

.cwginstock-subscribe-form .cwgstock_button {
    background: var(--color-primary) !important;
    color: var(--color-primary-contrast) !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    padding: 0.85rem 1.5rem !important;
    font-size: 0.95rem;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    transition: background 0.15s;
}

.cwginstock-subscribe-form .cwgstock_button:hover {
    background: var(--color-primary-hover) !important;
}

.cwginstock-subscribe-form .cwgstock_output:not(:empty) {
    margin-top: 0.75rem;
}

.cwginstock-subscribe-form .cwgstock_output .cwginstocksuccess,
.cwginstock-subscribe-form .cwgstock_output .cwginstockerror {
    color: inherit !important;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
}

.cwginstock-subscribe-form .cwgstock_output .cwginstocksuccess {
    background: rgba(22, 163, 74, 0.1);
    color: var(--color-success) !important;
}

.cwginstock-subscribe-form .cwgstock_output .cwginstockerror {
    background: rgba(220, 38, 38, 0.1);
    color: var(--color-error) !important;
}
