/**
 * WC User Balance - 前端样式
 * 品牌色: #025BE7
 */

:root {
    --wcub-primary: #025BE7;
    --wcub-primary-dark: #0247b5;
    --wcub-primary-light: #e8f0fd;
    --wcub-success: #28a745;
    --wcub-danger: #dc3545;
    --wcub-warning: #ffc107;
    --wcub-gray: #6c757d;
    --wcub-light: #f8f9fa;
    --wcub-border: #dee2e6;
    --wcub-radius: 8px;
    --wcub-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 通用样式 - 使用 !important 防止主题覆盖 */
.wcub-btn,
button.wcub-btn,
a.wcub-btn,
input[type="button"].wcub-btn,
input[type="submit"].wcub-btn {
    display: inline-block !important;
    padding: 10px 20px !important;
    border: none !important;
    border-radius: var(--wcub-radius) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    text-align: center !important;
    line-height: 1.5 !important;
    box-shadow: none !important;
}

.wcub-btn-primary,
button.wcub-btn-primary,
a.wcub-btn-primary {
    background: var(--wcub-primary) !important;
    color: #fff !important;
}

.wcub-btn-primary:hover,
button.wcub-btn-primary:hover,
a.wcub-btn-primary:hover {
    background: var(--wcub-primary-dark) !important;
    color: #fff !important;
}

.wcub-btn-primary:disabled,
button.wcub-btn-primary:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

.wcub-btn-secondary,
button.wcub-btn-secondary,
a.wcub-btn-secondary {
    background: var(--wcub-light) !important;
    color: var(--wcub-gray) !important;
    border: 1px solid var(--wcub-border) !important;
}

.wcub-btn-secondary:hover,
button.wcub-btn-secondary:hover,
a.wcub-btn-secondary:hover {
    background: #e9ecef !important;
}

/* 登录提示 */
.wcub-login-notice {
    padding: 20px;
    background: var(--wcub-light);
    border-radius: var(--wcub-radius);
    text-align: center;
}

.wcub-login-notice a {
    color: var(--wcub-primary);
    font-weight: 500;
}

/* 余额显示小部件 */
.wcub-balance-widget {
    position: relative;
    display: inline-block;
}

.wcub-balance-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--wcub-primary-light);
    border-radius: var(--wcub-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.wcub-balance-widget:hover .wcub-balance-display {
    background: var(--wcub-primary);
}

.wcub-balance-widget:hover .wcub-wallet-icon,
.wcub-balance-widget:hover .wcub-balance-label,
.wcub-balance-widget:hover .wcub-balance-amount,
.wcub-balance-widget:hover .wcub-dropdown-arrow {
    color: #fff !important;
}

.wcub-balance-widget:hover .wcub-balance-amount .woocommerce-Price-amount,
.wcub-balance-widget:hover .wcub-balance-amount .woocommerce-Price-currencySymbol {
    color: #fff !important;
}

.wcub-wallet-icon {
    display: inline-flex;
    align-items: center;
    color: var(--wcub-primary);
}

.wcub-balance-label {
    color: var(--wcub-gray);
    font-size: 14px;
}

.wcub-balance-amount {
    color: var(--wcub-primary);
    font-size: 18px;
    font-weight: 600;
}

.wcub-dropdown-arrow {
    display: inline-flex;
    align-items: center;
    color: var(--wcub-gray);
    transition: transform 0.2s;
}

.wcub-balance-widget:hover .wcub-dropdown-arrow {
    transform: rotate(180deg);
}

/* 下拉菜单 */
.wcub-balance-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    margin-top: 4px;
    padding: 8px 0;
    background: #fff;
    border-radius: var(--wcub-radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s;
    z-index: 1000;
}

.wcub-balance-widget:hover .wcub-balance-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.wcub-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #333 !important;
    text-decoration: none !important;
    font-size: 14px;
    transition: all 0.2s;
}

.wcub-dropdown-item:hover {
    background: var(--wcub-primary-light);
    color: var(--wcub-primary) !important;
}

.wcub-dropdown-item svg {
    color: var(--wcub-gray);
    flex-shrink: 0;
}

.wcub-dropdown-item:hover svg {
    color: var(--wcub-primary);
}

/* 交易记录 */
.wcub-history-wrapper {
    background: #fff;
    border-radius: var(--wcub-radius);
    box-shadow: var(--wcub-shadow);
    overflow: hidden;
}

.wcub-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--wcub-border);
}

.wcub-history-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.wcub-history-filter select {
    padding: 6px 12px;
    border: 1px solid var(--wcub-border);
    border-radius: 4px;
    font-size: 14px;
}

.wcub-history-list {
    max-height: 500px;
    overflow-y: auto;
}

.wcub-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--wcub-border);
    transition: background 0.2s;
}

.wcub-history-item:last-child {
    border-bottom: none;
}

.wcub-history-item:hover {
    background: var(--wcub-light);
}

.wcub-history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wcub-history-type {
    display: inline-block;
    padding: 2px 8px;
    background: var(--wcub-primary-light);
    color: var(--wcub-primary);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.wcub-history-item.expense .wcub-history-type {
    background: #ffeef0;
    color: var(--wcub-danger);
}

.wcub-history-note {
    color: #333;
    font-size: 14px;
}

.wcub-history-time {
    color: var(--wcub-gray);
    font-size: 12px;
}

.wcub-history-amount {
    text-align: right;
}

.wcub-history-amount .amount {
    display: block;
    font-size: 16px;
    font-weight: 600;
}

.wcub-history-amount .amount.positive {
    color: var(--wcub-success);
}

.wcub-history-amount .amount.negative {
    color: var(--wcub-danger);
}

.wcub-history-amount .balance-after {
    display: block;
    color: var(--wcub-gray);
    font-size: 12px;
}

.wcub-no-records {
    padding: 40px 20px;
    text-align: center;
    color: var(--wcub-gray);
}

/* 分页 */
.wcub-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--wcub-border);
}

.wcub-pagination a {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--wcub-border);
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
}

.wcub-pagination a:hover,
.wcub-pagination a.current {
    background: var(--wcub-primary);
    border-color: var(--wcub-primary);
    color: #fff;
}

/* 充值页面 */
.wcub-recharge-wrapper {
    background: #fff;
    border-radius: var(--wcub-radius);
    box-shadow: var(--wcub-shadow);
    padding: 24px;
}

.wcub-current-balance {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--wcub-primary), var(--wcub-primary-dark));
    border-radius: var(--wcub-radius);
    color: #fff;
    margin-bottom: 24px;
}

.wcub-current-balance .label {
    font-size: 14px;
    opacity: 0.9;
}

.wcub-current-balance .amount {
    font-size: 32px;
    font-weight: 700;
    margin-top: 8px;
    color: #fff;
}

.wcub-current-balance .amount .woocommerce-Price-amount,
.wcub-current-balance .amount .woocommerce-Price-currencySymbol {
    color: #fff;
}

.wcub-recharge-rules {
    background: var(--wcub-primary-light);
    border-radius: var(--wcub-radius);
    padding: 16px;
    margin-bottom: 24px;
}

.wcub-recharge-rules h4 {
    margin: 0 0 12px 0;
    color: var(--wcub-primary);
    font-size: 14px;
}

.wcub-recharge-rules ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wcub-recharge-rules li {
    padding: 6px 12px;
    background: #fff;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
}

.wcub-recharge-form h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: #333;
}

.wcub-amount-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.wcub-amount-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    border: 2px solid var(--wcub-border);
    border-radius: var(--wcub-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.wcub-amount-option:hover {
    border-color: var(--wcub-primary);
}

.wcub-amount-option.selected {
    border-color: var(--wcub-primary);
    background: var(--wcub-primary-light);
}

.wcub-amount-option .amount {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.wcub-amount-option .bonus {
    font-size: 12px;
    color: var(--wcub-danger);
    margin-top: 4px;
}

.wcub-custom-amount {
    margin-bottom: 20px;
}

.wcub-custom-amount label {
    display: block;
    margin-bottom: 8px;
    color: var(--wcub-gray);
    font-size: 14px;
}

.wcub-custom-amount input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--wcub-border);
    border-radius: var(--wcub-radius);
    font-size: 16px;
    box-sizing: border-box;
}

.wcub-custom-amount input:focus {
    outline: none;
    border-color: var(--wcub-primary);
}

.wcub-bonus-preview {
    display: block;
    margin-top: 8px;
    color: var(--wcub-danger);
    font-size: 14px;
}

#wcub-recharge-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

/* 转账页面 */
.wcub-transfer-wrapper {
    background: #fff;
    border-radius: var(--wcub-radius);
    box-shadow: var(--wcub-shadow);
    padding: 24px;
}

.wcub-transfer-form {
    margin-top: 20px;
}

.wcub-form-group {
    margin-bottom: 20px;
}

.wcub-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.wcub-form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--wcub-border);
    border-radius: var(--wcub-radius);
    font-size: 14px;
    box-sizing: border-box;
}

.wcub-form-group input:focus {
    outline: none;
    border-color: var(--wcub-primary);
}

.wcub-help-text {
    display: block;
    margin-top: 6px;
    color: var(--wcub-gray);
    font-size: 12px;
}

.wcub-recipient-info {
    margin-top: 8px;
    padding: 12px;
    background: var(--wcub-primary-light);
    border-radius: var(--wcub-radius);
}

.wcub-recipient-info .name {
    font-weight: 500;
    color: #333;
}

.wcub-recipient-info .email {
    color: var(--wcub-gray);
    font-size: 13px;
}

.wcub-fee-info {
    padding: 12px;
    background: var(--wcub-light);
    border-radius: var(--wcub-radius);
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--wcub-gray);
}

.wcub-transfer-summary {
    padding: 16px;
    background: var(--wcub-light);
    border-radius: var(--wcub-radius);
    margin-bottom: 20px;
}

.wcub-transfer-summary p {
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
}

#wcub-transfer-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

/* 仪表板 */
.wcub-dashboard {
    max-width: 1000px;
    margin: 0 auto;
}

.wcub-dashboard-header {
    margin-bottom: 24px;
}

.wcub-balance-card {
    background: linear-gradient(135deg, var(--wcub-primary), var(--wcub-primary-dark));
    border-radius: var(--wcub-radius);
    padding: 24px;
    color: #fff;
    margin-bottom: 16px;
}

.wcub-balance-main {
    text-align: center;
    margin-bottom: 20px;
}

.wcub-balance-main .label {
    font-size: 14px;
    opacity: 0.9;
}

.wcub-balance-main .amount {
    display: block;
    font-size: 36px;
    font-weight: 700;
    margin-top: 8px;
    color: #fff;
}

.wcub-balance-main .amount .woocommerce-Price-amount {
    color: #fff;
}

.wcub-balance-main .amount .woocommerce-Price-currencySymbol {
    color: #fff;
}

.wcub-balance-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.wcub-balance-stats .stat-item {
    text-align: center;
}

.wcub-balance-stats .label {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

.wcub-balance-stats .value {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.85);
}

.wcub-balance-stats .value .woocommerce-Price-amount,
.wcub-balance-stats .value .woocommerce-Price-currencySymbol {
    color: rgba(255, 255, 255, 0.85);
}

.wcub-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.wcub-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: #fff;
    border-radius: var(--wcub-radius);
    box-shadow: var(--wcub-shadow);
    text-decoration: none;
    transition: all 0.2s;
}

.wcub-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.wcub-action-btn .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
    color: var(--wcub-primary);
}

.wcub-action-btn .icon svg {
    width: 24px;
    height: 24px;
}

.wcub-action-btn .text {
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

/* 标签页 */
.wcub-dashboard-tabs {
    background: #fff;
    border-radius: var(--wcub-radius);
    box-shadow: var(--wcub-shadow);
    overflow: hidden;
}

.wcub-tab-nav {
    display: flex;
    border-bottom: 1px solid var(--wcub-border);
}

.wcub-tab-btn {
    flex: 1;
    padding: 14px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--wcub-gray);
    cursor: pointer;
    transition: all 0.2s;
}

.wcub-tab-btn:hover {
    color: var(--wcub-primary);
}

.wcub-tab-btn.active {
    color: var(--wcub-primary);
    border-bottom: 2px solid var(--wcub-primary);
}

.wcub-tab-content {
    padding: 0;
}

.wcub-tab-pane {
    display: none;
}

.wcub-tab-pane.active {
    display: block;
}

.wcub-tab-pane .wcub-history-wrapper,
.wcub-tab-pane .wcub-recharge-wrapper,
.wcub-tab-pane .wcub-transfer-wrapper {
    box-shadow: none;
    border-radius: 0;
}

/* 提示信息 */
.wcub-notice {
    padding: 16px;
    background: var(--wcub-light);
    border-radius: var(--wcub-radius);
    text-align: center;
    color: var(--wcub-gray);
}

/* 加载状态 */
.wcub-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.wcub-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--wcub-border);
    border-top-color: var(--wcub-primary);
    border-radius: 50%;
    animation: wcub-spin 0.8s linear infinite;
}

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

/* 弹窗模态框 */
.wcub-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.wcub-modal-overlay.active {
    display: flex;
}

.wcub-modal-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    animation: wcub-modal-in 0.3s ease;
}

@keyframes wcub-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.wcub-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--wcub-border);
    background: var(--wcub-primary);
}

.wcub-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.wcub-modal-close,
button.wcub-modal-close,
.wcub-modal-close:focus,
button.wcub-modal-close:focus {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    color: #fff !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: none !important;
    outline: none !important;
    line-height: 1 !important;
}

.wcub-modal-close:hover,
button.wcub-modal-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
}

.wcub-modal-close svg {
    width: 20px !important;
    height: 20px !important;
    stroke: currentColor !important;
}

.wcub-modal-body {
    padding: 20px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

.wcub-modal-loading {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.wcub-modal-loading.active {
    display: flex;
}

.wcub-modal-content.loading {
    display: none;
}

.wcub-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--wcub-border);
    border-top-color: var(--wcub-primary);
    border-radius: 50%;
    animation: wcub-spin 0.8s linear infinite;
}

/* 弹窗内的表单样式调整 */
.wcub-modal-body .wcub-recharge-wrapper,
.wcub-modal-body .wcub-transfer-wrapper,
.wcub-modal-body .wcub-history-wrapper {
    box-shadow: none;
    padding: 0;
}

.wcub-modal-body .wcub-current-balance {
    margin-bottom: 20px;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}

.wcub-modal-body .wcub-current-balance .label {
    display: block;
    font-size: 14px;
    opacity: 0.85;
    margin-bottom: 8px;
}

.wcub-modal-body .wcub-current-balance .amount {
    font-size: 36px;
    font-weight: 700;
    display: block;
}

.wcub-modal-body .wcub-recharge-rules {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 10px;
}

.wcub-modal-body .wcub-recharge-rules h4 {
    font-size: 14px;
    font-weight: 600;
}

.wcub-modal-body .wcub-recharge-rules ul {
    gap: 10px;
}

.wcub-modal-body .wcub-recharge-rules li {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid rgba(2, 91, 231, 0.1);
}

.wcub-modal-body .wcub-amount-options {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.wcub-modal-body .wcub-amount-option {
    padding: 14px 10px;
    border-radius: 10px;
    border-width: 2px;
}

.wcub-modal-body .wcub-amount-option .amount {
    font-size: 16px;
}

.wcub-modal-body .wcub-amount-option .bonus {
    font-size: 11px;
    margin-top: 6px;
}

.wcub-modal-body .wcub-custom-amount {
    margin-bottom: 16px;
}

.wcub-modal-body .wcub-custom-amount input {
    border-radius: 8px;
    padding: 14px;
}

.wcub-modal-body #wcub-recharge-btn {
    border-radius: 10px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
}

.wcub-modal-body .wcub-recharge-form h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
}

/* 响应式 */
@media (max-width: 768px) {
    .wcub-balance-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .wcub-quick-actions {
        grid-template-columns: 1fr;
    }
    
    .wcub-amount-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wcub-history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .wcub-history-amount {
        text-align: left;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
}
