/**
 * All of the CSS for your site-facing functionality should be
 * included in this file.
 */

/*
* Payment Fields -- Nested IDs for CSS specificity
*/

#weeconnectpay-wc-fields>#form-display-no-footer {
}

#weeconnectpay-wc-fields>#form-display-no-footer select.error, textarea.error, input.error, div.error {
    color: #FF0000;
}

/* for :before element placement */
#weeconnectpay-wc-fields>#form-display-no-footer .form-row .field {
    position: relative;
}

#weeconnectpay-wc-fields>#form-display-no-footer .form-row .field.error::before {
    background-image:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='h-6 w-6' width='24px' height='24px' fill='none' viewBox='0 0 24 24' stroke='red' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 24px;
    height: 24px;
}

#weeconnectpay-wc-fields>#form-display-no-footer .form-row .field.success::before {
    background-image:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='h-6 w-6' width='24px' height='24px' fill='none' viewBox='0 0 24 24' stroke='green' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 13l4 4L19 7' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 24px;
    height: 24px;
}

#weeconnectpay-wc-fields>#form-display-no-footer .form-row {
    margin: 0;
    padding: 0;
}

/* Remove border and background from themes that add it */
#weeconnectpay-wc-fields>#form-display-no-footer .form-row .field.success {
    background: unset;
    border: unset;
}

/* to place error div right under fields */
#weeconnectpay-wc-fields>#form-display-no-footer .form-row .field {
    height: 3.4em;
}

#weeconnectpay-wc-fields>#form-display-no-footer .input-errors {
    margin-bottom: 0.2em;
}

#weeconnectpay-wc-fields>#form-display-no-footer .top-row.error {
    height: 4em;
    margin-bottom: 0.3em;
}

#weeconnectpay-wc-fields>#form-display-no-footer .top-row-wrapper {
    display: flex;
    justify-content: space-between;
    height: auto;
}

#weeconnectpay-wc-fields>#form-display-no-footer .bottom-row-wrapper {
    display: flex;
    justify-content: space-between;
    height: auto;
}

#weeconnectpay-wc-fields>#form-display-no-footer .full-width {
    width: 100%;
}

#weeconnectpay-wc-fields>#form-display-no-footer .third-width {
    width: 32%;
}

#weeconnectpay-wc-fields>#form-display-no-footer .button-container {
    display: none;
    justify-content: center;
    margin: 1em;
}


/* To prevent Clover iframe from overflowing */
#weeconnectpay-wc-fields>#form-display-no-footer .field iframe {
    /*height: unset !important;*/
}

/* Enforce Google Pay min-height and min-width standards so themes don't override it */
#weeconnectpay-payment-request-button iframe {
    min-height: 40px;
    min-width: 90px;
}

div#weeconnectpay-separator-with-text {
    overflow: hidden;
    text-align: center;
    font-weight: bold;
}

div#weeconnectpay-separator-with-text:before,
div#weeconnectpay-separator-with-text:after {
    background-color: #000;
    content: "";
    display: inline-block;
    height: 1px;
    position: relative;
    vertical-align: middle;
    width: 50%;
}

div#weeconnectpay-separator-with-text:before {
    right: 0.5em;
    margin-left: -50%;
}

div#weeconnectpay-separator-with-text:after {
    left: 0.5em;
    margin-right: -50%;
}
/* Adds credit cards SVG in gateway name */
#payment .payment_method_weeconnectpay>label::after {
    content: url(../img/card-logos.png);
    display: block;
}
#payment #weeconnectpay-secured-by-clover {
    padding-top: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#payment #weeconnectpay-secured-by-clover>#weeconnectpay-secured-by-lock {
 padding-right: 10px;
}
#payment #weeconnectpay-secured-by-display>#weeconnectpay-secured-by-img {
    vertical-align: middle;
    margin: 0;
    max-height: unset;

}
#payment #weeconnectpay-secured-by-display {
    align-items: center;
    flex-wrap: wrap;
    display: flex;
    justify-content: space-around;
    min-width: 180px
}

#payment #weeconnectpay-secured-by-display>#weeconnectpay-secured-by-text{
    white-space: nowrap;
    padding-right: 5px;
}

/* Google Pay Error States */
div#weeconnectpay-separator-with-text.wcp-google-pay-error {
    display: none;
}
div#weeconnectpay-payment-request-button.wcp-google-pay-error {
    display: none;
}

/* Google Pay Ready States */
#weeconnectpay-wc-fields.wcp-google-pay-ready {
    position: relative;
    transition: all 0.3s ease;
}

/* Note: Overlay and switch button are now handled by JavaScript DOM elements */

div#weeconnectpay-separator-with-text.wcp-google-pay-ready {
    display: none;
}

/* Visual-only Google Pay ready indicator - wraps the button */
div#weeconnectpay-payment-request-button.wcp-google-pay-ready {
    position: relative;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 8px;
    background: rgba(76, 175, 80, 0.1);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
    animation: wcp-google-pay-ready-pulse 2s ease-in-out infinite;
}

/* Success checkmark positioned at top-right */
div#weeconnectpay-payment-request-button.wcp-google-pay-ready::before {
    content: "✓";
    position: absolute;
    top: -8px;
    right: -8px;
    background: #4caf50;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Subtle pulsing animation */
@keyframes wcp-google-pay-ready-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
    }
    50% { 
        box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.3);
    }
}

/* Switch overlay for Google Pay ready state - Ultra-high specificity for theme override protection */
#weeconnectpay-wc-fields#weeconnectpay-wc-fields > #wcp-switch-to-manual#wcp-switch-to-manual.wcp-switch-overlay.wcp-switch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    cursor: pointer;
}

#weeconnectpay-wc-fields#weeconnectpay-wc-fields > #wcp-switch-to-manual#wcp-switch-to-manual.wcp-switch-overlay.wcp-switch-overlay > .wcp-switch-backdrop.wcp-switch-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 4px;
    z-index: 100;
    cursor: pointer;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px); /* Safari support */
}

#weeconnectpay-wc-fields#weeconnectpay-wc-fields > #wcp-switch-to-manual#wcp-switch-to-manual.wcp-switch-overlay.wcp-switch-overlay > .wcp-switch-button.wcp-switch-button {
    position: absolute;
    top: 50%;
    left: 50%;
    text-align: center;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%); /* Safari support */
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #C8C8C8;
    border-radius: 3px;
    padding: 10px 16px;
    color: #333;
    font-size: 14px;
    font-family: inherit;
    font-weight: normal;
    line-height: normal;
    cursor: pointer;
    z-index: 101;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    -webkit-transition: all 0.2s ease; /* Safari support */
    margin: 0;
    outline: none;
    text-decoration: none;
    vertical-align: baseline;
    white-space: nowrap;
}

#weeconnectpay-wc-fields#weeconnectpay-wc-fields > #wcp-switch-to-manual#wcp-switch-to-manual.wcp-switch-overlay.wcp-switch-overlay > .wcp-switch-button.wcp-switch-button:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #999;
}

#weeconnectpay-wc-fields#weeconnectpay-wc-fields > #wcp-switch-to-manual#wcp-switch-to-manual.wcp-switch-overlay.wcp-switch-overlay > .wcp-switch-button.wcp-switch-button:focus {
    background: rgba(255, 255, 255, 1);
    border-color: #666;
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Error masking for Google Pay */
#weeconnectpay-wc-fields>#form-display-no-footer .form-row .field.wcp-error-masked {
    border-color: #C8C8C8;
    background: unset;
}

#weeconnectpay-wc-fields>#form-display-no-footer .form-row .field.wcp-error-masked::before {
    display: none;
}

#weeconnectpay-wc-fields>#form-display-no-footer .input-errors.wcp-error-masked {
    display: none;
    visibility: hidden;
}

/* 3-D Secure beta — Visa requires cardholder name + email/phone alongside
   browser IP for 3DS-enabled charges. Clover's iframe placeholders carry
   the field labels ("Card Holder Name", "Cardholder Email Address") so we
   don't render external <label> elements. The grid uses intrinsic sizing
   (auto-fit + minmax) instead of a media query: when the container has
   room for two 220px tracks the fields go side-by-side; otherwise they
   stack. 220px is the floor at which Clover's "Cardholder Email Address"
   placeholder still renders without clipping inside its iframe. */
#weeconnectpay-wc-fields>#form-display-no-footer .weeconnectpay-3ds-section {
    margin-top: 0.9em;
    padding-top: 0.85em;
    border-top: 1px solid #e4e4e4;
    display: flex;
    flex-direction: column;
    gap: 0.7em;
}

#weeconnectpay-wc-fields>#form-display-no-footer .weeconnectpay-3ds-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
}

#weeconnectpay-wc-fields>#form-display-no-footer .weeconnectpay-3ds-icon {
    flex: 0 0 auto;
    color: #4a4a4a;
    margin-top: 0.08em;
    line-height: 0;
}

#weeconnectpay-wc-fields>#form-display-no-footer .weeconnectpay-3ds-icon svg {
    width: 1.05em;
    height: 1.05em;
    display: block;
}

#weeconnectpay-wc-fields>#form-display-no-footer .weeconnectpay-3ds-text {
    display: flex;
    flex-direction: column;
    gap: 0.12em;
    min-width: 0;
}

#weeconnectpay-wc-fields>#form-display-no-footer .weeconnectpay-3ds-section-title {
    font-size: 0.9em;
    font-weight: 600;
    color: #2c2c2c;
    margin: 0;
    line-height: 1.25;
}

#weeconnectpay-wc-fields>#form-display-no-footer .weeconnectpay-3ds-section-hint {
    font-size: 0.78em;
    color: #6a6a6a;
    margin: 0;
    line-height: 1.4;
}

#weeconnectpay-wc-fields>#form-display-no-footer .weeconnectpay-3ds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.55em;
}

/* Pin the iframe wrappers to the same row height as the card fields so
   Clover's default tall rendering can't blow out the layout. min-width:0
   is required on grid children so they can shrink below their iframe's
   intrinsic width. */
#weeconnectpay-wc-fields>#form-display-no-footer .card-name-field,
#weeconnectpay-wc-fields>#form-display-no-footer .card-email-field {
    height: 3.4em;
    min-width: 0;
    overflow: hidden;
}

#weeconnectpay-wc-fields>#form-display-no-footer .card-name-field iframe,
#weeconnectpay-wc-fields>#form-display-no-footer .card-email-field iframe {
    width: 100% !important;
    min-width: 0;
    height: 3.4em !important;
    min-height: 3.4em;
}
