/* ----------------------------------------------------------------
 * Checkout
 * ---------------------------------------------------------------- */
.erp-checkout {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 16px 75px;
    font-family: var(--erp-font);
}
.erp-checkout h1 {
    font-size: 30px;
    line-height: 1.15;
    margin: 0 0 20px;
}

.erp-cart > .erp-page-heading,
.erp-checkout > .erp-page-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.erp-cart > .erp-page-heading {
    margin-bottom: 24px;
}

.erp-checkout > .erp-page-heading {
    margin-bottom: 20px;
}

.erp-cart .erp-page-heading h1,
.erp-checkout .erp-page-heading h1 {
    margin: 0;
}

.erp-page-heading__logout {
    flex: 0 0 auto;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: var(--erp-text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    line-height: 1.4;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: color var(--erp-transition), text-decoration-color var(--erp-transition);
}

.erp-page-heading__logout:hover,
.erp-page-heading__logout:focus-visible {
    color: var(--erp-text);
    text-decoration-color: currentColor;
}

.erp-page-heading__logout:focus-visible {
    outline: 2px solid var(--erp-primary);
    outline-offset: 3px;
    border-radius: 2px;
}

.erp-checkout__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 28px;
    align-items: start;
}

/* Checkout login prompt */
.erp-checkout__login-prompt {
    margin-bottom: 20px;
    padding: 16px 18px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: var(--erp-radius);
    font-size: 14px;
    box-shadow: var(--erp-shadow);
}

.erp-checkout__login-prompt > p {
    margin: 0;
    color: #475569;
}

.erp-checkout__login-prompt > p a {
    color: var(--erp-primary);
    font-weight: 600;
    text-decoration: none;
}

.erp-checkout__login-prompt > p a:hover {
    text-decoration: underline;
}

.erp-checkout__login-form {
    margin-top: 12px;
}

.erp-checkout__login-form .erp-form-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.erp-checkout__login-form .erp-form-group {
    flex: 1;
}

.erp-checkout__login-form .erp-form-group--btn {
    flex: 0 0 auto;
}

.erp-checkout__login-form .erp-form-group--btn button {
    white-space: nowrap;
    height: 40px;
}

.erp-checkout__login-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--erp-text-muted);
    margin-bottom: 4px;
}

.erp-checkout__login-error {
    margin-top: 8px;
    font-size: 13px;
    color: #dc2626;
}

@media (max-width: 640px) {
    .erp-checkout__login-form .erp-form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .erp-checkout__login-form .erp-form-group--btn {
        flex: 1;
    }
}

.erp-checkout__step {
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: var(--erp-radius);
    margin-bottom: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--erp-shadow);
}
.erp-checkout__step--active {
    border-color: color-mix(in srgb, var(--erp-primary) 42%, transparent);
}
.erp-checkout__step--done {
    border-color: rgba(34, 197, 94, 0.42);
}

.erp-checkout__step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: #fff;
    border-bottom: 1px solid var(--erp-border);
}
.erp-checkout__step--active .erp-checkout__step-header {
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}
.erp-checkout__step--done .erp-checkout__step-header {
    background: linear-gradient(180deg, #f7fef9 0%, #ffffff 100%);
}

.erp-checkout__step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}
.erp-checkout__step--active .erp-checkout__step-num {
    background: var(--erp-primary);
    color: #fff;
}
.erp-checkout__step--done .erp-checkout__step-num {
    background: var(--erp-success);
    color: #fff;
}

.erp-checkout__step-header h2 {
    flex: 1;
    font-size: 17px;
    margin: 0;
}

.erp-checkout__step-body {
    padding: 22px;
}

.erp-checkout__step-summary {
    padding: 0 0 12px;
    font-size: 14px;
    color: var(--erp-text-muted);
}

/* Forms */
.erp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.erp-form-group {
    margin-bottom: 14px;
}
.erp-form-group--sm {
    max-width: 120px;
}
.erp-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--erp-text);
}

.erp-checkout__form button[type="submit"],
#erp-place-order {
    min-height: 48px;
    min-width: 210px;
    color: #fff;
}

#erp-place-order {
    width: 100%;
    margin-top: 14px;
}

.erp-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}
.erp-checkbox input { margin: 0; }

/* Shipping options */
.erp-shipping-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.erp-shipping-options--loading {
    min-height: 100px;
    align-items: stretch;
    justify-content: flex-start;
    text-align: left;
}
.erp-shipping-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: var(--erp-radius-sm);
    cursor: pointer;
    background: #fff;
    transition: border-color var(--erp-transition), box-shadow var(--erp-transition), background var(--erp-transition);
}
.erp-shipping-option:has(input:checked) {
    border-color: var(--erp-primary);
    background: color-mix(in srgb, var(--erp-primary) 5%, var(--erp-bg));
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.08);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--erp-primary) 9%, transparent);
}
.erp-shipping-option__body {
    flex: 1;
}
.erp-shipping-option__body strong {
    display: block;
    font-size: 14px;
}
.erp-shipping-option__body span {
    font-size: 12px;
    color: var(--erp-text-muted);
}
.erp-shipping-option__price {
    font-weight: 600;
    font-size: 14px;
}

.erp-checkout__free-hint {
    font-size: 13px;
    color: var(--erp-success);
    margin-bottom: 16px;
}

.erp-checkout__terms {
    font-size: 12px;
    color: var(--erp-text-muted);
    margin-top: 12px;
    text-align: center;
}
.erp-checkout__terms a {
    color: var(--erp-primary);
}

/* Inline form validation */
.erp-form-group.has-error .erp-input {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
.erp-form-error {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #dc2626;
    line-height: 1.3;
}

/* Dedicated shop login */
.erp-login__card {
    width: min(100%, 520px);
    max-width: 520px;
    margin-inline: auto;
}

.erp-login__auth {
    display: block;
    border-bottom: 0;
    border-radius: var(--erp-radius);
}

.erp-login__reset-feedback {
    margin-top: 12px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.45;
}

.erp-login__reset-feedback--success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.erp-login__reset-feedback--error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.erp-login__password-reset {
    margin-top: 12px;
}

.erp-login__password-reset summary {
    width: fit-content;
    color: var(--erp-primary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.erp-login__password-reset summary:hover,
.erp-login__password-reset summary:focus-visible {
    color: var(--erp-primary-hover);
    text-decoration: underline;
}

.erp-login__password-reset-content {
    margin-top: 10px;
    padding: 14px;
    border: 1px solid var(--erp-border);
    border-radius: 10px;
    background: #fff;
}

.erp-login__password-reset-content p {
    margin: 0 0 12px;
    color: var(--erp-text-muted);
    font-size: 14px;
}

.erp-login__password-reset-form {
    display: grid;
    gap: 9px;
}

.erp-login__password-reset-form label {
    color: var(--erp-text);
    font-size: 13px;
    font-weight: 700;
}

.erp-login__password-reset-button {
    width: 100%;
    min-height: 44px;
}

.erp-login__password-update-form {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--erp-border);
    border-radius: 12px;
    background: #fff;
}

.erp-login__password-update-form label {
    color: var(--erp-text);
    font-size: 13px;
    font-weight: 700;
}

.erp-login__password-update-form small {
    margin-top: -5px;
    color: var(--erp-text-muted);
    font-size: 12px;
}

.erp-login__back-link {
    display: inline-block;
    margin-top: 14px;
    color: var(--erp-primary);
    font-size: 14px;
    font-weight: 700;
}

.erp-login__back-link:hover,
.erp-login__back-link:focus-visible {
    color: var(--erp-primary-hover);
    text-decoration: underline;
}

.erp-login__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

/* Trust signals on checkout sidebar */
.erp-checkout__trust {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--erp-border);
}
.erp-checkout__trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--erp-text-muted);
}
.erp-checkout__trust-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--erp-success, #22c55e);
}

/* Trust signals on cart sidebar */
.erp-cart__trust {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--erp-border);
}
.erp-cart__trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--erp-text-muted);
}
.erp-cart__trust-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: var(--erp-success, #22c55e);
}

/* Sticky mobile checkout CTA */
@media (max-width: 768px) {
    .erp-cart__sidebar .erp-cart__totals {
        position: sticky;
        bottom: 0;
        z-index: 100;
        background: #fff;
        margin: 0 -12px;
        padding: 14px 12px 14px;
        box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.1);
        border-top: 1px solid var(--erp-border);
        border-radius: 0;
    }
}

.erp-payment-box {
    border: 1px solid var(--erp-border);
    background: #f8fafc;
    border-radius: var(--erp-radius-sm);
    padding: 14px;
}

.erp-payment-box--loading {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.erp-payment-box__title {
    margin: 0 0 6px;
    font-weight: 600;
    color: var(--erp-text);
}

.erp-payment-box__text {
    margin: 0;
    color: var(--erp-text-muted);
    font-size: 14px;
}

.erp-payment-box__actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.erp-payment-box__spinner {
    width: 42px;
    height: 42px;
    margin: 0 0 14px;
    border: 3px solid #dbe4f0;
    border-top-color: var(--erp-primary);
    border-radius: 999px;
    animation: erp-shop-spin 0.8s linear infinite;
}

@keyframes erp-shop-spin {
    to {
        transform: rotate(360deg);
    }
}

body.erp-payment-is-preparing {
    overflow: hidden;
}

.erp-payment-preparation {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: 20px;
    font-family: var(--erp-font);
}

.erp-payment-preparation[hidden] {
    display: none !important;
}

.erp-payment-preparation__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.66);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.erp-payment-preparation__card {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    padding: 30px 26px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
    text-align: center;
}

.erp-payment-preparation__card .erp-payment-box__spinner {
    margin: 0 auto 18px;
}

.erp-payment-preparation__title {
    margin: 0 0 8px;
    color: var(--erp-text);
    font-size: 20px;
    font-weight: 700;
}

.erp-payment-preparation__message {
    min-height: 42px;
    margin: 0;
    color: var(--erp-text-muted);
    font-size: 15px;
    line-height: 1.45;
}

.erp-payment-preparation__hint {
    margin: 14px 0 0;
    color: #94a3b8;
    font-size: 12px;
}

/* Sidebar */
.erp-checkout__sidebar {
    position: sticky;
    top: 24px;
    align-self: start;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: var(--erp-radius);
    padding: 22px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}
.erp-checkout__sidebar h3 {
    font-size: 18px;
    margin: 0 0 18px;
}

.erp-checkout__item {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    font-size: 14px;
    padding: 12px 0;
    border-bottom: 1px solid #edf2f7;
}
.erp-checkout__item-media {
    width: 58px;
    height: 58px;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-sm);
    background: var(--erp-bg-light);
    overflow: hidden;
}
.erp-checkout__item-media img,
.erp-checkout__item-media span {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.erp-checkout__item-name {
    display: block;
    color: var(--erp-text);
    font-weight: 700;
    line-height: 1.28;
    text-decoration: none;
}
.erp-checkout__item-name:hover {
    color: var(--erp-primary);
}
.erp-checkout__item-main small {
    display: block;
    margin-top: 3px;
    color: var(--erp-text-muted);
}
.erp-checkout__item-price {
    font-weight: 700;
    white-space: nowrap;
}

.erp-checkout__totals {
    border-top: 1px solid var(--erp-border);
    margin-top: 16px;
    padding-top: 14px;
}

/* Checkout owns its controls even when a theme overrides .btn or .form-control. */
#erp-checkout :is(.erp-checkout__step, .erp-checkout__sidebar, .erp-checkout__login-prompt) {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .035);
}

#erp-checkout .erp-checkout__step-header {
    border: 0;
    background: transparent;
}

#erp-checkout .erp-checkout__step--done .erp-checkout__step-num {
    background: #dcfce7;
    color: #166534;
}

#erp-checkout .erp-checkout__step-header h2 {
    min-width: 0;
    border-radius: 4px;
    font-weight: 650;
    line-height: 1.35;
}

#erp-checkout :is(.erp-form-group, .erp-shipping-option__body) {
    min-width: 0;
}

#erp-checkout .erp-input {
    box-sizing: border-box;
    width: 100%;
    height: auto;
    min-height: 48px;
    margin: 0;
    padding: 11px 13px;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    background-color: #fff !important;
    box-shadow: none !important;
    color: var(--erp-text) !important;
    font-family: var(--erp-font);
    font-size: 16px !important;
    line-height: 1.5;
}

#erp-checkout select.erp-input {
    padding-right: 36px;
}

#erp-checkout .erp-input:focus {
    border-color: var(--erp-primary) !important;
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--erp-primary) 14%, transparent) !important;
}

#erp-checkout .erp-form-group.has-error .erp-input {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, .12) !important;
}

#erp-checkout .erp-form-group label {
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

#erp-checkout .erp-form-group label.erp-checkbox {
    display: flex;
    min-height: 44px;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    font-weight: 400;
}

#erp-checkout :is(input[type="radio"], input[type="checkbox"]) {
    appearance: auto !important;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--erp-primary);
    box-shadow: none;
}

#erp-checkout :is(button, a).btn-gradient-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    min-width: 0;
    max-width: 100%;
    height: auto;
    padding: 12px 20px;
    border: 1px solid transparent !important;
    border-radius: 12px !important;
    background: linear-gradient(90deg, var(--erp-primary-hover), var(--erp-primary)) !important;
    box-shadow: none;
    color: #fff !important;
    font-family: var(--erp-font);
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    letter-spacing: normal;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    white-space: normal;
    cursor: pointer;
    transition: box-shadow .15s ease;
}

#erp-checkout .btn-gradient-primary:hover:not(:disabled) {
    box-shadow: 0 4px 14px color-mix(in srgb, var(--erp-primary) 20%, transparent);
}

#erp-checkout .btn-gradient-primary:disabled {
    opacity: .55;
    box-shadow: none;
    cursor: not-allowed;
}

#erp-checkout :is(.erp-inline-action, .erp-page-heading__logout) {
    min-height: 44px;
    min-width: 0;
    padding: 6px 8px;
    border: 0 !important;
    border-radius: 6px;
    background: transparent !important;
    box-shadow: none;
    color: var(--erp-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    text-transform: none;
    text-underline-offset: 3px;
}

#erp-checkout :is(button, a, summary, input[type="radio"], input[type="checkbox"], .erp-checkout__step-header h2):focus-visible {
    outline: 3px solid var(--erp-primary);
    outline-offset: 3px;
}

#erp-checkout .erp-shipping-option {
    min-height: 64px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: none;
}

#erp-checkout .erp-shipping-option:has(input:checked) {
    border-color: var(--erp-primary);
    background: color-mix(in srgb, var(--erp-primary) 4%, #fff);
}

#erp-checkout .erp-payment-box {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

@media (max-width: 768px) {
    #erp-checkout .erp-checkout__form > button[type="submit"],
    #erp-checkout .erp-checkout__login-form button[type="submit"] {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    #erp-checkout :is(.btn-gradient-primary, .erp-input, .erp-shipping-option) {
        transition: none;
    }
}
/* Hosted Wallee fields inherit the checkout width on desktop and mobile. */
.erp-payment-option { align-items: center; }
.erp-payment-option__logo { width: 64px; max-height: 32px; object-fit: contain; margin-left: auto; }
.erp-payment-inline { min-width: 0; width: 100%; margin: 16px 0; }
.erp-payment-inline iframe { display: block; width: 100%; border: 0; }
