/* DX Premium Subscription Modal Styles - Premium Edition */

.subscription-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.subscription-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.subscription-modal-content {
    position: relative;
    background: var(--bg-primary, #0a0a0a);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 24px;
    max-width: 920px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    /* Prevent horizontal overflow */
    padding: 48px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* Ensure content doesn't overflow */
    box-sizing: border-box;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.subscription-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 300;
}

.subscription-modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary, #fff);
    transform: rotate(90deg) scale(1.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.subscription-modal-header {
    text-align: center;
    margin-bottom: 40px;
}

.subscription-modal-header h2 {
    font-size: 36px;
    font-weight: 800;
    margin: 0 0 16px 0;
    color: var(--text-primary, #fff);
    background: linear-gradient(135deg, #00d4ff 0%, #00ff88 50%, #00d4ff 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    line-height: 1.2;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.subscription-status {
    font-size: 15px;
    padding: 10px 20px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.subscription-status.active {
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
}

.subscription-status.active.premium {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.2);
}

.subscription-status.inactive {
    background: rgba(136, 136, 136, 0.1);
    color: #888;
    border: 1px solid rgba(136, 136, 136, 0.2);
}

.subscription-status.processing {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
}

.subscription-tiers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 28px;
    margin-bottom: 40px;
}

.subscription-tier-card {
    background: var(--bg-secondary, #1a1a1a);
    border: 2px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 20px;
    padding: 32px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    /* Prevent content from overflowing horizontally */
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

.subscription-tier-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-color, #00d4ff), transparent);
    opacity: 0;
    transition: opacity 0.4s;
}

.subscription-tier-card:hover {
    border-color: var(--accent-color, #00d4ff);
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 212, 255, 0.25), 0 0 0 1px rgba(0, 212, 255, 0.1);
}

.subscription-tier-card:hover::before {
    opacity: 1;
}

.subscription-tier-card[data-tier="premium"] {
    border-color: rgba(0, 255, 136, 0.4);
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.08) 0%, rgba(0, 212, 255, 0.08) 100%);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.15);
}

.subscription-tier-card[data-tier="premium"]::before {
    background: linear-gradient(90deg, transparent, #00ff88, transparent);
}

.subscription-tier-card[data-tier="premium"]:hover {
    box-shadow: 0 12px 40px rgba(0, 255, 136, 0.35), 0 0 0 1px rgba(0, 255, 136, 0.2);
    border-color: rgba(0, 255, 136, 0.6);
}

.tier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.tier-header h3 {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary, #fff);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.tier-badge {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid rgba(0, 212, 255, 0.3);
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.2);
}

.tier-badge.premium {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    border-color: rgba(0, 255, 136, 0.3);
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.2);
}

.tier-features {
    margin-bottom: 28px;
}

.tier-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tier-features li {
    padding: 12px 0;
    color: var(--text-secondary, #ccc);
    font-size: 15px;
    display: flex;
    align-items: center;
    line-height: 1.6;
    font-weight: 500;
}

.tier-features li::before {
    content: '✓';
    width: 24px;
    height: 24px;
    margin-right: 14px;
    background: linear-gradient(135deg, #00d4ff 0%, #00ff88 100%);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 700;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

.tier-price {
    font-size: 42px;
    font-weight: 800;
    color: var(--text-primary, #fff);
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.tier-price::after {
    content: '/month';
    font-size: 18px;
    font-weight: 500;
    color: var(--text-secondary, #888);
    margin-left: 4px;
}

.tier-button {
    width: 100%;
    padding: 16px 28px;
    background: linear-gradient(135deg, #00d4ff 0%, #00ff88 100%);
    border: none;
    border-radius: 14px;
    color: #000;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.4);
    position: relative;
    overflow: hidden;
}

.tier-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.tier-button:hover::before {
    left: 100%;
}

.tier-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.5);
}

.tier-button:active:not(:disabled) {
    transform: translateY(-1px);
}

/* Helio Checkout Container */
.helio-checkout-container {
    width: 100%;
    margin-top: 24px;
    margin-bottom: 24px;
    min-height: 200px;
    border-radius: 12px;
    overflow-x: hidden;
    overflow-y: visible;
    position: relative;
    /* Ensure proper sizing */
    box-sizing: border-box;
    /* Ensure container is visible and properly contained */
    display: block;
    visibility: visible;
    z-index: 1;
}

.helio-checkout-container iframe {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 200px;
    border: none;
    border-radius: 12px;
    display: block;
    box-sizing: border-box;
}

/* Ensure any child elements are contained horizontally only */
.helio-checkout-container>* {
    max-width: 100%;
    box-sizing: border-box;
}

/* Fix for Helio widget wrapper - only prevent horizontal overflow */
.helio-checkout-container div[style*="width"] {
    max-width: 100%;
    box-sizing: border-box;
}

/* Target any form or input elements that might overflow horizontally */
.helio-checkout-container form,
.helio-checkout-container input,
.helio-checkout-container select,
.helio-checkout-container button {
    max-width: 100%;
    box-sizing: border-box;
}

/* Prevent horizontal text overflow in widget only */
.helio-checkout-container p,
.helio-checkout-container span,
.helio-checkout-container div,
.helio-checkout-container label,
.helio-checkout-container h1,
.helio-checkout-container h2,
.helio-checkout-container h3,
.helio-checkout-container h4 {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tier-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-tertiary, #2a2a2a);
    color: var(--text-secondary, #888);
    box-shadow: none;
}

.tier-button.premium {
    background: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%);
    box-shadow: 0 4px 16px rgba(0, 255, 136, 0.4);
}

.tier-button.premium:hover:not(:disabled) {
    box-shadow: 0 8px 24px rgba(0, 255, 136, 0.5);
}

.subscription-footer {
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    margin-top: 32px;
}

.subscription-footer p {
    font-size: 13px;
    color: var(--text-secondary, #888);
    margin: 0 0 16px 0;
    line-height: 1.6;
    font-weight: 500;
}

.cancel-subscription-btn {
    width: 100%;
    padding: 12px 24px;
    background: transparent;
    border: 2px solid rgba(255, 77, 77, 0.5);
    border-radius: 12px;
    color: #ff4d4d;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cancel-subscription-btn:hover {
    background: rgba(255, 77, 77, 0.1);
    border-color: #ff4d4d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 77, 77, 0.2);
}

.cancel-subscription-btn:active {
    transform: translateY(0);
}

.cancel-subscription-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Subscription badge in wallet dropdown */
.subscription-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 8px;
    border: 1px solid;
    letter-spacing: 0.5px;
}

/* Free tier badge */
.subscription-badge.free {
    background: rgba(128, 128, 128, 0.15);
    color: #888;
    border-color: rgba(128, 128, 128, 0.3);
}

/* Plus tier badge */
.subscription-badge.plus {
    background: rgba(100, 0, 204, 0.2);
    color: #8b00ff;
    border-color: rgba(100, 0, 204, 0.4);
    box-shadow: 0 2px 6px rgba(100, 0, 204, 0.2);
}

/* Premium tier badge */
.subscription-badge.premium {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
    border-color: rgba(243, 156, 18, 0.4);
    box-shadow: 0 2px 6px rgba(243, 156, 18, 0.2);
}

/* Light theme support - Enhanced for readability */
html.light .subscription-modal-overlay {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

html.light .subscription-modal-content {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

html.light .subscription-modal-close {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

html.light .subscription-modal-close:hover {
    background: rgba(0, 0, 0, 0.12);
    color: #000;
}

html.light .subscription-modal-header h2 {
    background: linear-gradient(135deg, #0066cc 0%, #00aa55 50%, #0066cc 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

html.light .subscription-status.active {
    background: rgba(0, 102, 204, 0.12);
    color: #0066cc;
    border-color: rgba(0, 102, 204, 0.25);
}

html.light .subscription-status.active.premium {
    background: rgba(0, 170, 85, 0.12);
    color: #00aa55;
    border-color: rgba(0, 170, 85, 0.25);
}

html.light .subscription-status.inactive {
    background: rgba(0, 0, 0, 0.06);
    color: #666;
    border-color: rgba(0, 0, 0, 0.1);
}

html.light .subscription-status.processing {
    background: rgba(255, 193, 7, 0.12);
    color: #cc9900;
    border-color: rgba(255, 193, 7, 0.25);
}

html.light .subscription-tier-card {
    background: #f8f9fa;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

html.light .subscription-tier-card:hover {
    border-color: #0066cc;
    box-shadow: 0 12px 32px rgba(0, 102, 204, 0.15), 0 0 0 1px rgba(0, 102, 204, 0.1);
}

html.light .subscription-tier-card[data-tier="premium"] {
    border-color: rgba(0, 170, 85, 0.3);
    background: linear-gradient(135deg, rgba(0, 170, 85, 0.06) 0%, rgba(0, 102, 204, 0.06) 100%);
    box-shadow: 0 4px 20px rgba(0, 170, 85, 0.12);
}

html.light .subscription-tier-card[data-tier="premium"]:hover {
    box-shadow: 0 12px 40px rgba(0, 170, 85, 0.2), 0 0 0 1px rgba(0, 170, 85, 0.15);
    border-color: rgba(0, 170, 85, 0.5);
}

html.light .tier-header h3 {
    color: #1a1a1a;
}

html.light .tier-features li {
    color: #333;
}

html.light .tier-price {
    color: #1a1a1a;
}

html.light .tier-price::after {
    color: #666;
}

html.light .subscription-footer {
    border-color: rgba(0, 0, 0, 0.1);
}

html.light .subscription-footer p {
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .subscription-modal {
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .subscription-modal-content {
        padding: 24px 16px;
        margin: 0;
        border-radius: 20px;
        max-height: calc(100vh - 20px);
        width: calc(100% - 20px);
        overflow-y: auto;
        overflow-x: hidden;
    }

    .subscription-modal-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    .subscription-tiers {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .subscription-modal-header {
        margin-bottom: 24px;
    }

    .subscription-modal-header h2 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .tier-header h3 {
        font-size: 22px;
    }

    .tier-price {
        font-size: 32px;
    }

    .subscription-tier-card {
        padding: 20px;
    }

    /* Mobile-specific MoonPay widget fixes */
    .helio-checkout-container {
        width: 100%;
        max-width: 100%;
        margin-top: 16px;
        min-height: 400px;
        /* Prevent horizontal scrolling */
        overflow-x: hidden;
        overflow-y: visible;
        box-sizing: border-box;
        position: relative;
    }

    .helio-checkout-container iframe {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        height: auto;
        min-height: 400px;
        border: none;
        display: block;
        box-sizing: border-box;
    }

    /* Only prevent horizontal overflow, allow vertical scrolling */
    .helio-checkout-container * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Fix for any absolute positioned elements - only horizontal */
    .helio-checkout-container [style*="position: absolute"],
    .helio-checkout-container [style*="position:fixed"] {
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }

    /* Prevent text from overflowing horizontally only */
    .helio-checkout-container p,
    .helio-checkout-container span,
    .helio-checkout-container div,
    .helio-checkout-container label {
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .subscription-modal-content {
        padding: 20px 12px;
        border-radius: 16px;
    }

    .subscription-modal-header h2 {
        font-size: 22px;
    }

    .subscription-tier-card {
        padding: 16px;
    }

    .helio-checkout-container {
        min-height: 400px;
        max-height: 550px;
        overflow-x: hidden !important;
    }

    .helio-checkout-container iframe {
        min-height: 400px;
        max-height: 550px;
    }
}
