/* 询价单购物车样式 */

/* 阻止背景滚动 */
body.cart-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100vh;
    top: 0;
    left: 0;
}

/* 浮动按钮 */
.inquiry-cart-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
    gap: 2px;
}

.inquiry-cart-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

.inquiry-cart-button svg {
    width: 28px;
    height: 28px;
}

.inquiry-cart-button .cart-label {
    font-size: 10px;
    font-weight: 500;
    margin-top: -2px;
}

.cart-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff4444;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* 侧边栏 */
.inquiry-cart-sidebar {
    position: fixed;
    right: -450px;
    top: 0;
    width: 420px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.inquiry-cart-sidebar.open {
    right: 0;
}

.cart-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0;
}

.cart-header h3 {
    margin: 0;
    font-size: 20px;
}

.close-cart-btn {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.close-cart-btn:hover {
    opacity: 1;
}

.cart-items {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 15px;
    min-height: 0;
}

.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
    padding: 40px 20px;
}

.empty-cart svg {
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-cart p {
    font-size: 18px;
    margin: 10px 0;
    color: #666;
}

.empty-cart small {
    font-size: 14px;
    color: #999;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 12px;
    position: relative;
    background: white;
    transition: all 0.2s;
    align-items: center;
}

.cart-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    align-self: center;
}

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-item-info h4 {
    margin: 0;
    font-size: 14px;
    color: #333;
    line-height: 1.3;
}

.quantity-control,
.size-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-control label,
.size-control label {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

.quantity-control input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.size-control input {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    min-width: 100px;
}

.size-control input::placeholder {
    color: #999;
    font-size: 12px;
}

.cart-item-info textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    resize: vertical;
    min-height: 40px;
    font-family: inherit;
}

.remove-item-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff4444;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.remove-item-btn:hover {
    background: #cc0000;
    transform: scale(1.1);
}

.cart-footer {
    padding: 20px 25px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    background: #f8f9fa;
    flex-shrink: 0;
}

.cart-footer button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary {
    background: white;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #f5f5f5;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* 遮罩层 */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 询价表单模态框 */
.inquiry-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.inquiry-modal.active {
    opacity: 1;
    visibility: visible;
}

.inquiry-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.inquiry-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.inquiry-modal-header h2 {
    margin: 0;
    font-size: 22px;
}

.inquiry-modal-body {
    padding: 25px;
    overflow-y: auto;
}

.inquiry-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.inquiry-summary h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #333;
}

.inquiry-products {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inquiry-product-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px;
    border-radius: 6px;
}

.inquiry-product-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.inquiry-product-item span {
    font-size: 14px;
    color: #666;
}

.inquiry-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.inquiry-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.inquiry-form label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.inquiry-form input,
.inquiry-form textarea {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.inquiry-form input:focus,
.inquiry-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.form-actions button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

/* 提示框 */
.inquiry-toast {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1003;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}

.inquiry-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.inquiry-toast.success {
    background: #28a745;
}

.inquiry-toast.error {
    background: #dc3545;
}

/* 产品详情页的"添加到询价单"按钮 */
.add-to-inquiry-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    box-sizing: border-box;
    margin: 0;
    transition: all 0.3s;
}

.add-to-inquiry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.add-to-inquiry-btn svg {
    width: 20px;
    height: 20px;
}

/* 产品卡片标题旁的购物车按钮 */
.inquiry-cart-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: all 0.3s;
    flex-shrink: 0;
}

.inquiry-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.inquiry-cart-btn:active {
    transform: translateY(0);
}

.inquiry-cart-btn svg {
    width: 18px;
    height: 18px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .inquiry-cart-button {
        width: 60px;
        height: 60px;
        bottom: 20px;
        right: 20px;
    }

    .inquiry-cart-button svg {
        width: 24px;
        height: 24px;
    }

    .inquiry-cart-button .cart-label {
        font-size: 9px;
    }

    .inquiry-cart-sidebar {
        width: 100%;
        right: -100%;
        height: 100vh;
        height: 100dvh; /* 动态视口高度，更准确 */
        max-height: -webkit-fill-available; /* Safari 兼容 */
        overflow: hidden; /* 防止整体溢出 */
    }

    .cart-header {
        flex-shrink: 0; /* 确保标题不被压缩 */
    }

    .cart-items {
        flex: 1 1 0; /* 强制收缩到最小 */
        min-height: 0;
        max-height: calc(100vh - 200px); /* 减去 header + footer 约 200px */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .cart-footer {
        padding: 15px 20px;
        padding-bottom: max(30px, calc(15px + env(safe-area-inset-bottom)));
        flex-shrink: 0; /* 不允许压缩 */
        flex-grow: 0; /* 不允许扩展 */
        position: relative;
        z-index: 10;
        width: 100%;
        box-sizing: border-box;
    }

    .cart-footer button {
        padding: 14px 20px;
        font-size: 16px;
        min-height: 48px;
    }

    .inquiry-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .inquiry-toast {
        right: 20px;
        left: 20px;
        bottom: 90px;
    }
}

