/**
 * Xuwbk Donation 前端样式
 *
 * 适配子比主题的浅色/深色模式切换
 * 子比主题通过在 body 上添加/移除 .dark-theme 类来切换模式
 *
 * @package XUWBK_DASONG
 */

/* 移除这个禁用样式，使用JS事件拦截来处理 */

/* ========================================
   子比主题支付方式样式
   ======================================== */

.payment-method-radio {
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.payment-method-radio:hover {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.05);
}

.payment-method-radio.active {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}

.payment-method-radio img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-bottom: 8px;
}

.payment-method-radio .method-icon {
    font-size: 24px;
}

.payment-method-radio div {
    font-size: 14px;
    color: #333;
}

/* 深色模式 */
.dark-theme .payment-method-radio {
    border-color: #444;
}

.dark-theme .payment-method-radio:hover {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}

.dark-theme .payment-method-radio.active {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.15);
}

.dark-theme .payment-method-radio div {
    color: #ddd;
}

/* ========================================
   基础样式（浅色模式 - 默认）
   ======================================== */

/* 文章信息区域 */
.xuwbk-dasong-post-info {
    display: flex;
    align-items: flex-start;
    line-height: 1.5;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    color: #4e5358;
}

/* 金额提示 */
.xuwbk-dasong-amount-tip {
    font-size: 0.9em;
    color: #999;
}

/* 金额选择器 */
.xuwbk-dasong-amount-selector {
    margin-bottom: 15px;
}

.xuwbk-dasong-amount-selector .flex {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.xuwbk-dasong-amount-item {
    flex: 1 1 calc(33.333% - 10px);
    min-width: 80px;
    padding: 12px 8px;
    text-align: center;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    color: #4e5358;
    /* 确保内容不溢出 */
    overflow: hidden;
    word-break: break-all;
}

.xuwbk-dasong-amount-item:hover {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
}

.xuwbk-dasong-amount-item.active {
    border-color: #ff6b6b;
    background: #ff6b6b;
    color: #fff;
}

.xuwbk-dasong-amount-mark {
    font-size: 0.85em;
    margin-right: 2px;
}

.xuwbk-dasong-amount-value {
    font-size: 1.2em;
    font-weight: bold;
}

.xuwbk-dasong-amount-item.active .xuwbk-dasong-amount-mark,
.xuwbk-dasong-amount-item.active .xuwbk-dasong-amount-value {
    color: #fff;
}

/* 自定义金额输入框 */
.xuwbk-dasong-custom-amount {
    margin-bottom: 15px;
}

.xuwbk-dasong-custom-amount input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f5f6f7;
    color: #4e5358;
}

.xuwbk-dasong-custom-amount input:focus {
    border-color: #ff6b6b;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15);
}

.xuwbk-dasong-custom-amount input::placeholder {
    color: #b1b1b1;
}

/* 隐藏 number 输入框的 spinner 按钮 */
.xuwbk-dasong-custom-amount input[type="number"]::-webkit-outer-spin-button,
.xuwbk-dasong-custom-amount input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.xuwbk-dasong-custom-amount input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* 自定义金额输入错误状态 */
.xuwbk-dasong-custom-amount input.xuwbk-dasong-input-error {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.xuwbk-dasong-custom-amount input.xuwbk-dasong-input-error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

/* 错误提示文字 */
.xuwbk-dasong-amount-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.xuwbk-dasong-amount-error.show {
    display: block;
}

/* 留言输入框 */
.xuwbk-dasong-message-input {
    margin-bottom: 20px;
}

.xuwbk-dasong-message-input textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f5f6f7;
    color: #4e5358;
}

.xuwbk-dasong-message-input textarea:focus {
    border-color: #ff6b6b;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15);
}

.xuwbk-dasong-message-input textarea::placeholder {
    color: #b1b1b1;
}

/* 抽成提示 */
.xuwbk-dasong-commission-notice {
    margin-bottom: 12px;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.6;
    color: #e6a23c;
    background: rgba(230, 162, 60, 0.08);
    border: 1px solid rgba(230, 162, 60, 0.2);
    border-radius: 6px;
}

.xuwbk-dasong-commission-icon {
    font-style: normal;
    margin-right: 2px;
}

/* 支付方式区域 */
.xuwbk-dasong-payment-methods {
    margin-bottom: 10px;
}

/* 支付表单 */
.xuwbk-dasong-payment-form {
    margin-top: 10px;
}

/* 隐藏优惠码功能区域（子比主题支付组件自带的） */
.modal .modal-body .xuwbk-dasong-payment-form .coupon-box,
.modal .modal-body .xuwbk-dasong-payment-form .coupon-input,
.modal .modal-body .xuwbk-dasong-payment-form .coupon-desc,
.modal .modal-body .xuwbk-dasong-payment-form [class*="coupon"],
.modal .modal-body .xuwbk-dasong-payment-form .pay-coupon-box,
.xuwbk-dasong-payment-form .coupon-box,
.xuwbk-dasong-payment-form .coupon-input,
.xuwbk-dasong-payment-form .coupon-desc,
.xuwbk-dasong-payment-form [class*="coupon"],
.xuwbk-dasong-payment-form .pay-coupon-box {
    display: none;
}

/* ========================================
   响应式适配
   ======================================== */

@media (max-width: 480px) {
    .xuwbk-dasong-amount-item {
        flex: 1 1 calc(50% - 10px);
        padding: 10px 6px;
    }
    
    .xuwbk-dasong-amount-value {
        font-size: 1.1em;
    }
}

/* ========================================
   深色模式适配（子比主题通过 .dark-theme 类切换）
   ======================================== */

.dark-theme .xuwbk-dasong-post-info {
    background: rgba(255, 255, 255, 0.03);
    color: #e5eef7;
}

.dark-theme .xuwbk-dasong-amount-tip {
    color: #888a8f;
}

.dark-theme .xuwbk-dasong-amount-item {
    background: #323335;
    border-color: #43454a;
    color: #e5eef7;
}

.dark-theme .xuwbk-dasong-amount-item:hover {
    background: rgba(255, 107, 107, 0.12);
    border-color: #ff6b6b;
}

.dark-theme .xuwbk-dasong-amount-item.active {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: #fff;
}

.dark-theme .xuwbk-dasong-custom-amount input {
    background: #2d2e31;
    border-color: #43454a;
    color: #e5eef7;
}

.dark-theme .xuwbk-dasong-custom-amount input:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2);
}

.dark-theme .xuwbk-dasong-custom-amount input::placeholder {
    color: #636469;
}

.dark-theme .xuwbk-dasong-custom-amount input.xuwbk-dasong-input-error {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.dark-theme .xuwbk-dasong-message-input textarea {
    background: #2d2e31;
    border-color: #43454a;
    color: #e5eef7;
}

.dark-theme .xuwbk-dasong-message-input textarea:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2);
}

.dark-theme .xuwbk-dasong-message-input textarea::placeholder {
    color: #636469;
}

.dark-theme .xuwbk-dasong-amount-error {
    color: #ff6b6b;
}

.dark-theme .xuwbk-dasong-commission-notice {
    color: #e6a23c;
    background: rgba(230, 162, 60, 0.1);
    border-color: rgba(230, 162, 60, 0.25);
}

/* ========================================
   子比主题兼容性样式
   ======================================== */

/* 打赏弹窗样式 */
.xuwbk-donation-modal {
    display: none;
}

.xuwbk-donation-modal.in {
    display: block;
}

.modal-backdrop[data-xuwbk-donation],
.modal-backdrop[data-xuwbk-payment] {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998 !important;
}

.xuwbk-donation-modal,
#xuwbk-payment-modal {
    position: fixed !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    z-index: 999999 !important;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.3s ease;
    margin: 0 !important;
    right: auto !important;
    bottom: auto !important;
}

.xuwbk-donation-modal.in,
.xuwbk-donation-modal.in,
#xuwbk-payment-modal.in {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.xuwbk-donation-modal.modal-mini {
    width: 420px;
}

#xuwbk-payment-modal .modal-content,
.xuwbk-donation-modal .modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

#xuwbk-payment-modal .modal-body,
.xuwbk-donation-modal .modal-body {
    padding: 0;
}

.xuwbk-donation-modal .modal-colorful-header {
    position: relative;
    padding: 30px 20px 20px;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #fff;
}

.xuwbk-donation-modal .colorful-bg.jb-yellow {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
}

.xuwbk-donation-modal .modal-close,
#xuwbk-payment-modal .modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.xuwbk-donation-modal .modal-close:hover,
#xuwbk-payment-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.5);
}

.colorful-make {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ========================================
   子比主题兼容性样式 - 仅在打赏组件内部生效
   ======================================== */

/* 以下工具类限制在打赏弹窗和支付模态框内使用（合并优化） */
.xuwbk-donation-modal .text-center,
#xuwbk-payment-modal .text-center { text-align: center; }

.xuwbk-donation-modal .em2x,
#xuwbk-payment-modal .em2x { font-size: 2em; }

.xuwbk-donation-modal .em12,
#xuwbk-payment-modal .em12 { font-size: 1.2em; }

.xuwbk-donation-modal .em09,
#xuwbk-payment-modal .em09 { font-size: 0.9em; }

.xuwbk-donation-modal .em14,
#xuwbk-payment-modal .em14 { font-size: 1.4em; }

.xuwbk-donation-modal .px12,
#xuwbk-payment-modal .px12 { padding-left: 2px; padding-right: 2px; }

.xuwbk-donation-modal .ml6,
#xuwbk-payment-modal .ml6 { margin-left: 6px; }

.xuwbk-donation-modal .mr6,
#xuwbk-payment-modal .mr6 { margin-right: 6px; }

.xuwbk-donation-modal .mt10,
#xuwbk-payment-modal .mt10 { margin-top: 10px; }

.xuwbk-donation-modal .mt6,
#xuwbk-payment-modal .mt6 { margin-top: 6px; }

.xuwbk-donation-modal .mb10,
#xuwbk-payment-modal .mb10 { margin-bottom: 10px; }

.xuwbk-donation-modal .mb20,
#xuwbk-payment-modal .mb20 { margin-bottom: 20px; }

.xuwbk-donation-modal .padding-w10,
#xuwbk-payment-modal .padding-w10 { padding: 0 10px; }

.xuwbk-donation-modal .padding-h10,
#xuwbk-payment-modal .padding-h10 { padding: 10px; }

.xuwbk-donation-modal .ic-xl,
#xuwbk-payment-modal .ic-xl { width: 64px; height: 64px; }

.xuwbk-donation-modal .zbd-amount-tip,
#xuwbk-payment-modal .zbd-amount-tip {
    padding: 0 20px;
    font-size: 14px;
    color: #666;
    text-align: center;
}

.xuwbk-donation-modal .zbd-amount-selector,
#xuwbk-payment-modal .zbd-amount-selector { padding: 0 20px; }

.xuwbk-donation-modal .zbd-amount-item,
#xuwbk-payment-modal .zbd-amount-item {
    padding: 12px 8px;
    margin: 0 5px 10px 0;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    flex: 1;
    min-width: calc(3.33% - 10px);
}

.xuwbk-donation-modal .zbd-amount-item:hover,
#xuwbk-payment-modal .zbd-amount-item:hover {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
}

.xuwbk-donation-modal .zbd-amount-item.active,
#xuwbk-payment-modal .zbd-amount-item.active {
    border-color: #ff6b6b;
    background: #ff6b6b;
    color: #fff;
}

.xuwbk-donation-modal .zbd-amount-item .zbd-amount-mark,
#xuwbk-payment-modal .zbd-amount-item .zbd-amount-mark { font-size: 14px; margin-right: 2px; }

.xuwbk-donation-modal .zbd-amount-item .zbd-amount-value,
#xuwbk-payment-modal .zbd-amount-item .zbd-amount-value { font-size: 18px; font-weight: bold; }

.xuwbk-donation-modal .zbd-custom-amount,
#xuwbk-payment-modal .zbd-custom-amount { padding: 0 20px; margin-bottom: 20px; }

.xuwbk-donation-modal .zbd-custom-amount .form-control,
#xuwbk-payment-modal .zbd-custom-amount .form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    font-size: 14px;
    background: #f5f6f7;
}

.xuwbk-donation-modal .zbd-message-input,
#xuwbk-payment-modal .zbd-message-input { padding: 0 20px; margin-bottom: 20px; }

.xuwbk-donation-modal .zbd-message-textarea,
#xuwbk-payment-modal .zbd-message-textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    font-size: 14px;
    background: #f5f6f7;
    resize: vertical;
    min-height: 80px;
}

.xuwbk-donation-modal .zbd-commission-notice,
#xuwbk-payment-modal .zbd-commission-notice {
    margin: 0 20px 20px;
    padding: 10px 12px;
    font-size: 12px;
    color: #e6a23c;
    background: rgba(230, 162, 60, 0.08);
    border: 1px solid rgba(230, 162, 60, 0.2);
    border-radius: 6px;
    line-height: 1.6;
}

.xuwbk-donation-modal .zbd-commission-icon,
#xuwbk-payment-modal .zbd-commission-icon { margin-right: 4px; }

.xuwbk-donation-modal .dependency-box,
#xuwbk-payment-modal .dependency-box { padding: 0 20px 20px; }

.xuwbk-donation-modal .muted-box,
#xuwbk-payment-modal .muted-box {
    background: #f5f6f7;
    border-radius: 8px;
    padding: 15px;
}

.xuwbk-donation-modal .muted-2-color,
#xuwbk-payment-modal .muted-2-color { color: #666; }

.xuwbk-donation-modal .c-blue-2,
#xuwbk-payment-modal .c-blue-2 { color: #3b82f6; }

.xuwbk-donation-modal .jsb,
#xuwbk-payment-modal .jsb { justify-content: space-between; }

.xuwbk-donation-modal .flex,
#xuwbk-payment-modal .flex { display: flex; }

.xuwbk-donation-modal .ac,
#xuwbk-payment-modal .ac { align-items: center; }

.xuwbk-donation-modal .btn-block,
#xuwbk-payment-modal .btn-block { width: 100%; display: block; }

.xuwbk-donation-modal .but,
#xuwbk-payment-modal .but {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.xuwbk-donation-modal .but.jb-red,
#xuwbk-payment-modal .but.jb-red {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #fff;
}

.xuwbk-donation-modal .but.jb-red:hover,
#xuwbk-payment-modal .but.jb-red:hover {
    background: linear-gradient(135deg, #ee5a5a 0%, #dd4949 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.xuwbk-donation-modal .radius,
#xuwbk-payment-modal .radius { border-radius: 8px; }

.xuwbk-donation-modal .pay-price-text,
#xuwbk-payment-modal .pay-price-text { margin-left: 10px; }

/* 响应式适配 */
@media (max-width: 480px) {
    .xuwbk-donation-modal.modal-mini {
        width: 90%;
        margin: 20px auto !important;
    }

    .zbd-amount-item {
        min-width: calc(50% - 10px);
        padding: 10px 6px;
    }
}

/* 模态框关闭按钮绝对定位（合并优化） */
.xuwbk-donation-modal :where(.close.abs-close),
#xuwbk-payment-modal :where(.close.abs-close) {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 10;
}

/* 模态框 body-bg 背景色（合并优化） */
.xuwbk-donation-modal :where(.body-bg .modal-content),
#xuwbk-payment-modal :where(.body-bg .modal-content) {
    background: var(--body-bg-color, #f5f6f7);
}

.xuwbk-donation-modal.dark-theme :where(.body-bg .modal-content),
#xuwbk-payment-modal.dark-theme :where(.body-bg .modal-content) {
    background: var(--body-bg-color, #1a1a1a);
}

/* 加载提示（合并优化） */
.xuwbk-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 支付方式选择器 */
.payment-method-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.payment-method-item {
    flex: 1;
    min-width: 100px;
    padding: 12px 15px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
}

.payment-method-item:hover {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.05);
}

.payment-method-item.active {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.payment-method-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.method-icon {
    font-size: 1.5em;
    display: block;
    margin-bottom: 5px;
}

.method-name {
    font-size: 0.9em;
    color: #4e5358;
}

/* 深色模式下的支付方式选择器（合并优化） */
.dark-theme .payment-method-item {
    border-color: #3a3a3a;
    color: #e8e8e8;
}

.dark-theme .payment-method-item:hover {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
}

.dark-theme .payment-method-item.active {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.2);
}

.dark-theme .method-name { color: #e8e8e8; }

/* 修复 modal-colorful-header 的 margin-top 问题（合并优化） */
.modal-colorful-header + *,
.xuwbk-donation-modal .modal-colorful-header + * {
    margin-top: 12px !important;
}
