/**
 * 续费许可证对话框 - 现代化UI样式
 * 与工单提交系统风格一致
 */

/* 模态框容器 */
.renewal-modal-wrapper {
    display: flex;
    flex-direction: column;
    margin: 0 !important;
    min-height: 100%;
    background: var(--bg-card, #FFFFFF);
    overflow: hidden;
    position: relative;
}

/* 续费模态框使用较低的 z-index，让 tooltip 可以显示在上面 */
#generic-modal:has(.renewal-modal-wrapper) {
    z-index: var(--z-modal, 1050);
}

#generic-modal:has(.renewal-modal-wrapper) > .generic-modal-dialog {
    padding: 0;
    overflow: hidden;
}

#generic-modal:has(.renewal-modal-wrapper) > .generic-modal-dialog > .generic-modal-content {
    padding: 0;
    background: transparent;
}

#generic-modal:has(.renewal-payment-modal) > .generic-modal-dialog {
    display: flex;
    flex-direction: column;
}

/* 关闭按钮 - 使用统一的关闭按钮变量 */
.renewal-close-btn {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    left: unset !important;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--app-close-btn-bg, rgba(255, 255, 255, 0.10));
    color: var(--app-close-btn-color, #FFFFFF);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    transition: var(--close-btn-transition, 0.2s ease);
    z-index: 100;
}

.renewal-close-btn:hover {
    background: var(--app-close-btn-bg-hover, rgba(255, 255, 255, 0.18));
    color: var(--app-close-btn-color, #FFFFFF);
    transform: var(--close-btn-hover-transform, rotate(90deg));
}

/* 顶部英雄区域 */
.renewal-hero {
    background: linear-gradient(135deg, #F0B90B 0%, #FCD535 100%);
    padding: 24px;
    text-align: center;
    border-radius: 0;
}

.renewal-hero i {
    font-size: 36px;
    color: #1E2329;
    margin-bottom: 12px;
    display: block;
}

.renewal-hero h3 {
    margin: 0 0 8px 0;
    font-size: var(--app-brand-dialog-title-font-size, 18px);
    font-weight: var(--app-brand-dialog-title-font-weight, 700);
    line-height: var(--app-brand-dialog-title-line-height, 1.2);
    letter-spacing: var(--app-brand-dialog-title-letter-spacing, 0.01em);
    color: #0B0E11;
}

.renewal-hero p {
    margin: 0;
    font-size: 14px;
    color: rgba(11, 14, 17, 0.7);
}

/* 主体区域 */
.renewal-modal-body {
    padding: 0;
}

.renewal-payment-modal {
    height: 100%;
    max-height: 70vh;
}

.renewal-payment-body {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.renewal-payment-body::-webkit-scrollbar {
    display: none;
}

.renewal-payment-content {
    text-align: center;
    padding: 16px;
}

.renewal-payment-qrcode {
    display: inline-block;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 8px;
}

.renewal-payment-qrcode-fallback {
    padding: 20px;
    color: #666;
}

.renewal-payment-countdown {
    font-size: 14px;
    color: #F6465D;
    font-weight: 500;
    margin-bottom: 16px;
}

.renewal-payment-summary {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 16px;
    text-align: left;
}

.renewal-payment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.renewal-payment-label {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 4px;
}

.renewal-payment-label--address {
    margin-bottom: 6px;
}

.renewal-payment-value {
    font-weight: 500;
}

.renewal-payment-value--compact {
    font-size: 13px;
}

.renewal-payment-value--amount {
    color: var(--color-primary, #F0B90B);
    font-size: 16px;
    font-weight: 600;
}

.renewal-payment-address {
    background: linear-gradient(135deg, rgba(240, 185, 11, 0.15) 0%, rgba(240, 185, 11, 0.08) 100%);
    border: 1px solid rgba(240, 185, 11, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

.renewal-payment-value--address {
    word-break: break-all;
    font-size: 13px;
    font-family: monospace;
    color: var(--text-primary);
}

.renewal-payment-address-tail {
    color: var(--binance-yellow, #F0B90B);
    font-weight: 700;
}

.renewal-payment-footer {
    flex-shrink: 0;
    margin-top: 16px;
    padding-top: 16px;
    background: var(--bg-card, #fff);
    border-top: 1px solid var(--border, #e5e7eb);
}

/* 续费选项 */
.renew-options {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.renew-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border: 2px solid var(--border-color, #E0E0E0);
    border-radius: 12px;
    background: var(--bg-secondary, #FAFAFA);
    cursor: pointer;
    transition: all 0.25s ease;
}

.renew-option:hover {
    border-color: #F0B90B;
    background: rgba(240, 185, 11, 0.06);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 185, 11, 0.15);
}

.renew-option:has(input:checked) {
    border-color: #F0B90B;
    background: linear-gradient(135deg, rgba(240, 185, 11, 0.12) 0%, rgba(240, 185, 11, 0.06) 100%);
    box-shadow: 0 4px 16px rgba(240, 185, 11, 0.2);
}

.renew-option-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.renew-option-left input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.renew-option-left > span:first-of-type {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary, #1E2329);
}

.renew-option-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-left: 8px;
}

.renew-option-tag.warn {
    background: rgba(240, 185, 11, 0.15);
    color: #B8860B;
}

.renew-option-tag.success {
    background: rgba(14, 203, 129, 0.15);
    color: #0ECB81;
}

.renew-option-price {
    font-size: 18px;
    font-weight: 700;
    color: #F0B90B;
}

/* 底部按钮区域 */
.renewal-modal-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-card, #FFFFFF);
    border-top: 1px solid var(--border-color, #E0E0E0);
    border-radius: 0;
}

.renewal-cancel-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid var(--border-color, #E0E0E0);
    background: var(--bg-tertiary, #F5F5F5);
    color: var(--text-primary, #1E2329);
    cursor: pointer;
    transition: all 0.2s ease;
}

.renewal-cancel-btn:hover {
    background: var(--bg-hover, #ECEFF3);
    border-color: var(--color-primary, #F0B90B);
}

.renewal-confirm-btn {
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #F0B90B 0%, #FCD535 100%);
    color: #0B0E11;
    cursor: pointer;
    transition: all 0.25s ease;
}

.renewal-confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(240, 185, 11, 0.35);
}

.renewal-confirm-btn:active {
    transform: translateY(0);
}

/* 购买/续费成功仪式动画 */
.renewal-success-celebration {
    position: fixed;
    inset: 0;
    z-index: 12000;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.renewal-success-celebration.is-visible {
    opacity: 1;
}

.renewal-success-card {
    position: relative;
    min-width: 300px;
    max-width: 400px;
    padding: 20px 24px 22px;
    border-radius: 14px;
    border: 1px solid rgba(240, 185, 11, 0.35);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 247, 215, 0.98) 100%);
    box-shadow: 0 18px 56px rgba(11, 14, 17, 0.24), 0 2px 12px rgba(240, 185, 11, 0.28);
    text-align: center;
    transform: translateY(16px) scale(0.92);
    opacity: 0;
}

.renewal-success-celebration.is-visible .renewal-success-card {
    animation: renewalSuccessPop 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.renewal-success-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 13px;
    line-height: 1.2;
    font-weight: 700;
    opacity: 0;
    transform: translateY(10px) scale(0.96);
}

.renewal-success-card--purchase .renewal-success-action {
    background: rgba(14, 203, 129, 0.16);
    border-color: rgba(14, 203, 129, 0.32);
    color: #087f53;
}

.renewal-success-card--renew .renewal-success-action {
    background: rgba(75, 107, 251, 0.14);
    border-color: rgba(75, 107, 251, 0.32);
    color: #3150D8;
}

.renewal-success-celebration.is-visible .renewal-success-action {
    animation: renewalSuccessTextReveal 0.34s cubic-bezier(0.21, 0.9, 0.3, 1.12) 0.14s forwards;
}

.renewal-success-icon {
    position: relative;
    width: 112px;
    height: 112px;
    margin: 18px auto 2px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ECB81 0%, #35D29A 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 32px rgba(14, 203, 129, 0.38);
    opacity: 0;
    transform: scale(0.32) rotate(-12deg);
}

.renewal-success-icon::before {
    content: '';
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 203, 129, 0.26) 0%, rgba(14, 203, 129, 0.12) 38%, rgba(14, 203, 129, 0) 72%);
    opacity: 0;
    transform: scale(0.45);
}

.renewal-success-checkmark-svg {
    width: 60px;
    height: 60px;
    display: block;
    overflow: visible;
}

.renewal-success-checkmark-circle {
    fill: none;
    stroke: rgba(255, 255, 255, 0.26);
    stroke-width: 2.5;
}

.renewal-success-checkmark-path {
    fill: none;
    stroke: #FFFFFF;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 36;
    stroke-dashoffset: 36;
    opacity: 0;
}

.renewal-success-celebration.is-visible .renewal-success-icon {
    animation: renewalSuccessCheckReveal 0.62s cubic-bezier(0.2, 0.9, 0.25, 1.3) 0.88s forwards;
}

.renewal-success-celebration.is-visible .renewal-success-icon::before {
    animation: renewalSuccessHalo 0.72s ease-out 0.98s forwards;
}

.renewal-success-celebration.is-visible .renewal-success-checkmark-path {
    animation: renewalSuccessCheckDraw 0.38s cubic-bezier(0.2, 0.9, 0.3, 1) 1.04s forwards;
}

.renewal-success-title {
    color: #0B0E11;
    margin-top: 12px;
    font-size: 28px;
    line-height: 1.25;
    font-weight: 700;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
}

.renewal-success-celebration.is-visible .renewal-success-title {
    animation: renewalSuccessTextReveal 0.38s cubic-bezier(0.21, 0.9, 0.3, 1.12) 0.26s forwards;
}

.renewal-success-subtitle {
    margin-top: 8px;
    color: #5E6673;
    font-size: 14px;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
}

.renewal-success-celebration.is-visible .renewal-success-subtitle {
    animation: renewalSuccessTextReveal 0.38s cubic-bezier(0.21, 0.9, 0.3, 1.12) 0.4s forwards;
}

.renewal-success-confetti-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.renewal-success-confetti {
    position: absolute;
    top: -20px;
    width: var(--width, 9px);
    height: var(--height, 14px);
    opacity: 0;
    border-radius: 2px;
    transform: translate3d(0, 0, 0) rotate(var(--tilt, 0deg));
}

.renewal-success-celebration.is-visible .renewal-success-confetti {
    animation: renewalConfettiFall var(--duration, 2.8s) linear var(--delay, 0s) forwards;
}

@keyframes renewalSuccessPop {
    0% {
        transform: translateY(16px) scale(0.92);
        opacity: 0;
    }
    65% {
        transform: translateY(-2px) scale(1.02);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes renewalConfettiFall {
    0% {
        opacity: 0;
        transform: translate3d(0, -12px, 0) rotate(var(--tilt, 0deg)) scale(0.76);
    }
    10% {
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate3d(var(--drift, 0), 340px, 0) rotate(calc(var(--tilt, 0deg) + 720deg)) scale(1);
    }
}

@keyframes renewalSuccessTextReveal {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    65% {
        opacity: 1;
        transform: translateY(-2px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes renewalSuccessCheckReveal {
    0% {
        opacity: 0;
        transform: scale(0.32) rotate(-12deg);
    }
    60% {
        opacity: 1;
        transform: scale(1.14) rotate(3deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes renewalSuccessCheckDraw {
    0% {
        opacity: 0;
        stroke-dashoffset: 36;
    }
    15% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        stroke-dashoffset: 0;
    }
}

@keyframes renewalSuccessHalo {
    0% {
        opacity: 0;
        transform: scale(0.45);
    }
    35% {
        opacity: 0.9;
    }
    100% {
        opacity: 0;
        transform: scale(1.16);
    }
}

/* 深色主题 */
[data-theme="dark"] #generic-modal .renewal-modal-wrapper .renewal-close-btn,
[data-theme="dark"] .renewal-modal-wrapper > .renewal-close-btn {
    background: var(--app-close-btn-bg, rgba(255, 255, 255, 0.10));
    color: var(--app-close-btn-color, #FFFFFF);
}

[data-theme="dark"] #generic-modal .renewal-modal-wrapper .renewal-close-btn:hover,
[data-theme="dark"] .renewal-modal-wrapper > .renewal-close-btn:hover {
    background: var(--app-close-btn-bg-hover, rgba(255, 255, 255, 0.18));
}

[data-theme="dark"] .renew-option {
    background: var(--bg-secondary, #1E2329);
    border-color: var(--border-color, #2B3139);
}

[data-theme="dark"] .renew-option:hover {
    background: rgba(240, 185, 11, 0.08);
}

[data-theme="dark"] .renew-option-tag.warn {
    background: rgba(240, 185, 11, 0.2);
    color: #F0B90B;
}

[data-theme="dark"] .renew-option-tag.success {
    background: rgba(14, 203, 129, 0.2);
    color: #0ECB81;
}

[data-theme="dark"] .renewal-modal-footer {
    background: var(--bg-card, #1E2329);
    border-color: var(--border-color, #2B3139);
}

[data-theme="dark"] .renewal-cancel-btn {
    background: var(--bg-tertiary, #2B3139);
    border-color: var(--border-color, #2B3139);
    color: var(--text-primary, #EAECEF);
}

[data-theme="dark"] .renewal-cancel-btn:hover {
    background: var(--bg-hover, #363D47);
}

[data-theme="dark"] .renewal-payment-qrcode {
    background: #fff;
}

[data-theme="dark"] .renewal-success-card {
    background: linear-gradient(160deg, rgba(30, 35, 41, 0.98) 0%, rgba(24, 28, 35, 0.98) 100%);
    border-color: rgba(240, 185, 11, 0.28);
    box-shadow: 0 22px 62px rgba(0, 0, 0, 0.45), 0 2px 12px rgba(240, 185, 11, 0.2);
}

[data-theme="dark"] .renewal-success-title {
    color: #F5F5F5;
}

[data-theme="dark"] .renewal-success-subtitle {
    color: #B7BDC6;
}

[data-theme="dark"] .renewal-success-card--purchase .renewal-success-action {
    background: rgba(14, 203, 129, 0.2);
    border-color: rgba(14, 203, 129, 0.45);
    color: #4BE2AA;
}

[data-theme="dark"] .renewal-success-card--renew .renewal-success-action {
    background: rgba(75, 107, 251, 0.22);
    border-color: rgba(75, 107, 251, 0.45);
    color: #9EB1FF;
}

/* 响应式 */
@media (max-width: 480px) {
    .renewal-hero {
        padding: 20px 16px;
    }
    
    .renew-options {
        padding: 16px;
    }
    
    .renew-option {
        padding: 14px 16px;
    }
    
    .renewal-modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .renewal-cancel-btn,
    .renewal-confirm-btn {
        width: 100%;
        justify-content: center;
    }

    .renewal-payment-grid {
        grid-template-columns: 1fr;
    }

    .renewal-success-card {
        min-width: 0;
        width: calc(100vw - 48px);
        max-width: 340px;
        padding: 18px 16px 18px;
    }

    .renewal-success-icon {
        width: 96px;
        height: 96px;
    }

    .renewal-success-checkmark-svg {
        width: 52px;
        height: 52px;
    }

    .renewal-success-title {
        font-size: 24px;
    }
}
