/**
 * Enquiry System — Frontend Styles
 * Version: 4.0
 *
 * Covers: enquiry buttons, floating WhatsApp icon, variation
 * radio buttons, stock status, WhatsApp popup, and responsive.
 * Applies to both single product page and quick view popup.
 */

/* =================================================================
   ENQUIRY & WHATSAPP BUTTONS
================================================================= */

.enq-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
}
.enq-action-row .button {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 400;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-transform: capitalize;
    white-space: nowrap;
    flex: 1 1 auto;
    justify-content: center;
}

.single-enquiry-btn.button {
    background: #83B735;
    color: #fff;
}

.enq-wa-inline-btn.button {
    background: #25D366 !important;
    color: #fff !important;
    border-color: #25D366 !important;
}
.enq-wa-inline-btn.button:hover {
    background: #1ebe5d !important;
    border-color: #1ebe5d !important;
    color: #fff !important;
}

/* =================================================================
   FLOATING WHATSAPP BUTTON
================================================================= */
#enq-wa-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99998;
    width: 56px;
    height: 56px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4), 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: enq-wa-pulse 2s ease-in-out infinite;
}

#enq-wa-floating:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5), 0 4px 10px rgba(0,0,0,0.2);
    animation: none;
}

#enq-wa-floating:active {
    transform: scale(0.95);
}

/* Tooltip */
.enq-wa-floating-tooltip {
    position: absolute;
    right: 68px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.enq-wa-floating-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #333;
    border-right: none;
}

#enq-wa-floating:hover .enq-wa-floating-tooltip {
    opacity: 1;
}

@keyframes enq-wa-pulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(37,211,102,0.4), 0 2px 6px rgba(0,0,0,0.15); }
    50%      { box-shadow: 0 4px 24px rgba(37,211,102,0.6), 0 2px 10px rgba(0,0,0,0.2); }
}

/* =================================================================
   VARIATION TABLE — hide default labels/selects
   Single product page + quick view
================================================================= */
.variations th.label,
.popup-quick-view .product-quick-view .variations th.label {
    display: none !important;
}

.variations td.value,
.popup-quick-view .product-quick-view .variations td.value {
    display: block !important;
    width: 100% !important;
    padding-left: 0 !important;
}

.variations select,
.popup-quick-view .product-quick-view .variations select {
    display: none !important;
}

/* =================================================================
   STOCK STATUS
================================================================= */
.enq-stock-status-wrapper {
    margin: 12px 0 16px;
}

.enq-stock-display {
    margin: 0 !important;
    padding: 0 !important;
}

.stock-label {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0px 14px;
    border-radius: 4px;
    line-height: 1.4;
    position: relative;
}

.stock-label.out-of-stock {
    color: #d32f2f;
    background: #ffebee;
    border: 1px solid #ffcdd2;
}

.stock-label.in-stock::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    left: 0px;
    top: 7px;
}

/* =================================================================
   VARIATION RADIO BUTTONS
   Single product page + quick view
================================================================= */

/* Radio group container */
.enq-variation-radio-group,
.popup-quick-view .product-quick-view .enq-variation-radio-group {
    margin-bottom: 0px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex-direction: column;
}

/* Attribute label */
.enq-variation-label,
.popup-quick-view .product-quick-view .enq-variation-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    flex-shrink: 0;
    min-width: auto;
}

/* Radio options wrapper */
.enq-radio-options,
.popup-quick-view .product-quick-view .enq-radio-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
}

/* Individual radio option */
.enq-radio-option,
.popup-quick-view .product-quick-view .enq-radio-option {
    position: relative;
    flex: 0 0 auto;
}

/* Hide default radio input */
.enq-variation-radio,
.popup-quick-view .product-quick-view .enq-variation-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Radio label (clickable pill) */
.enq-radio-option label,
.popup-quick-view .product-quick-view .enq-radio-option label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border: 1px solid #b1b1b1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fff;
    font-weight: 500;
    font-size: 12px;
    margin: 0;
    min-width: 60px;
    justify-content: center;
}

/* Pseudo-element override (theme compat) */
.enq-radio-option label::after,
.popup-quick-view .product-quick-view .enq-radio-option label::after {
    display: none;
}

/* Custom radio circle */
.enq-radio-button,
.popup-quick-view .product-quick-view .enq-radio-button {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #999;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.enq-radio-button::after,
.popup-quick-view .product-quick-view .enq-radio-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.25s ease;
}

/* Hover state */
.enq-radio-option:not(.disabled) label:hover,
.popup-quick-view .product-quick-view .enq-radio-option:not(.disabled) label:hover {
    border-color: #83b735;
    background: rgb(131 183 53 / 10%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Selected state */
.enq-radio-option.selected label,
.popup-quick-view .product-quick-view .enq-radio-option.selected label {
    border-color: #83b735;
    background: rgb(131 183 53 / 20%);
    color: #222;
    box-shadow: none;
}

.enq-radio-option.selected .enq-radio-button,
.popup-quick-view .product-quick-view .enq-radio-option.selected .enq-radio-button {
    border-color: #fff;
    background: #fff;
}

.enq-radio-option.selected .enq-radio-button::after,
.popup-quick-view .product-quick-view .enq-radio-option.selected .enq-radio-button::after {
    transform: translate(-50%, -50%) scale(1);
    background: #4caf50;
}

/* Disabled state */
.enq-radio-option.disabled label,
.popup-quick-view .product-quick-view .enq-radio-option.disabled label {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f5f5f5;
    border-color: #e0e0e0;
}

.enq-radio-option.disabled .enq-radio-button,
.popup-quick-view .product-quick-view .enq-radio-option.disabled .enq-radio-button {
    border-color: #ccc;
}

.enq-radio-option.disabled label:hover,
.popup-quick-view .product-quick-view .enq-radio-option.disabled label:hover {
    transform: none;
    box-shadow: none;
    border-color: #e0e0e0;
    background: #f5f5f5;
}

/* =================================================================
   HIDE QUANTITY + NATIVE ADD TO CART
   Single product page + quick view
================================================================= */
.single-product div.quantity,
.popup-quick-view .product-quick-view div.quantity {
    display: none !important;
}

.single-product form.cart > .single_add_to_cart_button:not(.single-enquiry-btn),
.popup-quick-view .product-quick-view form.cart > .single_add_to_cart_button:not(.single-enquiry-btn) {
    display: none !important;
}

/* =================================================================
   WHATSAPP POPUP
================================================================= */
#wa-popup {
    z-index: 999999 !important;
    position: fixed !important;
}

.wa-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 999999;
}

.wa-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    z-index: 1000000;
    background: #fff;
    border-radius: 12px;
    padding: 28px 24px 20px;
    width: min(360px, 92vw);
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    font-family: inherit;
}
.wa-box h3 {
    margin: 0 0 18px;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
}
.wa-box label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    margin-bottom: 3px;
    color: #555;
}
.wa-required { color: #d32f2f; }
.wa-optional { color: #999; font-weight: 400; font-size: 0.78rem; }
.wa-box input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: .95rem;
    transition: border-color 0.2s;
}
.wa-box input:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.15);
}
.wa-box input[readonly] { background: #f5f5f5; color: #666; }
#wa-send {
    width: 100%;
    padding: 12px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    transition: background .2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#wa-send:hover { background: #1ebe5d; }
#wa-send:disabled { background: #a5d6a7; cursor: wait; }
.wa-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #888;
    padding: 0;
}
.wa-close:hover { color: #333; }

/* =================================================================
   RESPONSIVE
================================================================= */
@media (max-width: 768px) {
    .enq-variation-radio-group {
        flex-direction: column;
        align-items: flex-start;
    }
    .enq-radio-options {
        width: 100%;
    }
    #enq-wa-floating {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 480px) {
    .enq-radio-option label {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .enq-radio-button {
        width: 16px;
        height: 16px;
    }
    .enq-radio-button::after {
        width: 8px;
        height: 8px;
    }
    .stock-label {
        font-size: 0.85rem;
        padding: 5px 12px;
    }
}
