/* Global XP Network CSS Variables */
:root {
    /* Brand palette */
    --xp-color-bg-dark-1: #1d0538; /* deep purple */
    --xp-color-bg-dark-2: #2c134a; /* top gradient purple */
    --xp-color-white: #ffffff;
    --xp-color-gold-1: #e5af0c; /* gold */
    --xp-color-gold-2: #af5f1e; /* deep gold */
    --xp-font-family: Archivo, sans-serif;

    /* Reusable gradients */
    --xp-gradient-surface: linear-gradient(180deg, var(--xp-color-bg-dark-2) 0%, var(--xp-color-bg-dark-1) 100%);
    --xp-gradient-gold: linear-gradient(180deg, var(--xp-color-gold-1) 0%, var(--xp-color-gold-2) 100%);
    --xp-gradient-shine: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    /* Slightly amber shine for button overlay to match Figma */
    --xp-gradient-shine-amber: linear-gradient(
        180deg,
        rgba(253, 201, 103, 0.16) 0%,
        rgba(253, 201, 103, 0.08) 50%,
        rgba(253, 201, 103, 0) 100%
    );
}

.xp-login-container {
    margin-top: 5px;
}

.xp-login-icon-button {
    margin-top: -5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.xp-login-icon-button:hover img {
    transform: scale(1.1);
}

.xp-login-icon-button img {
    width: 24px;
    height: 24px;
    display: block;
    transition: transform 0.2s ease;
}

.xp-login-icon-button.authenticated img {
    width: 26px;
    height: 26px;
}

.xp-login-popover {
    position: fixed;
    background: var(--xp-gradient-surface);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    flex-direction: column;
    gap: 12px;
    width: 90vw;
    max-width: 400px;
    pointer-events: auto;
    overflow: hidden;
}

.xp-login-popover.open {
    display: flex;
}

.xp-login-popover-trigger {
    position: relative;
    display: inline-block;
    z-index: 3;
}

.xp-login-popover-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 16px 12px 16px;
    background: var(--xp-gradient-shine);
    border-radius: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.xp-login-popover-header.has-balance {
    justify-content: space-between;
}

.xp-header-balance-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.xp-transfer-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--xp-color-gold-1);
    text-decoration: none;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.xp-transfer-link:hover {
    color: var(--xp-color-white);
    background: rgba(255, 255, 255, 0.1);
}

.xp-header-balance-icon {
    width: 24px;
    height: 24px;
}

.xp-header-balance-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.xp-header-balance-text {
    color: var(--xp-color-white);
    font-family: var(--xp-font-family);
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
}

.xp-header-points-title {
    color: var(--xp-color-white);
    font-family: var(--xp-font-family);
    font-size: 8px;
    font-weight: 500;
    line-height: 12px;
}

.xp-login-popover-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.xp-login-popover-logo-link:hover {
    opacity: 0.8;
}

.xp-login-popover-logo {
    width: 90px;
    height: auto;
    display: block;
}

.xp-login-popover-content {
    padding: 16px;
    text-align: center;
    margin-top: -12px;
}

.xp-login-description {
    color: var(--xp-color-white);
    font-family: var(--xp-font-family);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    margin-bottom: 16px;
    font-weight: 400;
}

.xp-login-button-in-popover {
    background: var(--xp-gradient-surface);
    border: 1px solid var(--xp-color-gold-1);
    cursor: pointer;
    padding: 12px 16px;
    min-height: 44px;
    border-radius: 50px;
    color: var(--xp-color-white);
    font-family: var(--xp-font-family);
    font-size: 14px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01) inset;
    transform-origin: center;
    transition:
        transform 0.15s ease,
        opacity 0.2s ease;
    /* Mobile touch improvements */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.xp-login-button-in-popover::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: inherit;
    background: var(--xp-gradient-shine-amber);
    pointer-events: none;
    z-index: 1;
}

.xp-login-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
    position: relative;
    flex-shrink: 0;
}

.xp-login-button-icon img {
    width: 18px;
    height: 18px;
}

.xp-login-button-text {
    position: relative;
    z-index: 2;
}

.xp-login-page-link {
    color: var(--xp-color-white);
    text-decoration: none;
    font-family: var(--xp-font-family);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 0;
    transition: opacity 0.2s ease;
}

.xp-login-page-link:hover {
    opacity: 0.85;
}

@media (max-width: 768px) {
    .xp-login-popover {
        max-width: calc(100vw - 16px);
        width: auto;
    }
}

/* XP Cart Selector Component Styles */

.xp-cart-selector-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

.xp-cart-selector {
    font-family: var(--xp-font-family);
}

.xp-selector-card,
.xp-prompt-card {
    padding: 3px;
    position: relative;
}

.xp-cart-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.xp-cart-header-new {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.xp-cart-header-inner {
    display: flex;
    gap: 12px;
    align-items: center;
}

.xp-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
    align-items: flex-start;
}

.xp-question {
    color: var(--xp-color-white);
    font-family: var(--xp-font-family);
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    text-align: left;
}

.xp-conversion-rate {
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--xp-font-family);
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
}

.xp-header-right {
    flex-shrink: 0;
}

.xp-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(58, 58, 58, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.xp-cart-header h3 {
    color: var(--xp-color-white);
    font-weight: 600;
    font-size: 18px;
    margin: 0;
    line-height: 1.2;
    flex: 1;
}

.xp-balance {
    color: var(--xp-color-white);
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.xp-input-group-new {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    margin-bottom: 16px;
}

.xp-input-group-new .xp-number-input-large {
    flex: 1;
    min-width: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.xp-input-group-new .xp-max-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.xp-selected-display {
    color: #f2bc17;
    font-weight: 500;
}

.xp-discount-value {
    color: #f2bc17;
}

.xp-caret-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.xp-divider {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

.xp-selected-amount {
    color: var(--xp-color-gold-1);
}

@media (max-width: 480px) {
    .xp-cart-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .xp-balance {
        width: 100%;
        justify-content: flex-start;
    }

    .xp-cart-header-new {
        flex-direction: row;
        gap: 16px;
        align-items: center;
    }

    .xp-question {
        font-size: 14px;
        line-height: 20px;
    }

    .xp-header-left {
        flex: 1 1 auto;
        min-width: 150px;
    }
}

.xp-cart-content {
    position: relative;
    z-index: 1;
}

.xp-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.xp-number-input {
    flex: 1;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--xp-color-white);
    font-family: var(--xp-font-family);
}

.xp-number-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.xp-number-input-large {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    color: var(--xp-color-white);
    font-family: var(--xp-font-family);
    text-align: center;
    transition: all 0.2s ease;
}

.xp-number-input-large:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.xp-number-input-large:focus {
    outline: none;
    border-color: var(--xp-color-gold-1);
    background: rgba(255, 255, 255, 0.15);
}

.xp-number-input-large::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.xp-number-input-large::-webkit-inner-spin-button,
.xp-number-input-large::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.xp-max-btn {
    padding: 10px 16px;
    background: var(--xp-gradient-gold);
    color: var(--xp-color-white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--xp-font-family);
    /* transition: all 0.2s ease; */
    white-space: nowrap;
    flex-shrink: 0;
}

.xp-max-btn:hover {
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.xp-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.xp-apply-btn,
.xp-clear-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--xp-font-family);
    font-size: 14px;
    transition: all 0.2s ease;
}

.xp-apply-btn {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.2) 100%);
    color: var(--xp-color-white);
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.xp-apply-btn-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

.xp-apply-btn .discount-amount {
    font-weight: 700;
    color: var(--xp-color-gold-1);
}

.xp-apply-btn:disabled {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
}

.xp-apply-btn:disabled .discount-amount {
    color: rgba(229, 175, 12, 0.5);
}

.xp-apply-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.xp-apply-btn-new {
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 44px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--xp-font-family);
    font-size: 12px;
    line-height: 16px;
    transition: all 0.2s ease;
    background: linear-gradient(
        180deg,
        rgba(202, 202, 202, 0.15) 0%,
        rgba(193, 193, 193, 0.07) 45%,
        rgba(135, 135, 135, 0.07) 100%
    );
    color: var(--xp-color-white);
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.01) inset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.xp-apply-btn-text-new {
    display: flex;
    align-items: center;
    gap: 4px;
}

.xp-apply-discount-amount {
    font-weight: 600;
}

.xp-apply-btn-new:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.xp-apply-btn-new:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.xp-clear-btn {
    background: rgba(244, 67, 54, 0.8);
    color: var(--xp-color-white);
}

.xp-clear-btn:hover {
    background: rgba(244, 67, 54, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.xp-clear-btn-new {
    padding: 6px 10px;
    border: 1px solid rgba(244, 67, 54, 0.5);
    border-radius: 44px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--xp-font-family);
    font-size: 12px;
    line-height: 16px;
    transition: all 0.2s ease;
    background: linear-gradient(180deg, rgba(244, 67, 54, 0.7) 0%, rgba(220, 50, 40, 0.8) 100%);
    color: var(--xp-color-white);
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.01) inset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.xp-clear-btn-new:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
    background: linear-gradient(180deg, rgba(244, 67, 54, 0.85) 0%, rgba(220, 50, 40, 0.95) 100%);
}

.xp-not-logged-in {
    display: none;
}

.xp-not-logged-in p {
    color: var(--xp-color-white);
    font-size: 16px;
    margin: 0;
    text-align: center;
    position: relative;
    z-index: 1;
}

.config-error {
    text-align: center;
    padding: 8px;
}

.error-message {
    color: #f44336;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

/* Max XP info text */
.xp-max-info {
    font-family: Archivo, sans-serif;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    margin-top: 8px;
    width: 100%;
}

/* No balance message */
.xp-no-balance .xp-selector-card {
    padding: 20px;
}

.xp-no-balance-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.xp-no-balance-text {
    text-align: center;
    font-family: Archivo, sans-serif;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.xp-earn-link {
    font-family: Archivo, sans-serif;
    font-size: 12px;
    color: #e5af0c;
    text-decoration: none;
}

.xp-earn-link:hover {
    text-decoration: underline;
}

/* ============================================
   Catalyst Theme Override Fixes
   ============================================
   High-specificity rules to prevent theme CSS from breaking cart selector layout.
*/

/* 1. Fix the Apply button - proper width and single line text */
.xp-cart-content .xp-apply-btn-new {
    min-width: 160px !important;
    padding: 10px 20px !important;
    white-space: nowrap !important;
}

/* 2. Fix the discount amount span inside button - remove box styling */
.xp-cart-content .xp-apply-btn-new .xp-discount-display,
.xp-cart-content .xp-apply-btn-new span {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline !important;
}

/* 3. Fix the number input - prevent theme overriding background */
.xp-cart-content .xp-number-input-large,
.xp-cart-content input.xp-number-input-large {
    background: rgba(255, 255, 255, 0.1) !important;
    box-shadow: none !important;
}

/* 5. Hide the straggler data elements that should be invisible */
.xp-cart-content span[id^='xp-selected-'],
.xp-cart-content span[id^='xp-balance-amount-'] {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* ============================================
   Minimum XP Spend Notice Styles
   ============================================ */

.xp-min-spend-notice {
    margin-bottom: 12px;
}

.xp-min-spend-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    font-family: var(--xp-font-family);
    font-size: 13px;
    line-height: 1.4;
}

.xp-min-spend-banner.xp-can-meet {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #81c784;
}

.xp-min-spend-banner.xp-cannot-meet {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #ef9a9a;
}

.xp-min-spend-icon {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: bold;
    height: 16px;
    width: 16px;
}

.xp-min-spend-message {
    flex: 1;
}

/* ============================================
   XP Price Display Styles
   ============================================ */

.xp-price-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--xp-font-family);
    margin: 8px 0;
}

/* Badge style (default) */
.xp-price-display--badge .xp-price-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    padding: 6px;
}

/* Badge style variants */
.xp-price-badge--purple {
    background: linear-gradient(180deg, #2c134a 0%, #1d0538 100%);
    border: 1px solid rgba(255, 255, 255, 1);
}

.xp-price-badge--white {
    background: #ffffff;
    border: 1px solid #000000;
}

.xp-price-badge--white .xp-price-value {
    color: #000000;
}

.xp-price-badge--white .xp-price-points-title {
    color: #000000;
}

.xp-price-badge--none {
    background: transparent;
    border: none;
    padding: 0;
}

.xp-price-badge--none .xp-price-value {
    color: inherit;
}

.xp-price-badge--none .xp-price-points-title {
    color: inherit;
}

/* With label style */
.xp-price-display--with_label {
    flex-direction: row;
}

.xp-price-display--with_label .xp-price-label {
    color: inherit;
    font-size: inherit;
    font-weight: 500;
}

.xp-price-display--with_label .xp-price-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    padding: 6px;
}

/* Inline style */
.xp-price-display--inline {
    flex-wrap: wrap;
}

.xp-price-display--inline .xp-price-currency {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.xp-price-display--inline .xp-price-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    padding: 6px;
}

/* Stacked style */
.xp-price-display--stacked {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.xp-price-display--stacked .xp-price-currency {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.xp-price-display--stacked .xp-price-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    padding: 6px;
}

/* Common badge elements */
.xp-price-icon {
    width: 1.15em;
    height: 1.15em;
    flex-shrink: 0;
    margin-right: 0.4em;
    margin-left: 0.1em;
}

.xp-price-value {
    color: inherit;
    font-size: inherit;
}

.xp-price-points-title {
    color: var(--xp-color-white, #ffffff);
    font-size: inherit;
    font-weight: inherit;
    margin-left: 4px;
}
