/**
 * Saga Payments Express Checkout v2
 * Production-ready styles for quick pay buttons + popup
 */

/* =============================================
   Z-INDEX STACK (theme-customizable)
   =============================================
   Mirrors checkout.css — declared here as a fallback for product/cart pages
   where checkout.css isn't loaded. Override by redefining these in theme CSS.
*/
:root {
    --saga-z-overlay: 2147483640;
    --saga-z-modal: 2147483645;
    --saga-z-3ds: 2147483646;
}

/* =============================================
   BUTTONS CONTAINER
   ============================================= */

.saga-express-checkout {
    margin: 16px 0;
    padding: 16px 0 0;
    clear: both;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    float: none !important;
}

.saga-express-checkout--product {
    margin: 8px 0 !important;
    padding: 0 !important;
    clear: none !important;
}

.saga-express-checkout--no-separator {
    padding-top: 0 !important;
}

.saga-express-checkout--aligned-with-express {
    margin-top: 8px !important;
    padding-top: 0 !important;
    clear: none !important;
}

.saga-express-checkout--no-separator .saga-express-separator {
    display: none !important;
}

.saga-express-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.saga-express-separator::before,
.saga-express-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.saga-express-separator span {
    flex-shrink: 0;
    padding: 0;
    color: #595959;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 500;
}

.saga-express-buttons {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
    box-sizing: border-box !important;
    float: none !important;
    clear: none !important;
}

.saga-express-checkout *,
.saga-express-checkout *::before,
.saga-express-checkout *::after {
    box-sizing: border-box !important;
}

/* =============================================
   INDIVIDUAL BUTTONS — inline styles do the heavy lifting,
   CSS handles hover/active/focus + theme defense
   ============================================= */

button.saga-express-btn,
.saga-express-btn {
    /* Reinforce inline styles against theme !important rules */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 6px !important;
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    text-indent: 0 !important;
    cursor: pointer !important;
    overflow: hidden !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    text-decoration: none !important;
    box-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    outline: none !important;
    float: none !important;
    position: relative !important;
    transition: opacity 0.15s ease, box-shadow 0.15s ease !important;
    opacity: 1 !important;
}

.saga-express-btn img,
.saga-express-logo,
.saga-express-icon {
    display: block !important;
    width: auto !important;
    max-width: 90px !important;
    min-width: 0 !important;
    max-height: 30px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    border: 0 !important;
    object-fit: contain !important;
    float: none !important;
    clear: none !important;
    position: static !important;
    transform: none !important;
    vertical-align: middle !important;
}

button.saga-express-btn:hover,
.saga-express-btn:hover {
    opacity: 0.85 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15) !important;
}

button.saga-express-btn:active,
.saga-express-btn:active {
    opacity: 0.75 !important;
}

button.saga-express-btn:focus-visible,
.saga-express-btn:focus-visible {
    outline: 2px solid #0066cc !important;
    outline-offset: 2px !important;
}

/* Logo sizing — inline styles handle this too, but reinforce */
.saga-express-btn img {
    height: 22px !important;
    width: auto !important;
    max-width: 100px !important;
    max-height: 22px !important;
    object-fit: contain !important;
    display: block !important;
    pointer-events: none !important;
}

.saga-express-btn .saga-exp-logo-wrap,
.saga-exp-pay-btn .saga-exp-logo-wrap,
#saga-express-popup .saga-exp-logo-wrap {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 32px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    color: #4a4a49 !important;
    font-size: 14px !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-indent: 0 !important;
    text-transform: none !important;
    text-decoration: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    filter: none !important;
    float: none !important;
    overflow: visible !important;
}

.saga-express-btn .saga-exp-logo,
.saga-exp-pay-btn .saga-exp-logo,
#saga-express-popup .saga-exp-logo {
    display: block !important;
    width: auto !important;
    max-width: 100px !important;
    height: 22px !important;
    max-height: 22px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    object-fit: contain !important;
    text-indent: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    float: none !important;
}

.saga-express-btn[data-method="NSWISH"] .saga-exp-logo,
.saga-exp-pay-btn[data-method="NSWISH"] .saga-exp-logo {
    width: 72px !important;
    max-width: 90px !important;
    height: 22px !important;
    max-height: 22px !important;
}

.saga-express-btn .saga-exp-logo-bg,
.saga-exp-pay-btn .saga-exp-logo-bg,
#saga-express-popup .saga-exp-logo-bg {
    display: block !important;
    width: 72px !important;
    max-width: 90px !important;
    height: 22px !important;
    max-height: 22px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    filter: none !important;
    pointer-events: none !important;
}

.saga-express-btn[data-method="NSWISH"] .saga-exp-logo-bg,
.saga-exp-pay-btn[data-method="NSWISH"] .saga-exp-logo-bg {
    background-image: url('../images/swish.svg') !important;
}

.saga-express-btn[data-method="NSWISH"] .saga-exp-logo-wrap > img.saga-exp-logo,
.saga-exp-pay-btn[data-method="NSWISH"] .saga-exp-logo-wrap > img.saga-exp-logo {
    /* v4.0.118: Show the Swish <img> (was hidden because the legacy
       background-span variant rendered the logo). The PHP renderer now ships
       an <img> for Swish like the other brands so the logo is visible even
       when this stylesheet is deferred/blocked by the theme. */
    display: block !important;
}

.saga-express-btn[data-method="NSWISH"] .saga-exp-logo--swish,
.saga-exp-pay-btn[data-method="NSWISH"] .saga-exp-logo--swish {
    width: 72px !important;
    max-width: 90px !important;
    height: 22px !important;
    max-height: 22px !important;
}

.saga-exp-logo-fallback {
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #4a4a49 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-indent: 0 !important;
    text-transform: none !important;
    text-decoration: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    float: none !important;
}

/* Method-specific border reinforcement */
button.saga-express-btn[data-method="APPLE_PAY"],
.saga-express-btn[data-method="APPLE_PAY"] {
    background: #000 !important;
    border: none !important;
}

button.saga-express-btn[data-method="GOOGLE_PAY"],
.saga-express-btn[data-method="GOOGLE_PAY"] {
    background: #fff !important;
    border: 1px solid #dadce0 !important;
}

button.saga-express-btn[data-method="NSWISH"],
.saga-express-btn[data-method="NSWISH"] {
    background: #fff !important;
    border: 1px solid #dadce0 !important;
}

button.saga-express-btn[data-method="SVIPPS"],
.saga-express-btn[data-method="SVIPPS"] {
    background: #FF5B24 !important;
    border: none !important;
}

/* Button loading state � instant feedback on click */
.saga-exp-btn-loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.saga-exp-btn-loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    margin-top: -8px;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: sagaSpin 0.7s linear infinite;
}

/* Disabled state for non-selected buttons during loading */
.saga-exp-btn-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Unavailable (e.g. Apple Pay on non-Safari) */
.saga-exp-unavailable {
    opacity: 0.35 !important;
    cursor: not-allowed !important;
    pointer-events: auto;
}

/* =============================================
   POPUP OVERLAY
   ============================================= */

.saga-exp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--saga-z-overlay, 2147483640);
    padding: 16px;
    animation: sagaFadeIn 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.saga-exp-overlay.saga-exp-closing {
    animation: sagaFadeOut 0.2s ease forwards;
}

@keyframes sagaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes sagaFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* =============================================
   POPUP CARD
   ============================================= */

.saga-exp-popup {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    animation: sagaSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Mobile bottom-sheet drag handle */
.saga-exp-popup::before {
    content: '';
    display: none;
    width: 36px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 10px auto 0;
}

.saga-exp-closing .saga-exp-popup {
    animation: sagaSlideDown 0.2s ease forwards;
}

@keyframes sagaSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sagaSlideDown {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(16px) scale(0.97); }
}

/* =============================================
   THEME-PROOF POPUP ISOLATION
   ============================================= */

#saga-express-popup.saga-exp-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: var(--saga-z-overlay, 2147483640) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    padding: 16px !important;
    margin: 0 !important;
    background: rgba(0, 0, 0, 0.55) !important;
    color: #111827 !important;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    text-align: initial !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    float: none !important;
    clear: none !important;
}

#saga-express-popup,
#saga-express-popup *,
#saga-express-popup *::before,
#saga-express-popup *::after {
    box-sizing: border-box !important;
}

#saga-express-popup .saga-exp-popup {
    display: block !important;
    position: relative !important;
    width: min(400px, calc(100vw - 32px)) !important;
    max-width: 400px !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 32px) !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #111827 !important;
    border: 0 !important;
    border-radius: 20px !important;
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden !important;
    float: none !important;
    clear: none !important;
    text-align: initial !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-family: inherit !important;
    line-height: 1.5 !important;
}

#saga-express-popup .saga-exp-close,
#saga-express-popup button.saga-exp-close {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    bottom: auto !important;
    left: auto !important;
    z-index: var(--saga-z-modal, 2147483645) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: rgba(0, 0, 0, 0.06) !important;
    color: #666666 !important;
    font-family: Arial, sans-serif !important;
    font-size: 24px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    text-indent: 0 !important;
    text-align: center !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    box-shadow: none !important;
    outline: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    cursor: pointer !important;
    opacity: 1 !important;
    transform: none !important;
    float: none !important;
}

#saga-express-popup .saga-exp-close:hover,
#saga-express-popup button.saga-exp-close:hover {
    background: rgba(0, 0, 0, 0.1) !important;
    color: #333333 !important;
}

#saga-express-popup .saga-exp-header {
    display: block !important;
    padding: 28px 24px 0 !important;
    margin: 0 !important;
    text-align: center !important;
    background: transparent !important;
    border: 0 !important;
}

#saga-express-popup .saga-exp-method-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 64px !important;
    min-width: 64px !important;
    height: 64px !important;
    min-height: 64px !important;
    padding: 0 !important;
    margin: 0 0 8px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04) !important;
}

#saga-express-popup .saga-exp-method-icon img,
#saga-express-popup .saga-exp-logo,
#saga-express-popup .saga-exp-icon {
    display: block !important;
    width: auto !important;
    height: 32px !important;
    max-width: 48px !important;
    max-height: 32px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    border: 0 !important;
    object-fit: contain !important;
    float: none !important;
    transform: none !important;
}

#saga-express-popup .saga-exp-header h3 {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    color: #1a1a1a !important;
    background: transparent !important;
    border: 0 !important;
    font-family: inherit !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    letter-spacing: normal !important;
    text-align: center !important;
    text-transform: none !important;
}

#saga-express-popup .saga-exp-body {
    display: block !important;
    padding: 24px !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
}

#saga-express-popup .saga-exp-state {
    display: block;
    width: 100% !important;
    min-height: 100px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
}

#saga-express-popup .saga-exp-field {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 0 16px !important;
    background: transparent !important;
    border: 0 !important;
}

#saga-express-popup .saga-exp-field label {
    display: block !important;
    padding: 0 !important;
    margin: 0 0 5px !important;
    color: #374151 !important;
    background: transparent !important;
    border: 0 !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    letter-spacing: normal !important;
    text-align: left !important;
    text-transform: none !important;
}

#saga-express-popup .saga-exp-field input,
#saga-express-popup input.saga-exp-input {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 48px !important;
    max-height: none !important;
    padding: 11px 14px !important;
    margin: 0 !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    color: #1f2937 !important;
    box-shadow: none !important;
    outline: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
    letter-spacing: normal !important;
    text-align: left !important;
    text-transform: none !important;
    text-indent: 0 !important;
}

#saga-express-popup .saga-exp-field input:focus {
    border-color: #3b82f6 !important;
    background: #ffffff !important;
    color: #1f2937 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

#saga-express-popup .saga-exp-continue,
#saga-express-popup .saga-exp-pay-btn,
#saga-express-popup .saga-exp-retry,
#saga-express-popup button.saga-exp-continue,
#saga-express-popup button.saga-exp-pay-btn,
#saga-express-popup button.saga-exp-retry {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 48px !important;
    max-height: none !important;
    padding: 14px 18px !important;
    margin: 8px 0 0 !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: #111827 !important;
    color: #ffffff !important;
    box-shadow: none !important;
    outline: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    cursor: pointer !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    letter-spacing: normal !important;
    text-align: center !important;
    text-decoration: none !important;
    text-indent: 0 !important;
    text-transform: none !important;
    white-space: normal !important;
    opacity: 1 !important;
    transform: none !important;
    float: none !important;
}

#saga-express-popup .saga-exp-continue:hover,
#saga-express-popup .saga-exp-pay-btn:hover,
#saga-express-popup .saga-exp-retry:hover {
    background: #1f2937 !important;
    color: #ffffff !important;
    opacity: 1 !important;
}

/* Close button — must stay above SDK iframes/overlays.
   v4.0.25 compat: reduced z-index from Int32.MaxValue (2147483647) to 9999999
   so it sits above 3DS overlays but below OS-level UI (cookie banners, browser
   dialogs) and modern theme modal stacks. Previous value obscured theme UI. */
.saga-exp-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.06);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    z-index: var(--saga-z-modal, 2147483645);
    pointer-events: auto;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.saga-exp-close:hover {
    background: rgba(0,0,0,0.1);
    color: #333;
}

.saga-exp-close:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* =============================================
   HEADER
   ============================================= */

.saga-exp-header {
    padding: 28px 24px 0;
    text-align: center;
}

.saga-exp-method-icon {
    margin-bottom: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.saga-exp-method-icon .saga-exp-icon,
.saga-exp-method-icon .saga-exp-logo {
    height: 32px;
    width: auto;
    max-width: 40px;
    object-fit: contain;
}

.saga-exp-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.02em;
}

/* =============================================
   BODY
   ============================================= */

.saga-exp-body {
    padding: 24px;
}

.saga-exp-state {
    min-height: 100px;
}

/* =============================================
   FORM FIELDS
   ============================================= */

.saga-exp-field {
    margin-bottom: 16px;
}

.saga-exp-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

.saga-exp-required {
    color: #ef4444;
}

/* v4.0.25 compat: removed !important from layout-ish properties so theme CSS
   can still override. Kept minimal !important on background/color/border to
   protect against dark themes making inputs unreadable (white-on-white). */
.saga-exp-field input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    background: #fff !important;
    color: #1f2937 !important;
    font-family: inherit;
    -webkit-appearance: none;
}

.saga-exp-field input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff !important;
    color: #1f2937 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.saga-exp-field input:active,
.saga-exp-field input:hover {
    background: #fff !important;
    color: #1f2937 !important;
}

.saga-exp-field input::placeholder {
    color: #6b7280;
}

/* Override browser autofill light-on-light */
.saga-exp-field input:-webkit-autofill,
.saga-exp-field input:-webkit-autofill:hover,
.saga-exp-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #1f2937 !important;
    -webkit-box-shadow: 0 0 0px 1000px #fff inset !important;
    box-shadow: 0 0 0px 1000px #fff inset !important;
}

.saga-exp-field-row {
    display: flex;
    gap: 10px;
}

.saga-exp-field-row .saga-exp-field {
    flex: 1;
}

/* Continue button */
.saga-exp-continue {
    width: 100%;
    padding: 14px;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
}

.saga-exp-continue:hover {
    background: #1f2937;
}

.saga-exp-continue:active {
    transform: scale(0.98);
}

.saga-exp-continue:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* =============================================
   LOADING / PROCESSING
   ============================================= */

.saga-exp-loading,
.saga-exp-processing {
    text-align: center;
    padding: 32px 0 16px;
}

.saga-exp-loading p,
.saga-exp-processing p {
    color: #6b7280;
    font-size: 14px;
    margin: 14px 0 0;
    font-weight: 500;
}

.saga-exp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    margin: 0 auto;
    animation: sagaSpin 0.7s linear infinite;
}

.saga-exp-spinner-sm {
    width: 24px;
    height: 24px;
    border-width: 2.5px;
}

@keyframes sagaSpin {
    to { transform: rotate(360deg); }
}

/* =============================================
   PAY BUTTON STATE
   ============================================= */

.saga-exp-pay {
    text-align: center;
    padding: 12px 0;
}

.saga-exp-amount {
    font-size: 28px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 4px;
    letter-spacing: -0.03em;
}

.saga-exp-pay-desc {
    color: #4b5563; /* Improved contrast */
    font-size: 13px;
    margin: 0 0 20px;
}

.saga-exp-pay-btn {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    color: #fff;
    background: #111827;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
}

.saga-exp-pay-btn:hover { opacity: 0.92; }
.saga-exp-pay-btn:active { transform: scale(0.98); }

.saga-exp-pay-btn .saga-exp-icon,
.saga-exp-pay-btn .saga-exp-logo {
    height: 22px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
}

/* Method-specific pay button colors */
.saga-exp-pay-btn[data-method="APPLE_PAY"] { background: #000; }
.saga-exp-pay-btn[data-method="APPLE_PAY"] .saga-exp-logo { filter: brightness(0) invert(1); }
.saga-exp-pay-btn[data-method="GOOGLE_PAY"] { background: #4285F4; }
.saga-exp-pay-btn[data-method="GOOGLE_PAY"] .saga-exp-logo { filter: brightness(0) invert(1); }
.saga-exp-pay-btn[data-method="NSWISH"] { background: #22A348; }
.saga-exp-pay-btn[data-method="SVIPPS"] { background: #FF5B24; }
.saga-exp-pay-btn[data-method="SVIPPS"] .saga-exp-logo { filter: brightness(0) invert(1); }

/* SDK wallet widget containers � Apple Pay / Google Pay native buttons */
#saga-exp-applepay-widget,
#saga-exp-googlepay-widget {
    margin: 0 auto 12px;
    max-width: 320px;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    overflow: hidden !important;
    contain: paint;
    isolation: isolate;
    position: relative;
    border-radius: 8px;
}

.saga-exp-sdk-widget {
    width: 100%;
}

#saga-exp-applepay-widget > *,
#saga-exp-applepay-widget > * > *,
#saga-exp-googlepay-widget > *,
#saga-exp-googlepay-widget > * > * {
    width: 100% !important;
    max-width: 100% !important;
    height: 48px !important;
    max-height: 48px !important;
    overflow: hidden !important;
    border-radius: 8px !important;
}

#saga-exp-applepay-widget apple-pay-button,
#saga-exp-applepay-widget button,
#saga-exp-googlepay-widget button,
#saga-exp-googlepay-widget iframe,
#saga-exp-googlepay-widget div[role="button"] {
    width: 100% !important;
    min-height: 48px;
    max-height: 48px !important;
    border-radius: 8px;
}

#saga-exp-googlepay-widget iframe,
#saga-exp-applepay-widget iframe {
    position: relative !important;
    max-width: 100% !important;
    border: none !important;
}

/* =============================================
   QR CODE STATE (SWISH DESKTOP)
   ============================================= */

.saga-exp-qr {
    text-align: center;
    padding: 8px 0;
}

.saga-exp-qr-title {
    color: #374151;
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 16px;
}

.saga-exp-qr-img {
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.saga-exp-qr-img img {
    max-width: 220px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 8px;
    background: #fff;
}

.saga-exp-qr-wait {
    color: #4b5563; /* Improved contrast */
    font-size: 13px;
    margin: 8px 0 0;
    animation: sagaPulse 1.5s ease-in-out infinite;
}

@keyframes sagaPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* =============================================
   SUCCESS STATE
   ============================================= */

.saga-exp-success {
    text-align: center;
    padding: 24px 0 12px;
}

.saga-exp-check-circle {
    margin-bottom: 12px;
    animation: sagaScaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sagaScaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.saga-exp-success-title {
    font-size: 18px;
    font-weight: 700;
    color: #059669;
    margin: 0 0 6px;
}

.saga-exp-redirect-msg {
    color: #4b5563; /* Improved contrast */
    font-size: 13px;
    font-weight: 400;
    margin: 0;
}

/* =============================================
   ERROR STATE
   ============================================= */

.saga-exp-error {
    text-align: center;
    padding: 24px 0 12px;
}

.saga-exp-error-circle {
    margin-bottom: 12px;
    animation: sagaShake 0.5s ease;
}

@keyframes sagaShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.saga-exp-error-msg {
    color: #dc2626;
    font-size: 14px;
    margin: 0 0 18px;
    line-height: 1.5;
    font-weight: 500;
}

.saga-exp-retry {
    padding: 11px 28px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    color: #374151;
    font-family: inherit;
}

.saga-exp-retry:hover { background: #e5e7eb; }
.saga-exp-retry:active { transform: scale(0.97); }
.saga-exp-retry:focus-visible { outline: 2px solid #0066cc; outline-offset: 2px; }

.saga-exp-timeout-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    color: #3b82f6;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.saga-exp-timeout-link:hover {
    text-decoration: underline;
}

/* =============================================
   VIPPS BACKDROP (iframe centering)
   ============================================= */

.saga-exp-vipps-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2147483646;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =============================================
   MINI-CART / CART DRAWER
   ============================================= */

.widget_shopping_cart .saga-express-checkout,
.woocommerce-mini-cart__buttons .saga-express-checkout {
    margin: 8px 0 0;
    padding: 8px 0 0;
    border-top: 1px solid #e5e7eb;
}

.widget_shopping_cart .saga-express-separator,
.woocommerce-mini-cart__buttons .saga-express-separator {
    margin-bottom: 8px;
}

.widget_shopping_cart .saga-express-separator span,
.woocommerce-mini-cart__buttons .saga-express-separator span {
    font-size: 10px;
}

.widget_shopping_cart button.saga-express-btn,
.widget_shopping_cart .saga-express-btn,
.woocommerce-mini-cart__buttons button.saga-express-btn,
.woocommerce-mini-cart__buttons .saga-express-btn {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    border-radius: 4px !important;
}

.widget_shopping_cart .saga-express-btn img,
.widget_shopping_cart .saga-express-btn .saga-exp-logo,
.woocommerce-mini-cart__buttons .saga-express-btn img,
.woocommerce-mini-cart__buttons .saga-express-btn .saga-exp-logo {
    height: 16px !important;
    max-height: 16px !important;
    max-width: 70px !important;
}

/* =============================================
   PRODUCT PAGE ADJUSTMENTS
   ============================================= */

.product .saga-express-checkout {
    margin-top: 12px;
    border-top: 1px solid #e5e7eb;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 480px) {
    .saga-express-btn {
        height: 44px;
    }

    .saga-exp-popup {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        margin-top: auto;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .saga-exp-popup::before {
        display: none;
    }

    .saga-exp-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .saga-exp-amount {
        font-size: 24px;
    }
}

@media (max-width: 360px) {
    .saga-exp-header {
        padding: 20px 16px 0;
    }

    .saga-exp-body {
        padding: 16px;
    }

    .saga-exp-header h3 {
        font-size: 17px;
    }

    .saga-exp-field-row {
        flex-direction: column;
        gap: 0;
    }
}

/* =============================================
   DARK MODE SUPPORT
   ============================================= */

@media (prefers-color-scheme: dark) {
    .saga-express-separator span {
        color: #4b5563; /* Improved contrast */
    }

    .saga-express-separator::before,
    .saga-express-separator::after {
        background: #374151;
    }

    button.saga-express-btn[data-method="GOOGLE_PAY"],
    .saga-express-btn[data-method="GOOGLE_PAY"] {
        background: #1f2937 !important;
        border-color: #374151 !important;
    }

    .saga-express-btn[data-method="GOOGLE_PAY"] img {
        filter: brightness(0) invert(1) !important;
    }

    button.saga-express-btn[data-method="NSWISH"],
    .saga-express-btn[data-method="NSWISH"] {
        background: #ffffff !important;
        border-color: #dadce0 !important;
    }

    .saga-express-btn[data-method="NSWISH"] img,
    .saga-express-btn[data-method="NSWISH"] .saga-exp-logo {
        filter: none !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Popup dark mode */
    .saga-exp-popup {
        background: #1f2937;
        color: #e5e7eb;
    }

    .saga-exp-header {
        border-bottom-color: #374151;
    }

    .saga-exp-header h3 {
        color: #f3f4f6;
    }

    .saga-exp-amount {
        color: #fff;
    }

    .saga-exp-pay-desc {
        color: #9ca3af;
    }

    .saga-exp-close {
        color: #4b5563; /* Improved contrast */
    }

    .saga-exp-close:hover {
        color: #f3f4f6;
        background: rgba(255, 255, 255, 0.1);
    }

    .saga-exp-form input {
        background: #fff !important;
        color: #1f2937 !important;
        border-color: #d1d5db !important;
    }

    .saga-exp-form input:focus {
        border-color: #3b82f6 !important;
        background: #fff !important;
        color: #1f2937 !important;
    }

    .saga-exp-form label {
        color: #374151;
    }

    .saga-exp-qr-img {
        background: #fff;
        padding: 12px;
        border-radius: 8px;
    }
}

/* =============================================
   REDUCED MOTION � respect user accessibility preference
   ============================================= */

@media (prefers-reduced-motion: reduce) {
    .saga-exp-overlay,
    .saga-exp-popup,
    .saga-exp-check-circle svg,
    .saga-exp-error-circle svg,
    .saga-exp-spinner,
    .saga-exp-qr-wait {
        animation: none !important;
        transition: none !important;
    }

    .saga-exp-overlay {
        opacity: 1;
    }

    .saga-exp-check-circle {
        animation: none !important;
    }

    .saga-exp-qr-wait {
        opacity: 1;
    }
}

/* =============================================
   PRINT: HIDE EVERYTHING
   ============================================= */

/* Screen-reader only utility */
.saga-exp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media print {
    .saga-express-checkout,
    .saga-exp-overlay {
        display: none !important;
    }
}
