/* ══════════════════════════════════════════════════════════════════════════
   WC Color Swatches v4 – frontend.css
   ══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. FIX: Fixed-height image wrapper on archive (stops jump from
         variation images with different heights) ────────────────────────── */

/* Target WooCommerce loop product image link */
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link,
.woocommerce ul.products li.product a.woocommerce-loop-product__link,
.woocommerce ul.products li.product .woocommerce-product-gallery__image > a,
.woocommerce ul.products li.product > a:first-child {
    display: block;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}


/* Image fills the fixed container, centred */
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link img,
.woocommerce ul.products li.product a.woocommerce-loop-product__link img,
.woocommerce ul.products li.product > a:first-child img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: opacity .22s ease;
}

/* Image opacity fade for hover swap */
.wccs-fading {
    opacity: 0 !important;
    transition: opacity .15s ease !important;
}

/* ─── 2. Shared swatch base ─────────────────────────────────────────────── */
.wccs-swatch {
    position: relative;
    display: inline-block;
    cursor: pointer;
    box-sizing: border-box;
    border-radius: 50%;
    transform-origin: center center;
    will-change: transform;
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition:
        transform     0.16s cubic-bezier(.34,1.56,.64,1),
        outline-color 0.16s ease,
        box-shadow    0.16s ease;
    flex-shrink: 0;
    vertical-align: middle;
}
/* gloss shine */
.wccs-swatch::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,.32) 0%, transparent 55%);
    pointer-events: none;
    z-index: 1;
}

/* ─── 3. ARCHIVE swatches row ───────────────────────────────────────────── */
.wccs-swatches {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    /* Fixed height so scaling swatches never push the title down */
    height: 36px;
    overflow: visible;
    padding: 0;
    margin: 8px 0 4px;
    line-height: 1;
}

.wccs-swatches .wccs-swatch {
    width: 20px;
    height: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.wccs-swatches .wccs-swatch:hover,
.wccs-swatches .wccs-swatch.wccs-swatch--active {
    transform: scale(1.35);
    outline-color: var(--sc, #888);
    box-shadow: 0 2px 8px rgba(0,0,0,.28);
    z-index: 5;
}

/* Tooltip for archive swatches */
.wccs-swatches .wccs-swatch::after {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #111;
    color: #fff;
    font-size: 10px;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .14s ease, transform .14s ease;
    z-index: 99;
}
.wccs-swatches .wccs-swatch:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── 4. SINGLE PAGE swatches ───────────────────────────────────────────── */
.wccs-single-swatches {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;   /* centred like the rest of the summary */
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.wccs-color-label {
    display: block;
    width: 100%;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #888;
    min-height: 16px;
    margin-bottom: 4px;
    text-align: center;
}
.wccs-color-label strong { color: #222; }

.wccs-single-swatches .wccs-swatch {
    width: 30px;
    height: 30px;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.wccs-single-swatches .wccs-swatch:hover {
    transform: scale(1.18);
    outline-color: var(--sc, #888);
    box-shadow: 0 4px 10px rgba(0,0,0,.24);
    z-index: 2;
}
.wccs-single-swatches .wccs-swatch.wccs-swatch--active {
    transform: scale(1.14);
    outline-color: var(--sc, #888);
    box-shadow: 0 4px 12px rgba(0,0,0,.26);
    z-index: 2;
}
.wccs-single-swatches .wccs-swatch.wccs-swatch--active::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='%23fff' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/55% no-repeat;
    z-index: 2;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.4));
    pointer-events: none;
}

/* Disabled add to cart loop button (out of stock) */
.woocommerce ul.products li.product .button.wccs-disabled,
.woocommerce ul.products li.product button.wccs-disabled {
    opacity: .45 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* ─── 5. Buy Now button (archive loop) ─────────────────────────────────── */
.wccs-buy-now {
    display: block;
    width: 100%;
    margin-top: 6px !important;
    text-align: center;
    background: #fc5721 !important;
    color: #fff !important;
    border: 2px solid #fc5721 !important;
    border-radius: 3px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: .07em !important;
    text-transform: uppercase !important;
    padding: 11px 14px !important;
    cursor: pointer;
    line-height: 1.4 !important;
    transition: background .18s ease, color .18s ease, opacity .18s !important;
    text-decoration: none !important;
    box-sizing: border-box;
}
.wccs-buy-now:hover:not(:disabled):not(.wccs-disabled) {
    background: #fff !important;
    color: #fc5721 !important;
}

.woocommerce-product-details__short-description ul {
    text-align: left;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li.active:before, .woocommerce div.ast-product-tabs-layout-vertical .woocommerce-tabs ul.tabs li:hover::before{
	background: #fc5721 !important;
}

/* Disabled / out of stock */
.wccs-buy-now.wccs-disabled,
.wccs-buy-now:disabled {
    opacity: .45;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Single page – inline beside add-to-cart, full-width below qty row */
.wccs-buy-now--single {
    display: inline-block !important;
    width: auto !important;
    margin-top: 0 !important;
    margin-left: 8px !important;
}

/* ─── 6. Single page: qty + button layout to match design ──────────────── */
/* Make quantity + add-to-cart sit in one row, buy-now full width below */
.single-product .cart {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    gap: 0 8px !important;
}
.single-product .cart .quantity {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border: 2px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
}
/* qty input */
.single-product .cart .qty {
    width: 52px !important;
    text-align: center !important;
    border: none !important;
    outline: none !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    padding: 10px 4px !important;
    -moz-appearance: textfield !important;
}
.single-product .cart .qty::-webkit-outer-spin-button,
.single-product .cart .qty::-webkit-inner-spin-button { -webkit-appearance: none; }

/* qty +/- stepper buttons injected by JS */
.wccs-qty-btn {
    background: #fff;
    border: none;
    width: 38px;
    height: 100%;
    font-size: 20px;
    font-weight: 400;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .14s;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}
.wccs-qty-btn:hover { background: #f5f5f5; color: #111; }

/* add-to-cart button – grows to fill remaining space */
.single-product .cart .single_add_to_cart_button {
    flex: 1 1 auto !important;
    margin: 0 !important;
}

/* buy now – full width on its own row */
.single-product .wccs-buy-now--single {
    flex: 0 0 100% !important;
    width: 100% !important;
    display: block !important;
    margin-left: 0 !important;
    margin-top: 8px !important;
}

/* ─── 7. POPUP overlay ──────────────────────────────────────────────────── */
.wccs-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.58);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}
.wccs-overlay.wccs-overlay--open {
    opacity: 1;
    pointer-events: all;
}

.wccs-popup {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 740px;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(.97);
    transition: transform .26s cubic-bezier(.34,1.2,.64,1);
    box-shadow: 0 24px 70px rgba(0,0,0,.24);
}
.wccs-overlay--open .wccs-popup { transform: translateY(0) scale(1); }

/* close */
.wccs-popup__close {
    position: absolute;
    top: 12px; 
	right: 14px;
    width: 40px; 
	height: 40px;
    border: none; 
	background: rgba(0,0,0,.07); 
	border-radius: 50%;
    cursor: pointer; font-size: 16px;
    display: flex; 
	align-items: center; 
	justify-content: center;
    color: #555; 
	transition: background .15s; z-index: 10;
}
.wccs-popup__close:hover { background: rgba(0,0,0,.14); }

/* grid layout */
.wccs-popup__body {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 360px;
}
@media (max-width: 580px) {
    .wccs-popup__body { grid-template-columns: 1fr; }
    .wccs-popup__image { height: 240px; border-radius: 12px 12px 0 0 !important; }
}

/* image pane */
.wccs-popup__image {
    background: #f4f4f4;
    border-radius: 12px 0 0 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    /* FIX: left padding/margin so image doesn't butt against edge */
    padding: 16px;
}
.wccs-popup__image img {
    width: 100%;
    height: 100% !important;
    object-fit: contain;   /* contain so product isn't cropped */
    display: block;
    transition: opacity .2s ease;
    border-radius: 6px;
}

/* details pane */
.wccs-popup__details {
    padding: 24px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
}

.wccs-popup__name {
    font-size: 17px;
    font-weight: 700;
    color: #111;
    margin: 0 0 6px;
    line-height: 1.3;
    padding-right: 28px;
}
.wccs-popup__price {
    font-size: 19px;
    font-weight: 700;
    color: #111;
    margin: 0 0 14px;
}
.wccs-popup__price ins { text-decoration: none; }

/* attribute block */
.wccs-popup__attr { margin-bottom: 12px; }
.wccs-popup__attr-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.wccs-popup__attr-label em { font-style: normal; color: #333; font-size: 11px; }

/* popup swatches */
.wccs-popup-swatches {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    /* fixed height prevents layout shift when swatches scale */
    min-height: 36px;
    overflow: visible;
}
.wccs-popup-swatches .wccs-swatch { width: 26px; height: 26px; box-shadow: 0 2px 5px rgba(0,0,0,.18); }
.wccs-popup-swatches .wccs-swatch:hover {
    transform: scale(1.2); outline-color: var(--sc,#888); z-index: 2;
}
.wccs-popup-swatches .wccs-swatch.wccs-swatch--active {
    transform: scale(1.15); outline-color: var(--sc,#888); box-shadow: 0 3px 8px rgba(0,0,0,.22); z-index: 2;
}
.wccs-popup-swatches .wccs-swatch.wccs-swatch--active::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='%23fff' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/55% no-repeat;
    z-index:2; filter:drop-shadow(0 1px 1px rgba(0,0,0,.4)); pointer-events:none;
}

/* pills for non-color attributes */
.wccs-popup-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.wccs-popup-pill {
    padding: 5px 12px;
    border: 1.5px solid #ddd;
    border-radius: 4px;
    font-size: 12px; font-weight: 600; color: #444;
    cursor: pointer; user-select: none;
    transition: border-color .14s, background .14s;
}
.wccs-popup-pill:hover { border-color: #888; }
.wccs-popup-pill.wccs-swatch--active { border-color: var(--wc-primary,#7f0000); background: var(--wc-primary,#7f0000); color: #fff; }

/* qty row – matches the screenshot: [−] [1] [+]  |  [ADD TO CART] */
.wccs-popup__qty-row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 10px;
}

.wccs-popup__qty-control {
    display: flex;
    align-items: stretch;
    border: 2px solid #ddd;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}
.wccs-popup__qty-minus,
.wccs-popup__qty-plus {
    width: 38px;
    background: #fff;
    border: none;
    font-size: 20px;
    font-weight: 400;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .14s;
    padding: 0;
    line-height: 1;
}
.wccs-popup__qty-minus:hover,
.wccs-popup__qty-plus:hover { background: #f5f5f5; color: #111; }

.wccs-popup__qty {
    width: 52px;
    border: none;
    border-left: 1.5px solid #ddd;
    border-right: 1.5px solid #ddd;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    padding: 8px 4px;
    outline: none;
    -moz-appearance: textfield;
}
.wccs-popup__qty::-webkit-outer-spin-button,
.wccs-popup__qty::-webkit-inner-spin-button { -webkit-appearance: none; }

/* popup Add to Cart – outline style, fills remaining width */
.wccs-popup__add-to-cart {
    flex: 1 1 auto;
    padding: 10px 12px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: .07em !important;
    text-transform: uppercase !important;
    border-radius: 3px !important;
    cursor: pointer;
    border: 2px solid #fc5721 !important;
    background: #fff !important;
    color: #fc5721 !important;
    transition: background .18s, color .18s !important;
    line-height: 1.4 !important;
}
.wccs-popup__add-to-cart:hover { background: #fc5721 !important; color: #fff !important; }

/* popup Buy Now – solid, full width below */
.wccs-popup__buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.wccs-popup__buy-now {
    width: 100%;
    padding: 12px 12px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: .07em !important;
    text-transform: uppercase !important;
    border-radius: 3px !important;
    cursor: pointer;
    border: 2px solid #fc5721 !important;
    background: #fc5721 !important;
    color: #fff !important;
    transition: background .18s, color .18s !important;
    line-height: 1.4 !important;
    text-align: center;
}
.wccs-popup__buy-now:hover { opacity: .88; }

/* feedback message */
.wccs-popup__feedback {
    font-size: 12px; min-height: 18px; margin-top: 6px;
    color: #2e7d32; font-weight: 600;
}
.wccs-popup__feedback.wccs-error { color: #c62828; }

/* loading spinner */
.wccs-popup__loading {
    position: absolute; inset: 0;
    background: rgba(255,255,255,.78);
    align-items: center; justify-content: center;
    border-radius: 12px; z-index: 10;
    display: none;
}
.wccs-popup__loading::after {
    content: ''; width: 34px; height: 34px;
    border: 3px solid #ddd; border-top-color: var(--wc-primary,#7f0000);
    border-radius: 50%; animation: wccs-spin .7s linear infinite;
}
@keyframes wccs-spin { to { transform: rotate(360deg); } }

@media (max-width: 767px){
	.wccs-popup__qty-row {
		flex-flow: column;
	}
	.wccs-popup__image{
		margin-top: 18px;
	}
}
