:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--gray-900);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo p {
    color: var(--gray-500);
    font-size: 14px;
}

.admin-link {
    color: var(--gray-500);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.admin-link:hover {
    color: var(--primary);
}

/* 区块标题 */
.section-title {
    color: white;
    font-size: 24px;
    margin-bottom: 20px;
    padding-left: 10px;
    border-left: 4px solid white;
}

/* 商品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.product-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.product-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}

.product-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.product-desc {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.product-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--danger);
}

.profit-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 5px 10px;
    border-radius: 20px;
}

.profit-icon {
    font-size: 12px;
}

.profit-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--success);
}

/* 商品卡片内的 product-profit 兼容旧样式 */
.product-profit {
    font-size: 12px;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

/* 下单弹窗中的价格明细 */
.product-modal-header {
    margin-bottom: 16px;
}

.product-modal-name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 6px;
}

.product-modal-desc {
    font-size: 13px;
    color: var(--gray-500);
    line-height: 1.4;
}

.product-modal-prices {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.price-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.price-detail .label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.price-detail .value {
    font-size: 16px;
    font-weight: 700;
}

.price-detail .value.cost {
    color: var(--gray-700);
}

.price-detail .value.sell {
    color: var(--danger);
}

.price-arrow {
    color: var(--gray-400);
    font-size: 18px;
}

.profit-box {
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
}

.profit-box .value.profit-val {
    color: var(--success);
    font-size: 18px;
}

.profit-percent {
    font-size: 11px;
    color: var(--success);
    opacity: 0.7;
}

/* 弹窗价格行的利润提示 */
.modal-profit-hint {
    font-size: 13px;
    color: var(--success);
    font-weight: 600;
    margin-left: 8px;
}

.loading {
    text-align: center;
    padding: 60px;
    color: white;
    font-size: 18px;
}

/* 查询区块 */
.query-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
}

.query-box {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.3s;
}

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

/* 按钮 */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-block {
    width: 100%;
    margin-top: 16px;
}

/* 订单结果 */
.order-result {
    padding: 20px;
    border-radius: 10px;
    background: var(--gray-100);
    display: none;
}

.order-result.show {
    display: block;
}

.order-result .info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-200);
}

.order-result .info-row:last-child {
    border-bottom: none;
}

.order-result .label {
    color: var(--gray-500);
}

.order-result .card-key {
    background: var(--gray-900);
    color: var(--success);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: monospace;
    margin-top: 12px;
    word-break: break-all;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-500);
    transition: color 0.3s;
}

.close:hover {
    color: var(--gray-900);
}

.modal-content h2 {
    margin-bottom: 24px;
    font-size: 22px;
}

.modal-product {
    padding: 16px;
    background: var(--gray-100);
    border-radius: 10px;
    margin-bottom: 24px;
}

.modal-product .name {
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-product .price {
    font-size: 20px;
    font-weight: 700;
    color: var(--danger);
}

.order-form .form-group {
    margin-bottom: 16px;
}

.order-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.order-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.3s;
}

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

.price-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--gray-100);
    border-radius: 10px;
    margin-top: 16px;
}

.price-info .price {
    font-size: 24px;
    font-weight: 700;
    color: var(--danger);
}

/* 支付弹窗 */
.pay-info {
    padding: 20px;
    background: var(--gray-100);
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.pay-info .amount {
    font-size: 32px;
    font-weight: 700;
    color: var(--danger);
}

.payment-title {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.payment-options {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.payment-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.3s;
}

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

.payment-option input {
    display: none;
}

.payment-option input:checked + .payment-icon {
    transform: scale(1.1);
}

.payment-icon {
    font-size: 24px;
    transition: transform 0.3s;
}

.pay-result {
    margin-top: 16px;
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    display: none;
}

.pay-result.show {
    display: block;
}

.pay-result.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.pay-result.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* 成功弹窗 */
.success-content {
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
    margin: 0 auto 24px;
}

.success-info {
    padding: 20px;
    background: var(--gray-100);
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: left;
}

.success-info .card-key {
    background: var(--gray-900);
    color: var(--success);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: monospace;
    margin-top: 12px;
    word-break: break-all;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 30px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* 响应式 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .query-box {
        flex-direction: column;
    }
    
    .payment-options {
        flex-direction: column;
    }
}
