/* ========================================
   GamiPress Points Discount - Modern UI
   ======================================== */

/* 基础卡片样式 */
.gpd-cart-points-card,
.gpd-checkout-points-card,
.gpd-mixed-payment-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 20px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e5e7eb;
}

.gpd-cart-points-card:hover,
.gpd-checkout-points-card:hover,
.gpd-mixed-payment-card:hover {
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
    border-color: #667eea;
}

/* 卡片头部 */
.gpd-card-header {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.gpd-icon-wrapper {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    backdrop-filter: blur(10px);
}

.gpd-icon-gradient {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.gpd-icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.gpd-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: inherit;
}

/* 卡片内容 */
.gpd-card-body {
    padding: 24px;
}

/* 积分网格布局 */
.gpd-points-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.gpd-points-item {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.gpd-points-item:hover {
    background: #f3f4f6;
    border-color: #667eea;
}

.gpd-label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
}

.gpd-value {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.gpd-value-primary {
    color: #667eea;
}

.gpd-value-success {
    color: #10b981;
}

.gpd-value-warning {
    color: #f59e0b;
}

/* 分隔线 */
.gpd-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #e5e7eb, transparent);
    margin: 20px 0;
}

/* 状态消息 */
.gpd-status-message {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border-radius: 12px;
    gap: 12px;
}

.gpd-status-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-left: 4px solid #10b981;
}

.gpd-status-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left: 4px solid #ef4444;
}

.gpd-status-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.gpd-status-success .gpd-status-icon {
    color: #059669;
}

.gpd-status-error .gpd-status-icon {
    color: #dc2626;
}

.gpd-status-content {
    flex: 1;
}

.gpd-status-text {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.gpd-status-subtext {
    margin: 0;
    font-size: 13px;
    color: #4b5563;
}

.gpd-status-subtext strong {
    color: #667eea;
}

/* 积分对比布局（结账页） */
.gpd-points-comparison {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 12px;
    margin-bottom: 20px;
}

.gpd-comparison-item {
    text-align: center;
    flex: 1;
}

.gpd-comparison-label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
}

.gpd-comparison-value {
    font-size: 32px;
    font-weight: 800;
    color: #111827;
    line-height: 1;
    margin-bottom: 4px;
}

.gpd-comparison-unit {
    font-size: 14px;
    color: #6b7280;
}

.gpd-text-success {
    color: #10b981 !important;
}

.gpd-text-warning {
    color: #f59e0b !important;
}

.gpd-text-primary {
    color: #667eea !important;
}

.gpd-comparison-divider {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.gpd-comparison-divider svg {
    width: 32px;
    height: 32px;
}

/* 警告框 */
.gpd-alert {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border-radius: 12px;
    gap: 12px;
}

.gpd-alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
}

.gpd-alert-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #ef4444;
}

.gpd-alert-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.gpd-alert-success .gpd-alert-icon {
    color: #059669;
}

.gpd-alert-error .gpd-alert-icon {
    color: #dc2626;
}

.gpd-alert-content {
    flex: 1;
}

.gpd-alert-title {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 700;
}

.gpd-alert-success .gpd-alert-title {
    color: #065f46;
}

.gpd-alert-error .gpd-alert-title {
    color: #991b1b;
}

.gpd-alert-message {
    margin: 0;
    font-size: 13px;
}

.gpd-alert-success .gpd-alert-message {
    color: #047857;
}

.gpd-alert-error .gpd-alert-message {
    color: #b91c1c;
}

.gpd-alert-message strong {
    font-weight: 700;
}

/* Mixed模式 - 积分余额 */
.gpd-points-balance {
    margin-bottom: 24px;
}

.gpd-balance-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #f9fafb;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.gpd-balance-item:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.gpd-balance-highlight {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    border-color: #8b5cf6;
}

.gpd-balance-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.gpd-balance-value {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.gpd-balance-value small {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    margin-left: 4px;
}

.gpd-balance-equivalent {
    font-size: 14px;
    color: #9ca3af;
}

/* 输入框区域 */
.gpd-input-wrapper {
    margin-bottom: 20px;
}

.gpd-input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.gpd-label-icon {
    width: 18px;
    height: 18px;
    color: #667eea;
}

.gpd-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.gpd-input-field {
    width: 100%;
    padding: 14px 60px 14px 16px;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
    background: #ffffff;
}

.gpd-input-field:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.gpd-input-field::-webkit-inner-spin-button,
.gpd-input-field::-webkit-outer-spin-button {
    opacity: 1;
    height: 30px;
}

.gpd-input-suffix {
    position: absolute;
    right: 16px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    pointer-events: none;
}

.gpd-input-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #9ca3af;
}

.gpd-input-hint strong {
    color: #667eea;
}

/* 折扣预览 */
.gpd-discount-preview {
    padding: 16px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-radius: 10px;
    border: 2px solid #10b981;
    margin-top: 16px;
}

.gpd-preview-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.gpd-preview-label {
    font-size: 14px;
    color: #065f46;
    font-weight: 500;
}

.gpd-preview-amount {
    font-size: 24px;
    font-weight: 800;
    color: #059669;
}

.gpd-preview-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    overflow: hidden;
}

.gpd-preview-progress {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* 错误消息 */
.gpd-error-message {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
    font-weight: 500;
}

/* 支付方式通知框 */
.gpd-payment-notice {
    margin-top: 15px;
    padding: 16px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
    animation: gpdSlideIn 0.4s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@keyframes gpdSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 动画效果 */
@keyframes gpdPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.gpd-status-success .gpd-icon-wrapper,
.gpd-alert-success .gpd-icon-wrapper {
    animation: gpdPulse 2s infinite;
}

/* ========================================
   纯积分模式 - 结账页面Grid布局
   ======================================== */

@media (min-width: 769px) {
    /* 突破父容器宽度限制 */
    body.gpd-points-only-checkout main,
    body.gpd-points-only-checkout main > *,
    body.gpd-points-only-checkout .entry-the-content,
    body.gpd-points-only-checkout .woocommerce,
    body.gpd-points-only-checkout .hgrid-span-9 {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Form使用CSS Grid布局 */
    body.gpd-points-only-checkout form.checkout.woocommerce-checkout {
        display: grid !important;
        grid-template-columns: 58% 38% !important;
        grid-template-rows: auto auto auto auto !important;
        gap: 20px 30px !important;
        width: 100% !important;
        max-width: none !important;
    }
    
    /* 左侧：客户详情（跨4行）*/
    body.gpd-points-only-checkout div.col2-set#customer_details {
        grid-column: 1 / 2 !important;
        grid-row: 1 / 5 !important;
    }
    
    /* 右侧第一行：订单标题 */
    body.gpd-points-only-checkout h3#order_review_heading {
        grid-column: 2 / 3 !important;
        grid-row: 1 / 2 !important;
        margin-top: 0 !important;
    }
    
    /* 右侧第二行：订单摘要 */
    body.gpd-points-only-checkout div#order_review.woocommerce-checkout-review-order {
        grid-column: 2 / 3 !important;
        grid-row: 2 / 3 !important;
        margin-top: 0 !important;
    }
    
    /* 右侧第三行：备注 */
    body.gpd-points-only-checkout div.woocommerce-additional-fields {
        grid-column: 2 / 3 !important;
        grid-row: 3 / 4 !important;
        margin-top: 0 !important;
    }
    
    /* 全宽第四行：支付区域 */
    body.gpd-points-only-checkout div#payment.woocommerce-checkout-payment {
        grid-column: 1 / 3 !important;
        grid-row: 4 / 5 !important;
    }
}

/* 美化结账页面卡片 */
body.gpd-points-only-checkout div.col2-set#customer_details,
body.gpd-points-only-checkout div#order_review.woocommerce-checkout-review-order,
body.gpd-points-only-checkout div#payment.woocommerce-checkout-payment {
    background: #ffffff !important;
    padding: 30px !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid #e5e7eb !important;
}

body.gpd-points-only-checkout h3#order_review_heading {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin-bottom: 0 !important;
    padding: 30px 30px 20px 30px !important;
    background: #ffffff !important;
    border-radius: 16px 16px 0 0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid #e5e7eb !important;
    border-bottom: none !important;
}

body.gpd-points-only-checkout div#order_review.woocommerce-checkout-review-order {
    border-radius: 0 0 16px 16px !important;
    padding-top: 0 !important;
}

body.gpd-points-only-checkout div.col2-set#customer_details h3 {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin-bottom: 24px !important;
    padding-bottom: 12px !important;
    border-bottom: 2px solid #667eea !important;
}

/* col-1 和 col-2 内部垂直排列 */
body.gpd-points-only-checkout div.col2-set#customer_details div.col-1,
body.gpd-points-only-checkout div.col2-set#customer_details div.col-2 {
    width: 100% !important;
    float: none !important;
}

/* 隐藏优惠券部分 */
body.gpd-points-only-checkout div.woocommerce-form-coupon-toggle,
body.gpd-points-only-checkout form.checkout_coupon {
    display: none !important;
}

/* ========================================
   购物车页面 - 左右分栏布局
   ======================================== */

@media (min-width: 769px) {
    /* 购物车容器 */
    body.woocommerce-cart .woocommerce {
        position: relative;
    }
    
    /* 左侧：购物车表格 */
    body.woocommerce-cart form.woocommerce-cart-form {
        width: 58% !important;
        float: left !important;
        margin-right: 30px !important;
    }
    
    /* 右侧：购物车总计 */
    body.woocommerce-cart .cart-collaterals {
        width: 38% !important;
        float: right !important;
    }
    body.woocommerce-cart .cart-collaterals .cart_totals {
        width: 100% !important;
    }
    /* 清除浮动 */
    body.woocommerce-cart .woocommerce::after {
        content: "" !important;
        display: table !important;
        clear: both !important;
    }
}

/* 美化购物车卡片 */
body.woocommerce-cart .gpd-cart-points-card {
    margin: 20px 0 !important;
}

/* 移动端购物车 */
@media (max-width: 768px) {
    body.woocommerce-cart form.woocommerce-cart-form,
    body.woocommerce-cart .cart-collaterals {
        width: 100% !important;
        float: none !important;
        margin-right: 0 !important;
    }
    
    body.woocommerce-cart .cart-collaterals {
        margin-top: 30px !important;
    }
}

/* ========================================
   移动端响应式
   ======================================== */

@media (max-width: 768px) {
    /* 结账页面移动端 */
    body.gpd-points-only-checkout form.woocommerce-checkout {
        display: block !important;
    }
    
    body.gpd-points-only-checkout div.col2-set#customer_details,
    body.gpd-points-only-checkout h3#order_review_heading,
    body.gpd-points-only-checkout div#order_review,
    body.gpd-points-only-checkout div.woocommerce-additional-fields,
    body.gpd-points-only-checkout div#payment {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 20px !important;
    }
    
    body.gpd-points-only-checkout h3#order_review_heading {
        border-radius: 16px 16px 0 0 !important;
    }
    
    body.gpd-points-only-checkout div#order_review {
        border-radius: 0 0 16px 16px !important;
        margin-top: 0 !important;
    }
}