/* Modern Purchase Page Styles */
:root {
    --primary-color: #00aa40;
    --primary-hover: #008f36;
    --text-main: #333333;
    --text-secondary: #666666;
    --border-color: #e1e4e8;
    --bg-color: #f5f7fa;
    --surface-color: #ffffff;
    --error-color: #dc2f33;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    background-color: var(--bg-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#soft-buy {
    padding-top: 130px;
    padding-bottom: 40px;
}

.buy-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Card Styles */
.buy-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 30px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

/* Left Column: Product & Config */
.buy-left {
    flex: 1;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Right Column: User Form */
.buy-right {
    flex: 1.2;
    min-width: 320px;
    display: flex;
    flex-direction: column;
}

.buy-left .buy-card,
.buy-right .buy-card {
    height: 100%;
}

/* Product Info */
.product-header {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

.product-img {
    width: 100px;
    height: auto;
    object-fit: contain;
}

.product-title h2 {
    margin: 0;
    font-size: 22px;
    color: var(--text-main);
    font-weight: 700;
}

.product-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 5px;
}

/* Version Select (Pills) */
.form-group {
    margin-bottom: 24px;
}

/* 放大左侧主要区块的上下间距 */
.buy-left .form-group.block-spaced {
    margin-bottom: 48px;
}

.buy-left .price-summary.block-spaced {
    margin-top: 32px;
}

.group-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
}

.version-options {
    display: flex;
    gap: 10px;
}

.version-opt {
    flex: 1;
    text-align: center;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text-secondary);
}

.version-opt:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.version-opt.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 170, 64, 0.2);
}

/* Quantity Control（采用老页面布局风格） */
.qty-control {
    display: inline-block;
    width: auto;
    font-size: 0; /* 消除内部 inline-block 之间的空白间隙 */
}

.qty-control .qty-btn {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 34px;
    border: 1px solid #cccccc;
    background: #fafafa;
    font-size: 0;
    font-style: normal;
    vertical-align: middle;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
    outline: none;
}

.qty-control .qty-btn::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #999999;
}

.qty-control .qty-btn.minus::before {
    content: '−';
}

.qty-control .qty-btn.plus::before {
    content: '+';
}

/* 左右按钮与中间输入框拼接成连续边框 */
.qty-control .qty-btn.minus {
    border-right: none;
    border-radius: 4px 0 0 4px;
}

.qty-control .qty-btn.plus {
    border-left: none;
    border-radius: 0 4px 4px 0;
}

.qty-control .qty-btn:hover {
    background: #e9ecef;
}

.qty-control .qty-input {
    display: inline-block;
    width: 70px;
    height: 34px;
    line-height: 34px;
    margin: 0;
    border: 1px solid #cccccc;
    border-left: none;
    border-right: none;
    border-radius: 0;
    text-align: center;
    font-size: 16px;
    color: var(--text-main);
    font-weight: 600;
    vertical-align: top;
    -moz-appearance: textfield;
    outline: none;
}

.qty-control .qty-input::-webkit-outer-spin-button,
.qty-control .qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-control .qty-input:focus {
    border-color: #00aa40;
    box-shadow: 0 0 4px 1px rgba(0, 185, 70, 0.27);
}

/* Price Summary */
.price-summary {
    background: #f8fdf9;
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px dashed #ccebd9;
}

.price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.price-row.total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 18px;
    color: var(--text-main);
    font-weight: 700;
}

.price-val.highlight {
    color: var(--primary-color);
    font-size: 24px;
}

/* Form Inputs */
.input-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.input-col {
    flex: 1;
}

.form-control {
    width: 100%;
    height: 48px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: all 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 170, 64, 0.1);
}

.form-control.error {
    border-color: var(--error-color);
}

.error-msg {
    color: var(--error-color);
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

/* Payment Methods */
.payment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.pay-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.pay-card:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 170, 64, 0.02);
}

.pay-card.active {
    border-color: var(--primary-color);
    background-color: #f0fdf4;
    box-shadow: 0 4px 12px rgba(0, 170, 64, 0.15);
    position: relative;
}

.pay-card.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 4px 0 6px 0;
    clip-path: polygon(0 100%, 100% 100%, 100% 0);
}

.pay-icon {
    display: block;
    width: 32px;
    height: 32px;
    margin: 0 auto 10px;
    background-image: url("../img_css/icon_paymethod.png");
    background-size: cover;
}

/* Custom Icons positions based on original CSS logic */
.pay-icon.alipay {
    background-position: 0 0;
}

.pay-icon.wechat {
    background-position: -32px 0;
}

/* Adjusted based on width */
.pay-icon.transfer {
    background-position: -96px 0;
}

/* Approx */

/* Checkbox styling */
.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    user-select: none;
}

/* Invoice Section */
.invoice-section {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: var(--radius-md);
    display: none;
}

.invoice-section.show {
    display: block;
}

.submit-btn {
    width: 100%;
    height: 56px;
    background: var(--primary-color);
    color: white;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 170, 64, 0.3);
}

.submit-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 170, 64, 0.4);
}

/* Purchase Notice text below payment methods */
.pay-notice {
    font-size: 14px;
    color: #666;
    font-weight: normal;
    margin-left: 10px;
}

@media only screen and (max-width: 480px) {
    .pay-notice {
        display: block;
        margin-left: 0;
        margin-top: 5px;
    }
}

/* Buy info section (software purchase notes) */
#buy-info {
    background: #ffffff;
}

#buy-info > div:first-child {
    padding: 15px 0;
    color: #ffffff;
    background: var(--primary-color);
    font-size: 20px;
    text-align: center;
}

#buy-info .col-sm-3 {
    margin-top: 30px;
    margin-bottom: 30px;
}

#buy-info h4 {
    color: var(--primary-color);
    font-weight: 700;
}

/* 授权详情模态框内的图标样式（沿用旧版设计） */
#purchase-info .info-wrapper {
    position: relative;
    margin: 20px 0;
    padding-left: 58px;
}

#purchase-info .info-wrapper:before {
    content: '';
    position: absolute;
    width: 48px;
    height: 48px;
    left: 0;
    background: url("../img_css/purchase-info.png") no-repeat;
    background-size: auto 48px;
}

#purchase-info .col-sm-6:nth-of-type(1) .info-wrapper:before {
    background-position: 0px 0;
}

#purchase-info .col-sm-6:nth-of-type(2) .info-wrapper:before {
    background-position: -144px 0;
}

#purchase-info .col-sm-6:nth-of-type(3) .info-wrapper:before {
    background-position: -48px 0;
}

#purchase-info .col-sm-6:nth-of-type(4) .info-wrapper:before {
    background-position: -192px 0;
}

#purchase-info .col-sm-6:nth-of-type(5) .info-wrapper:before {
    background-position: -96px 0;
}

#purchase-info .col-sm-6:nth-of-type(6) .info-wrapper:before {
    background-position: -240px 0;
}

/* 模态框位置：参考老页面，距顶部约 10% */
#discounttable .modal-dialog,
#purchase-info .modal-dialog {
    margin: 10% auto;
    padding: 0 15px;
}

@media (max-width: 768px) {
    #soft-buy {
        padding-top: 80px;
        padding-bottom: 30px;
    }

    .buy-container {
        flex-direction: column;
    }

    .input-row {
        flex-direction: column;
        gap: 15px;
    }
}