/* ============================================================
   Easy External Links Button for WooCommerce – Frontend Styles
   ============================================================ */

.easy-external-links-button-for-woocommerce-buttons-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
}

.easy-external-links-button-for-woocommerce-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
}

.easy-external-links-button-for-woocommerce-button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.easy-external-links-button-for-woocommerce-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Inline "next to Add to Cart" wrapper.
   The WooCommerce add-to-cart form renders the quantity input and the
   submit button as block-level siblings. To place our button on the
   SAME visual row as the cart button we make the form's direct children
   flow as a flex row. This is the only reliable cross-theme approach.
   We target the standard Storefront / default WooCommerce form class. */
form.cart {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* The inline-wrap <span> sits as a flex child of form.cart, right after
   the Add to Cart <button>, so it naturally appears beside it. */
.easy-external-links-button-for-woocommerce-inline-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    /* No margin-left needed – flex gap handles spacing */
}

.easy-external-links-button-for-woocommerce-inline-button {
    vertical-align: middle;
}

/* ── Tooltip ──────────────────────────────────────────────────────────────
   The .easy-external-links-button-for-woocommerce-tooltip <span> is hidden
   by default and fades in when the parent <a> is hovered.
   It appears above the button with a small downward-pointing arrow.
   ─────────────────────────────────────────────────────────────────────── */
.easy-external-links-button-for-woocommerce-has-tooltip {
    position: relative;
}

.easy-external-links-button-for-woocommerce-tooltip {
    /* Take the span out of the flex flow so it does not render
       as a visible flex child inside the inline-flex button. */
    position: absolute;
    bottom: calc( 100% + 10px );
    left: 50%;
    transform: translateX( -50% );
    min-width: 140px;
    max-width: 260px;
    padding: 7px 12px;
    background-color: #1d2327;
    color: #ffffff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    white-space: normal;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    pointer-events: none;
    /* Hidden by default – must use both opacity+visibility AND
       width/height:0 overflow:hidden so the absolutely-positioned
       span does not contribute to the button's flex layout or
       cause any visible text bleed. */
    opacity: 0;
    visibility: hidden;
    width: 0;
    height: 0;
    overflow: hidden;
    padding: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease, width 0s 0.2s, height 0s 0.2s, padding 0s 0.2s;
    z-index: 9999;
    text-decoration: none !important;
    font-style: normal;
}

/* Downward-pointing arrow */
.easy-external-links-button-for-woocommerce-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX( -50% );
    border: 6px solid transparent;
    border-top-color: #1d2327;
}

/* Show on hover / focus – restore full size then fade in */
.easy-external-links-button-for-woocommerce-has-tooltip:hover
.easy-external-links-button-for-woocommerce-tooltip,
.easy-external-links-button-for-woocommerce-has-tooltip:focus-within
.easy-external-links-button-for-woocommerce-tooltip {
    opacity: 1;
    visibility: visible;
    width: auto;
    height: auto;
    overflow: visible;
    padding: 7px 12px;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Shop page context: stack buttons below loop item */
.easy-external-links-button-for-woocommerce-context-shop {
    margin-top: 8px;
    width: 100%;
}

.easy-external-links-button-for-woocommerce-context-shop .easy-external-links-button-for-woocommerce-button {
    width: 100%;
    justify-content: center;
}
