/* 产品积分插件前端样式 */

/* 用户积分账户页面 */
.user-points-account {
    max-width: 1200px;
    margin: 0 auto;
}

.user-points-account h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

/* 积分概览 */
.points-overview {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.points-card {
    flex: 1;
    min-width: 300px;
}

.points-balance {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.points-balance h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    opacity: 0.9;
}

.balance-amount {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.balance-value {
    font-size: 14px;
    opacity: 0.8;
}

.points-info {
    flex: 1;
    min-width: 300px;
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.points-info h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
}

.points-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.points-info li {
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
    position: relative;
    padding-left: 20px;
}

.points-info li:last-child {
    border-bottom: none;
}

.points-info li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

/* 积分历史记录 */
.points-history-section {
    margin-top: 40px;
}

.points-history-section h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
}

.points-history-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.points-history-table table {
    width: 100%;
    border-collapse: collapse;
}

.points-history-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.points-history-table td {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.points-history-table tr:hover {
    background: #f8f9fa;
}

.points-type {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.points-type.earn {
    background: #d4edda;
    color: #155724;
}

.points-type.spend {
    background: #f8d7da;
    color: #721c24;
}

.points-change {
    font-weight: bold;
    font-size: 16px;
}

.points-change.positive {
    color: #28a745;
}

.points-change.negative {
    color: #dc3545;
}

/* 加载更多按钮 */
.load-more-container {
    text-align: center;
    margin-top: 20px;
}

#load-more-history {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

#load-more-history:hover {
    background: #005a87;
}

#load-more-history:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 积分余额短代码样式 */
.user-points-balance {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.points-amount {
    font-size: 18px;
}

.points-label {
    font-size: 14px;
    opacity: 0.9;
}

.points-value {
    font-size: 12px;
    opacity: 0.8;
    margin-left: 5px;
}

/* 产品页面积分显示 */
.product-points-info {
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.product-points-info .points-icon {
    color: #007cba;
    margin-right: 8px;
    font-size: 16px;
}

.product-points-info .points-text {
    color: #333;
    font-weight: 500;
}

.product-points-info .points-amount {
    color: #007cba;
    font-weight: bold;
    font-size: 18px;
}

/* 购物车积分抵扣 */
.points-discount-form {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.points-discount-form h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.points-discount-form .form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.points-discount-form input[type="number"] {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.points-discount-form .button {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.points-discount-form .button:hover {
    background: #005a87;
}

.points-discount-form .button.remove {
    background: #dc3545;
}

.points-discount-form .button.remove:hover {
    background: #c82333;
}

.points-discount-info {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.points-discount-applied {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .points-overview {
        flex-direction: column;
        gap: 20px;
    }
    
    .points-card,
    .points-info {
        min-width: auto;
    }
    
    .balance-amount {
        font-size: 36px;
    }
    
    .points-history-table {
        overflow-x: auto;
    }
    
    .points-history-table table {
        min-width: 600px;
    }
    
    .points-discount-form .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .points-discount-form input[type="number"] {
        min-width: auto;
        margin-bottom: 10px;
    }
}

/* WooCommerce 兼容性 */
.woocommerce .user-points-account {
    margin-bottom: 40px;
}

.woocommerce-account .user-points-balance {
    margin: 10px 0;
}

/* 动画效果 */
.points-card,
.points-info,
.points-history-table {
    transition: transform 0.2s, box-shadow 0.2s;
}

.points-card:hover,
.points-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.points-history-table:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}