/* 前台产品展示页面样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #f8f8f8;
    color: #333;
    line-height: 1.6;
}

/* 产品切换导航 */
.product-nav {
    background: #fff;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.product-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.product-nav-item {
    padding: 10px 20px;
    text-decoration: none;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.3s;
}

.product-nav-item:hover {
    border-color: #ff6700;
    color: #ff6700;
}

.product-nav-item.active {
    border-color: #ff6700;
    background: #fff5f0;
    color: #ff6700;
    font-weight: bold;
}

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

.product-page {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 60px;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* 左侧图片 */
.product-gallery {
    position: sticky;
    top: 20px;
}

.main-image img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

/* 右侧信息 */
.product-info h1 {
    font-size: 26px;
    margin-bottom: 10px;
    color: #333;
}

.product-desc {
    font-size: 14px;
    color: #999;
    margin-bottom: 20px;
}

/* 代码显示区 */
.product-codes {
    margin: 20px 0;
    padding: 20px;
    background: #f0f7ff;
    border-left: 3px solid #1890ff;
    border-radius: 4px;
}

.code-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.code-item:last-child {
    margin-bottom: 0;
}

.code-item label {
    width: 80px;
    font-weight: 600;
    color: #666;
}

.code-item span {
    font-family: 'Courier New', monospace;
    font-size: 15px;
    color: #1890ff;
    font-weight: bold;
}

/* 价格显示 */
.product-price {
    margin: 25px 0;
    padding: 20px;
    background: #fff5f0;
    border-radius: 8px;
}

.price-label {
    font-size: 13px;
    color: #999;
    margin-bottom: 5px;
}

.price-value {
    display: flex;
    align-items: baseline;
}

.currency {
    font-size: 22px;
    color: #ff4d4f;
    margin-right: 4px;
}

.amount {
    font-size: 36px;
    font-weight: bold;
    color: #ff4d4f;
}

/* 规格选择器 */
.spec-selector {
    margin: 30px 0;
}

.spec-group {
    margin-bottom: 25px;
}

.spec-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.spec-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.spec-option {
    padding: 10px 18px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.3s;
    user-select: none;
}

.spec-option:hover {
    border-color: #ff6700;
    color: #ff6700;
}

.spec-option.selected {
    border-color: #ff6700;
    background: #fff5f0;
    color: #ff6700;
    font-weight: bold;
    position: relative;
}

.spec-option.selected::after {
    content: '✓';
    position: absolute;
    right: 4px;
    bottom: 4px;
    font-size: 12px;
    color: #ff6700;
}

.spec-option.disabled {
    border-color: #f0f0f0;
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    position: relative;
}

.spec-option.disabled::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ccc;
    transform: translateY(-50%) rotate(-10deg);
}

/* 库存数量 */
.stock-quantity {
    display: flex;
    align-items: center;
    margin: 25px 0;
    padding: 15px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.stock-info {
    flex: 1;
    font-size: 14px;
    color: #666;
}

.stock-info span {
    color: #06d6a0;
    font-weight: bold;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 0;
}

.quantity-selector button {
    width: 40px;
    height: 40px;
    border: 1px solid #d9d9d9;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.3s;
}

.quantity-selector button:hover {
    background: #f5f5f5;
}

.quantity-selector .btn-decrease {
    border-radius: 4px 0 0 4px;
}

.quantity-selector .btn-increase {
    border-radius: 0 4px 4px 0;
}

.quantity-selector input {
    width: 60px;
    height: 40px;
    text-align: center;
    border: 1px solid #d9d9d9;
    border-left: none;
    border-right: none;
    font-size: 15px;
    font-weight: bold;
}

/* 操作按钮 */
.product-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.product-actions button {
    flex: 1;
    height: 50px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-buy-now {
    background: #ff6700;
    color: #fff;
}

.btn-buy-now:hover:not(:disabled) {
    background: #ff8534;
}

.btn-add-cart {
    background: #fff;
    color: #ff6700;
    border: 2px solid #ff6700;
}

.btn-add-cart:hover:not(:disabled) {
    background: #fff5f0;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 购物车入口图标 */
.cart-icon {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #ff6700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(255, 103, 0, 0.4);
    z-index: 1000;
    transition: transform 0.3s, box-shadow 0.3s;
}

.cart-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 103, 0, 0.5);
}

.cart-icon::before {
    content: '';
    width: 22px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    background: #ff4d4f;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.cart-count:empty,
.cart-count[data-count="0"] {
    display: none;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ========== 购物车列表页样式 ========== */
.cart-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.cart-header {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 20px;
}

.cart-header .back-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    margin-right: 15px;
    transition: background 0.3s;
}

.cart-header .back-btn:hover {
    background: #e8e8e8;
}

.cart-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

/* 购物车商品列表 */
.cart-list {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}

.cart-item {
    display: flex;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s;
}

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

.cart-item:hover {
    background: #fafafa;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.cart-item-codes {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
    font-family: 'Courier New', monospace;
}

.cart-item-codes span {
    color: #1890ff;
    font-weight: 500;
}

.cart-item-specs {
    font-size: 12px;
    color: #999;
    line-height: 1.6;
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    min-width: 140px;
}

.cart-item-qty {
    display: flex;
    align-items: center;
}

.cart-item-qty button {
    width: 32px;
    height: 32px;
    border: 1px solid #d9d9d9;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.cart-item-qty button:hover {
    border-color: #ff6700;
    color: #ff6700;
}

.cart-item-qty button:first-child {
    border-radius: 4px 0 0 4px;
}

.cart-item-qty button:last-child {
    border-radius: 0 4px 4px 0;
}

.cart-item-qty input {
    width: 50px;
    height: 32px;
    border: 1px solid #d9d9d9;
    border-left: none;
    border-right: none;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
}

.cart-item-delete {
    color: #999;
    font-size: 13px;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.3s;
}

.cart-item-delete:hover {
    color: #ff4d4f;
}

/* 空购物车 */
.cart-empty {
    text-align: center;
    padding: 80px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.cart-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.cart-empty p {
    color: #999;
    font-size: 15px;
    margin-bottom: 20px;
}

.cart-empty a {
    display: inline-block;
    padding: 10px 30px;
    background: #ff6700;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.3s;
}

.cart-empty a:hover {
    background: #ff8534;
}

/* 购物车底部栏 */
.cart-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 15px 20px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.cart-footer-info {
    font-size: 14px;
    color: #666;
}

.cart-footer-info strong {
    color: #ff6700;
    font-size: 18px;
}

.cart-footer .btn-submit {
    padding: 12px 40px;
    background: #ff6700;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.cart-footer .btn-submit:hover {
    background: #ff8534;
}

.cart-footer .btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ========== 绑定提示样式 ========== */
.cart-item.has-binding-warning {
    border-left: 3px solid #faad14;
    background: #fffbe6;
}

.cart-item-binding {
    margin-top: 10px;
    padding: 8px 12px;
    background: #fff7e6;
    border: 1px solid #ffd591;
    border-radius: 4px;
    font-size: 13px;
    color: #d46b08;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.cart-item-binding .binding-icon {
    margin-right: 4px;
}

.cart-item-binding strong {
    color: #d4380d;
}

.cart-item-binding .binding-link {
    color: #1890ff;
    text-decoration: none;
    font-weight: 500;
}

.cart-item-binding .binding-link:hover {
    text-decoration: underline;
}

/* ========== 弹窗样式 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 24px 24px 16px;
    text-align: center;
}

.modal-header .modal-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

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

.modal-body {
    padding: 0 24px 20px;
    text-align: center;
}

.modal-body .binding-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-body .binding-list li {
    padding: 10px 0;
    font-size: 15px;
    color: #666;
    border-bottom: 1px dashed #f0f0f0;
}

.modal-body .binding-list li:last-child {
    border-bottom: none;
}

.modal-body .binding-list strong {
    color: #d4380d;
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
}

.modal-footer button {
    flex: 1;
    height: 44px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-footer .btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.modal-footer .btn-cancel:hover {
    background: #e8e8e8;
}

.modal-footer .btn-confirm {
    background: #ff6700;
    color: #fff;
}

.modal-footer .btn-confirm:hover {
    background: #ff8534;
}

/* 响应式 */
@media (max-width: 768px) {
    .product-page {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 20px;
    }

    .product-gallery {
        position: static;
    }

    .product-info h1 {
        font-size: 22px;
    }

    .amount {
        font-size: 28px;
    }

    .spec-option {
        padding: 8px 14px;
        font-size: 13px;
    }

    .product-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        padding: 10px;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 100;
    }
}
