/* === WhatsApp Button Styling === */
.cwl-screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cwl-whatsapp-button {
    background-color: #25d366 !important; /* WhatsApp Green */
    border-radius: 30px !important;
    color: #ffffff !important; /* White text for better contrast */
    border: none !important; /* Remove theme border if any */
    padding: 10px 20px !important; /* Consistent padding */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.cwl-whatsapp-button:hover {
    background-color: #128C7E !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* WhatsApp Icon */
.cwl-whatsapp-button::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="white"><path d="M380.9 97.1C339 55.1 283.2 32 223.9 32c-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480l117.7-30.9c32.4 17.7 68.9 27 106.1 27h.1c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.8 0-65.7-10.8-94-31.5l-6.7-4-69.8 18.3L72 359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1 34.8 34.9 56.2 81.2 56.1 130.5 0 101.8-84.9 184.6-186.6 184.6zm101.2-138.2c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8-3.7 5.6-14.3 18-17.6 21.8-3.2 3.7-6.5 4.2-12 1.4-32.8-16.2-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7.9-6.9-.5-9.7-1.4-2.8-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.7 1.4-14.8 6.9-5.1 5.6-19.4 19-19.4 46.3 0 27.3 19.9 53.7 22.6 57.4 2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4 4.6-13 4.6-24.1 3.2-26.4-1.3-2.5-5-3.9-10.5-6.6z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* === "Notify Me" Button Styling === */
.cwl-notify-button {
    background-color: #25d366 !important; /* WhatsApp Green */
    color: #ffffff !important;
    border-radius: 30px !important; /* Matching WhatsApp style */
    border: none !important;
    padding: 10px 20px !important;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.cwl-notify-button:hover {
    background-color: #128C7E !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.cwl-notify-button:disabled {
    background-color: #cccccc !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === "Back in Stock" Form Styling === */
.cwl-back-in-stock-container {
    margin: 20px auto;
    max-width: 50%;
}

.cwl-back-in-stock-form .cwl-form-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.cwl-back-in-stock-form .cwl-form-description {
    margin-bottom: 15px;
    color: #666;
}

.cwl-back-in-stock-form .cwl-form-fields {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.cwl-back-in-stock-form input[type="text"],
.cwl-back-in-stock-form input[type="tel"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.cwl-back-in-stock-form input[type="text"]:focus,
.cwl-back-in-stock-form input[type="tel"]:focus {
    border-color: #25d366;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.2);
}

.cwl-back-in-stock-form .cwl-consent-field {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.cwl-back-in-stock-form .cwl-consent-field input[type="checkbox"] {
    margin-right: 10px;
    flex-shrink: 0;
    margin-top: 3px;
}

.cwl-back-in-stock-form .cwl-consent-field label {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.cwl-back-in-stock-form .cwl-form-message {
    display: none;
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    font-weight: 500;
}

.cwl-back-in-stock-form .cwl-form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.cwl-back-in-stock-form .cwl-form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Hide original Add to Cart button when custom button is active */
.cwl-button-active .single_add_to_cart_button:not(.cwl-custom-button) {
    display: none !important;
}

/* === Elementor Back in Stock Enhancements === */
.elementor-add-to-cart .cwl-back-in-stock-container { margin: 10px 0 0; max-width: 320px; }
.elementor-add-to-cart .cwl-back-in-stock-form .cwl-form-fields { gap: 8px; }
.elementor-add-to-cart .cwl-back-in-stock-form input[type="text"],
.elementor-add-to-cart .cwl-back-in-stock-form input[type="tel"] { max-width: 100%; font-size: 14px; padding: 10px; }
.elementor-add-to-cart .cwl-back-in-stock-form button { width: 100%; margin-top: 4px; }

/* Prevent duplicate stock messaging clutter when form is present */
.elementor-add-to-cart .stock.out-of-stock + .cwl-back-in-stock-container .cwl-form-title,
.elementor-add-to-cart .cwl-back-in-stock-container + .stock.out-of-stock { display:none; }

/* RTL adjustments if site is RTL */
body.rtl .cwl-back-in-stock-form .cwl-consent-field input[type="checkbox"] { margin-right:0; margin-left:10px; }
body.rtl .cwl-back-in-stock-form input[type="text"],
body.rtl .cwl-back-in-stock-form input[type="tel"] { direction: rtl; }

/* === Out-of-Stock Swatch Styling (NASA Edition) === */

/* --- 1. Initial State: Out-of-Stock --- */
/* This applies to any swatch our JS has marked as unavailable. */
div.product .cwl-oos-x {
    position: relative;
    color: #9b9b9b !important;
    filter: grayscale(0.5) saturate(0.6) brightness(1.05);
}

div.product li.variable-item.cwl-oos-x {
    border: 1px solid #c8c8c8 !important;
    cursor: not-allowed !important;
    background-color: transparent !important;
}

/* Target the text inside the out-of-stock swatch */
div.product li.variable-item.cwl-oos-x .variable-item-span {
    color: #9b9b9b !important;
}

/* --- 2. Hover State: Disabled --- */
/* Remove any special hover effects for out-of-stock items. */
div.product li.variable-item.cwl-oos-x:hover {
    background-color: transparent !important; /* Prevent background color change */
    border-color: #ccc !important; /* Keep the gray border */
    box-shadow: none !important; /* Remove any hover shadow */
}

div.product li.variable-item.cwl-oos-x:hover .variable-item-span {
    color: #ccc !important; /* Keep the text gray */
}

/* Force-hide any pseudo-elements (like arrows/circles) for OOS/disabled items in ALL states */
div.product li.variable-item.cwl-oos-x::before,
div.product li.variable-item.cwl-oos-x::after,
div.product li.variable-item.cwl-oos-x .variable-item-span::before,
div.product li.variable-item.cwl-oos-x .variable-item-span::after,
div.product .variable-item.disabled::before,
div.product .variable-item.disabled::after,
div.product .variable-item.disabled .variable-item-span::before,
div.product .variable-item.disabled .variable-item-span::after,
div.product .button-variable-item.disabled::before,
div.product .button-variable-item.disabled::after,
div.product .swatch.disabled::before,
div.product .swatch.disabled::after,
div.product .swatch-item.disabled::before,
div.product .swatch-item.disabled::after,
div.product .woo-variation-item.disabled::before,
div.product .woo-variation-item.disabled::after,
div.product .woo-variation-item-button.disabled::before,
div.product .woo-variation-item-button.disabled::after,
div.product .woo-variation-item-image.disabled::before,
div.product .woo-variation-item-image.disabled::after,
div.product li.variable-item.cwl-oos-x.selected::before,
div.product li.variable-item.cwl-oos-x.selected::after {
    content: none !important;
    display: none !important;
    background: none !important;
    background-image: none !important;
    border: none !important;
    box-shadow: none !important;
    opacity: 0 !important;
}

/* --- 3. Active/Selected State: Out-of-Stock --- */
/* This applies when an out-of-stock swatch is clicked/selected. */
/* It remains visually disabled, just with a thicker border to indicate selection. */
div.product li.variable-item.cwl-oos-x.selected {
    background-color: transparent !important; /* NO background color */
    border-width: 2px !important; /* Make border thicker to show it's 'selected' */
    border-color: #b0b0b0 !important; /* A slightly darker gray for the selected border */
}

/* Keep the text gray for contrast when selected */
div.product li.variable-item.cwl-oos-x.selected .variable-item-span {
    color: #b0b0b0 !important; /* Keep text gray */
}

/* Defensive: hide any third‑party out-of-stock markers (icons/dots/X) */
div.product li.variable-item[data-wvstooltip-out-of-stock],
div.product .variable-item[aria-disabled="true"],
div.product .button-variable-item[aria-disabled="true"],
div.product .swatch[aria-disabled="true"],
div.product .swatch-item[aria-disabled="true"],
div.product .variation-swatches .swatch.disabled,
div.product .woo-variation-swatches .swatch.disabled,
div.product .wcvs-term.disabled,
div.product .wcvs-attribute-item.disabled,
div.product .variable-item.disabled,
div.product .button-variable-item.disabled,
div.product .swatch.disabled,
div.product .swatch-item.disabled {
    background-color: transparent !important;
    border: 1px solid #e0e0e0 !important;
    color: #b5b5b5 !important;
    box-shadow: none !important;
}

div.product li.variable-item[data-wvstooltip-out-of-stock]::before,
div.product li.variable-item[data-wvstooltip-out-of-stock]::after,
div.product .variable-item[aria-disabled="true"]::before,
div.product .variable-item[aria-disabled="true"]::after,
div.product .button-variable-item[aria-disabled="true"]::before,
div.product .button-variable-item[aria-disabled="true"]::after,
div.product .swatch[aria-disabled="true"]::before,
div.product .swatch[aria-disabled="true"]::after,
div.product .swatch-item[aria-disabled="true"]::before,
div.product .swatch-item[aria-disabled="true"]::after,
div.product .variation-swatches .swatch.disabled::before,
div.product .variation-swatches .swatch.disabled::after,
div.product .woo-variation-swatches .swatch.disabled::before,
div.product .woo-variation-swatches .swatch.disabled::after,
div.product .wcvs-term.disabled::before,
div.product .wcvs-term.disabled::after,
div.product .wcvs-attribute-item.disabled::before,
div.product .wcvs-attribute-item.disabled::after {
    content: none !important;
    display: none !important;
    background: none !important;
    background-image: none !important;
}

/* Highest-specificity overrides for known plugin selectors adding a red X */
.variable-items-wrapper li.cwl-oos-x .variable-item-span::after,
ul.variable-items-wrapper li.variable-item.cwl-oos-x .variable-item-span::after,
.wvs-style-rounded li.variable-item.cwl-oos-x .variable-item-span::after {
    content: none !important;
    display: none !important;
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
}

/* === Clear In-Stock vs Out-of-Stock Frames === */
/* In-Stock: black border + black text (never faded) */
div.product li.variable-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]):not([disabled]):not([data-wvstooltip-out-of-stock]),
div.product .button-variable-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]):not([disabled]):not([data-wvstooltip-out-of-stock]),
div.product .swatch:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]):not([disabled]):not([data-wvstooltip-out-of-stock]),
div.product .swatch-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]):not([disabled]):not([data-wvstooltip-out-of-stock]),
div.product .woo-variation-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]):not([disabled]):not([data-wvstooltip-out-of-stock]),
div.product .woo-variation-item-button:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]):not([disabled]):not([data-wvstooltip-out-of-stock]),
div.product .woo-variation-item-image:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]):not([disabled]):not([data-wvstooltip-out-of-stock]) {
    border: 1px solid #000 !important;
    /* do not force background-color to avoid breaking color swatches */
    color: #000 !important;
    opacity: 1 !important;
    filter: none !important;
}

/* In-Stock text inside typical span */
div.product li.variable-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]) .variable-item-span,
div.product .button-variable-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]) .variable-item-span,
div.product .swatch:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]) .variable-item-span,
div.product .swatch-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]) .variable-item-span,
div.product li.variable-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]) a,
div.product .button-variable-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]) a {
    color: #000 !important;
    opacity: 1 !important;
}

/* In-Stock selected: stronger black frame */
div.product li.variable-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]).selected,
div.product .button-variable-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]).selected,
div.product .swatch:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]).selected,
div.product .swatch-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]).selected {
    border-color: #000 !important;
    border-width: 1px !important;
    opacity: 1 !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55);
}

div.product li.variable-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]).selected .variable-item-span,
div.product .button-variable-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]).selected .variable-item-span,
div.product .swatch-item:not(.cwl-oos-x):not(.disabled):not([aria-disabled="true"]).selected .variable-item-span {
    font-weight: 600;
}

div.product .cwl-oos-x .variable-item-span,
div.product .cwl-oos-x a {
    color: #9b9b9b !important;
}

div.product .cwl-oos-x .cwl-oos-mark {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
}

div.product .cwl-oos-x .cwl-oos-mark::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

div.product .cwl-oos-x .cwl-oos-mark::after {
    content: '×';
    position: relative;
    font-size: 1.1em;
    line-height: 1;
    color: #b1b1b1;
    font-weight: 600;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.75);
}

div.product .cwl-oos-x .cwl-oos-mark.cwl-oos-mark--no-icon::after {
    content: '';
}

div.product .cwl-oos-x .cwl-oos-mark.cwl-oos-mark--no-icon::before {
    inset: 1px;
}
